public void ProcessWentOutMessage(WentOutMessage m) { if (_Client == null) { return; } Player p = _Client.FindPlayer(m.PlayerId, true); if (_WentOutMessageDelegate != null) { _WentOutMessageDelegate(p); } }
protected Message getMessage() { byte[] b; int avail; try { //while we're here, look for data in the buffer avail = _sock.Available; if (avail > 0) { buffer.ReadFromSocket(_sock, avail); this.BytesReceived += avail; } //first see if we can actually decode something if (buffer.CanDecode()) { b = buffer.Decode(); } else { return(null); } } catch (Exception ex) { PhazeXLog.LogError(ex, GameLibraryVersion.VersionString, 104); _connected = false; return(null); } Message m = null; if (b.Length == 0) { return(m); } else if (b[0] == (byte)pxMessages.Heartbeat) { m = new HeartBeatMessage(b); } else if (b[0] == (byte)pxMessages.ChangeName) { m = new ChangeNameMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.ChangeNameReject) { m = new ChangeNameRejectMessage(b); } else if (b[0] == (byte)pxMessages.Chat) { m = new ChatMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.CompletedPhaze) { m = new CompletedPhazeMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.CurrentPhaze) { m = new CurrentPhazeMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.DiscardSkip) { m = new DiscardSkipMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.DialogMessage) { m = new DialogMessage(b); } else if (b[0] == (byte)pxMessages.ErrorMessage) { m = new ErrorMessage(b); } else if (b[0] == (byte)pxMessages.GameOver) { m = new GameOverMessage(b); } else if (b[0] == (byte)pxMessages.GameRules) { m = new GameRulesMessage(b); } else if (b[0] == (byte)pxMessages.GameStarting) { m = new GameStartingMessage(b); } else if (b[0] == (byte)pxMessages.Goodbye) { m = new GoodbyeMessage(b); } else if (b[0] == (byte)pxMessages.GotCards) { m = new GotCardsMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.GotDeckCard) { m = new GotDeckCardMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.GotDiscard) { m = new GotDiscardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.Hand) { m = new HandMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.Login) { m = new LoginMessage(b); } else if (b[0] == (byte)pxMessages.LoginAcknowledgment) { m = new LoginAckMessage(b); } else if (b[0] == (byte)pxMessages.LogOff) { m = new LogOffMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.NewHand) { m = new NewHandMessage(b); } else if (b[0] == (byte)pxMessages.PlayedCardOnTable) { m = new PlayedCardOnTableMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.Ready) { m = new ReadyMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.Scoreboard) { m = new ScoreboardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.SkipNotification) { m = new SkipNotificationMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.StartGameTimer) { m = new StartGameTimerMessage(b); } else if (b[0] == (byte)pxMessages.Status) { m = new StatusMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.SystemMessage) { m = new SystemMessage(b); } else if (b[0] == (byte)pxMessages.Table) { m = new TableMessage(b, this.GameRules); } else if (b[0] == (byte)pxMessages.TurnEnd) { m = new TurnEndMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.TurnStart) { m = new TurnStartMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.UpdateDiscard) { m = new UpdateDiscardMessage(b, this.GetPlayerIDs(), this.GameRules); } else if (b[0] == (byte)pxMessages.WentOut) { m = new WentOutMessage(b, this.GetPlayerIDs()); } else if (b[0] == (byte)pxMessages.Won) { m = new WonMessage(b, this.GetPlayerIDs()); } else { m = new UnknownMessage(b); } return(m); }