Ejemplo n.º 1
0
 protected override void OnUnload(bool all)
 {
     if (Bundle != null)
     {
         DLCManager.UnloadBundle(Bundle, all);
     }
 }
Ejemplo n.º 2
0
 internal Asset(string bundleName, string assetName, System.Type type)
 {
     this.AssetName      = assetName;
     this.BundleName     = bundleName;
     this.AssetFullPath  = DLCManager.GetAssetPath(bundleName, assetName);
     this.Mapkey         = bundleName + assetName;
     this.RealBundleName = DLCManager.GetBundleName(AssetFullPath);
     this.DlcName        = DLCManager.GetDLCName(bundleName, assetName);
     AssetType           = type;
 }
Ejemplo n.º 3
0
        protected override void OnLoad()
        {
#if UNITY_EDITOR
            if (DLCConfig.Ins.IsEditorMode)
            {
                Object = UnityEditor.AssetDatabase.LoadAssetAtPath(AssetFullPath, AssetType);
                return;
            }
#endif
            {
                Bundle    = DLCManager.LoadBundle(RealBundleName, DlcName, true);
                loadState = LoadStateType.Loading;
                loadCount = 0;
            }
        }
Ejemplo n.º 4
0
        public DLCManifest GetManifestFile()
        {
            DLCManifest reader = null;

            if (DLCConfig.Ins.IsEditorOrConfigMode)
            {
                reader = FileUtil.LoadJson <DLCManifest>(GetManifest());
            }
            else
            {
                var asset = DLCManager.LoadRawAsset <TextAsset>(Const.BN_Config, "DLCManifest", this);
                if (asset != null)
                {
                    reader = JsonUtility.FromJson <DLCManifest>(asset.text);
                }
            }
            return(reader);
        }
Ejemplo n.º 5
0
 public byte[] GetExcelFile(string name)
 {
     if (DLCConfig.Ins.IsEditorOrConfigMode)
     {
         string file = GetExcel(name);
         if (File.Exists(file))
         {
             return(File.ReadAllBytes(file));
         }
     }
     else
     {
         var asset = DLCManager.LoadRawAsset <TextAsset>(Const.BN_Excel, name, this);
         if (asset != null)
         {
             return(asset.bytes);
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
        protected override void OnLoad()
        {
#if UNITY_EDITOR
            if (DLCConfig.Ins.IsEditorMode)
            {
                Object = UnityEditor.AssetDatabase.LoadAssetAtPath(AssetFullPath, AssetType);
                return;
            }
#endif
            {
                Bundle = DLCManager.LoadBundle(RealBundleName, DlcName);
                if (Bundle == null)
                {
                    if (DLCManager.IsNextLogError)
                    {
                        CLog.Error("没有这个Bundle,错误的realBundleName:{0} dlcName:{1}", RealBundleName, DlcName);
                    }
                    return;
                }
                Object = Bundle.LoadAsset(AssetName, AssetType);
            }
        }
Ejemplo n.º 7
0
        protected override void OnLoad()
        {
#if UNITY_EDITOR
            if (DLCConfig.Ins.IsEditorMode)
            {
                asyncOperation = EditorSceneManager.LoadSceneAsyncInPlayMode(AssetFullPath, new LoadSceneParameters(LoadSceneMode.Additive, LocalPhysicsMode.None));
                loadState      = LoadStateType.Loading;
                loadCount      = 0;
                return;
            }
#endif
            {
                Bundle = DLCManager.LoadBundle(RealBundleName, DlcName, true);
                if (Bundle == null)
                {
                    CLog.Error($"无法加载场景Bundle!!{RealBundleName}:{DlcName}");
                }
                else
                {
                }
                loadState = LoadStateType.Loading;
                loadCount = 0;
            }
        }