示例#1
0
    public static void Rpc(string rpc, object[] args, Action <RpcReader> callback)
    {
        RpcWriter writer = new RpcWriter();

        for (int i = 0; i < args.Length; i++)
        {
            writer.Write((int)args[i]);
        }

        RpcRequest.Types.RequestHeader header = RpcRequest.Types.RequestHeader.CreateBuilder().SetRpcId(5).SetReqId(Instance.currReqId++).Build();
        RpcRequest request = RpcRequest.CreateBuilder().SetHeader(header).SetContent(ByteString.CopyFrom(writer.GetBytes())).Build();

        Instance.sendQueue.Enqueue(request);
    }