Esempio n. 1
0
 private bool ButtonClick(string txt)
 {
     BattleshipConsole.AddModule(new MainMenu());
     BattleshipConsole.RemoveModule(this);
     BattleshipConsole.UpdateDisplay();
     return(false);
 }
Esempio n. 2
0
        private bool SelectionConfirm(string btn)
        {
            ControllerSkeleton red = null, blue = null;

            foreach (var bot in selectableBots)
            {
                var botName = bot.GetAttribute <NameAttribute>().Name;
                if (red == null && redGroup.GetSelected() == botName)
                {
                    red = bot;
                }
                if (blue == null && blueGroup.GetSelected() == botName)
                {
                    blue = bot;
                }
                if (red != null && blue != null)
                {
                    break;
                }
            }
            BattleshipConsole.RemoveModule(this);
            BattleshipConsole.AddModule(new CompetitionOptionsDisplay(red, blue));
            BattleshipConsole.UpdateDisplay();
            return(true);
        }
 private bool Exit(string input)
 {
     BattleshipConsole.RemoveModule(this);
     BattleshipConsole.AddModule(new MainMenu());
     BattleshipConsole.UpdateDisplay();
     return(true);
 }
Esempio n. 4
0
        private bool ButtonConfirmEvent(string btn)
        {
            Configuration.Global.SetValue("mbc_match_rounds", roundsNumberControl.Value.ToString());
            var match = new ClassicMatch();

            match.PlayerCreate(red);
            match.PlayerCreate(blue);
            CompetitionRun runner = new CompetitionRun(match, millisecondControl.Value, showBoards.IsChecked);

            BattleshipConsole.AddModule(runner);
            BattleshipConsole.RemoveModule(this);
            BattleshipConsole.UpdateDisplay();
            runner.Begin();
            return(true);
        }
 private bool ApplyChanges(string input)
 {
     foreach (var control in stringControls)
     {
         try
         {
             Configuration.Global.SetValue(control.PlaceholderText, control.InputText);
         }
         catch
         {
             error = control.PlaceholderText;
             BattleshipConsole.UpdateDisplay();
             return(false);
         }
     }
     return(true);
 }
Esempio n. 6
0
        private bool MenuSelectEvent(string s)
        {
            switch (s)
            {
            case "Start a competition":
                BattleshipConsole.RemoveModule(this);
                BattleshipConsole.AddModule(new BotSelector());
                BattleshipConsole.UpdateDisplay();
                return(true);

            case "Configuration Manager":
                BattleshipConsole.RemoveModule(this);
                BattleshipConsole.AddModule(new ConfigurationManager());
                BattleshipConsole.UpdateDisplay();
                return(true);

            case "Exit":
                BattleshipConsole.Running = false;
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 private void MatchEnd(Event ev)
 {
     BattleshipConsole.RemoveModule(this);
     BattleshipConsole.AddModule(new ResultDisplay(competition));
     BattleshipConsole.UpdateDisplay();
 }