protected virtual bool InternalDestroyResource(ResKey key, ResValue res) { if (key.resType == typeof(Sprite)) { if (res.obj != null) { Resources.UnloadAsset(res.obj); } } else if (key.resType == typeof(Sprite[])) { if (res.objs != null) { for (int i = 0; i < res.objs.Length; ++i) { UnityEngine.Object obj = res.objs[i]; if (obj != null) { Resources.UnloadAsset(obj); } } } } return(true); }
public static ResValue Create() { InitPool(); ResValue ret = m_Pool.GetObject(); return(ret); }
protected bool FindResValue(UnityEngine.Object target, System.Type resType, out ResValue value, string resName = "") { value = null; if (target == null) { return(false); } return(FindResValue(target.GetInstanceID(), resType, out value, resName)); }
protected bool FindResValue(ResKey key, out ResValue value) { value = null; if (m_ResMap == null) { return(false); } return(m_ResMap.TryGetValue(key, out value)); }
protected ResValue CreateValue(UnityEngine.Object[] objs, string tag = "") { ResValue ret = ResValue.Create(); ret.obj = null; ret.objs = objs; ret.tag = tag; return(ret); }
private static void InPool(ResValue obj) { if (obj == null) { return; } InitPool(); obj.Reset(); m_Pool.Store(obj); }
protected void SetResources(int instanceId, UnityEngine.Object[] res, System.Type resType, string resName = "", string tag = "") { ResKey key = CreateKey(instanceId, resType, resName); DestroyResource(key); if (res == null) { return; } CheckResMap(); CheckVisible(); ResValue value = CreateValue(res, tag); m_ResMap.Add(key, value); }
protected bool FindResValue(int instanceId, System.Type resType, out ResValue value, string resName = "") { ResKey key = CreateKey(instanceId, resType, resName); return(FindResValue(key, out value)); }
protected virtual bool InternalDestroyResource(ResKey key, ResValue res) { return(true); }