public UI3WndPanelLayer(UI3WndPanelLayerType argType, int argStep, UI3WndPanelLayerType argStackLayerType) { this.type = argType; this.begin = curBegin; this.end = this.begin + argStep; this.step = argStep; curBegin += argStep; this.stackLayerType = argStackLayerType; }
public int GetPanelLayerBegin() { UI3WndPanelLayerType layerType = (UI3WndPanelLayerType)Enum.Parse(typeof(UI3WndPanelLayerType), panelLayerType); if (UI3WndPanelLayer.layers.Length <= 0 || (int)layerType >= UI3WndPanelLayer.layers.Length) { return(0); } return(UI3WndPanelLayer.layers[(int)layerType].begin); }
public static void ClearStack(UI3WndPanelLayerType type) { string panelLayer = type.ToString(); UIStack <string> stack = GetStackByPanelLayer(panelLayer); if (stack == null) { return; } stack.Clear(); }
public static UI3Wnd createWindow(string className) { UI3Wnd window = findWindow(className); if (window != null) { return(window); } GameObject res = loadWindowRes(className) as GameObject; if (res == null) { return(null); } GameObject parent = getWndRootPanel(className); GameObject uiGo = NGUITools.AddChild(parent, res); UIAnchor[] Anchor = uiGo.GetComponentsInChildren <UIAnchor>(true); for (int i = 0; i < Anchor.Length; ++i) { if (Anchor[i].uiCamera == null) { Anchor[i].uiCamera = Unity3Tools.FindInParent <Camera>(uiGo); } } uiGo.SetActive(false); window = uiGo.AddMissingComponent <UI3Wnd>(); int layerDepth = 0; UI3WndPanelLayerType layerType = (UI3WndPanelLayerType)Enum.Parse(typeof(UI3WndPanelLayerType), window.panelLayerType); if (UI3WndPanelLayer.layers.Length > (int)layerType) { layerDepth = UI3WndPanelLayer.layers[(int)layerType].begin; } window.addDepth(layerDepth); UIResInfo resInfo = m_resInfoDict[className]; if (resInfo != null) { window.WndType = resInfo.type; resInfo.objList.Add(uiGo); } window.ClassMark = resInfo.uiMark; return(window); }
public static GameObject getWndRootPanel(string wndName) { GameObject root = getUIRootPanel(); if (root == null) { return(null); } UIResInfoAsset uiResInfoAsset = UIResInfoAssetAssetBundleReader.Instance.FindById(wndName); if (uiResInfoAsset == null) { return(null); } UI3WndPanelLayerType layerType = (UI3WndPanelLayerType)Enum.Parse(typeof(UI3WndPanelLayerType), uiResInfoAsset.layerType); string wndRootName = uiResInfoAsset.layerType.ToString(); Transform wndTran = root.transform.Find(wndRootName); if (wndTran == null) { GameObject panelGO = new GameObject(wndRootName); panelGO.transform.parent = root.transform; panelGO.transform.localPosition = Vector3.zero; panelGO.transform.localRotation = Quaternion.identity; panelGO.transform.localScale = Vector3.one; panelGO.layer = root.layer; wndTran = root.transform.Find(wndRootName); } int beginDepth = 0; if (UI3WndPanelLayer.layers[(int)layerType] != null) { beginDepth = UI3WndPanelLayer.layers[(int)layerType].begin; } UIPanel panel = wndTran.gameObject.GetComponent <UIPanel>(); if (panel == null) { panel = wndTran.gameObject.AddComponent <UIPanel>(); panel.depth = beginDepth; } return(wndTran.gameObject); }
public static void ClearUIByLayerType(UI3WndPanelLayerType type) { foreach (KeyValuePair <string, UIResInfo> pair in m_resInfoDict) { UIResInfo resInfo = pair.Value; for (int i = 0; i < resInfo.objList.Count; i++) { if (resInfo.objList[i] != null && resInfo.layerType == type.ToString()) { NGUITools.Destroy(resInfo.objList[i]); resInfo.objList[i] = null; resInfo.objList.Clear(); resInfo.prefab = null; } } } ClearStack(type); }
public static UIStack <string> GetStackByPanelLayer(UI3WndPanelLayerType layerType) { return(GetStackByPanelLayer(layerType.ToString())); }