protected void NotifyRoomPlayersExcept(WebsocketSendObjctBase websocketSendObjctBase, int playerId) { for (int i = 0; i < InningeGame.IRoom.Players.Count; i++) { var player = InningeGame.IRoom.Players[i]; if (player.Id != playerId) { NotifyByWebsockLink?.Invoke(websocketSendObjctBase, player.WebSocketLink); } } }
/// <summary> /// 刷新玩家客户端数据 /// </summary> /// <param name="playerId">玩家Id</param> /// <returns>发送到客户端玩家数据</returns> /// /// <summary> /// // public virtual object FreshGameFace(int playerId) { // return null; // } protected void NotifyRoomPlayers(WebsocketSendObjctBase websocketSendObjctBase) { // foreach (IPlayerJoinRoom item in InningeGame.IRoom.Players) // { var players = InningeGame.IRoom.Players; for (int i = 0; i < players.Count; i++) { if (null != players[i].WebSocketLink) { // NotifyByWebsockLink?.Invoke(websocketSendObjctBase, item.WebSocketLink); NotifyByWebsockLink?.Invoke(websocketSendObjctBase, players[i].WebSocketLink); } } // } }
protected void NotifySinglePlayer(WebsocketSendObjctBase websocketSendObjctBase, int playerId) { var myPlayer = InningeGame.IRoom.Players.Find(p => p.Id == playerId); NotifyByWebsockLink?.Invoke(websocketSendObjctBase, myPlayer.WebSocketLink); }