public GameObject GetMaskByType(UIWindowType type) { GameObject mask = null; if (type == UIWindowType.ePopup) { mask = GameObject.Instantiate(popupMask.gameObject); } else if (type == UIWindowType.ePopup_Black) { mask = GameObject.Instantiate(blackMask.gameObject); } else if (type == UIWindowType.ePopup_Blue) { mask = GameObject.Instantiate(blurMask.gameObject); var rawImages = mask.GetComponentsInChildren <RawImage>(); var rawImage = rawImages[rawImages.Length - 1]; rawImage.texture = null; rawImage.gameObject.SetActive(true); } if (mask != null) { mask.SetActive(true); } return(mask); }
//打开窗体 //从uiWindowDic中查找,若没有则创建缓存 public UIWindow OpenWindow(UIWindowType windowType) { if (uiWindowDic == null) { uiWindowDic = new Dictionary <UIWindowType, UIWindow>(); } UIWindow uIWindow; uiWindowDic.TryGetValue(windowType, out uIWindow); if (uIWindow == null) { //初始化窗口 string path; uiWindowPathDic.TryGetValue(windowType, out path); GameObject instWindow = GameObject.Instantiate(Resources.Load(path)) as GameObject; uIWindow = instWindow.GetComponent <UIWindow>(); //设置根节点 UIRoot.SetParent(instWindow.transform, true, uIWindow.currentUIType.UIForm_Type); //加入缓存集合 uiWindowDic.Add(windowType, uIWindow); return(uIWindow); } else { UIRoot.SetParent(uIWindow.transform, true, uIWindow.currentUIType.UIForm_Type); uIWindow.OnEnter(); return(uIWindow); } }
private void SetInstantiatedWindow(UIWindowType windowType, RectTransform window) { switch (windowType) { case UIWindowType.LoginMode: _loginModeWindow = window; break; case UIWindowType.Portal: _portalWindow = window; break; case UIWindowType.Room: _roomWindow = window; break; case UIWindowType.Seat: _seatWindow = window; break; case UIWindowType.Game: _gameWindow = window; break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Match: UIViewUtil.Instance.LoadWindowAsync(UIWindowType.Match, (GameObject go) => { m_UIBattleView = go.GetComponent <UIMatchView>(); m_UIBattleView.OnEnterClick = OnEnterClick; m_UIBattleView.OnSeeDetailClick = OnSeeDetailClick; m_UIBattleView.SetCards(AccountProxy.Instance.CurrentAccountEntity.cards); AudioBackGroundManager.Instance.Play("bgm_match"); RequestBattleList(0, 0); }); break; case UIWindowType.MatchWait: OpenMatchWaitView(); break; case UIWindowType.MatchRankList: OpenMatchRankListView(); break; } }
/// <summary> /// Calculate right depth with windowType /// </summary> /// <param name="baseWindow"></param> private void AdjustBaseWindowDepth(UIWindowBase baseWindow) { UIWindowType windowType = baseWindow.windowData.windowType; int needDepth = 1; if (windowType == UIWindowType.NormalLayer) { needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UINormalLayerRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue); Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.Normal] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } else if (windowType == UIWindowType.ForegroundLayer) { needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UIForegroundLayerRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue); Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.PopUp] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } else if (windowType == UIWindowType.BackgroundLayer) { needDepth = Mathf.Clamp(UGUITools.GetMaxTargetDepth(UIBackgroundLayerRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue); Debug.Log(string.Format("<color=#2a5caa>[UIWindowType.Fixed] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } if (baseWindow.MinDepth != needDepth) { UGUITools.SetTargetMinPanelDepth(baseWindow.gameObject, needDepth); } // send window added message to game client if (baseWindow.windowData.windowType == UIWindowType.ForegroundLayer) { // trigger the window PopRoot added window event // EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventId.PopRootWindowAdded); //暂时不需要事件系统 } baseWindow.MinDepth = needDepth; }
/// <summary> /// Creates the window. /// </summary> /// <returns>The window.</returns> /// <param name="windowName">UI预设名</param> /// <param name="type">UI类型</param> /// <param name="layer">UI层级</param> public UIWindow CreateWindow(string windowName, UIWindowType type, UIWindowLayer layer = UIWindowLayer.Normal) { GameObject uiPrefab = LoadPrefab(windowName); if (uiPrefab == null) { Debug.LogError($"{GetType()}.CreateWindow, cannot find window resource : {windowName}"); return(null); } UIWindow window = null; GameObject obj = Instantiate(uiPrefab, mRoot.transform, false) as GameObject; string[] dirs = windowName.Split('/'); string className = dirs[dirs.Length - 1] + "Controller"; window = obj.AddComponent(Type.GetType(className)) as UIWindow; if (window == null) { Debug.LogError($"Cant find UIWindow: {className}, check the name or remove any outter namespace."); return(null); } return(window); }
private void AdjustBaseWindowDepth(UIBaseWindow baseWindow) { UIWindowType windowType = baseWindow.windowData.windowType; int needDepth = 1; if (windowType == UIWindowType.Normal) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UINormalWindowRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue); Debug.Log("[UIWindowType.Normal] maxDepth is " + needDepth + baseWindow.GetID); } else if (windowType == UIWindowType.PopUp) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIPopUpWindowRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue); Debug.Log("[UIWindowType.PopUp] maxDepth is " + needDepth); } else if (windowType == UIWindowType.Fixed) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIFixedWidowRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue); Debug.Log("[UIWindowType.Fixed] max depth is " + needDepth); } if (baseWindow.MinDepth != needDepth) { GameUtility.SetTargetMinPanel(baseWindow.gameObject, needDepth); } baseWindow.MinDepth = needDepth; }
/// <summary> /// 清除指定root下所有窗口 /// </summary> /// <param name="type"></param> public virtual void HideAllWindowByWindowType(UIWindowType type) { switch (type) { case UIWindowType.BackgroundLayer: { for (int i = 0; i < UIBackgroundLayerRoot.transform.childCount; i++) { UIWindowBase chidWindow = UIBackgroundLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>(); HideWindow(chidWindow.ID); } } break; case UIWindowType.ForegroundLayer: { for (int i = 0; i < UIForegroundLayerRoot.transform.childCount; i++) { UIWindowBase chidWindow = UIForegroundLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>(); HideWindow(chidWindow.ID); } } break; case UIWindowType.NormalLayer: { for (int i = 0; i < UINormalLayerRoot.transform.childCount; i++) { UIWindowBase chidWindow = UINormalLayerRoot.transform.GetChild(i).GetComponent <UIWindowBase>(); HideWindow(chidWindow.ID); } } break; } }
/// <summary> /// Calculate right depth with windowType /// </summary> /// <param name="baseWindow"></param> private void AdjustBaseWindowDepth(UIBaseWindow baseWindow) { UIWindowType windowType = baseWindow.windowData.windowType; int needDepth = 1; if (windowType == UIWindowType.Normal) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UINormalWindowRoot.gameObject, false) + 1, normalWindowDepth, int.MaxValue); Debuger.Log(string.Format("<color=cyan>[UIWindowType.Normal] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } else if (windowType == UIWindowType.PopUp) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIPopUpWindowRoot.gameObject) + 1, popUpWindowDepth, int.MaxValue); Debuger.Log(string.Format("<color=cyan>[UIWindowType.PopUp] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } else if (windowType == UIWindowType.Fixed) { needDepth = Mathf.Clamp(GameUtility.GetMaxTargetDepth(UIFixedWidowRoot.gameObject) + 1, fixedWindowDepth, int.MaxValue); Debuger.Log(string.Format("<color=cyan>[UIWindowType.Fixed] maxDepth is {0} , {1}.</color>", needDepth.ToString(), baseWindow.ID.ToString())); } if (baseWindow.MinDepth != needDepth) { GameUtility.SetTargetMinPanelDepth(baseWindow.gameObject, needDepth); } // send window added message to game client if (baseWindow.windowData.windowType == UIWindowType.PopUp) { // trigger the window PopRoot added window event EventDispatcher.GetInstance().UIFrameWorkEventManager.TriggerEvent(EventSystemDefine.EventUIFrameWorkPopRootWindowAdded); } baseWindow.MinDepth = needDepth; }
//OpenViewPaiJiu 以观察者模式提供加载窗口 private void OpenViewPaiJiu(object[] obj) { for (int i = 0; i < obj.Length; i++) { UIWindowType type = (UIWindowType)obj[i]; OpenView(type); } }
public UIWindowInfo(UIWindowEnum name, UIWindowType type, string path) { this.windowEnum = name; this.windowType = type; this.assetPath = path; windowName = assetPath.Substring(path.LastIndexOf('/') + 1); }
public bool isPopup(UIWindowType type) { if (type != UIWindowType.oNormal) { return(true); } return(false); }
/// <summary> /// 窗口信息 /// </summary> /// <param name="key">标识</param> /// <param name="t">宿主脚本</param> /// <param name="resName">资源名称,如果resName为null取key.tostring()</param> /// <param name="wType">窗口类型</param> /// <param name="wEffect">窗口效果</param> public UIWindowInfo(UIType key, System.Type t, string resName = "", UIWindowType wType = UIWindowType.ModelType, UIWindowEffect wEffect = UIWindowEffect.Default) { Key = key; Owner = t; WinType = wType; WinEffect = wEffect; mResourceName = resName; }
public void WindowHasFocus(UIWindowType type) { if (!mTaskbarButtons.ContainsKey(type)) { return; } mWindows[type].transform.SetAsLastSibling(); }
public PSI_UIWindow GetWindow(UIWindowType type) { if (!mWindows.ContainsKey(type)) { return(null); } return(mWindows[type]); }
/// <summary> /// 窗口信息 /// </summary> /// <param name="key">标识</param> /// <param name="t">宿主脚本</param> /// <param name="resName">资源名称,如果resName为null取key.tostring()</param> /// <param name="wType">窗口类型</param> /// <param name="wEffect">窗口效果</param> public UIWindowInfo(UIType key, System.Type t, string resName = "", UIWindowType wType = UIWindowType.ModelType, UIWindowEffect wEffect = UIWindowEffect.Default) { Key = key; Owner = t; WinType = wType; WinEffect = wEffect; mResourceName = resName; }
/// <summary> /// 异步加载窗口 /// </summary> /// <param name="type">窗口类型</param> /// <param name="onComplete">加载完毕回调</param> public void LoadWindowAsync(UIWindowType type, Action <GameObject> onComplete) { if (type == UIWindowType.None) { return; } LoadWindowAsync(type.ToString(), onComplete); }
/// <summary> /// 同步加载窗口 /// </summary> /// <returns>窗口类型</returns> public GameObject LoadWindow(UIWindowType type) { if (type == UIWindowType.None) { return(null); } return(LoadWindow(type.ToString())); }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Ranking: OpenRankingView(); break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Shop: OpenShopView(); break; } }
/// <summary> /// 关闭并且打开下一个窗口 /// </summary> /// <param name="nextType"></param> public virtual void CloseOpenNext(UIWindowType nextType) { this.Close(); if (nextType == UIWindowType.None) { return; } UIViewUtil.Instance.NextOpenViewName = nextType.ToString(); }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Retroaction: OpenRetroactionView(); break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Record: OpenRecordView(); break; } }
/// <summary> /// 打开视图 /// </summary> /// <param name="type"></param> public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.UIZJHTotalSettlement: //OpenUnitSettlement_ZJH(); break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.Rule: OpenRuleView(); break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.AgreeMent: OpenAgreeMentView(); break; } }
public void OpenView(UIWindowType type) { switch (type) { case UIWindowType.AgentService: OpenAgentServiceView(); break; } }
private void DestroyWindow(UIWindowType type) { MyLog.DebugWithFrame(name, string.Format("Destroy window: {0}", type)); switch (type) { case UIWindowType.LoginMode: if (_loginModeWindow) { Destroy(_loginModeWindow.gameObject); _loginModeWindow = null; NeedUnloadAsset(); } break; case UIWindowType.Portal: if (_portalWindow) { Destroy(_portalWindow.gameObject); _portalWindow = null; NeedUnloadAsset(); } break; case UIWindowType.Room: if (_roomWindow) { Destroy(_roomWindow.gameObject); _roomWindow = null; NeedUnloadAsset(); } break; case UIWindowType.Seat: if (_seatWindow) { Destroy(_seatWindow.gameObject); _seatWindow = null; NeedUnloadAsset(); } break; case UIWindowType.Game: if (_gameWindow) { Destroy(_gameWindow.gameObject); _gameWindow = null; NeedUnloadAsset(); } break; } }
private static IUserInterfaceWindow GetInstance(UIWindowType windowType, object[] args) { Type windowClassType; if (uiWindowImplementations.TryGetValue(windowType, out windowClassType)) { return((IUserInterfaceWindow)Activator.CreateInstance(windowClassType, args)); } return(null); }
public StackData GetTopStackByWinType(UIWindowType type) { StackChunk chunk; if (mChunkWindow.TryGetValue(type, out chunk)) { return(chunk.TopStack); } return(null); }
/// <summary> /// Closes the user interface window. /// </summary> /// <param name="windowType">Window type.</param> public void CloseUIWindow(UIWindowType windowType) { if (uiWindowDic.ContainsKey(windowType)) { GameObject uiWindow = uiWindowDic[windowType]; UIWindowControllerBase uiWindownController = uiWindow.GetOrAddComponent <UIWindowControllerBase>(); UIWindowShowAnimationType windowShowAnimationType = uiWindownController.windowShowAnimationType; StartActiveUIWindow(uiWindow, windowShowAnimationType, state: false); } }
void DrawStack() { if (CSCommonEditor.DrawHeader("Chunk Info", "CSUI-Stack")) { var stackMng = CSCommonEditor.GetField<StackManager>(UIManager.Instance, "mStackInstance"); var listWnd = CSCommonEditor.GetField<List<StackData>>(stackMng, "mListWindow"); var chunkWnd = CSCommonEditor.GetField<Dictionary<UIWindowType, StackChunk>>(stackMng, "mChunkWindow"); GUILayout.Label(string.Format(" Stack Window Count {0} ", listWnd.Count.ToString()), GUILayout.Width(120)); GUILayout.BeginHorizontal(); foreach (var iter in chunkWnd) { if (GUILayout.Toggle(chunkSelectType == iter.Key, iter.Key.ToString(), "ButtonLeft")) { chunkSelectType = iter.Key; } } GUILayout.EndHorizontal(); DrawStackChunkInfo(chunkWnd[chunkSelectType]); } }
public StackChunk(UIWindowType t) { mChunkType = t; mChunkList = new List<StackData>(); mStartDepth = (int)t; }
public StackData GetTopStackByWinType(UIWindowType type) { StackChunk chunk; if (mChunkWindow.TryGetValue(type, out chunk)) { return chunk.TopStack; } return null; }
private Transform GetTargetRoot(UIWindowType type) { if (type == UIWindowType.Fixed) return UIFixedWidowRoot; if (type == UIWindowType.Normal) return UINormalWindowRoot; if (type == UIWindowType.PopUp) return UIPopUpWindowRoot; return UIRoot; }