Esempio n. 1
0
        static void Main(string[] args)
        {
            _game = new Game("tank",1280,720);
            _game.Color = Color.White;
            _game.MouseVisible = true;

            //show a menu
            UiManager uiManager = new UiManager();
            //ui manager needs fully qualified path to the enum the menu is based on
            uiManager.ShowListMenu("gamemode?", "tank.Code.GameModes", OnSelectionCallback);
            uiManager.ShowToast("use arrow and enter\nkeys to navigate!", 3000);
            _game.Start(uiManager.Scene);
        }
Esempio n. 2
0
 private static void OnSelectionCallback(int selection)
 {
     GameModes mode = (GameModes) selection;
     _game.RemoveScene();
     switch (mode)
     {
         case GameModes.Network:
             //the following 3 lines are everything you need for a menu
             UiManager uiManager = new UiManager();
             uiManager.ShowListMenu("create server?", "tank.Code.YESORNOCHOOSENOW", ServerSelectionCallback);
             _game.AddScene(uiManager.Scene);
             break;
         case GameModes.Testing:
             GameMode = new TestingMode();
             _game.AddScene(GameMode.Scene);
             break;
         case GameModes.LocalMultiplayer:
             GameMode = new LocalMultiplayer();
             _game.AddScene(GameMode.Scene);
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
     }
 }