Beispiel #1
0
        private void LoginMessageImpl(NetIncomingMessage im, MessageBase msg)
        {
            var loginMsg    = msg as LoginMessage;
            var r           = new LoginResultMessage();

            var user = AdventurePluginDB.User.Get(loginMsg.Name, loginMsg.Pass);
            if (user != null)
            {
                r.Result = OkTag;
                r.PlayerId = user.id;
            }
            else
            {
                r.Result = ErrorTag;
            }
            SharedServer.SendMessage(r, im.SenderConnection);
        }
Beispiel #2
0
        private void LoginMessageImpl(NetServer server, NetIncomingMessage im, MessageBase msg)
        {
            var registerMsg = msg as LoginMessage;
            var r = new LoginResultMessage();

            var user = AdventurePluginDB.User.Get(registerMsg.Name, registerMsg.Pass);
            if (user != null)
            {
                r.Result = "OK";
                r.UserId = user.id;
            }
            else
            {
                r.Result = "Error";
            }
            server.SendMessage(r, im.SenderConnection);
        }
Beispiel #3
0
        private void OnLoginRspMessage(LoginResultMessage msg)
        {
            if (msg.Result == OkTag)
            {
                PlayerObject.Instance.Self.PlayerId = msg.PlayerId;

                var sendMsg = new PullMessage()
                {
                    PlayerId = msg.PlayerId,
                };

                MessageManager.SendMessage("Client.Send", sendMsg);
            }
            else if (msg.Result == ErrorTag)
            {
                MessageManager.SendMessage("Message.Login.Failed");
            }
        }