예제 #1
0
        public void Init(string resRootDir)
        {
            ResRootDir = resRootDir;
            if (!ResRootDir.EndsWith("/"))
            {
                ResRootDir += "/";
            }
#if UNITY_EDITOR
            StreamingAssetsPath = Application.dataPath + "/../AssetBundles/" + RunPlatform + "/";   //editor下的streaming就是打包的目录,稍微改了下(并不是工程目录下Streaming下的目录
            ResourceLoadPath    = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/";
            FILE_SYMBOL         = @"file://";
            OUTER_FILE_SYMBOL   = @"file:///";
#elif (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX)
            StreamingAssetsPath = Application.dataPath + "/StreamingAssets/AssetBundles/" + RunPlatform + "/";
            ResourceLoadPath    = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/";
            FILE_SYMBOL         = @"file://";
            OUTER_FILE_SYMBOL   = @"file:///";
#elif UNITY_IOS
            StreamingAssetsPath = Application.dataPath + "/Raw/AssetBundles/" + RunPlatform + "/";
            ResourceLoadPath    = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/";
            FILE_SYMBOL         = "file://";
            OUTER_FILE_SYMBOL   = "file://";
#elif UNITY_ANDROID
            StreamingAssetsPath = Application.dataPath + "!/assets/AssetBundles/" + RunPlatform + "/";
            ResourceLoadPath    = Application.persistentDataPath + "/AssetBundles/" + RunPlatform + "/";
            FILE_SYMBOL         = "jar:file://";
            OUTER_FILE_SYMBOL   = "file://";
#endif

            _resourceMgr    = gameObject.AddComponentOnce <ResourceMgr>();
            _assetBundleMgr = gameObject.AddComponentOnce <AssetBundleMgr>();
        }
예제 #2
0
        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>();

            resUtil.Init(resRootDir);
            _assetBundleMgr = gameObject.AddComponentOnce <AssetBundleMgr>();
        }