wangguan
2020-12-02 6bc45c691891dac88bece3483fb6f3cf2d7a00a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using Core.UI;
using UnityEngine;
 
namespace TowerDefense.UI.HUD
{
    /// <summary>
    /// Main menu implementation for tower defense
    /// </summary>
    public class TowerDefenseMainMenu : MainMenu
    {
        /// <summary>
        /// Reference to options menu
        /// </summary>
        public OptionsMenu optionsMenu;
        
        /// <summary>
        /// Reference to title menu
        /// </summary>
        public SimpleMainMenuPage titleMenu;
        
        /// <summary>
        /// Reference to level select menu
        /// </summary>
        public LevelSelectScreen levelSelectMenu;
 
        /// <summary>
        /// Bring up the options menu
        /// </summary>
        public void ShowOptionsMenu()
        {
            ChangePage(optionsMenu);
        }
        
        /// <summary>
        /// Bring up the options menu
        /// </summary>
        public void ShowLevelSelectMenu()
        {
            ChangePage(levelSelectMenu);
        }
        
        /// <summary>
        /// Returns to the title screen
        /// </summary>
        public void ShowTitleScreen()
        {
            Back(titleMenu);
        }
 
        /// <summary>
        /// Set initial page
        /// </summary>
        protected virtual void Awake()
        {
            ShowTitleScreen();
        }
 
        /// <summary>
        /// Escape key input
        /// </summary>
        protected virtual void Update()
        {
            if (UnityEngine.Input.GetKeyDown(KeyCode.Escape))
            {
                if ((SimpleMainMenuPage)m_CurrentPage == titleMenu)
                {
                    Application.Quit();
                }
                else
                {
                    Back();
                }
            }
        }
    }
}