Пример #1
0
    protected override void GetResultsCommand(UdpNetworkDriver driver, NetworkConnection connection, DataStreamReader strm)
    {
        GetResultsResponseData responseReceived = new GetResultsResponseData(strm);

        ClientController.PlayerState playerState = (ClientController.PlayerState)responseReceived.playerState;
        PlayerTurnData.UIColors      playerColor = (PlayerTurnData.UIColors)responseReceived.playerColor;

        TimeLogger.Log("CLIENT {0} - {3} - response - GetResults ({1} at {2})",
                       ((ClientCommunication)owner).ClientId, playerState, responseReceived.playerPosition, playerColor);

        GetResultsEvent?.Invoke(playerState, responseReceived.playerPosition, playerColor);
    }
Пример #2
0
    protected override void GetResultsCommand(UdpNetworkDriver driver, NetworkConnection connection, DataStreamReader strm)
    {
        GetResultsRequestData requestReceived = new GetResultsRequestData(strm);
        int clientId = requestReceived.playerId;

        PlayerSimplifiedTurnData data = ((ServerCommunication)owner).PopPlayerData(clientId);

        TimeLogger.Log("SERVER - {0}[{1}] - {3} - request - GetResults ({2})", clientId, connection.InternalId, data.state, (PlayerTurnData.UIColors)data.playerColor);

        GetResultsResponseData response = new GetResultsResponseData(clientId, data.playerColor, data.state, data.position);
        IJob job = DataPackageWrapper.CreateSendDataJob(driver, connection, response.DataToArray());

        jobHandler.QueueJob(job);
    }