Exemplo n.º 1
0
 static int ClearSceneData(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         LuaSceneTool.ClearSceneData();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 2
0
 static int UnloadSceneSuccess(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
         LuaSceneTool.UnloadSceneSuccess(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 3
0
 static int ChangeScene(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         int  arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
         bool arg1 = LuaDLL.luaL_checkboolean(L, 2);
         LuaSceneTool.ChangeScene(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 4
0
 static int RegisterEvent(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LuaFunction arg0 = ToLua.CheckLuaFunction(L, 1);
         LuaFunction arg1 = ToLua.CheckLuaFunction(L, 2);
         LuaSceneTool.RegisterEvent(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 5
0
 private void Start()
 {
     mUnloadSceneIndex = LuaSceneTool.CurrentSceneIndex;
     mTargetSceneIndex = LuaSceneTool.SceneIndex;
     mIsUnloadScene    = LuaSceneTool.IsUnload;
     LuaSceneTool.ClearSceneData();
     if (mIsUnloadScene)
     {
         StartUnloadScene();
     }
     else
     {
         StartLoadScene();
     }
 }
Exemplo n.º 6
0
    IEnumerator UnloadScene()
    {
        mUnloadAsync = SceneManager.UnloadSceneAsync(mUnloadSceneIndex);
        while (!mUnloadAsync.isDone)
        {
            SetLoading(mUnloadAsync.progress);
            yield return(new WaitForEndOfFrame());
        }

        if (mUnloadAsync.isDone)
        {
            LuaSceneTool.UnloadSceneSuccess(mUnloadSceneIndex);
            SetLoading(1.0f);
            StartLoadScene();
        }

        yield return(new WaitForEndOfFrame());
    }
Exemplo n.º 7
0
    IEnumerator LoadScene()
    {
        mLoadAsync = SceneManager.LoadSceneAsync(mTargetSceneIndex, LoadSceneMode.Additive);
        while (!mLoadAsync.isDone)
        {
            SetLoading(mLoadAsync.progress);
            yield return(new WaitForEndOfFrame());
        }

        if (mLoadAsync.isDone)
        {
            LuaSceneTool.CurrentSceneIndex = mTargetSceneIndex;
            SceneManager.UnloadSceneAsync(1);
            SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(mTargetSceneIndex));
            LuaSceneTool.LoadSceneSuccess(mTargetSceneIndex);
            ClearData();
        }
        yield return(new WaitForEndOfFrame());
    }
Exemplo n.º 8
0
    static int _CreateLuaSceneTool(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                LuaSceneTool obj = new LuaSceneTool();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: LuaSceneTool.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemplo n.º 9
0
 public void OnClickChange()
 {
     LuaSceneTool.ChangeScene(5, true);
 }