static public void CreatUIRoot() { GameObject root = GameObject.Instantiate(AssetLoad.LoadUI("UIRoot")) as GameObject; GameObject.DontDestroyOnLoad(root); root.name = "UIRoot"; }
private void LoadResource() { string temp = this.GetType().Name; string prefabName = StringUtil.StringBuild("Win_", temp.Substring(0, temp.Length - 3)); panel = GameObject.Instantiate(AssetLoad.LoadUI(prefabName)) as GameObject; panel.name = temp; }
// Use this for initialization void Awake() { Instance = this; mLocalResRootPath = Application.persistentDataPath + "/AssetBundle/StandaloneWindow"; mAssetsABDic = new Dictionary <string, AssetsBundleData>(); StartCoroutine(SetMD5AssetsList()); }
public void onLoadCompleted(AssetLoad dl) { currLoadings -= 1; if (dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE) { loadingbar.loadingbar_currValue += 1; Common.DEBUG_MSG("loadingbar_currValue=" + loadingbar.loadingbar_currValue); for (int i = 0; i < before_loads.Count; i++) { if (before_loads[i] == dl) { before_loads.RemoveAt(i); break; } } if (before_loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_BEFORE!"); } } else if (dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER) { for (int i = 0; i < after_loads.Count; i++) { if (after_loads[i] == dl) { after_loads.RemoveAt(i); break; } } if (after_loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_AFTER!"); } } else { for (int i = 0; i < loads.Count; i++) { if (loads[i] == dl) { loads.RemoveAt(i); break; } } if (loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: NORMAL!"); } } loadNext(); }
static void LoadConfig(string fileName, Action <string> callback) { Count += 1; var addressableName = StringUtil.Contact("Txt/", fileName); AssetLoad.LoadAsync <TextAsset>(addressableName, asset => { var textAsset = asset.asset as TextAsset; callback?.Invoke(textAsset.text); }); }
private void InitResManger() { AssetLoad l = null; #if UNITY_EDITOR l = new AssetLoadEditor(); #else l = new AssetLoadRun(); #endif ResourceManger.SetLoadObj(this, l); ResourceManger.InitCache(); }
public bool stop(bool isAllUnLoadLevel) { // loader_.StopAllCoroutines(); for (int i = 0; i < before_loads.Count; i++) { AssetLoad load = before_loads[i]; if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL) { continue; } if (load.loading == true) { load.stop(); break; } } for (int i = 0; i < after_loads.Count; i++) { AssetLoad load = after_loads[i]; if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL) { continue; } if (load.loading == true) { load.stop(); break; } } for (int i = 0; i < loads.Count; i++) { AssetLoad load = loads[i]; if (isAllUnLoadLevel == false && load.asset.unloadLevel != Asset.UNLOAD_LEVEL.LEVEL_NORMAL) { continue; } if (load.loading == true) { load.stop(); break; } } isLoading = false; return(true); }
public AssetLoad addLoad(Asset a) { //if(a.bundle != null || a.isLoaded == true) if ((!(System.Object.ReferenceEquals(a.bundle, null))) || a.isLoaded == true) { Common.DEBUG_MSG("LoadAssetsPool::addLoad:" + a.source + ", bundle != null(" + a.bundle + ") or isLoaded(" + a.isLoaded + ")!"); return(null); } if (findLoad(a.source) != null) { Common.DEBUG_MSG("LoadAssetsPool::addLoad: findLoad(" + a.source + ") = true!"); return(null); } AssetLoad load = null; if (a.type == Asset.TYPE.SKYBOX) { load = new AssetLoadSkybox(loader_, this, a); } else if (a.type == Asset.TYPE.TERRAIN) { load = new AssetLoadTerrain(loader_, this, a); } else if (a.type == Asset.TYPE.TERRAIN_DETAIL_TEXTURE) { load = new AssetLoadTerrain(loader_, this, a); } else if (a.type == Asset.TYPE.TERRAIN_TREE) { load = new AssetLoadTerrain(loader_, this, a); } else if (a.type == Asset.TYPE.WORLD_OBJ) { load = new AssetLoad(loader_, this, a); } else { load = new AssetLoad(loader_, this, a); } add(load); return(load); }
private void TryOpen(string windowName) { if (windows.ContainsKey(windowName)) { var window = windows[windowName]; if (window.state == WindowState.Closed) { window.Open(); } } else { openingList.Add(windowName); var addressableName = StringUtil.Contact("Windows/", windowName); AssetLoad.LoadAsync <GameObject>(addressableName, asset => { OnLoadedWindow(windowName, asset.asset as GameObject); }); } }
private void OnLoadedWindow(string windowName, GameObject go) { if (openingList.Contains(windowName)) { openingList.Remove(windowName); go.transform.SetParent(uiRoot); var window = go.GetComponent <Window>(); var canvas = go.GetComponent <Canvas>(); canvas.worldCamera = uiCamera; windows.Add(windowName, window); window.Open(); } else { var addressableName = StringUtil.Contact("Windows/", windowName); AssetLoad.Release(addressableName, go); } }
public void add(AssetLoad load) { // Common.DEBUG_MSG("LoadAssetsPool::add: " + load.asset.source + ", loadlevel=" + load.asset.loadLevel + "!"); switch (load.asset.loadLevel) { case Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE: before_loads.Add(load); loadingbar.loadingbar_maxValue += 1; break; case Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER: after_loads.Add(load); break; case Asset.LOAD_LEVEL.LEVEL_SCRIPT_DYNAMIC: // after_loads.Add(load); break; default: loads.Add(load); break; } ; }
public void onLoadCompleted(AssetLoad dl) { currLoadings -= 1; if(dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE) { loadingbar.loadingbar_currValue += 1; Common.DEBUG_MSG("loadingbar_currValue=" + loadingbar.loadingbar_currValue); for(int i=0; i<before_loads.Count; i++) { if(before_loads[i] == dl) { before_loads.RemoveAt(i); break; } } if(before_loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_BEFORE!"); } } else if(dl.asset.loadLevel == Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER) { for(int i=0; i<after_loads.Count; i++) { if(after_loads[i] == dl) { after_loads.RemoveAt(i); break; } } if(after_loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: ENTER_AFTER!"); } } else { for(int i=0; i<loads.Count; i++) { if(loads[i] == dl) { loads.RemoveAt(i); break; } } if(loads.Count == 0) { Common.DEBUG_MSG("LoadAssetsPool::onLoadCompleted: NORMAL!"); } } loadNext(); }
public static void SetLoadObj(MonoBehaviour fac, AssetLoad load) { g_AssetLoad = load; g_asyncGo = fac; }
public void Awake() { Instance = this; }
public static void CreateUIRoot() { GameObject go = Instantiate(AssetLoad.LoadUI("UIRoot")); go.name = "UIRoot"; }
public AssetLoad addLoad(Asset a) { if(a.bundle != null || a.isLoaded == true) { Common.DEBUG_MSG("LoadAssetsPool::addLoad:" + a.source + ", bundle != null(" + a.bundle + ") or isLoaded(" + a.isLoaded + ")!"); return null; } if(findLoad(a.source) != null) { Common.DEBUG_MSG("LoadAssetsPool::addLoad: findLoad("+ a.source + ") = true!"); return null; } AssetLoad load = null; if(a.type == Asset.TYPE.SKYBOX) { load = new AssetLoadSkybox(loader_, this, a); } else if(a.type == Asset.TYPE.TERRAIN) { load = new AssetLoadTerrain(loader_, this, a); } else if(a.type == Asset.TYPE.TERRAIN_DETAIL_TEXTURE) { load = new AssetLoadTerrain(loader_, this, a); } else if(a.type == Asset.TYPE.TERRAIN_TREE) { load = new AssetLoadTerrain(loader_, this, a); } else if(a.type == Asset.TYPE.WORLD_OBJ) { load = new AssetLoad(loader_, this, a); } else { load = new AssetLoad(loader_, this, a); } add(load); return load; }
public void erase(Asset.TYPE type, bool removeAllOther) { while (true) { for (int i = 0; i < before_loads.Count; i++) { AssetLoad load = before_loads[i]; if ((load.asset.type == type) != removeAllOther) { if (load.loading == true) { load.stop(); } before_loads.RemoveAt(i); break; } } break; } while (true) { for (int i = 0; i < after_loads.Count; i++) { AssetLoad load = after_loads[i]; if ((load.asset.type == type) != removeAllOther) { if (load.loading == true) { load.stop(); } after_loads.RemoveAt(i); break; } } break; } while (true) { for (int i = 0; i < loads.Count; i++) { AssetLoad load = loads[i]; if ((load.asset.type == type) != removeAllOther) { if (load.loading == true) { load.stop(); } loads.RemoveAt(i); break; } } break; } }
public void eraseByUNLoadLevel(Asset.UNLOAD_LEVEL level, bool removeAllOther) { while (true) { for (int i = 0; i < before_loads.Count; i++) { AssetLoad load = before_loads[i]; if ((load.asset.unloadLevel == level) != removeAllOther) { if (load.loading == true) { load.stop(); } before_loads.RemoveAt(i); break; } } break; } while (true) { for (int i = 0; i < after_loads.Count; i++) { AssetLoad load = after_loads[i]; if ((load.asset.unloadLevel == level) != removeAllOther) { if (load.loading == true) { load.stop(); } after_loads.RemoveAt(i); break; } } break; } while (true) { for (int i = 0; i < loads.Count; i++) { AssetLoad load = loads[i]; if ((load.asset.unloadLevel == level) != removeAllOther) { if (load.loading == true) { load.stop(); } loads.RemoveAt(i); break; } } break; } }
public void add(AssetLoad load) { // Common.DEBUG_MSG("LoadAssetsPool::add: " + load.asset.source + ", loadlevel=" + load.asset.loadLevel + "!"); switch(load.asset.loadLevel) { case Asset.LOAD_LEVEL.LEVEL_ENTER_BEFORE: before_loads.Add(load); loadingbar.loadingbar_maxValue += 1; break; case Asset.LOAD_LEVEL.LEVEL_ENTER_AFTER: after_loads.Add(load); break; case Asset.LOAD_LEVEL.LEVEL_SCRIPT_DYNAMIC: // after_loads.Add(load); break; default: loads.Add(load); break; }; }