protected bool Contains(ResKey key) { if (m_ResMap == null) { return(false); } return(m_ResMap.ContainsKey(key)); }
protected bool FindResValue(ResKey key, out ResValue value) { value = null; if (m_ResMap == null) { return(false); } return(m_ResMap.TryGetValue(key, out value)); }
protected static ResKey CreateKey(int instanceId, System.Type resType, string resName = "") { ResKey ret = new ResKey(); ret.resName = resName; ret.resType = resType; ret.instanceId = instanceId; return(ret); }
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 ExitsResKeyTag <T>(UnityEngine.Object target, string fileName, out T obj) where T : UnityEngine.Object { obj = default(T); if (target == null || string.IsNullOrEmpty(fileName)) { return(false); } ResKey key = CreateKey(target.GetInstanceID(), typeof(T)); ResValue value; if (FindResValue(key, out value)) { if (string.Compare(value.tag, fileName) == 0) { obj = value.obj as T; return(true); } } return(false); }
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 void DestroyResource(int instanceId, System.Type resType, string resName = "") { ResKey key = CreateKey(instanceId, resType, resName); DestroyResource(key); }
protected virtual bool InternalDestroyResource(ResKey key, ResValue res) { return(true); }