﻿using UnityEngine;
using System.Collections;

public class UIManagerCtrl : MonoBehaviour
{
  public Animator startButton;
  public Animator settingsButton;
  public Animator settingsPanel;
  public Animator contentPanel;
  public Animator gearImage;

  void Start() {
    var transform = contentPanel.gameObject.transform as RectTransform;        
    var position = transform.anchoredPosition;
    position.y -= transform.rect.height;
    transform.anchoredPosition = position;
  }

  public void StartGame() {
    Application.LoadLevel ("Level01");
  }

  public void OpenSettings() {
    startButton.SetBool("hidden", true);
    settingsButton.SetBool("hidden", true);

    settingsPanel.enabled = true;
    settingsPanel.SetBool ("hidden", true);
  }

  public void CloseSettings() {
    startButton.SetBool("hidden", false);
    settingsButton.SetBool("hidden", false);
    settingsPanel.SetBool ("hidden", false);
  }

  public void ToggleMenu() {
    contentPanel.enabled = true;
    gearImage.enabled = true;
    var hidden = contentPanel.GetBool("hidden");
    contentPanel.SetBool ("hidden", !hidden);
    gearImage.SetBool ("hidden", !hidden);
  }
}
