Пример #1
0
        public IEnumerator IsCreatingNewButton()
        {
            yield return(new WaitForEndOfFrame());

            const string newButtonName = "TESTING";

            MenuController.AddButton(() => { }, newButtonName);
            yield return(new WaitForEndOfFrame());

            GameObject result = GameObject.Find(newButtonName);

            Assert.IsNotNull(result);
        }
Пример #2
0
        public IEnumerator IsAddingOnClickFunction()
        {
            yield return(new WaitForEndOfFrame());

            const string newButtonName   = "Change Int Button";
            const int    startingExample = 0;
            int          numberExample   = startingExample;

            MenuController.AddButton(() => { numberExample = 4; }, newButtonName);
            yield return(new WaitForEndOfFrame());

            GameObject.Find(newButtonName).GetComponent <Button>().onClick.Invoke();
            Assert.IsTrue(numberExample != startingExample);
        }
Пример #3
0
 /// <summary>
 /// Set whether this can move.
 /// </summary>
 public void SetMovement(bool setMove, MenuController menu)
 {
     if (!setMove)
     {
         menu.RemoveButton("cursorNE");
         menu.RemoveButton("cursorE");
         menu.RemoveButton("cursorSE");
         menu.RemoveButton("cursorNW");
         menu.RemoveButton("cursorW");
         menu.RemoveButton("cursorSW");
         MoveEnabled = false;
     }
     else
     {
         menu.AddButton("cursorNE", "E - Move North East", MoveNE, KeyCode.E);
         menu.AddButton("cursorE", "D - Move East", MoveE, KeyCode.D);
         menu.AddButton("cursorSE", "X - Move South East", MoveSE, KeyCode.X);
         menu.AddButton("cursorNW", "W - Move North West", MoveNW, KeyCode.W);
         menu.AddButton("cursorW", "A - Move West", MoveW, KeyCode.A);
         menu.AddButton("cursorSW", "Z - Move South West", MoveSW, KeyCode.Z);
         MoveEnabled = true;
     }
 }
Пример #4
0
 /// <summary>
 /// Loads the in game screen.
 /// </summary>
 public void LoadMainGameScreen()
 {
     MainMenuScreen.ClearMenu();
     MainMenuScreen.AddButton("mainmenu", "esc - Main Menu", LoadMainMenu, KeyCode.Escape);
     MainMenuScreen.AddButton("pause", "space - Pause", () => { TimeController.Paused = !TimeController.Paused; }, KeyCode.Space);
     MainMenuScreen.AddButton("goto", "G - Goto", () => { LoadGotoMenu(); }, KeyCode.G);
     MainMenuScreen.AddButton("select", "S - Select", LoadSelectObjectPageMenu, KeyCode.S);
     MainMenuScreen.AddButton("colonies", "H - Colonies", () => { LoadSelectObjectPageMenu(Cursor.PlayerEmpire.Colonies.Select(x => x.GetComponent <BaseAttributes>())); }, KeyCode.H);
     MainMenuScreen.AddButton("ships", "J - Ships", () => { LoadSelectObjectPageMenu(Cursor.PlayerEmpire.Ships.Select(x => x.GetComponent <BaseAttributes>())); }, KeyCode.J);
     MainMenuScreen.AddButton("ping", "P - Goto Last Message", () => { Cursor.SetPosition(Logger.PingLocation); }, KeyCode.P);
     MainMenuScreen.AddButton("look", "L - Look", () =>
     {
         var loc = Cursor.Movement.Location;
         if (StarSystem.EntityManager.Battles.ContainsKey(loc))
         {
             LoadBattleMenu(StarSystem.EntityManager.Battles[loc]);
             return;
         }
         LoadLookMenu(loc);
     }, KeyCode.L);
     MainMenuScreen.AddButton("flag", "I - Toggle Flags", () => { Flag.EnableFlash = !Flag.EnableFlash; }, KeyCode.I);
     Cursor.SetMovement(true, MainMenuScreen);
 }