Inheritance: global::ProtoBuf.IExtensible
Esempio n. 1
0
 private void RoleEnter(string accountId, string nickname)
 {
     try {
         NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, accountId);
         GameFrameworkMessage.RoleEnter protoData = new GameFrameworkMessage.RoleEnter();
         protoData.m_Nickname = nickname;
         msg.m_ProtoData      = protoData;
         SendMessage(msg);
     } catch (Exception ex) {
         LogSystem.Error("Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
Esempio n. 2
0
 private void HandleRoleEnter(NodeMessage msg, int handle, uint seq)
 {
     GameFrameworkMessage.NodeMessageWithAccount enterMsg = msg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithAccount;
     if (null != enterMsg)
     {
         GameFrameworkMessage.RoleEnter protoData = msg.m_ProtoData as GameFrameworkMessage.RoleEnter;
         if (null != protoData)
         {
             m_UserProcessScheduler.DefaultUserThread.QueueAction(m_UserProcessScheduler.DoRoleEnter, enterMsg.m_Account, protoData.m_Nickname);
         }
     }
 }
Esempio n. 3
0
        private void HandleRoleEnterResult(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.NodeMessageWithAccountAndGuid headerData = lobbyMsg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithAccountAndGuid;
            GameFrameworkMessage.RoleEnterResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.RoleEnterResult;
            if (null != protoData)
            {
                RoleEnterResult.RoleEnterResultEnum ret = protoData.Result;
                m_Guid = headerData.m_Guid;
                ClientInfo.Instance.Guid     = m_Guid;
                ClientInfo.Instance.RoleData = protoData;

                if (ret == RoleEnterResult.RoleEnterResultEnum.Wait)
                {
                    PluginFramework.Instance.HighlightPrompt("Tip_WaitOffline");
                    Thread.Sleep(2000);
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter data = new GameFrameworkMessage.RoleEnter();
                    msg.m_ProtoData = data;
                    SendMessage(msg);
                    LogSystem.Info("Retry RoleEnter {0} {1}", m_AccountId, m_Guid);
                    return;
                }
                else if (ret == RoleEnterResult.RoleEnterResultEnum.Success)
                {
                    //客户端接收服务器传来的数据,创建玩家对象
                    m_WorldId = protoData.WorldId;
                    ///
                    m_IsLogining  = false;
                    m_HasLoggedOn = true;
                    GfxStorySystem.Instance.SendMessage("start_game");
                }
                else if (ret == RoleEnterResult.RoleEnterResultEnum.Reconnect)
                {
                    //重连用户,等待服务器处理重连过程后返回进场景消息,这种情形不用做任何处理
                    PluginFramework.Instance.HighlightPrompt("Tip_Reconnecting");
                }
                else
                {
                    //进入游戏失败
                    PluginFramework.Instance.HighlightPrompt("Tip_RoleEnterFailed");
                }
            }
        }
Esempio n. 4
0
        private void HandleAccountLoginResult(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.AccountLoginResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.AccountLoginResult;
            if (null == protoData)
            {
                return;
            }
            GameFrameworkMessage.AccountLoginResult.AccountLoginResultEnum ret = protoData.m_Result;
            ulong userGuid = protoData.m_UserGuid;

            UserNetworkSystem.Instance.IsQueueing = false;
            if (m_HasLoggedOn)  //重连处理
            {
                if (ret == AccountLoginResult.AccountLoginResultEnum.Success)
                {
                    //登录成功,向服务器请求玩家角色
                    m_Guid = userGuid;
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
                    msg.m_ProtoData = protoMsg;
                    SendMessage(msg);
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing ||
                         ret == AccountLoginResult.AccountLoginResultEnum.QueueFull ||
                         ret == AccountLoginResult.AccountLoginResultEnum.Wait)
                {
                    Disconnect();
                }
                else
                {
                    //PluginFramework.Instance.ReturnToLogin();
                }
            }
            else    //首次登录处理
            {
                if (ret == AccountLoginResult.AccountLoginResultEnum.Success)
                {
                    m_Guid = userGuid;
                    //登录成功,向服务器请求玩家角色
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
                    protoMsg.m_Nickname = string.Empty;
                    msg.m_ProtoData     = protoMsg;
                    SendMessage(msg);
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.FirstLogin)
                {
                    //账号首次登录,需要指定昵称
                    m_Guid = userGuid;
                    RequestNickname();
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Wait)
                {
                    //同时登录人太多,需要等待一段时间后再登录
                    PluginFramework.Instance.HighlightPrompt("Tip_TooManyPeople");
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Banned)
                {
                    //账号已被封停,禁止登录
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing)
                {
                    PluginFramework.Instance.HighlightPrompt("Tip_Queueing");
                    UserNetworkSystem.Instance.IsQueueing  = true;
                    UserNetworkSystem.Instance.QueueingNum = -1;
                }
                else if (ret == AccountLoginResult.AccountLoginResultEnum.QueueFull)
                {
                    //排队满
                    StopLoginLobby();
                    PluginFramework.Instance.HighlightPrompt("Tip_QueueFull");
                }
                else
                {
                    //账号登录失败
                    PluginFramework.Instance.HighlightPrompt("Tip_AccountLoginFailed");
                }
            }
        }
 private void RoleEnter(string accountId, string nickname)
 {
     try {
         NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, accountId);
         GameFrameworkMessage.RoleEnter protoData = new GameFrameworkMessage.RoleEnter();
         protoData.m_Nickname = nickname;
         msg.m_ProtoData = protoData;
         SendMessage(msg);
     } catch (Exception ex) {
         LogSystem.Error("Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
        private void HandleRoleEnterResult(NodeMessage lobbyMsg)
        {
            GameFrameworkMessage.NodeMessageWithAccountAndGuid headerData = lobbyMsg.m_NodeHeader as GameFrameworkMessage.NodeMessageWithAccountAndGuid;
            GameFrameworkMessage.RoleEnterResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.RoleEnterResult;
            if (null != protoData) {
                RoleEnterResult.RoleEnterResultEnum ret = protoData.Result;
                m_Guid = headerData.m_Guid;
                ClientInfo.Instance.Guid = m_Guid;
                ClientInfo.Instance.RoleData = protoData;

                if (ret == RoleEnterResult.RoleEnterResultEnum.Wait) {
                    ClientModule.Instance.HighlightPrompt("Tip_WaitOffline");
                    Thread.Sleep(2000);
                    NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
                    GameFrameworkMessage.RoleEnter data = new GameFrameworkMessage.RoleEnter();
                    msg.m_ProtoData = data;
                    SendMessage(msg);
                    LogSystem.Info("Retry RoleEnter {0} {1}", m_AccountId, m_Guid);
                    return;
                } else if (ret == RoleEnterResult.RoleEnterResultEnum.Success) {
                    //�ͻ��˽��շ��������������ݣ�������Ҷ���
                    m_WorldId = protoData.WorldId;
                    ///
                    m_IsLogining = false;
                    m_HasLoggedOn = true;
                    GfxStorySystem.Instance.SendMessage("start_game");
                } else if (ret == RoleEnterResult.RoleEnterResultEnum.Reconnect) {
                    //�����û����ȴ������������������̺󷵻ؽ�������Ϣ���������β������κδ���
                    ClientModule.Instance.HighlightPrompt("Tip_Reconnecting");
                } else {
                    //������Ϸʧ��
                    ClientModule.Instance.HighlightPrompt("Tip_RoleEnterFailed");
                }
            }
        }
 private void HandleAccountLoginResult(NodeMessage lobbyMsg)
 {
     GameFrameworkMessage.AccountLoginResult protoData = lobbyMsg.m_ProtoData as GameFrameworkMessage.AccountLoginResult;
     if (null == protoData)
         return;
     GameFrameworkMessage.AccountLoginResult.AccountLoginResultEnum ret = protoData.m_Result;
     ulong userGuid = protoData.m_UserGuid;
     UserNetworkSystem.Instance.IsQueueing = false;
     if (m_HasLoggedOn) {//��������
         if (ret == AccountLoginResult.AccountLoginResultEnum.Success) {
             //��¼�ɹ����������������ҽ�ɫ
             m_Guid = userGuid;
             NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
             GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
             msg.m_ProtoData = protoMsg;
             SendMessage(msg);
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing ||
           ret == AccountLoginResult.AccountLoginResultEnum.QueueFull ||
           ret == AccountLoginResult.AccountLoginResultEnum.Wait) {
             Disconnect();
         } else {
             //ClientModule.Instance.ReturnToLogin();
         }
     } else {//�״ε�¼����
         if (ret == AccountLoginResult.AccountLoginResultEnum.Success) {
             m_Guid = userGuid;
             //��¼�ɹ����������������ҽ�ɫ
             NodeMessage msg = new NodeMessage(LobbyMessageDefine.RoleEnter, m_AccountId);
             GameFrameworkMessage.RoleEnter protoMsg = new GameFrameworkMessage.RoleEnter();
             protoMsg.m_Nickname = string.Empty;
             msg.m_ProtoData = protoMsg;
             SendMessage(msg);
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.FirstLogin) {
             //�˺��״ε�¼����Ҫָ���dz�
             m_Guid = userGuid;
             RequestNickname();
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.Wait) {
             //ͬʱ��¼��̫�࣬��Ҫ�ȴ�һ��ʱ����ٵ�¼
             ClientModule.Instance.HighlightPrompt("Tip_TooManyPeople");
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.Banned) {
             //�˺��ѱ���ͣ����ֹ��¼
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.Queueing) {
             ClientModule.Instance.HighlightPrompt("Tip_Queueing");
             UserNetworkSystem.Instance.IsQueueing = true;
             UserNetworkSystem.Instance.QueueingNum = -1;
         } else if (ret == AccountLoginResult.AccountLoginResultEnum.QueueFull) {
             //�Ŷ���
             StopLoginLobby();
             ClientModule.Instance.HighlightPrompt("Tip_QueueFull");
         } else {
             //�˺ŵ�¼ʧ��
             ClientModule.Instance.HighlightPrompt("Tip_AccountLoginFailed");
         }
     }
 }