public void LoadTexture(string path) { if (m_RawImage == null) { return; } m_RawImage.texture = null; if (m_AutoHide) { m_RawImage.enabled = false; } if (m_ResLoader != null) { m_ResLoader.ReleaseAllRes(); } m_TexturePath = path; if (string.IsNullOrEmpty(m_TexturePath)) { return; } if (m_ResLoader == null) { m_ResLoader = ResLoader.Allocate("AyncTexture"); } m_ResLoader.Add2Load(m_TexturePath, OnResLoadFinish); m_ResLoader.LoadAsync(); }
private void LoadNextPanelRes() { if (m_NextPanelResLoader != null) { m_NextPanelResLoader.ReleaseAllRes(); } else { m_NextPanelResLoader = ResLoader.Allocate("SwitchAnimPanel"); } if (m_OpenParam.nextPanelUIID < 0) { OnNextPanelResLoadFinish(); } UIData data = UIDataTable.Get(m_OpenParam.nextPanelUIID); if (data == null) { return; } UIMgr.CollectDynamicResource(data, m_NextPanelResLoader, m_OpenParam.args); m_NextPanelResLoader.Add2Load(data.fullPath); m_NextPanelResLoader.LoadAsync(OnNextPanelResLoadFinish); }
private static AppConfig LoadInstance() { ResLoader loader = ResLoader.Allocate("AppConfig", null); UnityEngine.Object obj = loader.LoadSync(ProjectPathConfig.appConfigPath); if (obj == null) { Log.w("Not Find App Config, Will Use Default App Config."); loader.ReleaseAllRes(); obj = loader.LoadSync(ProjectPathConfig.DEFAULT_APP_CONFIG_PATH); if (obj == null) { Log.e("Not Find Default App Config File!"); loader.Recycle2Cache(); loader = null; return(null); } } //Log.i("Success Load App Config."); s_Instance = obj as AppConfig; AppConfig newAB = GameObject.Instantiate(s_Instance); s_Instance = newAB; loader.Recycle2Cache(); return(s_Instance); }
public bool LoadBuildInSceneSync(string sceneName, LoadSceneMode mode = LoadSceneMode.Single) { if (m_CurrentLoader != null) { m_CurrentLoader.ReleaseAllRes(); m_CurrentLoader.Recycle2Cache(); m_CurrentLoader = null; } try { SceneManager.LoadScene(sceneName, mode); } catch (Exception e) { Log.e("SceneManager LoadBuildInSceneSysn Failed! SceneName:" + sceneName); Log.e(e); return(false); } return(true); }
public void PrepareTransition() { if (m_ResLoader == null) { m_ResLoader = ResLoader.Allocate("FadeInOutAnim"); } else { m_ResLoader.ReleaseAllRes(); } m_ResLoader.Add2Load("SwitchAnimShaderAnim", OnResLoadFinish); m_ResLoader.LoadAsync(); }
public void Load(string sprite) { if (m_SpriteRenderer == null) { return; } if (string.IsNullOrEmpty(sprite)) { return; } if (m_Loader != null) { m_Loader.ReleaseAllRes(); } else { m_Loader = ResLoader.Allocate("AsyncSpriteRenderer"); } m_SpriteName = sprite; m_Loader.Add2Load(sprite, (result, res) => { if (result) { m_SpriteRenderer.sprite = res.asset as Sprite; } }); if (m_IsAsync) { m_Loader.LoadAsync(); } else { m_Loader.LoadSync(); } }