Exemplo n.º 1
0
    public void ReadSumResult(byte[] data)
    {
        PooledNetworkReader pooledNetworkReader = NetworkReaderPool.GetReader(data);
        int value = pooledNetworkReader.Read <int>();

        Debug.LogWarning("Sum " + value);

        pooledNetworkReader.Dispose();
    }
Exemplo n.º 2
0
    public void ReaderFuction(byte[] data)
    {
        PooledNetworkReader pooledNetworkReader = NetworkReaderPool.GetReader(data);
        int  value  = pooledNetworkReader.Read <int>();
        bool value2 = pooledNetworkReader.Read <bool>();

        Debug.LogWarning("ABCD " + value);

        TEST.OnDataReceive(value, value2);

        pooledNetworkReader.Dispose();
    }
Exemplo n.º 3
0
    public void SumOnServer(byte[] serverReceivedData)
    {
        PooledNetworkReader pooledNetworkReader = NetworkReaderPool.GetReader(serverReceivedData);
        int a = pooledNetworkReader.Read <int>();
        int b = pooledNetworkReader.Read <int>();

        pooledNetworkReader.Dispose();
        PooledNetworkWriter pooledNetworkWriter = NetworkWriterPool.GetWriter();
        int result = a + b;

        pooledNetworkWriter.Write(result);
        pooledNetworkWriter.ToArray();
        byte[] dataToSendClient = pooledNetworkWriter.ToArray();
        Debug.LogWarning("Server " + result);
        RpcReceive(DataCommand.TEST_SumOnServer, dataToSendClient);
        pooledNetworkWriter.Dispose();
    }