Beispiel #1
0
        /// <summary>
        /// 登录回复
        /// </summary>
        /// <param name="jsonData"></param>
        private void TryLoginInPlayer(JsonData jsonData)
        {
            LoginInfo tryInfo = new LoginInfo();

            tryInfo.UserId = jsonData["userId"].ToString();
            PlayerData     tempLoginInfo = PlayerModule.Instance.GetPlayerDataByID(tryInfo.UserId);
            MsgTryLoginRes resMsg        = new MsgTryLoginRes();

            if (tempLoginInfo == null)
            {
                resMsg.SetMessage(-1, 0, 0);
            }
            else
            {
                resMsg.SetMessage(tempLoginInfo.modelType, 0, 0);
            }

            Debug.Log("用户尝试登陆信息回复:--- in --- ");
            List <string> receivers = new List <string>();

            receivers.Add(tryInfo.UserId);
            if (_gameDataHandle.TryLoginEvent != null)
            {
                _gameDataHandle.TryLoginEvent(tryInfo.UserId, resMsg);
            }

            //Debug.Log(Qy_CSharp_NetWork.Tools.Json.JsonTools.ToJson(msg));
            _lookAtMe.PushMsgToOther(resMsg, receivers.ToArray(), false, true);
            Debug.Log("用户尝试登陆信息回复:--- out --- ");
        }
Beispiel #2
0
        /// <summary>
        /// 尝试登录回复
        /// </summary>
        /// <param name="receiver"></param>
        /// <param name="msg"></param>
        public void ResponseTryLoginMsg(string receiver, MsgTryLoginRes msg)
        {
            Debug.Log("用户尝试登陆信息回复:--- in --- ");
            List <string> receivers = new List <string>();

            receivers.Add(receiver);

            Debug.Log(Qy_CSharp_NetWork.Tools.Json.JsonTools.ToJson(msg));
            LookAtMe.PushMsgToOther(msg, receivers.ToArray(), false, true);
            Debug.Log("用户尝试登陆信息回复:--- out --- ");
        }
Beispiel #3
0
        /// <summary>
        /// 收到玩家信息进行处理
        /// </summary>
        /// <param name="message"></param>
        private void _UserMessageHandle(string message)
        {
            JsonData jsonData = JsonTools.GetJsonData(message);
            //取得消息的头部,
            Message_Type type = (Message_Type)(int)jsonData["type"];

            Debug.LogError("消息类型" + type);
            switch (type)
            {
            case Message_Type.TryLogin:

                string         UserId        = jsonData["userId"].ToString();
                LoginInfo      tempLoginInfo = PlayerModule.Instance.GetTryLogininfo(UserId);
                MsgTryLoginRes resMsg        = new MsgTryLoginRes();
                if (tempLoginInfo == null)
                {
                    resMsg.SetMessage(-1, 0, 0);
                }
                else
                {
                    resMsg.SetMessage(-1, 0, 0);
                }
                if (TryLoginIn != null)
                {
                    TryLoginIn(jsonData);
                }
                break;

            case Message_Type.Login:
                if (LoginIn != null)
                {
                    LoginIn(jsonData);
                }
                break;

            default:
                break;
            }
        }