protected override void GetStateCommand(UdpNetworkDriver driver, NetworkConnection connection, DataStreamReader strm) { GetStateRequestData requestReceived = new GetStateRequestData(strm); int clientId = requestReceived.playerId; ServerController.ServerState currentServerState = ((ServerCommunication)owner).ServerCurrentState; //TimeLogger.Log("SERVER - {0}[{1}] request - GetState ({2})", clientId, connection.InternalId, currentServerState); GetStateResponseData response = new GetStateResponseData(clientId, currentServerState); IJob job = DataPackageWrapper.CreateSendDataJob(driver, connection, response.DataToArray()); jobHandler.QueueJob(job); }
void StateEnd(ServerController.ServerState nextState) { StateEnd(); serverController.NextState = nextState; }
void GetStateEventCallback(ServerController.ServerState serverState) { GetStateEvent?.Invoke(serverState); }
/// <summary> /// This constructor is for WRAPPING the data to make a request /// </summary> public GetStateResponseData(int playerId, ServerController.ServerState serverState) { this.playerId = playerId; this._serverState = (int)serverState; }