Beispiel #1
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
        }