Example #1
0
        public static void Shutdown()
        {
            EventList_.Clear();
            EventManager.UnRegister <EnterForegroundEvent>(OnEnterForegroundEvent);
            EventManager.UnRegister <EnterBackgroundEvent>(OnEnterBackgroundEvent);
            EventManager.OnSend -= OnLuaEvent;

            MainEntity_?.Shutdown();
            MainEntity_ = null;
            GC.Collect();
            GC.WaitForPendingFinalizers();
            LuaEnv_.Dispose(true);
        }
Example #2
0
        public static bool ExecuteMainLuaFile(string FileName)
        {
            LuaEnv_.DoString($"_lite_main_entity_ = require '{FileName}'", FileName);

            MainEntity_ = LuaEnv_.Global.GetInPath <ILuaMainEntity>("_lite_main_entity_");
            if (MainEntity_ == null)
            {
                LLogger.LWarning($"can't load {FileName}.lua file");
                return(false);
            }

            var State = MainEntity_.Startup();

            if (!State)
            {
                LLogger.LWarning("lua main entity start failed");
                return(false);
            }

            return(true);
        }