public void Initialize() { if (frontGround == null) { frontGround = GameObject.Find("FrontGround").GetComponent <Image>(); } if (IntroUI == null) { IntroUI = GameObject.FindObjectOfType <UIIntro>(); } if (LoadingUI == null) { LoadingUI = GameObject.FindObjectOfType <UILoading>(); } if (TimerUI == null) { TimerUI = GameObject.FindObjectOfType <UITimer>(); } if (ScoreUI == null) { ScoreUI = GameObject.FindObjectOfType <UIScore>(); } if (ResultUI == null) { ResultUI = GameObject.FindObjectOfType <UIResult>(); } IntroUI.Initialize(this); LoadingUI.Initialize(this); TimerUI.Initialize(this); ScoreUI.Initialize(this); ResultUI.Initialize(this); }
public void Initialize() { if (_ui == null) { _ui = new UILoading(); } goUI = GameSystem.Instance.mClient.mUIManager.CreateUI("Prefab/GUI/UILoading"); _ui.Initialize(goUI); Scheduler.Instance.AddUpdator(Update); GameSystem.Instance.showLoading = true; isInitialized = true; string str = GameSystem.Instance.CommonConfig.GetString("gLoadingBg"); string[] items = str.Split('&'); int nt = 0; Dictionary <int, string> bgDic = new Dictionary <int, string>(); List <int> bgList = new List <int>(); foreach (string item in items) { string[] info = item.Split(':'); string bg = info[0]; int weight = int.Parse(info[1]); if (weight == 0) { continue; } nt += weight; bgDic.Add(nt, bg); bgList.Add(nt); } int randNum = UnityEngine.Random.Range(1, nt); int key = -1; for (int i = 0; i < bgList.Count; i++) { if (randNum <= bgList[i]) { key = bgList[i]; break; } } string bgStr = bgDic[key]; _ui._bg.mainTexture = ResourceLoadManager.Instance.GetResources("Texture/" + bgStr, true) as Texture; }