示例#1
0
    static int LoadAsync(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 2);
            XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage));
            System.Action <UnityEngine.GameObject> arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckObject(L, 2, typeof(System.Action <UnityEngine.GameObject>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.GameObject>), func) as System.Action <UnityEngine.GameObject>;
            }

            obj.LoadAsync(arg0);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#2
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);
            });
        }
    }
示例#3
0
    static int LoadAsync(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage));
                System.Action <UnityEngine.GameObject> arg0 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 2);
                obj.LoadAsync(arg0);
                return(0);
            }
            else if (count == 3)
            {
                XPage obj = (XPage)ToLua.CheckObject(L, 1, typeof(XPage));
                LuaFramework.ResourceManager           arg0 = (LuaFramework.ResourceManager)ToLua.CheckObject <LuaFramework.ResourceManager>(L, 2);
                System.Action <UnityEngine.GameObject> arg1 = (System.Action <UnityEngine.GameObject>)ToLua.CheckDelegate <System.Action <UnityEngine.GameObject> >(L, 3);
                obj.LoadAsync(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: XPage.LoadAsync"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#4
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);
                });
            }
        }
    }