Exemplo n.º 1
0
 public void setFormSize(Config config)
 {
     this.pb_Game.Width = config.BoardWidth * 4;
     this.pb_Game.Height = config.BoardHeight * 4;
     Point statsLocation = new Point(config.BoardWidth * 4, 0);
     this.grp_stats.Location = statsLocation;
     this.ClientSize = new Size(config.BoardWidth * 4 + this.grp_stats.Width, config.BoardHeight * 4);
 }
Exemplo n.º 2
0
 private void btn_gameConfigNew_Click(object sender, EventArgs e)
 {
     config = new Config();
     configLoadedOrNewCreatedGame();
     loadGame(config);
     checkPlayerKI();
     btn_save.Focus();
 }
Exemplo n.º 3
0
 public void start(Config config)
 {
     setFormSize(config);
     game = new Game(config);
     game.start();
     initTimer(config.Ticks);
     setPlayernameInStatistic();
     setColorInStatistic();
     Show();
 }
Exemplo n.º 4
0
        public Game(Config config)
        {
            double startMoney = config.StartMoney;
            Player1 = new Player(new AILoader(config.Player1AIPath), startMoney);
            Player2 = new Player(new AILoader(config.Player2AIPath), startMoney);
            initAI(Player1);
            initAI(Player2);

            Conf = config;
        }
Exemplo n.º 5
0
 private void btn_gameConfigLoad_Click(object sender, EventArgs e)
 {
     String res = openDialog();
     if (res != null) {
         try {
             config = Config.loadConfig(res);
         } catch (InvalidConfigurationException exception) {
             MessageBox.Show(Messages.ERROR_INVALID_CONFIG + exception.Message, Messages.ERROR_INVALID_CONFIG_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         configLoadedOrNewCreatedGame();
         checkPlayerKI();
         loadGame(config);
     }
     btn_save.Focus();
 }
Exemplo n.º 6
0
 public void view(Config config)
 {
     setFormSize(config);
     setColorInStatistic();
     Show();
 }
Exemplo n.º 7
0
 private void loadGame(Config conf)
 {
     nmc_sugarMin.Value = conf.SugarMin;
     nmc_sugarMax.Value = conf.SugarMax;
     nmc_sugarAmountMin.Value = conf.SugarAmountMin;
     nmc_sugarAmountMax.Value = conf.SugarAmountMax;
     nmc_boardWidth.Value = conf.BoardWidth;
     nmc_boardHeigth.Value = conf.BoardHeight;
     nmc_startMoney.Value = (decimal) conf.StartMoney;
     nmc_ticks.Value = conf.Ticks;
     nmc_maxTicks.Value = conf.MaxTicks;
     nmc_points.Value = conf.Points;
 }