コード例 #1
0
        public void UnLoadAsset(int resourceIndex)
        {
            var assetLoadMode = GameCenter.s_ConfigManager.GlobalGameConfig.AssetLoadMode;

#if UNITY_EDITOR
            if (assetLoadMode == GameConfig.AssetLoadModeEnum.EditMode)
            {
                EditorModeAssetLoader.UnLoad(resourceIndex);
            }
            else
#endif
            BundleAssetLoader.UnLoad(resourceIndex);
        }
コード例 #2
0
        public void OnUpdate()
        {
            if (m_Step == 1)
            {
                if (GameCenter.s_ConfigManager.GlobalGameConfig.LuaScriptLoadMode ==
                    GameConfig.LuaScriptLoadModeEnum.RawFileMode)
                {
                    m_Step = 4;
                }
                else
                {
                    m_Step            = 2;
                    m_LuaFileResIndex = BundleAssetLoader.LoadAsync <LuaFileRef>(
                        CommonDefine.s_ScriptAssetBundleName + "." + CommonDefine.s_BundleSuffixName,
                        CommonDefine.s_ScriptFileDescName, (b, fileRef) =>
                    {
                        m_Step            = 3;
                        var fileBytesDict = new Dictionary <string, ScriptManager.LuaFileBytes>();
                        foreach (var asset in fileRef.AssetsRefDict)
                        {
                            var fileBytes = new ScriptManager.LuaFileBytes();
                            fileBytes.SetBytes(Encoding.UTF8.GetBytes(asset.Value.text));
                            fileBytesDict.Add(asset.Key, fileBytes);
                        }

                        GameCenter.s_ScriptManager.SetLuaFileBytesDict(fileBytesDict);
                    }
                        );
                }
            }
            else if (m_Step == 2)
            {
            }
            else if (m_Step == 3)
            {
                if (m_LuaFileResIndex != -1)
                {
                    BundleAssetLoader.UnLoad(m_LuaFileResIndex);
                }
                m_Step = 4;
            }
            else if (m_Step == 4)
            {
                GameCenter.s_GameFlowManager.GameFlowFsm.ChangeState(GameFlowManager.GameFlowState.LuaLoop);
            }
        }