public void Set3rdLogin()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("LoginScript_hotfix", "Set3rdLogin"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.LoginScript_hotfix", "Set3rdLogin", null, null);
            return;
        }

        bool   is3RdLogin     = ChannelHelper.Is3RdLogin();
        string channelAllName = ChannelHelper.GetChannelAllName();

        LogUtil.Log("渠道号:" + OtherData.s_channelName + ",渠道名:" + channelAllName);

        bool isThirdLogin = PlatformHelper.IsThirdLogin();

        //应用宝渠道
        if ("yyb".Equals(OtherData.s_channelName))
        {
            GameUtil.hideGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
            m_button_guanfang.gameObject.SetActive(false);
            GameUtil.showGameObject(m_button_qq.gameObject);
            GameUtil.showGameObject(m_button_wechat.gameObject);

            Vector3 qqV3 = m_button_qq.gameObject.transform.localPosition;
            m_button_qq.gameObject.transform.localPosition = new Vector3(-168, qqV3.y, qqV3.z);

            Vector3 wxV3 = m_button_wechat.gameObject.transform.localPosition;
            m_button_wechat.gameObject.transform.localPosition = new Vector3(132, wxV3.y, wxV3.z);
            return;
        }

        if (is3RdLogin && isThirdLogin)
        {
            m_button_3rdLogin.gameObject.SetActive(true);
            GameUtil.showGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
            GameUtil.hideGameObject(m_button_guanfang.gameObject);
            GameUtil.hideGameObject(m_button_qq.gameObject);
            GameUtil.hideGameObject(m_button_wechat.gameObject);

            var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent <Text>();
            childText.text = channelAllName + "账号登录";

            m_button_3rdLogin.onClick.AddListener(() =>
            {
                AudioScript.getAudioScript().playSound_ButtonClick();
                PlatformHelper.Login("AndroidCallBack", "GetLoginResult", OtherData.s_channelName);
                NetLoading.getInstance().Show();
            });
        }
        else
        {
            GameUtil.showGameObject(m_button_guanfang.gameObject);
            GameUtil.showGameObject(m_button_qq.gameObject);
            GameUtil.showGameObject(m_button_wechat.gameObject);
            GameUtil.hideGameObject(m_button_3rdLogin.gameObject);
            GameUtil.hideGameObject(m_button_defaultLogin.gameObject);
        }

        //bool is3RdLogin = ChannelHelper.Is3RdLogin();
        //string channelAllName = ChannelHelper.GetChannelAllName();
        //LogUtil.Log("渠道号:" + OtherData.s_channelName + ",渠道名:"+ channelAllName);

        //bool isThirdLogin = PlatformHelper.IsThirdLogin();

        //if (is3RdLogin)
        //{
        //    if (isThirdLogin)
        //    {
        //        m_button_3rdLogin.gameObject.SetActive(true);
        //        m_button_defaultLogin.gameObject.SetActive(false);
        //        m_button_guanfang.gameObject.SetActive(false);
        //        m_button_qq.gameObject.SetActive(false);
        //        m_button_wechat.gameObject.SetActive(false);
        //        var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent<Text>();
        //        childText.text = channelAllName + "账号登录";
        //    }
        //}
        //else
        //{
        //    m_button_3rdLogin.gameObject.SetActive(false);
        //    m_button_defaultLogin.gameObject.SetActive(true);
        //    m_button_guanfang.gameObject.SetActive(true);
        //    m_button_qq.gameObject.SetActive(true);
        //    m_button_wechat.gameObject.SetActive(true);
        //    var childText = m_button_3rdLogin.transform.GetChild(0).GetComponent<Text>();
        //    childText.text = channelAllName + "账号登录";
        //}

        //m_button_3rdLogin.onClick.AddListener(() =>
        //{
        //    AudioScript.getAudioScript().playSound_ButtonClick();
        //    PlatformHelper.Login("AndroidCallBack", "GetLoginResult", OtherData.s_channelName);
        //    NetLoading.getInstance().Show();
        //});
    }
Beispiel #2
0
        public void initData()
        {
            ReferenceCollector rc = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>();

            panel_start      = rc.Get <GameObject>("Start");
            panel_phoneLogin = rc.Get <GameObject>("PhoneLogin");

            btn_phone       = rc.Get <GameObject>("Button_phone").GetComponent <Button>();
            btn_wechat      = rc.Get <GameObject>("Button_wechat").GetComponent <Button>();
            btn_guest       = rc.Get <GameObject>("Button_guest").GetComponent <Button>();
            btn_login       = rc.Get <GameObject>("Button_Login").GetComponent <Button>();
            btn_third       = rc.Get <GameObject>("Button_Third").GetComponent <Button>();
            btn_yanzhengma  = rc.Get <GameObject>("Button_YanZhengMa").GetComponent <Button>();
            btn_backToStart = rc.Get <GameObject>("Button_back").GetComponent <Button>();

            inputField_Phone      = rc.Get <GameObject>("InputField_Phone").GetComponent <InputField>();
            inputField_YanZhengMa = rc.Get <GameObject>("InputField_YanZhengMa").GetComponent <InputField>();

            text_yanzhengmadaojishi = rc.Get <GameObject>("Text_yanzhengmadaojishi").GetComponent <Text>();

            btn_phone.onClick.Add(onClickOpenPhoneLogin);
            btn_wechat.onClick.Add(onClickWechatLogin);
            btn_third.onClick.Add(onClickWechatLogin);
            btn_guest.onClick.Add(onClickGuestLogin);
            btn_login.onClick.Add(onClickPhoneCodeLogin);
            btn_yanzhengma.onClick.Add(onClickGetPhoneCode);
            btn_backToStart.onClick.Add(onClickBackStart);

            // 四个UI层级画布
            {
                OtherData.s_loginCanvas  = panel_start.transform.parent.parent.parent.Find("LoginCanvas").gameObject;
                OtherData.s_mainCanvas   = panel_start.transform.parent.parent.parent.Find("MainCanvas").gameObject;
                OtherData.s_roomCanvas   = panel_start.transform.parent.parent.parent.Find("RoomCanvas").gameObject;
                OtherData.s_commonCanvas = panel_start.transform.parent.parent.parent.Find("CommonCanvas").gameObject;
            }

            #region 登录按钮设置
            {
                // 测试服开启游客登录按钮
                if (!NetConfig.getInstance().isFormal)
                {
                    btn_guest.transform.localScale = new Vector3(1, 1, 1);
                }

                if (ChannelHelper.IsThirdChannel() && PlatformHelper.IsThirdLogin())
                {
                    btn_third.transform.localScale = new Vector3(1, 1, 1);
                    btn_third.GetComponentInChildren <Text>().text = ChannelHelper.GetChannelAllName() + "登录";
                }
                else
                {
                    btn_phone.transform.localScale  = new Vector3(1, 1, 1);
                    btn_wechat.transform.localScale = new Vector3(1, 1, 1);

                    if (OtherData.getIsShiedPhoneLogin())
                    {
                        btn_phone.transform.localScale = Vector3.zero;
                    }
                    else if (OtherData.getIsShiedWeChatLogin())
                    {
                        btn_wechat.transform.localScale = Vector3.zero;
                    }
                }
            }
            #endregion

            #region 压力测试
            // pressTestButton = rc.Get<GameObject>("PressTestButton").GetComponent<Button>();
            // pressTestButton.onClick.Add(this.OnClickPressTest);
            // if (!NetConfig.getInstance().isFormal)
            // {
            //     pressTestButton.gameObject.SetActive(true);
            // }
            // else
            // {
            //     pressTestButton.gameObject.SetActive(false);
            // }
            #endregion
        }
        public static void setLogonTypeUI()
        {
            LoginScript script = OtherData.s_loginScript;

            // 更新的部分
            if (ShieldThirdLogin.isShield(OtherData.s_channelName))
            {
                GameUtil.showGameObject(script.m_button_guanfang.gameObject);
                script.m_button_guanfang.transform.localPosition = new Vector3(0, -194.1f, 0);

                GameUtil.hideGameObject(script.m_button_qq.gameObject);
                GameUtil.hideGameObject(script.m_button_wechat.gameObject);
                GameUtil.hideGameObject(script.m_button_defaultLogin.gameObject);
                GameUtil.hideGameObject(script.m_button_3rdLogin.gameObject);

                return;
            }

            bool   is3RdLogin     = ChannelHelper.Is3RdLogin();
            string channelAllName = ChannelHelper.GetChannelAllName();

            LogUtil.Log("渠道号:" + OtherData.s_channelName + ",渠道名:" + channelAllName);

            bool isThirdLogin = PlatformHelper.IsThirdLogin();

            if (is3RdLogin && isThirdLogin)
            {
                return;
            }
            else
            {
                {
                    int defaultLoginType = PlayerPrefs.GetInt("DefaultLoginType", (int)OtherData.s_defaultLoginType);

                    switch (defaultLoginType)
                    {
                    case (int)OtherData.DefaultLoginType.DefaultLoginType_Default:
                    {
                        GameUtil.showGameObject(script.m_button_guanfang.gameObject);
                        GameUtil.showGameObject(script.m_button_qq.gameObject);
                        GameUtil.showGameObject(script.m_button_wechat.gameObject);

                        GameUtil.hideGameObject(script.m_button_defaultLogin.gameObject);
                        GameUtil.hideGameObject(script.m_button_3rdLogin.gameObject);
                    }
                    break;

                    case (int)OtherData.DefaultLoginType.DefaultLoginType_GuanFang:
                    {
                        GameUtil.hideGameObject(script.m_button_guanfang.gameObject);
                        GameUtil.hideGameObject(script.m_button_qq.gameObject);
                        GameUtil.hideGameObject(script.m_button_wechat.gameObject);
                        GameUtil.hideGameObject(script.m_button_3rdLogin.gameObject);

                        GameUtil.showGameObject(script.m_button_defaultLogin.gameObject);

                        script.m_button_defaultLogin.transform.Find("Text_LoginType").GetComponent <Text>().text = "账号登录";
                    }
                    break;

                    case (int)OtherData.DefaultLoginType.DefaultLoginType_QQ:
                    {
                        GameUtil.hideGameObject(script.m_button_guanfang.gameObject);
                        GameUtil.hideGameObject(script.m_button_qq.gameObject);
                        GameUtil.hideGameObject(script.m_button_wechat.gameObject);
                        GameUtil.hideGameObject(script.m_button_3rdLogin.gameObject);

                        GameUtil.showGameObject(script.m_button_defaultLogin.gameObject);

                        script.m_button_defaultLogin.transform.Find("Text_LoginType").GetComponent <Text>().text = "QQ登录";
                    }
                    break;

                    case (int)OtherData.DefaultLoginType.DefaultLoginType_WeChat:
                    {
                        GameUtil.hideGameObject(script.m_button_guanfang.gameObject);
                        GameUtil.hideGameObject(script.m_button_qq.gameObject);
                        GameUtil.hideGameObject(script.m_button_wechat.gameObject);

                        GameUtil.hideGameObject(script.m_button_3rdLogin.gameObject);

                        GameUtil.showGameObject(script.m_button_defaultLogin.gameObject);
                        script.m_button_defaultLogin.transform.Find("Text_LoginType").GetComponent <Text>().text = "微信登录";
                    }
                    break;
                    }
                }
            }
        }