Exemplo n.º 1
0
    /// <summary>
    /// 打开面板
    /// </summary>
    /// <param name="isSync">是否同步加载</param>
    /// <param name="pageLoadPath">加载的相对路径</param>
    public void ShowPage(string pageName)
    {
        if (string.IsNullOrEmpty(pageName))
        {
            Debug.LogError("pageName--是null");
            return;
        }
        bool  isExist   = CheckPageExist(pageName);
        XPage currXPage = null;

        if (isExist)
        {
            currXPage = m_pageDic[pageName];
            if (currXPage.m_currState == EPageState.HIDE)
            {
                CheckPageMode(currXPage);
                currXPage.Rest();
                currShowXPage = currXPage;
            }
        }
        else
        {
            //add
            currXPage = new XPage(pageName, "");
            currXPage.Awake();
            currXPage.LoadAsync(ResManager, o =>
            {
                m_pageDic.Add(pageName, currXPage);
                currShowXPage = currXPage;
                CheckPageMode(currXPage);
                currXPage.Start();
                Debug.LogWarning("CreatePanel::>> " + name + " " + o);
            });
        }
    }
Exemplo n.º 2
0
 static int Rest(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage));
         obj.Rest();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// 打开面板
    /// </summary>
    /// <param name="isSync">是否同步加载</param>
    /// <param name="pageLoadPath">加载的相对路径</param>
    public void ShowPage(bool isSync, string pageLoadPath)
    {
        string pageName = GetPageName(pageLoadPath);

        bool isExist = CheckPageExist(pageName);

        XPage currXPage = null;

        if (isExist)
        {
            currXPage = m_pageDic[pageName];

            CheckPageMode(currXPage);

            currXPage.Rest();

            currShowXPage = currXPage;
        }
        else
        {
            //add
            currXPage = new XPage(pageName, pageLoadPath);
            currXPage.Awake();
            XPageLoadBind.Bind(currXPage);
            if (isSync)
            {
                currXPage.LoadSync((go) =>
                {
                    CheckPageMode(currXPage);

                    currXPage.Start();

                    m_pageDic.Add(pageName, currXPage);
                });
            }
            else
            {
                currXPage.LoadAsync((go) =>
                {
                    currXPage.Awake();

                    CheckPageMode(currXPage);

                    m_pageDic.Add(pageName, currXPage);
                });
            }
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// 隐藏当前的页面
    /// </summary>
    public bool HideCurrPage()
    {
        if (currShowXPage != null)
        {
            if (currShowXPage.m_pageMode == EPageHideMode.HideOtherAndNeedBack)
            {
                if (m_pageNeedBackPool.Count > 0)
                {
                    if (m_pageNeedBackPool.Peek().Equals(currShowXPage))
                    {
                        XPage topPage = m_pageNeedBackPool.Pop();
                        topPage.Hide();
                        currShowXPage = null;

                        if (m_pageNeedBackPool.Count > 0)
                        {
                            XPage _curr = m_pageNeedBackPool.Peek();
                            _curr.Rest();
                            currShowXPage = _curr;
                        }
                    }
                }
            }
            else
            {
                if (currShowXPage.m_currState == EPageState.OPEN)
                {
                    currShowXPage.Hide();
                    currShowXPage = null;
                }
            }

            return(true);
        }
        else
        {
            Debug.Log("currShowPage is null");
            return(false);
        }
    }