public override void ShowWindow(BaseWindowContextData rankContextData) { NGUITools.SetActive(this.gameObject, true); // you can also use Rank's window manager to show target child window // UIRankManager.GetInstance().ShowWindow(WindowID.WindowID_Rank_OwnDetail); EnterAnimation(delegate { }); ContextDataRank data = rankContextData as ContextDataRank; if (data != null) { FillRankItem(data.listRankItemDatas); } }
public override void InitWindowOnAwake() { base.InitWindowOnAwake(); InitWindowCoreData(); twPositions = new TweenPosition[4]; btnInfor = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject; btnRank = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject; btnLevel = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject; btnSwitch = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject; btnSkill = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject; lbSwitch = GameUtility.FindDeepChild <UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label"); twPositions[0] = btnInfor.GetComponent <TweenPosition>(); twPositions[1] = btnRank.GetComponent <TweenPosition>(); twPositions[2] = btnLevel.GetComponent <TweenPosition>(); twPositions[3] = btnSkill.GetComponent <TweenPosition>(); UIEventListener.Get(btnRank).onClick = delegate { ShowWindowData showData = new ShowWindowData(); showData.forceResetWindow = true; string[] headIcons = new string[] { "Rambo", "Angry", "Smile", "Laugh", "Dead", "Frown", "Annoyed" }; // fill the rank data ContextDataRank contextData = new ContextDataRank(); contextData.listRankItemDatas = new List <RankItemData>(); // rank list for (int i = 0; i < 10; i++) { RankItemData newData = new RankItemData(); newData.playerName = headIcons[UnityEngine.Random.Range(0, headIcons.Length)]; newData.headIcon = "Emoticon - " + newData.playerName; newData.playerName = "Mr." + newData.playerName; newData.playerDescription = string.Format("I'm {0}", newData.playerName); contextData.listRankItemDatas.Add(newData); } showData.contextData = contextData; UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Rank, showData); }; UIEventListener.Get(btnSwitch).onClick = delegate { switchFlag = !switchFlag; if (switchFlag) { ShowBtns(); } else { HideBtns(); } }; UIEventListener.Get(btnLevel).onClick = delegate { UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Level); }; UIEventListener.Get(btnSkill).onClick = delegate { UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill); }; }
public override void InitWindowOnAwake() { base.InitWindowOnAwake(); InitWindowCoreData(); twPositions = new TweenPosition[4]; btnInfor = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Infor").gameObject; btnRank = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Rank").gameObject; btnLevel = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Level").gameObject; btnSwitch = GameUtility.FindDeepChild(this.gameObject, "BottomRight/Btn_Switch").gameObject; btnSkill = GameUtility.FindDeepChild(this.gameObject, "LeftBottom/Btns/Btn_Skill").gameObject; lbSwitch = GameUtility.FindDeepChild<UILabel>(this.gameObject, "BottomRight/Btn_Switch/Label"); twPositions[0] = btnInfor.GetComponent<TweenPosition>(); twPositions[1] = btnRank.GetComponent<TweenPosition>(); twPositions[2] = btnLevel.GetComponent<TweenPosition>(); twPositions[3] = btnSkill.GetComponent<TweenPosition>(); UIEventListener.Get(btnRank).onClick = delegate { ShowWindowData showData = new ShowWindowData(); showData.forceResetWindow = true; string[] headIcons = new string[] { "Rambo", "Angry", "Smile", "Laugh", "Dead", "Frown", "Annoyed" }; // fill the rank data ContextDataRank contextData = new ContextDataRank(); contextData.listRankItemDatas = new List<RankItemData>(); // rank list for (int i = 0; i < 10; i++) { RankItemData newData = new RankItemData(); newData.playerName = headIcons[UnityEngine.Random.Range(0, headIcons.Length)]; newData.headIcon = "Emoticon - " + newData.playerName; newData.playerName = "Mr." + newData.playerName; newData.playerDescription = string.Format("I'm {0}", newData.playerName); contextData.listRankItemDatas.Add(newData); } showData.contextData = contextData; UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Rank, showData); }; UIEventListener.Get(btnSwitch).onClick = delegate { switchFlag = !switchFlag; if (switchFlag) ShowBtns(); else HideBtns(); }; UIEventListener.Get(btnLevel).onClick = delegate { UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Level); }; UIEventListener.Get(btnSkill).onClick = delegate { UICenterMasterManager.Instance.ShowWindow(WindowID.WindowID_Skill); }; }