示例#1
0
        //-------------------------------------------------------------------------
        public override void init()
        {
            Debug.Log("ClientLogin.init()");

            Entity et_app = EntityMgr.findFirstEntityByType <EtApp>();

            CoApp = et_app.getComponent <ClientApp <DefApp> >();

            EntityMgr.getDefaultEventPublisher().addHandler(Entity);

            MbMain.Instance.setupMain();
            CoApp.CoDataEye.setupDataEye();

            // 显示登录界面
            UiMgr.Instance.destroyFirstUi <UiLoading>();
            UiLogin ui_login = UiMgr.Instance.createUi <UiLogin>("Login", "Login");

            //string version_info = string.Format("应用版本:{0} 数据版本:{1}", CoApp.BundleVersion, CoApp.DataVersion);
            //mb_login.setVersion(version_info);

            if (PlayerPrefs.HasKey(ClientLogin <DefLogin> .mGuestPlayerKey))
            {
                mGuestPlayerInfo = EbTool.jsonDeserialize <_tGuestPlayerInfo>(PlayerPrefs.GetString(ClientLogin <DefLogin> .mGuestPlayerKey));
            }
        }
示例#2
0
        //-------------------------------------------------------------------------
        void _uCenterGuestCallBack(UCenterResponseStatus status, AccountGuestLoginResponse response, UCenterError error)
        {
            if (status == UCenterResponseStatus.Success)
            {
                if (mGuestPlayerInfo == null)
                {
                    mGuestPlayerInfo = new _tGuestPlayerInfo();
                }

                mGuestPlayerInfo.account_id   = response.AccountId;
                mGuestPlayerInfo.account_name = response.AccountName;
                mGuestPlayerInfo.pwd          = response.Password;
                PlayerPrefs.SetString(mGuestPlayerKey, EbTool.jsonSerialize(mGuestPlayerInfo));

                _requestLogin(mGuestPlayerInfo.account_name, mGuestPlayerInfo.pwd);
            }
            else if (error != null)
            {
                //if (error.ErrorCode == GF.UCenter.Common.Portable.UCenterErrorCode.AccountRegisterFailedAlreadyExist)
                //{
                //    FloatMsgInfo f_info;
                //    f_info.msg = "帐号已存在";
                //    f_info.color = Color.red;
                //    UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                //}
                //UiHelper.DestroyWaiting();
                Debug.LogError(string.Format("_uCenterGuestCallBack::Error::ErrorCode::{0} ErrorMsg::{1}", error.ErrorCode.ToString(), error.Message));
            }
            else
            {
                //FloatMsgInfo f_info;
                //f_info.msg = "注册失败";
                //f_info.color = Color.red;
                //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                //UiHelper.DestroyWaiting();
            }
        }
示例#3
0
        //-------------------------------------------------------------------------
        void _onUCenterLogin(UCenterResponseStatus status, AccountLoginResponse response, UCenterError error)
        {
            EbLog.Note("ClientLogin._onUCenterLogin() Status=" + status);
            if (error != null)
            {
                EbLog.Note("ErrorCode=" + error.ErrorCode + " ErrorMsg=" + error.Message);
            }

            if (status == UCenterResponseStatus.Success)
            {
                CoApp.CoNetMonitor.AccId = response.AccountId;
                CoApp.CoNetMonitor.Acc   = response.AccountName;
                CoApp.CoNetMonitor.Token = response.Token;

                //FloatMsgInfo f_info;
                //f_info.msg = "登陆成功";
                //f_info.color = Color.green;
                //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);

                // DataEye登陆
                //CoApp.CoDataEye.login(Acc, AccId);

                ClientConfig cc = MbMain.Instance.ClientConfig;
                CoApp.CoNetMonitor.connectBase(cc.BaseIp, cc.BasePort);
            }
            else if (error != null)
            {
                if (error.ErrorCode == UCenterErrorCode.AccountNotExist)
                {
                    //FloatMsgInfo f_info;
                    //f_info.msg = "帐号不存在";
                    //f_info.color = Color.red;
                    //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);

                    if (mGuestPlayerInfo != null)
                    {
                        //if(mGuestPlayerInfo.account_id==)
                        mGuestPlayerInfo = null;
                        PlayerPrefs.DeleteKey(mGuestPlayerKey);
                    }
                }
                else if (error.ErrorCode == UCenterErrorCode.AccountLoginFailedPasswordNotMatch)
                {
                    //FloatMsgInfo f_info;
                    //f_info.msg = "帐号或密码错误";
                    //f_info.color = Color.red;
                    //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                }
                else if (error.ErrorCode == UCenterErrorCode.Failed)
                {
                    //FloatMsgInfo f_info;
                    //f_info.msg = "登陆失败";
                    //f_info.color = Color.red;
                    //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                }
                else
                {
                    //FloatMsgInfo f_info;
                    //f_info.msg = "其他登陆错误";
                    //f_info.color = Color.red;
                    //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);
                }
            }
            //UiHelper.DestroyWaiting();
        }
示例#4
0
 //-------------------------------------------------------------------------
 void _clearGuest()
 {
     mGuestPlayerInfo = null;
     PlayerPrefs.DeleteKey(mGuestPlayerKey);
 }