public TzaarClientLogic(PictureBox aPictureBox, GameMessage.Version versionMsg, GamePlayer playerNumber, GameBoard initialBoard)
 {
     this.pictureBox1 = aPictureBox;
     this.versionMsg = versionMsg;
     this.painter = new TzaarClientPainter(this.pictureBox1);
     this.playerNumber = playerNumber;
     this.painter.SetLocalPlayerColor((playerNumber == GamePlayer.One) ? TzaarColor.WHITE : TzaarColor.BLACK);
     this.logic = new TzaarLogic(new TzaarGameState((TzaarBoard)initialBoard));
 }
        public OwariClientLogic(PictureBox aPictureBox, GameMessage.Version versionMsg, GamePlayer playerNumber, GameBoard initialBoard)
        {
            this.playerNumber = 0;

            this.pictureBox1 = aPictureBox;
            this.versionMsg = versionMsg;

            // Make the configuration active.
            try
            {
                OwariConfiguration.SetConfig(versionMsg.GameConfig);
            }
            catch
            {
                Console.WriteLine("[OwariClientLogic] WARNING: unable to set configuration from string '" + versionMsg.GameConfig + "'");
            }

            this.painter = new OwariPainter(this.pictureBox1);
            this.logic = new OwariLogic();

            this.playerNumber = playerNumber;

            this.logic = new OwariLogic(new OwariGameState(initialBoard));
        }
 public IGameClientLogic GetNewGameClientLogic(PictureBox aPictureBox, GameMessage.Version versionMsg, GamePlayer playerNumber, GameBoard initialBoard)
 {
     return new TzaarClientLogic(aPictureBox, versionMsg, playerNumber, initialBoard);
 }
        public void HandleMove(GamePlayer playerNumber, GameMessage.Move moveMsg)
        {
            this.logic.MakeMove(playerNumber, moveMsg);

            this.logic.GetGameState().AddMove(moveMsg);

            if (playerNumber == this.playerNumber)
            {
                TzaarGameState state = (TzaarGameState)this.logic.GetGameState();

                if (state.GetCurrentPlayerNumber() == playerNumber && !state.IsFirstMoveOfTurn)
                    this.painter.PassButtonEnabled = true;
                else
                    this.painter.PassButtonEnabled = false;
            }
        }
 private void RecordMove(GamePlayer playerNumber, GameMessage.Move move)
 {
     try
     {
         lock (this.locker)
         {
             this.gameClientLogic.HandleMove(this.playerNumber, move);
             this.gameStateQueue.Enqueue(this.gameClientLogic.GetGameState());
         }
     }
     catch (Exception)
     {
     }
 }
        public void HandleMove(GamePlayer playerNumber, GameMessage.Move moveMsg)
        {
            this.logic.MakeMove(playerNumber, moveMsg);

            this.logic.GetGameState().AddMove(moveMsg);
        }