public void Init(bool resourceLoadMode, string resRootDir) { _succCallbacks = new Dictionary <Resource, List <ResourceHandler> >(); _failCallbacks = new Dictionary <Resource, List <ResourceHandler> >(); _mapRes = new Dictionary <string, Resource>(); _resLoader = ResourceLoader.GetResLoader(this.gameObject); _resLoader.OnDone += OnResourceDone; ResourcesLoadMode = resourceLoadMode; ResourceFileUtil resUtil = gameObject.AddComponentOnce <ResourceFileUtil>(); _resRootDir = resRootDir; resUtil.Init(resRootDir); _assetBundleFile = gameObject.AddComponentOnce <AssetBundleFile>(); }
public void Init(bool directLoadMode, string resRootDir) { _resRootDir = resRootDir; Resource.BundlePreRootDir = _resRootDir.EndsWith("/") ? _resRootDir.ToLower() : (_resRootDir + "/").ToLower(); //根据传入的目录判断是直接用Resources.Load还是外部加载 _dirInResources = _resRootDir == "Assets/Resources"; _succCallbacks = new Dictionary <Resource, List <ResourceHandlerStruct> >(); _failCallbacks = new Dictionary <Resource, List <ResourceHandlerStruct> >(); _mapRes = new Dictionary <string, Resource>(); _resLoader = ResourceLoader.GetResLoader(this.gameObject); _resLoader.OnDone += OnResourceDone; DirectLoadMode = directLoadMode; ResourceFileUtil resUtil = gameObject.AddComponentOnce <ResourceFileUtil>(); resUtil.Init(resRootDir); _assetBundleFile = gameObject.AddComponentOnce <AssetBundleFile>(); }
private void OnDestroy() { _resUtil = null; }
private void Awake() { _resUtil = gameObject.AddComponentOnce <ResourceFileUtil>(); }
protected virtual void OnDestroy() { _resUtil = null; }