Beispiel #1
0
    /// <summary>
    /// 加载场景
    /// </summary>
    /// <param name="sceneName">场景名</param>
    /// <param name="additive">是叠加加载,还是独立加载</param>
    /// <param name="loadDone">加载完成回调</param>
    /// <param name="updateProgress">加载进度更新回调</param>
    public void LoadScene(string sceneName, bool additive,
                          SceneLoader.LoadSceneDoneCallback loadDone, SceneLoader.LoadSceneUpdateCallback updateProgress)
    {
        SceneLoader loader = null;

#if ASSETBUNDLE
        // TODO 检查已经加载的情况

        loader = new AssetBundleSceneLoader(sceneName, additive, loadDone, updateProgress);
#else
        loader = new SceneLoader(sceneName, additive, loadDone, updateProgress);
#endif
        // 启动加载
        Game.Instance().StartCoroutine(loader);
        this.sceneLoader = loader;
    }
Beispiel #2
0
        static internal int checkDelegate(IntPtr l, int p, out SceneLoader.LoadSceneUpdateCallback ua)
        {
            int op = extractFunction(l, p);

            if (LuaDLL.lua_isnil(l, p))
            {
                ua = null;
                return(op);
            }
            else if (LuaDLL.lua_isuserdata(l, p) == 1)
            {
                ua = (SceneLoader.LoadSceneUpdateCallback)checkObj(l, p);
                return(op);
            }
            LuaDelegate ld;

            checkType(l, -1, out ld);
            if (ld.d != null)
            {
                ua = (SceneLoader.LoadSceneUpdateCallback)ld.d;
                return(op);
            }
            LuaDLL.lua_pop(l, 1);

            l  = LuaState.get(l).L;
            ua = (string a1, float a2) =>
            {
                int error = pushTry(l);

                pushValue(l, a1);
                pushValue(l, a2);
                ld.pcall(2, error);
                LuaDLL.lua_settop(l, error - 1);
            };
            ld.d = ua;
            return(op);
        }