private void Awake() { // TODO C# UIMainmapWindow 接口不可用,需要改成新的控制方式 //UIMainmapWindow uiMainMap = UIManager.Instance.GetWindowImm<UIMainmapWindow>(); //Transform anchorTarget = uiMainMap.FindChild("MinimapBgSprite").transform; // UIWidget widget = goUnfold.GetComponent<UIWidget>(); // widget.leftAnchor.target = anchorTarget; // widget.rightAnchor.target = anchorTarget; // widget.bottomAnchor.target = anchorTarget; // widget.topAnchor.target = anchorTarget; // widget.ResetAndUpdateAnchors(); instance = this; OnUnFold(); OnAmountChanged(null); goSwitchBoard.SetActive(false); string[] splits = GameConstHelper.GetString("GAME_MWAR_WILD_HUMAN_COLOUR").Split(',', '[', ']'); int index = 0; foreach (var item in splits) { float f = 0; if (index < mPercent.Length && float.TryParse(item, out f)) { mPercent[index] = f; ++index; } } }
//-------------------------------------------------------- // 虚函数 //-------------------------------------------------------- protected override void InitUI() { base.InitUI(); mSelectedServerInfo = null; mMaintainingServerTimers = new List <Utils.DecimalTimer>(); mMaintainingServerTimers.Clear(); // 登录界面 m_MaskObject = FindChild("mask"); //mLoginPanel = FindChild<Transform>("LoginPanel").gameObject; mLoadingIcon = FindChild <Transform>("LoadingIcon").gameObject; mLoadingIcon.SetActive(false); mSelectedServerStateImage = FindChild <Image>("ServerStateImage"); mSelectedServerNameText = FindChild <Text>("ServerNameText"); mLoginButton = FindChild <Button>("LoginButton"); mLoginButton.onClick.AddListener(OnClickLoginButton); mGotoServerListButton = FindChild <Button>("ChooseServerButton"); mGotoServerListButton.onClick.AddListener(OnClickGotoServerListButton); mBtnAnnouncement = FindChild <Transform>("AnnouncementButton").gameObject.GetComponent <Button>(); mBtnAnnouncement.onClick.AddListener(onShowLoginNotice); mUserButton = FindChild <Transform>("UserButton").gameObject.GetComponent <Button>(); bool isShowUserCenterButton = true; string isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER"); if (isShowUserCenterButtonStr == "" || isShowUserCenterButtonStr == "0") { isShowUserCenterButton = false; } mUserButton.gameObject.SetActive(isShowUserCenterButton); mUserButton.onClick.AddListener(OnClickUserButton); mLogo = FindChild <Image>("Logo"); mCustomLogoRawImage = FindChild <RawImage>("CustomLogoRawImage"); //IOS #if UNITY_IPHONE mLogo.gameObject.SetActive(true); mCustomLogoRawImage.gameObject.SetActive(false); LoadMaJiaImage majiaImage = mLogo.gameObject.AddComponent <LoadMaJiaImage>(); var logoName = "logo.png"; majiaImage.mPath = ResNameMapping.Instance.GetMappingName(logoName); GameObject go = FindChild("Bg"); LoadMaJiaImage majiaBg = go.AddComponent <LoadMaJiaImage>(); var picName = "QuickLogin.jpg"; majiaBg.mPath = ResNameMapping.Instance.GetMappingName(picName); #endif mKVPanel = FindChild("KVPanel"); if (mKVPanel != null) { //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) // mKVPanel.SetActive(false); #if UNITY_IPHONE mKVPanel.SetActive(SDKHelper.GetAuditInfo("is_show_login_kv")); #endif } mVersionInfoText = FindChild <Text>("VersionInfoText"); mBgParent = FindChild("BgParent"); SetSelectedServerInfo(null); if (Const.Region != RegionType.CHINA) { // 隐藏健康提示 var login_panel_trans = FindChild <Transform>("LoginPanel"); if (login_panel_trans != null) { var health_text = login_panel_trans.Find("Text"); if (health_text != null) { health_text.gameObject.SetActive(false); } } } #if UNITY_ANDROID 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); } else { //GameDebug.LogError("Error, Can not load loading bg image: " + imageFileName); effect.SetActive(true); } #endif ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SELECT_SERVER, OnSelectServerChange); }
//-------------------------------------------------------- // 虚函数 //-------------------------------------------------------- protected override void InitUI() { mIsDestroy = false; base.InitUI(); m_LoadingIcon = FindChild <Transform>("LoadingIcon").gameObject; m_LoadingIcon.SetActive(false); //m_SDKAccountButton = FindChild("SDKAccountButton").GetComponent<Button>(); m_ChooseServerButton = FindChild("ChooseServerButton").GetComponent <Button>(); m_LoginButton = FindChild("LoginButton").GetComponent <Button>(); m_ServerStateImage = FindChild <Image>("ServerStateImage"); m_ServerNameText = FindChild <Text>("ServerNameText"); //m_SDKAccountButton.onClick.AddListener( OnClickSDKAccountButton); m_ChooseServerButton.onClick.AddListener(OnClickChooseServerButton); m_LoginButton.onClick.AddListener(OnClickLoginButton); mBtnAnnouncement = FindChild <Transform>("AnnouncementButton").gameObject.GetComponent <Button>(); mBtnAnnouncement.onClick.AddListener(onShowLoginNotice); mUserButton = FindChild <Transform>("UserButton").gameObject.GetComponent <Button>(); bool isShowUserCenterButton = true; string isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER"); if (Const.Region != RegionType.CHINA) { isShowUserCenterButtonStr = GameConstHelper.GetString("GAME_SYS_SHOW_SDK_USER_CENTER_OVERSEA"); } if (isShowUserCenterButtonStr == "" || isShowUserCenterButtonStr == "0") { isShowUserCenterButton = false; } mUserButton.gameObject.SetActive(isShowUserCenterButton); mUserButton.onClick.AddListener(OnClickUserButton); mLogo = FindChild <Image>("Logo"); #if UNITY_ANDROID var app_id = DBOSManager.getOSBridge().getAppID(); var item = DBAndroidMajia.Instance.GetData((uint)app_id); if (item != null) { mLogo.gameObject.SetActive(item.ShowLogo); mUserButton.gameObject.SetActive(item.ShowUserCenter); } #endif mCustomLogoRawImage = FindChild <RawImage>("CustomLogoRawImage"); GameObject ageIdentification = FindChild("AgeIdentification"); if (ageIdentification != null) { // 只有韩国版 onestore 渠道需要显示年龄分级图标 var ret = Const.Region == RegionType.KOREA && Application.identifier == GameConst.APK_NAME_KOREA_ONESTORE; ageIdentification.gameObject.SetActive(ret); } //IOS #if UNITY_IPHONE mLogo.gameObject.SetActive(true); mCustomLogoRawImage.gameObject.SetActive(false); LoadMaJiaImage majiaImage = mLogo.gameObject.AddComponent <LoadMaJiaImage>(); var logoName = "logo.png"; majiaImage.mPath = ResNameMapping.Instance.GetMappingName(logoName); //majiaImage.SetCallBack(LoadImgSuccess); GameObject go = FindChild("Bg"); LoadMaJiaImage majiaBg = go.AddComponent <LoadMaJiaImage>(); var picName = "QuickLogin.jpg"; majiaBg.mPath = ResNameMapping.Instance.GetMappingName(picName); #endif mKVPanel = FindChild("KVPanel"); if (mKVPanel != null) { //if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel()) // mKVPanel.SetActive(false); #if UNITY_IPHONE mKVPanel.SetActive(SDKHelper.GetAuditInfo("is_show_login_kv")); #endif #if UNITY_ANDROID item = DBAndroidMajia.Instance.GetData((uint)app_id); if (item != null) { mKVPanel.gameObject.SetActive(item.ShowKv); } #endif } mVersionInfoText = FindChild <Text>("VersionInfoText"); mBgParent = FindChild("BgParent"); if (Const.Region != RegionType.CHINA) { // 隐藏健康提示 var login_panel_trans = FindChild <Transform>("LoginPanel"); if (login_panel_trans != null) { var health_text = login_panel_trans.Find("Text"); if (health_text != null) { health_text.gameObject.SetActive(false); } } } // 注册网络消息 // 注册客户端消息 ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SDK_INITED, OnInitCallback); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SELECT_SERVER, OnSelectServerChange); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_START_GET_SERVER_INFOS, OnStartGetServerInfos); }