Exemplo n.º 1
0
        public GameForm(EngineList engineList, VolatileConfig volatileConfig)
        {
            InitializeComponent();
            engineSelectControl1.Initialize(engineList);
            engineSelectControl2.Initialize(engineList);
            this.volatileConfig = volatileConfig;

            engineSelectControl1.SelectedItem = engineList.Select(
                volatileConfig.GameEngine1Name, volatileConfig.GameEngine1Path);
            engineSelectControl2.SelectedItem = engineList.Select(
                volatileConfig.GameEngine2Name, volatileConfig.GameEngine2Path);
            engineTimeOptionControl1.TimeControl = volatileConfig.GameEngineTimeControls[0];
            engineTimeOptionControl2.TimeControl = volatileConfig.GameEngineTimeControls[1];
            engineTimeOptionControl1.Depth       = volatileConfig.GameEngineDepths[0];
            engineTimeOptionControl2.Depth       = volatileConfig.GameEngineDepths[1];
            engineTimeOptionControl1.Nodes       = volatileConfig.GameEngineNodes[0];
            engineTimeOptionControl2.Nodes       = volatileConfig.GameEngineNodes[1];
            switch (volatileConfig.GameTimeIndex)
            {
            case 0: radioButton1.Checked = true; break;

            case 1: radioButton2.Checked = true; break;

            case 2: radioButton3.Checked = true; break;

            default: goto case 0;
            }
            gameTimePickerControl1.TimeASeconds   = volatileConfig.GameTimes[0].TimeASeconds;
            gameTimePickerControl2.TimeASeconds   = volatileConfig.GameTimes[1].TimeASeconds;
            gameTimePickerControl3.TimeASeconds   = volatileConfig.GameTimes[2].TimeASeconds;
            gameTimePickerControl1.TimeBSeconds   = volatileConfig.GameTimes[0].TimeBSeconds;
            gameTimePickerControl2.TimeBSeconds   = volatileConfig.GameTimes[1].TimeBSeconds;
            gameTimePickerControl3.TimeBSeconds   = volatileConfig.GameTimes[2].TimeBSeconds;
            gameTimePickerControl1.IncTimeSeconds = volatileConfig.GameTimes[0].IncTimeSeconds;
            gameTimePickerControl2.IncTimeSeconds = volatileConfig.GameTimes[1].IncTimeSeconds;
            gameTimePickerControl3.IncTimeSeconds = volatileConfig.GameTimes[2].IncTimeSeconds;
            comboBox1.SelectedIndex = volatileConfig.GameTimeUpType;
            numericUpDown1.Value    = volatileConfig.GameCount;
            checkBox2.Checked       = volatileConfig.GameEndByMoveCount;
            numericUpDown3.Value    = volatileConfig.GameEndMoveCount;
            switch (volatileConfig.GameStartPosType)
            {
            case 0: radioButton5.Checked = true; break;

            case 1: radioButton6.Checked = true; break;

            default: goto case 0;
            }
            textBox1.Text           = volatileConfig.GameStartPosNotationPath;
            checkBox1.Checked       = volatileConfig.GameStartPosNotationShuffle;
            numericUpDown2.Value    = volatileConfig.GameStartPosNotationStartCount;
            checkBoxRestart.Checked = volatileConfig.GameEngineRestart;

            UpdateEnables();
        }
Exemplo n.º 2
0
        public ThinkForm(VolatileConfig volatileConfig, EngineList engineList)
        {
            InitializeComponent();
            engineSelectControl1.Initialize(engineList);
            this.volatileConfig = volatileConfig;

            engineSelectControl1.SelectedItem = engineList.Select(
                volatileConfig.ThinkEngineName, volatileConfig.ThinkEnginePath);

            UpdateEnables();
        }
Exemplo n.º 3
0
        public NetworkGameForm(EngineList engineList, Config config, VolatileConfig volatileConfig)
        {
            InitializeComponent();
            this.engineList     = engineList;
            this.config         = config;
            this.volatileConfig = volatileConfig;
            System.Diagnostics.Debug.Assert(
                config.NetworkGameConnections != null &&
                config.NetworkGameConnections.Length == 6);

            engineSelectControl1.Initialize(engineList);

            // コンフィグからフォームへ
            // エンジン
            engineSelectControl1.SelectedItem = engineList.Select(
                volatileConfig.NetworkGameEngineName,
                volatileConfig.NetworkGameEnginePath);
            // 接続先
            networkGameConnectionControl1.ReadFromConfig(config.NetworkGameConnections[0]);
            networkGameConnectionControl2.ReadFromConfig(config.NetworkGameConnections[1]);
            networkGameConnectionControl3.ReadFromConfig(config.NetworkGameConnections[2]);
            networkGameConnectionControl4.ReadFromConfig(config.NetworkGameConnections[3]);
            networkGameConnectionControl5.ReadFromConfig(config.NetworkGameConnections[4]);
            networkGameConnectionControl6.ReadFromConfig(config.NetworkGameConnections[5]);
            switch (volatileConfig.NetworkGameConnectionIndex)
            {
            case 0: radioButton1.Checked = true; break;

            case 1: radioButton2.Checked = true; break;

            case 2: radioButton3.Checked = true; break;

            case 3: radioButton4.Checked = true; break;

            case 4: radioButton5.Checked = true; break;

            case 5: radioButton6.Checked = true; break;

            default: goto case 0;
            }
            numericUpDown1.Value = volatileConfig.NetworkGameCount;

            // 表示を更新
            UpdateEnables();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 読み込み処理
        /// </summary>
        private void OnThread(object arg)
        {
            lock (syncObject) {
                try {
                    // Engine.xmlの読み込み
                    try {
                        engineList = ConfigSerializer.Deserialize <EngineList>();
                        engineList.Engines.Sort();
                    } catch (Exception ex) {
                        logger.Warn("Engine.xmlの読み込みに失敗。", ex);
                        ConfigLoadFailed(this, new ConfigLoadFailedEventArgs {
                            ConfigFileName = "Engine.xml", ToBeQuit = true
                        });
                        return;
                    }
                    // ShogiBoard.xmlの読み込み
                    try {
                        config = ConfigSerializer.Deserialize <Config>();
                        config.Ready();
                    } catch (Exception ex) {
                        logger.Warn("ShogiBoard.xmlの読み込みに失敗。", ex);
                        ConfigLoadFailed(this, new ConfigLoadFailedEventArgs {
                            ConfigFileName = "ShogiBoard.xml", ToBeQuit = true
                        });
                        return;
                    }
                    // ShogiBoard.Volatile.xmlの読み込み
                    try {
                        volatileConfig = ConfigSerializer.Deserialize <VolatileConfig>();
                    } catch (Exception ex) {
                        logger.Warn("ShogiBoard.Volatile.xmlの読み込みに失敗。", ex);
                        ConfigLoadFailed(this, new ConfigLoadFailedEventArgs {
                            ConfigFileName = "ShogiBoard.Volatile.xml", ToBeQuit = false
                        });
                        volatileConfig = new VolatileConfig(); // 初期値にしてしまう
                    }
                    volatileConfig.Ready();
                } catch (Exception ex) {
                    logger.Warn("ShogiBoard.Volatile.xmlの読み込みに失敗。", ex);
                }

                Monitor.PulseAll(syncObject);
            }
        }