public KickPlayerPoll(NetworkCommunicator playerPeer, bool banPlayer) { this.PlayerPeer = playerPeer; this.BanPlayer = banPlayer; }
public UpdateSelectedTroopIndex(NetworkCommunicator peer, int selectedTroopIndex) { this.Peer = peer; this.SelectedTroopIndex = selectedTroopIndex; }
void IUdpNetworkHandler.HandleEarlyPlayerDisconnect( NetworkCommunicator networkPeer) { this.HandleEarlyPlayerDisconnect(networkPeer); }
void IUdpNetworkHandler.HandlePlayerDisconnect(NetworkCommunicator networkPeer) => this.HandlePlayerDisconnect(networkPeer);
void IUdpNetworkHandler.HandleLateNewClientAfterLoadingFinished( NetworkCommunicator networkPeer) { this.HandleLateNewClientAfterLoadingFinished(networkPeer); }
void IUdpNetworkHandler.HandleLateNewClientAfterSynchronized( NetworkCommunicator networkPeer) { this.HandleLateNewClientAfterSynchronized(networkPeer); }
protected virtual void HandleLateNewClientAfterSynchronized(NetworkCommunicator networkPeer) { }
protected virtual void HandlePlayerDisconnect(NetworkCommunicator networkPeer) { }
public RemoveAgentVisualsForPeer(NetworkCommunicator peer) => this.Peer = peer;
protected virtual void HandleLateNewClientAfterLoadingFinished(NetworkCommunicator networkPeer) { }
public AddPeerComponent(NetworkCommunicator peer, uint componentId) { this.Peer = peer; this.ComponentId = componentId; }
public CreateBanner(NetworkCommunicator peer, string bannerCode) { this.Peer = peer; this.BannerCode = bannerCode; }
private void ClientGameLoop(object client) { NetworkCommunicator networkCommunicator = (NetworkCommunicator)client; ManualResetEvent sentDataThisTurn = new ManualResetEvent(false); ManualResetEvent endOfTurnWait = new ManualResetEvent(false); try { string data = string.Empty; _playersThatSentDataThisTurnList.Add(sentDataThisTurn); _endOfTurnWaitList.Add(endOfTurnWait); _currentTurnClientActions.Add(new PlayerAction(networkCommunicator.RemoteEndPoint.ToString(), MessageConstants.PlayerActionNone)); _log.InfoFormat("Client {0} connected running on thread: {1}, waiting for start game / 1st turn data", networkCommunicator.RemoteEndPoint, Thread.CurrentThread.ManagedThreadId); data = networkCommunicator.ReceiveData(); bool readFromClient = false; if (data == MessageConstants.StartGame) { readFromClient = true; RunGame(); foreach (NetworkCommunicator clientPlayer in _players) { clientPlayer.SendData(MessageConstants.GameStarting); } _completeGameState.StartNewGame(_currentTurnClientActions); } // Loop to receive all the data sent by the client. // this is now the main game loop for the game - 1 thread per client bool gameIsOn = true; while (gameIsOn) //issue [B.2.3] of the design document { if (readFromClient) { data = networkCommunicator.ReceiveData(); } else { readFromClient = true; } foreach (PlayerAction action in _currentTurnClientActions) { if (action.PlayerID == networkCommunicator.RemoteEndPoint.ToString()) { action.Action = data; } } sentDataThisTurn.Set(); _gameStateProcessed.WaitOne(); networkCommunicator.SendData(_completeGameState.ToString()); endOfTurnWait.Set(); WaitHandle.WaitAll(_endOfTurnWaitArray); //issue [B.2.3] of the design document _gameStateProcessed.Reset(); } } catch (Exception ex) { ErrorUtil.WriteError(ex); throw; } finally { sentDataThisTurn.Close(); endOfTurnWait.Close(); networkCommunicator.Dispose(); } }
public SetAgentPeer(Agent agent, NetworkCommunicator peer) { this.Agent = agent; this.Peer = peer; }
public AssignFormationToPlayer(NetworkCommunicator peer, FormationClass formationClass) { this.Peer = peer; this.FormationClass = formationClass; }