private void Awake() { var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(ISkillEventEditor)))) .ToArray(); eventDesDict.Clear(); foreach (Type t in types) { SkillEventAttribute attribute = (SkillEventAttribute)t.GetCustomAttribute(typeof(SkillEventAttribute)); eventDesDict.Add(attribute.Name, attribute.Des); } }
private void ShowEventList() { foreach (Type t in this._types) { SkillEventAttribute attribute = (SkillEventAttribute)t.GetCustomAttribute(typeof(SkillEventAttribute)); if (GUILayout.Button("EventName:" + attribute.Name + " " + attribute.Des)) { SkillEvent se = new SkillEvent(); se.EventName = attribute.Name; se.FrameId = this._curFrame; this._curBlock.Events.Insert(0, se); this.Close(); } } }
public static Type GetTypeBySEAttributeName(string name) { var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(ISkillEventEditor)))) .ToArray(); foreach (Type t in types) { SkillEventAttribute attribute = (SkillEventAttribute)t.GetCustomAttribute(typeof(SkillEventAttribute)); if (attribute != null && attribute.Name == name) { return(t); } } return(null); }
public static Dictionary <string, SkillEditorData> GetSkillEditorDict() { var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(ISkillEventEditor)))) .ToArray(); Dictionary <string, SkillEditorData> dict = new Dictionary <string, SkillEditorData>(); foreach (Type t in types) { SkillEventAttribute attribute = (SkillEventAttribute)t.GetCustomAttribute(typeof(SkillEventAttribute)); SkillEditorData data = new SkillEditorData(); data.classdata = t; data.attr = attribute; dict.Add(attribute.Name, data); } return(dict); }