private JoinResponseCommMessage SendMessagesJoin(int userId, IEnumerator <ActionResultInfo> iterator, CommunicationMessage originalMsg) { JoinResponseCommMessage response = null; GameDataCommMessage gameData = null; bool found = false; while (iterator.MoveNext()) { var curr = iterator.Current; if (curr != null && curr.Id != userId) { gameData = curr.GameData; _commHandler.AddMsgToSend(_parser.SerializeMsg(curr.GameData, ShouldUseDelim), curr.Id); } else if (curr != null) { found = true; gameData = curr.GameData; response = new JoinResponseCommMessage(_sessionIdHandler.GetSessionIdByUserId(userId), userId, curr.GameData.IsSucceed, originalMsg, curr.GameData); response.SetGameData(curr.GameData); } } if (!found && gameData != null) { response = new JoinResponseCommMessage(_sessionIdHandler.GetSessionIdByUserId(userId), userId, gameData.IsSucceed, originalMsg, gameData); response.SetGameData(gameData); } return(response); }
public void JoinAsSpectatorReceived(JoinResponseCommMessage msg) { _currSearchScreen.JoinOkayAsSpectate(msg.GameData); }
public void JoinAsPlayerReceived(JoinResponseCommMessage msg) { _currSearchScreen.JoinOkay(msg.GameData); }