Beispiel #1
0
 /// <summary>
 /// Closes the current menu then re-opens
 /// last menu, if any.
 /// </summary>
 public void Close()
 {
     activeMenu.Close(false);
     if (previousMenus.Count() > 0)
     {
         activeMenu = previousMenus.Pop();
     }
 }
Beispiel #2
0
 /// <summary>
 /// This method adds a new menu to storage
 /// </summary>
 public void AddMenu(string name, Menu menu)
 {
     Menus.Add(name, menu);
 }
Beispiel #3
0
 public void Play()
 {
     activeMenu.StopBGM();
     activeMenu = null;
     G.gameState = GameState.playing;
 }
Beispiel #4
0
        /// <summary>
        /// Puts any active menu item storage
        /// and then opens the new menu.
        /// </summary>
        /// <param name="name">Name of menu</param>
        public void Show(string name)
        {
            if (Menus.ContainsKey(name))
            {
                if (activeMenu == null)
                {
                    //First menu open, so we play bgm.
                    //Menus[name].PlayBGM(true);

                    //Sets the active menu based on name
                    //then performs menus open method.
                    activeMenu = Menus[name];
                    activeMenu.Open(false);
                }
                else
                {
                    //Perform closing actions of menu then
                    //puts current menu in stack of hidden.
                    activeMenu.Close(false);
                    previousMenus.Push(activeMenu);

                    //Sets the active menu based on name
                    //then performs menus open method.
                    activeMenu = Menus[name];
                    activeMenu.Open(false);
                }

            }
            else
                return;
        }
Beispiel #5
0
 /// <summary>
 /// Closes all menus, clears the storage
 /// then will be returned to game.
 /// </summary>
 public void Exit()
 {
     activeMenu.StopBGM();
     previousMenus.Clear();
     activeMenu.Close(false);
     activeMenu = null;
 }