public async Task SetPiece(int x, int y, string color) { this.TurnIndex = (this.TurnIndex == 0) ? 1 : 0; this.TimeLeft = TurnSeconds; this.Counter.Dispose(); this.Counter = new Timer(Countdown, null, 0, 1000); int pieceInt = ColorToInt(color); if (this.PieceGrid[y, x] == 0) { this.PieceGrid[y, x] = pieceInt; } else { throw new Exception($"棋盤資料異常 y = {y}, x = {x}"); } var connectionIds = GetConnectionIds(); await Clients.Clients(connectionIds).SendAsync("ReturnTurnIndex", this.TurnIndex); await Clients.Clients(connectionIds).SendAsync("UpdateBoard", x, y, color); await Clients.Client(this.PlayerList[0].ConnectionId).SendAsync("ControlBoard", this.TurnIndex == 0); await Clients.Client(this.PlayerList[1].ConnectionId).SendAsync("ControlBoard", this.TurnIndex == 1); int tempX = x; int tempY = y; if (CheckFive(1, 0, x, y, pieceInt) || CheckFive(0, 1, x, y, pieceInt) || CheckFive(1, 1, x, y, pieceInt) || CheckFive(1, -1, x, y, pieceInt)) { ResetGame(); await Clients.Clients(connectionIds).SendAsync("EndGame", color); await Clients.AllExcept(connectionIds).SendAsync("UpdateRoomList", Room.GetRoomList()); } //Debug.WriteLine(" 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5"); //for (int i = 1; i <= 15; i++) //{ // Debug.Write(i.ToString().PadLeft(2) + " "); // for (int j = 1; j <= 15; j++) // { // Debug.Write(this.PieceGrid[i, j] + " "); // } // Debug.Write("\n"); //} //Debug.WriteLine("========================================"); }
public T AllExcept(IReadOnlyList <string> excludedIds) => TypedClientBuilder <T> .Build(_hubClients.AllExcept(excludedIds));
public dynamic AllExcept(IReadOnlyList <string> excludedIds) => new DynamicClientProxy(_clients.AllExcept(excludedIds));
public TTo AllExcept(IReadOnlyList <string> excludedConnectionIds) { return(_src.AllExcept(excludedConnectionIds)); }