/// <summary> /// 取得初始化遊戲資訊 /// </summary> private void GameStartCommand(string cmdStr) { InitGameSetting init = JsonConvert.DeserializeObject <InitGameSetting>(cmdStr); if (init == null) { return; } this.pb_Board.Enabled = init.CanPlaceAPiece; //this.game.NextPlayer = init.PieceType; //this.game.CurrentPlayer = init.PieceType; }
/// <summary> /// 遊戲開始指令 /// </summary> private void GameStartCommand() { bool isFirst = true; InitGameSetting init; foreach (Socket sock in this.ht.Values) { init = new InitGameSetting(); init.PieceType = isFirst ? PieceType.Black : PieceType.White; init.CanPlaceAPiece = isFirst; isFirst = !isFirst; // 取得序列化後的指令字串 string cmdStr = this.GetCommandStr(TCPCommandType.GameStart, string.Empty, init, true); this.SendTo(cmdStr, sock); } }