void SendPing()
        {
            var pingRequest = PingRequest.CreateBuilder().SetTimestamp(UnixNow).Build();
            var packet      = ProtocolWrapper.WrapMessage <PingRequest>(PingRequest.RequestNumberFieldNumber, PingRequest.RequestNumber, pingRequest);

            this.ctx.WriteAndFlushAsync(packet);
        }
Exemple #2
0
        public virtual void ProcessAuthenciate()
        {
            var response = AsyncConnectionErrorRequest.CreateBuilder().SetCode(AsyncConnectionErrorRequest.Types.ConnectionError.SERVER_ERROR).Build();
            var packet   = ProtocolWrapper.WrapMessage <AsyncConnectionErrorRequest>(AsyncConnectionErrorRequest.RequestNumberFieldNumber, AsyncConnectionErrorRequest.RequestNumber, response);

            ctx.WriteAndFlushAsync(packet);
        }
        void SendUserPasswordAuthenticateRequest()
        {
            var authenticateRequest = AsyncAuthRequest.
                                      CreateBuilder().
                                      SetName("alice").
                                      SetPass("a123456").
                                      Build();
            var packet = ProtocolWrapper.WrapMessage <AsyncAuthRequest>(AsyncAuthRequest.RequestNumberFieldNumber, AsyncAuthRequest.RequestNumber, authenticateRequest);

            this.ctx.WriteAndFlushAsync(packet);
        }
        void SendActionCommitRequest()
        {
            var actionCommitRequest = ActionCommitedRequest.
                                      CreateBuilder().
                                      SetGameId(1).
                                      SetTurnIndex(1).
                                      Build();
            var packet = ProtocolWrapper.WrapMessage <ActionCommitedRequest>(ActionCommitedRequest.RequestNumberFieldNumber, ActionCommitedRequest.RequestNumber, actionCommitRequest);

            this.ctx.WriteAndFlushAsync(packet);
            Console.WriteLine($"Submit GameTurn: [GameId: {actionCommitRequest.GameId} TurnIndex: {actionCommitRequest.TurnIndex}]");
        }