public List <AssetReferenceMeta> GetAssociatedResourcesMeta(System.Type InType) { if ((InType != typeof(BaseEvent)) && !InType.IsSubclassOf(typeof(BaseEvent))) { return(null); } List <AssetReferenceMeta> list = null; if (!this.Repositories.TryGetValue(InType, out list)) { list = new List <AssetReferenceMeta>(); this.Repositories.Add(InType, list); for (System.Type type = InType; (type == typeof(BaseEvent)) || type.IsSubclassOf(typeof(BaseEvent)); type = type.BaseType) { FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance); if (fields != null) { for (int i = 0; i < fields.Length; i++) { FieldInfo element = fields[i]; AssetReference customAttribute = Attribute.GetCustomAttribute(element, typeof(AssetReference)) as AssetReference; if (customAttribute != null) { AssetReferenceMeta item = new AssetReferenceMeta { MetaFieldInfo = element, Reference = customAttribute }; list.Add(item); } } } } } return(list); }
public virtual void GetAssociatedResources(Dictionary <object, AssetRefType> results, int markID) { Type type = base.GetType(); Type typeFromHandle = typeof(string); Type typeFromHandle2 = typeof(int); Type typeFromHandle3 = typeof(uint); List <AssetReferenceMeta> associatedResourcesMeta = Singleton <ActionMetaRepository> .instance.GetAssociatedResourcesMeta(type); if (associatedResourcesMeta != null) { for (int i = 0; i < associatedResourcesMeta.get_Count(); i++) { AssetReferenceMeta assetReferenceMeta = associatedResourcesMeta.get_Item(i); switch (assetReferenceMeta.Reference.RefType) { case AssetRefType.Action: case AssetRefType.Prefab: case AssetRefType.Particle: case AssetRefType.Sound: if (assetReferenceMeta.MetaFieldInfo.get_FieldType() == typeFromHandle) { string text = assetReferenceMeta.MetaFieldInfo.GetValue(this) as string; if (text != null && text.get_Length() > 0 && !results.ContainsKey(text)) { results.Add(text, assetReferenceMeta.Reference.RefType); } } break; case AssetRefType.SkillID: case AssetRefType.SkillCombine: case AssetRefType.MonsterConfigId: case AssetRefType.CallActorConfigId: if (assetReferenceMeta.MetaFieldInfo.get_FieldType() == typeFromHandle2 || assetReferenceMeta.MetaFieldInfo.get_FieldType() == typeFromHandle3) { object value = assetReferenceMeta.MetaFieldInfo.GetValue(this); int num = (int)value; if (num != 0) { ulong num2 = (ulong)((ulong)((long)assetReferenceMeta.Reference.RefType) << 32); ulong num3 = (ulong)((long)num | (long)num2); if (!results.ContainsKey(num3)) { results.Add(num3, assetReferenceMeta.Reference.RefType); } } } break; } } } }
public virtual void GetAssociatedResources(Dictionary <object, AssetRefType> results, int markID) { System.Type inType = base.GetType(); System.Type type2 = typeof(string); System.Type type3 = typeof(int); System.Type type4 = typeof(uint); List <AssetReferenceMeta> associatedResourcesMeta = Singleton <ActionMetaRepository> .instance.GetAssociatedResourcesMeta(inType); if (associatedResourcesMeta != null) { for (int i = 0; i < associatedResourcesMeta.Count; i++) { AssetReferenceMeta meta = associatedResourcesMeta[i]; switch (meta.Reference.RefType) { case AssetRefType.Action: case AssetRefType.Prefab: case AssetRefType.Particle: case AssetRefType.Sound: if (meta.MetaFieldInfo.FieldType == type2) { string key = meta.MetaFieldInfo.GetValue(this) as string; if (((key != null) && (key.Length > 0)) && !results.ContainsKey(key)) { results.Add(key, meta.Reference.RefType); } } break; case AssetRefType.SkillID: case AssetRefType.SkillCombine: case AssetRefType.MonsterConfigId: if ((meta.MetaFieldInfo.FieldType == type3) || (meta.MetaFieldInfo.FieldType == type4)) { object obj2 = meta.MetaFieldInfo.GetValue(this); if ((((int)obj2) != 0) && !results.ContainsKey(obj2)) { results.Add(obj2, meta.Reference.RefType); } } break; } } } }
public virtual Dictionary <string, bool> GetAssociatedResources() { Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); Type type = base.GetType(); Type typeFromHandle = typeof(string); List <AssetReferenceMeta> associatedResourcesMeta = Singleton <ActionMetaRepository> .get_instance().GetAssociatedResourcesMeta(type); if (associatedResourcesMeta != null) { for (int i = 0; i < associatedResourcesMeta.get_Count(); i++) { AssetReferenceMeta assetReferenceMeta = associatedResourcesMeta.get_Item(i); if (assetReferenceMeta.MetaFieldInfo.get_FieldType() == typeFromHandle) { dictionary.Add(assetReferenceMeta.MetaFieldInfo.GetValue(this) as string, true); } } } return(dictionary); }
public virtual Dictionary <string, bool> GetAssociatedResources() { Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); System.Type inType = base.GetType(); System.Type type2 = typeof(string); List <AssetReferenceMeta> associatedResourcesMeta = Singleton <ActionMetaRepository> .instance.GetAssociatedResourcesMeta(inType); if (associatedResourcesMeta != null) { for (int i = 0; i < associatedResourcesMeta.Count; i++) { AssetReferenceMeta meta = associatedResourcesMeta[i]; if (meta.MetaFieldInfo.FieldType == type2) { dictionary.Add(meta.MetaFieldInfo.GetValue(this) as string, true); } } } return(dictionary); }
public List <AssetReferenceMeta> GetAssociatedResourcesMeta(Type InType) { if (InType != typeof(BaseEvent) && !InType.IsSubclassOf(typeof(BaseEvent))) { return(null); } List <AssetReferenceMeta> list = null; if (this.Repositories.TryGetValue(InType, out list)) { return(list); } list = new List <AssetReferenceMeta>(); this.Repositories.Add(InType, list); Type type = InType; while (type == typeof(BaseEvent) || type.IsSubclassOf(typeof(BaseEvent))) { FieldInfo[] fields = type.GetFields(20); if (fields != null) { for (int i = 0; i < fields.Length; i++) { FieldInfo fieldInfo = fields[i]; AssetReference assetReference = Attribute.GetCustomAttribute(fieldInfo, typeof(AssetReference)) as AssetReference; if (assetReference != null) { AssetReferenceMeta assetReferenceMeta = default(AssetReferenceMeta); assetReferenceMeta.MetaFieldInfo = fieldInfo; assetReferenceMeta.Reference = assetReference; list.Add(assetReferenceMeta); } } } type = type.get_BaseType(); } return(list); }