public async void Start()
        {
            //初始化zstring
            using (zstring.Block()) { }

            LaunchUI.Init();
            List <Func <Task> > initFunctions = new List <Func <Task> >();

            //config
            initFunctions.Add(UILocationAsset.Refresh);
            initFunctions.Add(UICodeTextAsset.Refresh);
            initFunctions.Add(UINamesAsset.Refresh);
            initFunctions.Add(AtlasConfigAsset.Refresh);
            initFunctions.Add(UIConfigAsset.Refresh);
            initFunctions.Add(AudioConfigAsset.Refresh);
            initFunctions.Add(PrefabPathAsset.Refresh);
            initFunctions.Add(ModelConfigAsset.Refresh);
            //setting
            initFunctions.Add(HUDConfigAsset.Load);
            for (int i = 0; i < initFunctions.Count; i++)
            {
                await initFunctions[i].Invoke();
                LaunchUI.ShowProcess((float)(i + 1) / (float)initFunctions.Count * 0.5f);
            }

            SoundManager.Init();
            TcpManager.Init();
            MapManager.Init();
            AOIManager.Init();
            XLuaManager.Init();
            XLuaManager.Inject <GameSettings>("GameSettings", GameSettings);
            XLuaManager.StartGame();
            LuaLoadedTime = DateTime.UtcNow.Ticks;
        }
 private void FixedUpdate()
 {
     TcpManager.FixedUpdate();
     TimeManager.FixedUpdate();
     XLuaManager.FixedUpdate();
     EntityBehaviorManager.FixedUpdate();
 }
Пример #3
0
        private LuaTable GenUIView(UIContainer container)
        {
            if (container == null)
            {
                return(null);
            }
            LuaTable table = XLuaManager.GetLuaEnv().NewTable();

            table.Set <string, UIContainer>("container", container);
            table.Set <string, Transform>("transform", container.transform);
            for (int i = 0; i < container.names.Count; i++)
            {
                string    name      = container.names[i];
                Component component = container.behaviours[i];
                LuaTable  compTable;
                if (component is UIContainer)
                {
                    compTable = GenUIView(component as UIContainer);
                    table.Set(name, compTable);
                }
                else
                {
                    table.Set(name, component);
                }
            }

            return(table);
        }
 private void Update()
 {
     InputManager.Update();
     TcpManager.Update();
     //TimeManager放在XLuaManager之后,保证OperationLuaTable即使0帧回收,也不会在XLuaUpdate里被利用
     XLuaManager.Update();
     TimeManager.Update();
     EntityBehaviorManager.Update();
     HUDManager.Update();
 }
 private async void OnApplicationQuit()
 {
     AtlasManager.Dispose();
     XLuaManager.Dispose();
     AOIManager.Dispose();
     TcpManager.Dispose();
     TimeManager.Dispose();
     MapManager.Dispose();
     HUDManager.Dispose();
     //why
     await Task.Delay(1);
 }
Пример #6
0
        public static LuaTable Load(string sceneName, Action loadCompleteCallback)
        {
            ResourceManager.Cleanup();

            TargetScene           = sceneName;
            LoadCompleteCallaback = loadCompleteCallback;
            IsLoading             = true;
            SceneManager.LoadSceneAsync(SceneNames.LoadingScene).completed += LoadEmptyComplete;

            if (m_Operation == null)
            {
                m_Operation = XLuaManager.GetLuaEnv().NewTable();
            }
            m_Operation.Set("IsDone", false);
            m_Operation.Set("process", 0);
            return(m_Operation);
        }
        private void LateUpdate()
        {
            XLuaManager.LateUpdate();
#if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.F1))
            {
                string        path = Application.dataPath.Replace("Assets", "Lua/");
                DirectoryInfo fdir = new DirectoryInfo(path);
                FileInfo[]    file = fdir.GetFiles("*.lua", SearchOption.AllDirectories);


                for (int i = 0; i < file.Length; i++)
                {
                    if (file[i].LastWriteTimeUtc.Ticks - LuaLoadedTime > 0)
                    {
                        //string luaFile = file[i].FullName.Replace("\\", "/").Replace(path, "").Replace(".lua", "");
                        //XLuaManager.HotfixLua(luaFile);
                    }
                }

                LuaLoadedTime = DateTime.UtcNow.Ticks;
            }
#endif
        }
 private void OnLevelWasLoaded()
 {
     XLuaManager.OnLevelWasLoaded();
 }