// Dump public static void Dump(bool filter = false) { if (panelMap == null) { return; } foreach (DictionaryEntry entry in panelMap) { string key = entry.Key as string; UIPanelInfo panel = entry.Value as UIPanelInfo; if (panel != null) { if (!filter) { int count = panel.panelList.Count; panel.Clean(); } else { panel.Clean(); } } else { if (!filter) { } } } }
public static GameObject[] GetObjects(string name) { UIPanelInfo info = GetUIPanelInfo(name); if (info != null) { return(info.GetObjects()); } return(null); }
public static UIPanelInfo GetOrAddUIPanelInfo(string name) { if (panelMap.ContainsKey(name)) { } else { panelMap[name] = new UIPanelInfo(); } return(panelMap[name] as UIPanelInfo); }
/// <summary> /// 本地用Resources,网络把预至物打包上传 /// </summary> void GetUIPanelUrl() { UIPanelInfo uiPanelInfo = new UIPanelInfo(); string blostr = Resources.Load <TextAsset>("JsonInfo/MainPanel").text; uiPanelInfo = JsonUtility.FromJson <UIPanelInfo>(blostr); for (int i = 0; i < uiPanelInfo.panelInfos.Count; i++) { Debug.Log(uiPanelInfo.panelInfos[i].panelName); } }
/// <summary> /// 解析面板配置文件 /// </summary> private void ParseUIPanelTypeJson() { m_PanelPathDict = new Dictionary <UIPanelType, string>(); TextAsset asset = Resources.Load <TextAsset>("UIPanelType"); List <UIPanelInfo> infoList = JsonMapper.ToObject <List <UIPanelInfo> >(asset.text); for (int i = 0; i < infoList.Count; i++) { UIPanelInfo info = infoList[i]; m_PanelPathDict.Add(info.PanelType, info.Path); } }
public static void UnregisterObject(GameObject panelObj, string UIID) { UIPanelInfo info = GetUIPanelInfo(UIID); if (info != null) { info.Unregister(panelObj); if (UISystem.IsBlock(UIID)) { UIBlockSystemLock(panelObj, false); } } }
public static void RegisterObject(GameObject panelObj, string UIID) { UIPanelInfo info = GetOrAddUIPanelInfo(UIID); if (info != null) { info.Register(panelObj); // Detect is blocked by other UI if (UISystem.IsBlock(UIID)) { UIBlockSystemLock(panelObj, true); } } }
public void PushPanel(UIPanelInfo panelInfo) { if (panelStack == null) { panelStack = new Stack <BasePanel>(); } if (panelStack.Count > 0) { BasePanel topPanel = panelStack.Peek(); topPanel.OnPause(); Debug.Log("暂停" + topPanel.name); } BasePanel panel = GetPanel(panelInfo); panel.OnEnter(); Debug.Log("进入" + panel.name); panelStack.Push(panel); }
private BasePanel GetPanel(UIPanelInfo panelInfo) { if (panelDic == null) { panelDic = new Dictionary <UIPanelInfo, BasePanel>(); } Debug.Log("panelDic字典的个数为" + panelDic.Count); BasePanel panel = null; panelDic.TryGetValue(panelInfo, out panel); if (panel == null) { GameObject instPanel = AddUIWidghtToUIPanel(panelInfo.UIPanelPath, panelInfo.UIPanelName, CanvasTransform); BasePanel temp = instPanel.GetComponent <BasePanel>(); panelDic.Add(panelInfo, temp); return(temp); } else { return(panel); } }
/// Json文件转对象 private void JsonToObject() { TextAsset TA = Resources.Load <TextAsset>("Json/PanelInfo"); PanelList = JsonUtility.FromJson <UIPanelInfo>(TA.text); }