Exemplo n.º 1
0
 void OnQuitGame()
 {
             #if Spade
     SpadeIOSLogin spadeSDK = Native.mInstace.m_thridParty as SpadeIOSLogin;
     spadeSDK.tryLogout();
             #else
     Application.Quit();
             #endif
 }
    void KickOut()
    {
#if Spade
        SpadeIOSLogin spadeSDK = Native.mInstace.m_thridParty as SpadeIOSLogin;
        spadeSDK.tryLogout();
#else
        Core.SM.OnUnregister();
        Core.SM.beforeLoadLevel(Application.loadedLevelName, SceneName.LOGIN_SCENE);
        AsyncLoadScene.m_Instance.LoadScene(SceneName.LOGIN_SCENE);
#endif
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
#if QiHo360
                Native.mInstace.m_thridParty.Quit();
#elif Spade
                SpadeIOSLogin spadeSDK = Native.mInstace.m_thridParty as SpadeIOSLogin;
                spadeSDK.quitGame();
#else
#endif
            }
        }
    }
Exemplo n.º 4
0
    public void onButtonClick()
    {
        AccountData ad = Native.mInstace.m_thridParty.GetAccountData();

        #if Spade
        SpadeIOSLogin spadeSdk = Native.mInstace.m_thridParty as SpadeIOSLogin;
        bool          retry    = spadeSdk == null ? false : spadeSdk.OnCheckGameEnter();
        //如果没有登录,或者取消登录,打开第三方登录界面
        if (ad.loginStatus == ThirdLoginState.CancelLogin || ad.loginStatus == ThirdLoginState.Invalid || retry == false)
        {
            spadeSdk.getUniqueId(
                (t) => { SendGetThirdServerRQ(); }, false
                );
        #else
        //如果没有登录,或者取消登录,打开第三方登录界面
        if (ad.loginStatus == ThirdLoginState.CancelLogin || ad.loginStatus == ThirdLoginState.Invalid)
        {
            Native.mInstace.m_thridParty.getUniqueId(
                (t) => { SendGetThirdServerRQ(); }
                );
        #endif
        }
        else if (ad.loginStatus == ThirdLoginState.LoginFinish)
        {
            ///
            /// ---- 到目前为止,都是第三方登陆成功,自己的还没有初始化成功 -----
            ///

                        #if UNITY_ANDROID && !UNITY_EDITOR && !CHECKCONFIG
            if (step != LoginStep.Prepare_Config)
            {
                User_Click_LoginBtn = true;
                return;
            }
                        #endif

            if (ChosenServer != null)
            {
                if (ChosenServer.status == Server.STATUS_STOP)
                {
                    string word = Core.Data.stringManager.getString(21);
                    if (string.IsNullOrEmpty(word))
                    {
                        word = "Beta test is Over.\nThe public test is coming soon!";
                    }
                    SQYAlertViewMove.CreateAlertViewMove(word, gameObject);
                    return;
                }
                else if (ChosenServer.status == Server.STATUS_FULL)
                {
                    //TODO :停服提示 yancg

                    string status_full = Core.Data.stringManager.getString(32002);
                    if (string.IsNullOrEmpty(status_full))
                    {
                        status_full = "Beta test is Over.\nThe public test is coming soon!";
                    }
                    SQYAlertViewMove.CreateAlertViewMove(status_full, gameObject);
                    return;
                }
            }
            if (bGetServerListOk)
            {
                Login();
            }
            else
            {
                SendGetThirdServerRQ();
            }
        }
    }
Exemplo n.º 5
0
    void HttpResp_UI(BaseHttpRequest request, BaseResponse response)
    {
        ConsoleEx.DebugLog(" --- Http Resp - running in the main thread, UI purpose --" + response.GetType().ToString());
        if (response != null && response.status != BaseResponse.ERROR)
        {
            HttpRequest myRequest = (HttpRequest)request;
            switch (myRequest.Type)
            {
            case RequestType.GET_PARTITION_SERVER:
                //UI ...
                GetPartitionServerResponse ServerResp = response as GetPartitionServerResponse;
                showServerList(ServerResp);
                LoginIsReady();
                if (ServerResp != null && ServerResp.data != null)
                {
                    SpeakerMgr.autoShow(ServerResp.data.noticeTitle, ServerResp.data.noticeContent);
                }
                break;

            case RequestType.THIRD_GET_SERVER:
                GetPartitionServerResponse resp = response as GetPartitionServerResponse;
                showServerList(resp);
                AccountData ad = Native.mInstace.m_thridParty.GetAccountData();
                if (!string.IsNullOrEmpty(resp.data.platId))
                {
                    ad.uniqueId = resp.data.platId;
                }
                ad.token = resp.data.platToken;

                this.UniqueId = resp.data.token;
                LoginIsReady();
                if (resp != null && resp.data != null)
                {
                    SpeakerMgr.autoShow(resp.data.noticeTitle, resp.data.noticeContent);
                }
                break;

            case RequestType.UPDATE_RESOURCES: {
                //更新资源包
                ConfigResponse r = response as ConfigResponse;
                if (r != null && r.result)
                {
                    step = LoginStep.DownloadConfig_Start;
                    Content.SetActive(false);
                    configLoading.gameObject.SetActive(true);
                    test_DownloadResource(r);
                }
                else
                {
                    Debug.Log("the Config.zip is The latest! Don't need Download.");
                    step = LoginStep.Download_OK;
                    readLocalConfig();
                }
            }
            break;

            case RequestType.LOGIN_GAME:
                ComLoading.Close();

                status = status.set(LoginStatus.Login_Ready);
                JumpToGameView();
                                #if Spade
                SpadeIOSLogin spadeSdk = Native.mInstace.m_thridParty as SpadeIOSLogin;
                                #if !UNITY_EDITOR
                spadeSdk.NotityLogin(ChosenServer);
                                #endif
                                #endif
                #if UNITY_IOS && !DEBUG
                // 添加 IOS 本地 push
                IOSLocalPush.getInstance().notifyLoggedin();
                                #endif
                MessageMgr.GetInstance().SendWorldChatLogin();

                ///
                /// --------------- 登陆完成之后,设定日期改变,设定获得活动运营信息 -------
                ///
                if (Core.Data != null && Core.Data.playerManager != null && Core.Data.playerManager.RTData != null)
                {
                    Core.SM.recordDayChanged(Core.Data.playerManager.RTData.systemTime);
                }

                if (Core.Data != null && Core.Data.HolidayActivityManager != null)
                {
                    Core.Data.HolidayActivityManager.setHourChanged();
                }

                Core.Data.rechargeDataMgr.SendHttpRequest();
                break;
            }
        }
        else
        {
            ComLoading.Close();

            //登陆超时了
            if (response.errorCode == 2000)
            {
                if (Core.Data != null && Core.Data.stringManager != null)
                {
                    SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(48), gameObject);
                }

                ///
                ///  ---- 回滚用户中心
                ///
                HttpClient.RevertToUserCenter();
                SendGetThirdServerRQ();
            }
            else
            {
                GetPartitionServerResponse ServerResp = response as GetPartitionServerResponse;
                if (ServerResp != null && ServerResp.data != null)
                {
                    SpeakerMgr.autoShow(ServerResp.data.noticeTitle, ServerResp.data.noticeContent);
                }

                if (Core.Data != null && Core.Data.stringManager != null)
                {
                    string word = Core.Data.stringManager.getString(response.errorCode);
                    if (!string.IsNullOrEmpty(word))
                    {
                        SQYAlertViewMove.CreateAlertViewMove(word, gameObject);
                    }
                }
            }
        }
    }