public override void ShowWindow(WindowID id, ShowWindowData data) { if (!IsWindowInControl(id)) { Debug.Log("UIRankManager has no control power of " + id.ToString()); return; } if (shownWindows.ContainsKey(id)) return; if (allWindows.ContainsKey(id)) { UIBaseWindow baseWindow = allWindows[id]; if (baseWindow.windowData.showMode == UIWindowShowMode.NeedBack) { BackWindowSequenceData backData = new BackWindowSequenceData(); backData.hideTargetWindow = baseWindow; backSequence.Push(backData); } allWindows[id].ShowWindow(); shownWindows[id] = allWindows[id]; this.lastShownNormalWindow = this.curShownNormalWindow; curShownNormalWindow = baseWindow; } }
public override void ShowWindow(WindowID id, ShowWindowData data) { if (!IsWindowInControl(id)) { Debug.Log("UIRankManager has no control power of " + id.ToString()); return; } if (shownWindows.ContainsKey(id)) { return; } if (allWindows.ContainsKey(id)) { UIBaseWindow baseWindow = allWindows[id]; if (baseWindow.windowData.showMode == UIWindowShowMode.NeedBack) { BackWindowSequenceData backData = new BackWindowSequenceData(); backData.hideTargetWindow = baseWindow; backSequence.Push(backData); } allWindows[id].ShowWindow(); shownWindows[id] = allWindows[id]; this.lastShownNormalWindow = this.curShownNormalWindow; curShownNormalWindow = baseWindow; } }
protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null) { // 检测控制权限 if (!this.IsWindowInControl(id)) { Debug.Log("UIManager has no control power of " + id.ToString()); return null; } if (shownWindows.ContainsKey(id)) return null; // 隐藏callWindowId指向窗口 /*if(showData != null) HideWindow(showData.callWindowId, null);*/ UIBaseWindow baseWindow = GetGameWindow(id); bool newAdded = false; if (!baseWindow) { newAdded = true; // 窗口不存在从内存进行加载 if (UIResourceDefine.windowPrefabPath.ContainsKey(id)) { string prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[id]; GameObject prefab = Resources.Load<GameObject>(prefabPath); if (prefab != null) { GameObject uiObject = (GameObject)GameObject.Instantiate(prefab); NGUITools.SetActive(uiObject, true); baseWindow = uiObject.GetComponent<UIBaseWindow>(); // 需要动态添加对应的控制界面,prefab不用添加脚本 Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType); GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform); allWindows[id] = baseWindow; } } } if (baseWindow == null) Debug.LogError("[window instance is null.]" + id.ToString()); // 重置界面(第一次添加,强制Reset) if (newAdded || (showData != null && showData.forceResetWindow)) baseWindow.ResetWindow(); // 显示界面固定内容 // 导航系统数据更新 RefreshBackSequenceData(baseWindow); // 调整层级depth AdjustBaseWindowDepth(baseWindow); // 添加背景Collider AddColliderBgForWindow(baseWindow); return baseWindow; }
public override void InitWindowOnAwake() { this.windowID = WindowID.WindowID_MainMenu; base.InitWindowOnAwake(); InitWindowData(); 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; UIManager.GetInstance().ShowWindow(WindowID.WindowID_Rank, showData); }; UIEventListener.Get(btnSwitch).onClick = delegate { switchFlag = !switchFlag; if (switchFlag) { ShowBtns(); } else { HideBtns(); } }; UIEventListener.Get(btnLevel).onClick = delegate { UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level); }; UIEventListener.Get(btnSkill).onClick = delegate { UIManager.GetInstance().ShowWindow(WindowID.WindowID_Skill); }; }
public override void InitWindowOnAwake() { this.windowID = WindowID.WindowID_MainMenu; base.InitWindowOnAwake(); InitWindowData(); 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; UIManager.GetInstance().ShowWindow(WindowID.WindowID_Rank, showData); }; UIEventListener.Get(btnSwitch).onClick = delegate { switchFlag = !switchFlag; if (switchFlag) ShowBtns(); else HideBtns(); }; UIEventListener.Get(btnLevel).onClick = delegate { UIManager.GetInstance().ShowWindow(WindowID.WindowID_Level); }; UIEventListener.Get(btnSkill).onClick = delegate { UIManager.GetInstance().ShowWindow(WindowID.WindowID_Skill); }; }
public override void ShowWindow(WindowID id, ShowWindowData data = null) { UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, data); if (baseWindow != null) { RealShowWindow(baseWindow, id); // 是否清空当前导航信息(回到主菜单) if (baseWindow.windowData.isStartWindow) { Debuger.Log("[Enter the start window, reset the backSequenceData for the navigation system.]"); ClearBackSequence(); } if (data != null && data.forceClearBackSeqData) ClearBackSequence(); } }
public override void ShowWindow(WindowID id, ShowWindowData data = null) { UIBaseWindow baseWindow = ReadyToShowBaseWindow(id, data); if (baseWindow != null) { RealShowWindow(baseWindow, id); // 是否清空当前导航信息(回到主菜单) if (baseWindow.windowData.isStartWindow) { Debuger.Log("[Enter the start window, reset the backSequenceData for the navigation system.]"); ClearBackSequence(); } if (data != null && data.forceClearBackSeqData) { ClearBackSequence(); } } }
protected override UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null) { // 检测控制权限 if (!this.IsWindowInControl(id)) { Debug.Log("UIManager has no control power of " + id.ToString()); return(null); } if (shownWindows.ContainsKey(id)) { return(null); } // 隐藏callWindowId指向窗口 /*if(showData != null) * HideWindow(showData.callWindowId, null);*/ UIBaseWindow baseWindow = GetGameWindow(id); bool newAdded = false; if (!baseWindow) { newAdded = true; // 窗口不存在从内存进行加载 if (UIResourceDefine.windowPrefabPath.ContainsKey(id)) { string prefabPath = UIResourceDefine.UIPrefabPath + UIResourceDefine.windowPrefabPath[id]; GameObject prefab = Resources.Load <GameObject>(prefabPath); if (prefab != null) { GameObject uiObject = (GameObject)GameObject.Instantiate(prefab); NGUITools.SetActive(uiObject, true); baseWindow = uiObject.GetComponent <UIBaseWindow>(); // 需要动态添加对应的控制界面,prefab不用添加脚本 Transform targetRoot = GetTargetRoot(baseWindow.windowData.windowType); GameUtility.AddChildToTarget(targetRoot, baseWindow.gameObject.transform); allWindows[id] = baseWindow; } } } if (baseWindow == null) { Debug.LogError("[window instance is null.]" + id.ToString()); } // 重置界面(第一次添加,强制Reset) if (newAdded || (showData != null && showData.forceResetWindow)) { baseWindow.ResetWindow(); } // 显示界面固定内容 // 导航系统数据更新 RefreshBackSequenceData(baseWindow); // 调整层级depth AdjustBaseWindowDepth(baseWindow); // 添加背景Collider AddColliderBgForWindow(baseWindow); return(baseWindow); }
protected virtual UIBaseWindow ReadyToShowBaseWindow(WindowID id, ShowWindowData showData = null) { return(null); }
private IEnumerator _ShowWindowDelay(float delayTime, WindowID id, ShowWindowData data = null) { yield return(new WaitForSeconds(delayTime)); ShowWindow(id, data); }
/// <summary> /// Delay 显示界面 /// </summary> /// <param name="delayTime"> 延迟时间</param> /// <param name="id"> 界面ID</param> /// <param name="data">显示数据</param> public virtual void ShowWindowDelay(float delayTime, WindowID id, ShowWindowData data = null) { StartCoroutine(_ShowWindowDelay(delayTime, id, data)); }
/// <summary> /// 显示界面 /// </summary> /// <param name="id">界面ID</param> public virtual void ShowWindow(WindowID id, ShowWindowData data = null) { }