Beispiel #1
0
        protected override void ResetUI()
        {
            base.ResetUI();

            // 显示版本信息
            UIManager.Instance.ShowWindow("UIVersionWindow");

            UpdateLoginNotice();
            SetSelectedServerInfo(null);

            GlobalConfig globalConfig = GlobalConfig.GetInstance();

            // 根据sdkname来选择配置信息
            SDKConfig sdkConfig = SDKHelper.GetSDKConfig();

            if (sdkConfig != null)
            {
                // logo
                Sprite sprite = LoadSprite(sdkConfig.LogoName);
                if (sprite != null)
                {
                    mLogo.sprite = sprite;
                }

#if UNITY_IPHONE
                //mCustoLogoTexture = Resources.Load("logo") as Texture;
                ////从resource里面读出,如果存在,则优先显示
                //if (mCustoLogoTexture != null)
                //{
                //    if (mCustomLogoRawImage != null)
                //    {
                //        mCustomLogoRawImage.texture = mCustoLogoTexture;
                //        mCustomLogoRawImage.gameObject.SetActive(true);
                //        mCustomLogoRawImage.SetNativeSize();
                //    }
                //    if (mLogo != null)
                //    {
                //        mLogo.gameObject.SetActive(false);
                //    }
                //}
                //else
                //{
                //    if (mLogo != null)
                //        mLogo.gameObject.SetActive(true);
                //    if (mCustomLogoRawImage != null)
                //        mCustomLogoRawImage.gameObject.SetActive(false);
                //}
#endif
                // 版号信息
                if (Const.Region == RegionType.CHINA)
                {
                    mVersionInfoText.text = sdkConfig.VersionInfo;
                }
                else
                {
                    mVersionInfoText.text = "";
                }
                if (mVersionInfoText != null)
                {
                    mVersionInfoText.gameObject.SetActive(AuditManager.Instance.AuditAndIOS() == false);
                }
            }

#if UNITY_ANDROID
            // 安卓平台从assets文件夹查找是否存在"login_logo.png"图片,存在则优先显示
            string logoFileName  = "login_logo.png";
            byte[] logoImageData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(logoFileName);
            if (logoImageData != null)
            {
                TextureFormat textureFormat = TextureFormat.RGBA4444;

                Texture2D newTexture2D = new Texture2D((int)mLogo.preferredWidth, (int)mLogo.preferredHeight, textureFormat, false);
                newTexture2D.LoadImage(logoImageData);
                mCustomLogoRawImage.texture = newTexture2D;
                mCustomLogoRawImage.gameObject.SetActive(true);
                mCustomLogoRawImage.SetNativeSize();

                mLogo.gameObject.SetActive(false);
            }
            else
            {
                GameDebug.LogError("Error, Can not load logo image: " + logoFileName);
            }

            // 安卓平台从assets文件夹查找是否存在"version_info"文件,存在则优先显示为版号信息
            string versionInfoFileName = "version_info";
            byte[] versionInfoFileData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(versionInfoFileName);
            if (versionInfoFileData != null)
            {
                mVersionInfoText.text = System.Text.Encoding.UTF8.GetString(versionInfoFileData);
            }
#endif

            mLogo.SetNativeSize();
        }
            void OnClickCreateNewRoleButton()
            {
                string char_name = mNameInputField.text;

                // 判断是否输入了角色名
                if (char_name.Length <= 0)
                {
                    ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL1")); //请输入角色名
                    return;
                }

                // 韩国版的角色名字和聊天敏感字库读取不同的表,其他
                if (Const.Region == RegionType.KOREA)
                {
                    // 判断角色名字是否合法
                    if (SensitiveWordsFilterPlayerName.Instance.IsInputUserNameLegal(char_name) == false)
                    {
                        ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL2")); //角色名请使用汉字,英文或者数字
                        return;
                    }

                    // 判断角色名中的敏感字符
                    if (SensitiveWordsFilterPlayerName.GetInstance().IsHaveSensitiveWords(char_name))
                    {
                        ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL3"));//角色名中包含敏感字符
                        return;
                    }
                }
                else
                {
                    // 判断角色名字是否合法
                    if (SensitiveWordsFilter.Instance.IsInputUserNameLegal(char_name, Const.Region) == false)
                    {
                        ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL2")); //角色名请使用汉字,英文或者数字
                        return;
                    }

                    // 判断角色名中的敏感字符
                    if (SensitiveWordsFilter.GetInstance().IsHaveSensitiveWords(char_name))
                    {
                        ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("CREATE_ROLE_FAIL3"));//角色名中包含敏感字符
                        return;
                    }
                }

                // 判断角色名字是否超长
                var   utf8_parse    = new Utf8Parse(char_name);
                float role_name_len = utf8_parse.GetWordLenByRule();

                if (role_name_len > (float)GameConstHelper.GetFloat("GAME_NAME_MAX_COUNT"))
                {
                    UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("NAME_COUNT_EXCEED"));
                    GameDebug.Log("role_name_len:" + role_name_len);
                    return;
                }

                if (GlobalConfig.GetInstance().LoginInfo == null || GlobalConfig.GetInstance().LoginInfo.ServerInfo == null)
                {
                    return;
                }

                mVocationId = 4;

                // 发送创建角色的协议
                var create_role = new C2SCreateRole();

                create_role.name      = System.Text.Encoding.UTF8.GetBytes(char_name);;
                create_role.rid       = mVocationId; // actor type, 从1开始
                create_role.server_id = (uint)GlobalConfig.GetInstance().LoginInfo.ServerInfo.SId;
                if (string.IsNullOrEmpty(GlobalConfig.GetInstance().LoginInfo.ProviderPassport))
                {
                    create_role.chn_passport = System.Text.Encoding.UTF8.GetBytes("provider_passport");
                }
                else
                {
                    create_role.chn_passport = System.Text.Encoding.UTF8.GetBytes(GlobalConfig.GetInstance().LoginInfo.ProviderPassport);
                }


                if (AuditManager.Instance.AuditAndIOS())
                {
                    SDKConfig sdkConfig = SDKHelper.GetSDKConfig();
                    if (sdkConfig != null)
                    {
                        create_role.majia_id   = sdkConfig.copy_bag_id;
                        create_role.majia_pack = sdkConfig.copy_bag_id;
                    }
                }
                else
                {
                    SDKConfig sdkConfig = SDKHelper.GetSDKConfig();
                    if (sdkConfig != null)
                    {
                        create_role.majia_id   = 0;
                        create_role.majia_pack = sdkConfig.copy_bag_id;
                    }
                }
                ControlServerLogHelper.CreatePkgAccPhoneInfos(create_role.phone_info);

                NetClient.GetBaseClient().SendData <C2SCreateRole>(NetMsg.MSG_CREATE_ROLE, create_role);

                // 保存创建角色的名字
                GlobalConfig.GetInstance().LoginInfo.Name = char_name;

                // 记录上一次选中的职业
                GlobalSettings.GetInstance().LastActorIndex = Game.GetInstance().CharacterList.Count;
                GlobalSettings.GetInstance().Save();

                Game.Instance.IsCreateRoleEnter = true;


                UIManager.Instance.ShowWaitScreen(true);

                // 点击创角按钮
                ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.ClickCreateActorButton);
                ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.create_role);

                // 点击选角按钮
                ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.ClickSelectActorButton);
                ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.select_role);
            }
            protected override void ResetUI()
            {
                base.ResetUI();

                var parmas = ShowParam;

                if (parmas != null && parmas.Length > 0)
                {
                    var get_last_server = Convert.ToBoolean(parmas[0]);
                    if (get_last_server)
                    {
                        StartGetServerInfos();
                    }
                }

                // 显示版本信息
                UIManager.Instance.ShowWindow("UIVersionWindow");

                GlobalConfig globalConfig = GlobalConfig.GetInstance();

                if (Game.Instance.ManualCancelReconnect)
                {
                    StartGetServerInfos();
                }
                else
                {
                    if (string.IsNullOrEmpty(globalConfig.LoginInfo.AccName) == true)
                    {
                        if (globalConfig.IsEnterSDK)
                        {
                            // 初始化sdk
                            if (AuditManager.Instance.AuditAndIOS() == false)
                            {
                                mInDelayTime = true;
                                DestroyInitSDKTimer();
                                mInitSDKTimer = new Utils.Timer(2000, false, 1000, OnDelayInitSDK);
                            }
                            else
                            {
                                OnDelayInitSDK(0);
                            }
                        }
                        else
                        {
                            mInDelayTime = false;
                            GameDebug.LogError("UIQucikWindow must be in sdk");
                        }
                    }
                }

                // 根据sdkname来选择配置信息
                SDKConfig sdkConfig = SDKHelper.GetSDKConfig();

                if (sdkConfig != null)
                {
                    // logo
                    Sprite sprite = LoadSprite(sdkConfig.LogoName);
                    if (sprite != null)
                    {
                        mLogo.sprite = sprite;
                    }
#if UNITY_IPHONE
                    //mCustoLogoTexture = Resources.Load("logo") as Texture;
                    ////从resource里面读出,如果存在,则优先显示
                    //if (mCustoLogoTexture != null)
                    //{
                    //    if (mCustomLogoRawImage != null)
                    //    {
                    //        mCustomLogoRawImage.texture = mCustoLogoTexture;
                    //        mCustomLogoRawImage.gameObject.SetActive(true);
                    //        mCustomLogoRawImage.SetNativeSize();
                    //    }
                    //    if (mLogo != null)
                    //    {
                    //        mLogo.gameObject.SetActive(false);
                    //    }
                    //}
                    //else
                    //{
                    //    if (mLogo != null)
                    //        mLogo.gameObject.SetActive(true);
                    //    if (mCustomLogoRawImage != null)
                    //        mCustomLogoRawImage.gameObject.SetActive(false);
                    //}
#endif
                    // 版号信息
                    if (Const.Region == RegionType.CHINA)
                    {
                        mVersionInfoText.text = sdkConfig.VersionInfo;

                        if (mVersionInfoText != null)
                        {
                            mVersionInfoText.gameObject.SetActive(AuditManager.Instance.AuditAndIOS() == false);
                        }
                    }
                    else
                    {
                        if (mVersionInfoText != null)
                        {
                            mVersionInfoText.gameObject.SetActive(false);
                        }
                    }

                    if (mBtnAnnouncement != null)
                    {
                        mBtnAnnouncement.gameObject.SetActive(AuditManager.Instance.AuditAndIOS() == false);
                    }
                }

#if UNITY_ANDROID
                // 安卓平台从assets文件夹查找是否存在"login_logo.png"图片,存在则优先显示
                string logoFileName  = "login_logo.png";
                byte[] logoImageData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(logoFileName);
                if (logoImageData != null)
                {
                    TextureFormat textureFormat = TextureFormat.RGBA4444;

                    Texture2D newTexture2D = new Texture2D((int)mLogo.preferredWidth, (int)mLogo.preferredHeight, textureFormat, false);
                    newTexture2D.LoadImage(logoImageData);
                    mCustomLogoRawImage.texture = newTexture2D;
                    mCustomLogoRawImage.gameObject.SetActive(true);
                    mCustomLogoRawImage.SetNativeSize();

                    mLogo.gameObject.SetActive(false);
                }
                else
                {
                    GameDebug.LogError("Error, Can not load logo image: " + logoFileName);
                }

                // 安卓平台从assets文件夹查找是否存在"version_info"文件,存在则优先显示为版号信息
                string versionInfoFileName = "version_info";
                byte[] versionInfoFileData = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(versionInfoFileName);
                if (versionInfoFileData != null)
                {
                    mVersionInfoText.text = System.Text.Encoding.UTF8.GetString(versionInfoFileData);
                }

                RawImage   bgImage = FindChild <RawImage>("Bg");
                GameObject effect  = FindChild("Effect");
                // 安卓平台从assets文件夹查找是否存在"login_bg.jpg"图片,存在则优先显示
                string imageFileName = "login_bg.jpg";
                byte[] imageData     = DBOSManager.getDBOSManager().getBridge().loadExternalFileData(imageFileName);
                if (imageData != null)
                {
                    TextureFormat textureFormat = TextureFormat.DXT1;
                    int           width         = Screen.currentResolution.width;
                    int           height        = Screen.currentResolution.height;

                    Texture2D newTexture2D = new Texture2D(width, height, textureFormat, false);
                    newTexture2D.LoadImage(imageData);
                    bgImage.texture = newTexture2D;

                    effect.SetActive(false);

                    var app_id = DBOSManager.getOSBridge().getAppID();
                    var item   = DBAndroidMajia.Instance.GetData((uint)app_id);
                    if (item != null)
                    {
                        effect.gameObject.SetActive(item.ShowEffect);
                    }
                }
                else
                {
                    //GameDebug.LogError("Error, Can not load loading bg image: " + imageFileName);
                    effect.SetActive(true);
                }
#endif

                mLogo.SetNativeSize();

                if (Const.Region == RegionType.KOREA)
                {
                    BuriedPointHelper.ReportAppsflyerEvnet("af_server");
                }
            }