using UnityEngine; using System.Collections; public class MainMenu : MenuLayer { private GUIStyle style; public AudioClip clickSound; public override string Name { get {return "MainMenu"; } } public override void Draw(){ float w = (float)Screen.width; float h = (float)Screen.height; float buttonHeight = 60; float buttonWidth = 250; float buttonSpacing = 10; float buttonOffset = buttonHeight + buttonSpacing; float buttonBlockHeight = buttonOffset * 5; float buttonBlockOffset = (h - buttonBlockHeight) * 0.5f; style = GUI.skin.GetStyle ("button"); style.fontSize = 22; GUI.enabled = (gameManager != null) && (gameManager.State.currentLevel != 0); if(GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 0, buttonWidth, buttonHeight), "Продолжить", style)){ if(manager != null){ //manager. } } GUI.enabled = true; if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 1, buttonWidth, buttonHeight), "Новая игра", style)) { if(clickSound != null) gameManager.audio.PlayOneShot(clickSound); gameManager.NewGame(); } if(GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 2, buttonWidth, buttonHeight), "Настройки", style)){ if(clickSound != null) gameManager.audio.PlayOneShot(clickSound); manager.ActivateMenu("SettingsMenu"); } if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 3, buttonWidth, buttonHeight), "Авторы", style)) { if(clickSound != null) gameManager.audio.PlayOneShot(clickSound); manager.ActivateMenu("AuthorsMenu"); } if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 4, buttonWidth, buttonHeight), "Выход", style)) { if(clickSound != null) gameManager.audio.PlayOneShot(clickSound); Application.Quit(); } } public override void Enter(){ } public override void Leave(){ } }