Beispiel #1
0
        protected override void OnEnter(ProcedureOwner procedureOwner)
        {
            base.OnEnter(procedureOwner);
            var luaComp = GameEntry.GetComponent <LuaComponent>();

            if (Application.isEditor && GameEntry.GetComponent <BaseComponent>().EditorResourceMode)
            {
                return;
            }

            for (int i = 0; i < PreloadLuaScriptsInfos.Length; ++i)
            {
                var info = PreloadLuaScriptsInfos[i];
                m_LoadFlags.Add(info.FileName);
                luaComp.LoadFile(info.AssetPathPrefix + info.FileName, info.FileName, OnLoadLuaScriptSuccess, OnLoadLuaScriptFailure);
            }
        }
Beispiel #2
0
        protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);

            if (Application.isEditor && GameEntry.GetComponent <BaseComponent>().EditorResourceMode)
            {
                ChangeState <ProcedureLoadLuaScripts>(procedureOwner);
                return;
            }

            if (!m_HasStartedInitRes)
            {
                m_HasStartedInitRes = true;
                GameEntry.GetComponent <EventComponent>().Subscribe(EventId.ResourceInitComplete, OnResourceInitComplete);
                GameEntry.GetComponent <ResourceComponent>().InitResources();
            }

            if (m_InitResComplete)
            {
                GameEntry.GetComponent <EventComponent>().Unsubscribe(EventId.ResourceInitComplete, OnResourceInitComplete);
                ChangeState <ProcedureLoadLuaScripts>(procedureOwner);
            }
        }