Ejemplo n.º 1
0
        private void SetGamePositionByFen(Kv kv)
        {
            string fen = kv.Get("Fen");

            base.Game.Flags.IsChallengerSendsGame = false;
            ChessBoardUc.SetFen(fen);
        }
Ejemplo n.º 2
0
        public void ChangeMainEngine(UCIEngine engine)
        {
            this.Game.DefaultEngine.Pause();
            this.Game.SwapPlayersIfNeeded();
            if (this.Game.IsDefaultEngine(engine))
            {
                this.Game.DefaultEngine.Resume();
                return;
            }

            this.Game.Clock.Stop();
            this.Game.PreviousPonderMove = "";
            this.Game.DefaultEngine.Close();
            this.Game.DefaultEngine = engine;
            AnalysisUc.ChangeEngine(engine);
            AnalysisUc.TabText = engine.EngineTitle;

            if (this.Game.GameMode == App.Model.GameMode.HumanVsEngine)
            {
                if (this.Game.CurrentPlayer.IsWhite)
                {
                    this.Game.Player2.Engine = this.Game.DefaultEngine;
                }
                else
                {
                    this.Game.Player1.Engine = this.Game.DefaultEngine;
                }

                ChessBoardUc.SetEvents();
                this.Game.GameData.Black1 = this.Game.DefaultEngine.EngineName;
                this.RefreshGameInfo();
            }
        }
Ejemplo n.º 3
0
        private void InitChessBoardUc()
        {
            Dock = DockStyle.Fill;
            pnlBackground.Controls.Clear();
            System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost();
            chessBoardUc1      = new ChessBoardUc(this.Game);
            elementHost1.Child = chessBoardUc1;
            elementHost1.Dock  = DockStyle.Fill;
            pnlBackground.Controls.Add(elementHost1);

            SetBackground();
        }
Ejemplo n.º 4
0
 private void startGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SocketClient.SetGamePositionByFen(ChessBoardUc.GetFen(), base.Game.DbGame.GameID, base.Game.GetLastMoveXml(), base.Game.DbGame.WhiteUserID, base.Game.DbGame.BlackUserID);
     EnablePositionSetup(false);
     base.Game.Flags.IsChallengerSendsGame = false;
 }
Ejemplo n.º 5
0
 public void ForceEngineToPlay()
 {
     SwapPlayers();
     ChessBoardUc.ForceEngineToPlay();
 }
Ejemplo n.º 6
0
 protected virtual void GameAfterSetFen()
 {
     ChessBoardUc.SetFen(this.Game.BoardFen);
 }
Ejemplo n.º 7
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     timer1.Enabled = false;
     ChessBoardUc.StartGame();
 }