public void LoadTexture(string path, string default_path, TextureLoadedCallBack textureLoaded, ResourceType resType = ResourceType.RT_TEXTURE_PNG) { string filePath = GameInfo.FilePath + path; if (resType == ResourceType.RT_TEXTURE_PNG) { filePath += ".png"; } else { filePath += ".jpg"; } bool loaded = false; Texture2D tex = ResourceMgr.Instance.LoadRes <Texture2D>(path); if (textureLoaded != null) { textureLoaded(tex); } if (tex != null || path.Equals(default_path)) { return; } if (!mCallBackTable.ContainsKey(path)) { DownLoader.Instance.Request(path, resType, ThreadPriority.Normal); mCallBackTable.Add(path, new List <TextureLoadedCallBack>()); } mCallBackTable[path].Add(textureLoaded); ProcessManager.Add(Instance); }
public void LoadIconByName(string picName, TextureLoadedCallBack textureLoaded) { if (string.IsNullOrEmpty(picName)) { return; } LoadTexture("Texture/Icon/" + picName, "Texture/Icon/0", textureLoaded); }
public void LoadIconByPicID(int pid, TextureLoadedCallBack textureLoaded) { LoadTexture("Texture/Icon/" + pid, "Texture/Icon/0", textureLoaded); }