Exemplo n.º 1
0
        // 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)
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static GameObject[] GetObjects(string name)
        {
            UIPanelInfo info = GetUIPanelInfo(name);

            if (info != null)
            {
                return(info.GetObjects());
            }
            return(null);
        }
Exemplo n.º 3
0
 public static UIPanelInfo GetOrAddUIPanelInfo(string name)
 {
     if (panelMap.ContainsKey(name))
     {
     }
     else
     {
         panelMap[name] = new UIPanelInfo();
     }
     return(panelMap[name] as UIPanelInfo);
 }
Exemplo n.º 4
0
    /// <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);
        }
    }
Exemplo n.º 5
0
    /// <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);
        }
    }
Exemplo n.º 6
0
        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);
                }
            }
        }
Exemplo n.º 7
0
        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);
                }
            }
        }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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);
        }
    }
Exemplo n.º 10
0
    /// Json文件转对象
    private void JsonToObject()
    {
        TextAsset TA = Resources.Load <TextAsset>("Json/PanelInfo");

        PanelList = JsonUtility.FromJson <UIPanelInfo>(TA.text);
    }