private static void Start() { ActionSyncWindow w = GetWindow <ActionSyncWindow>(false); Type t = UnityEditorReflectionTool.GetEditorWindow("AnimationWindow"); w.titleContent = UnityEditorReflectionTool.TextContentWithIcon("ActionSync", t.ToString()); }
private IEnumerator CollectExports() { if (exports == null) { exports = new List <Type>(); IEnumerable <Assembly> assemblies = UnityEditorReflectionTool.GetCustomAssembles().ToArray(); int count = 0; int total = assemblies.Count(); foreach ( IEnumerable <Type> types in assemblies.Select(a => a.GetTypes()).Select(ts => ts.Where(t => t.IsClass || t.IsEnum))) { foreach (Type t in from t in types let attributes = t.GetCustomAttributes(typeof(LuaExportAttribute), false) where attributes.Length != 0 select t) { exports.Add(t); } EditorUtility.DisplayProgressBar("Collecting", "Collect Types", (float)count / total); count++; yield return(null); } } }
private static void BuildConsole() { if (_consoleType == null) { _consoleType = UnityEditorReflectionTool.GetTypeInEditor("ConsoleWindow"); _consoleField = _consoleType.GetField("ms_ConsoleWindow", BindingFlags.Static | BindingFlags.NonPublic); _fieldListViewState = _consoleType.GetField("m_ListView", BindingFlags.Instance | BindingFlags.NonPublic); // _typeListViewState = UnityEditorReflectionTool.GetTypeInEditor("ListViewState"); _fieldActiveText = _consoleType.GetField("m_ActiveText", BindingFlags.Instance | BindingFlags.NonPublic); } }
private void CollectTypes() { AppendUsing(typeof(CpxMachineFactory)); AppendUsing(typeof(MachineType)); IEnumerable <Assembly> assembles = UnityEditorReflectionTool.GetCustomAssembles(); foreach (Assembly a in assembles) { Type[] ts = a.GetTypes(); IEnumerable <Type> types = ts.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(CpxCore))); foreach (var t in types) { CpxActionAttribute act = GetAttribute <CpxActionAttribute>(t); if (act != null) { if (!t.IsSubclassOf(typeof(CpxAction))) { Debug.LogError(t.Name + " is not for CpxAction"); continue; } if (_actions.ContainsKey(act.actionName)) { throw new Exception(string.Format("action: key = {0} occupied by {1}", act.actionName, _actions[act.actionName])); } _actions.Add(act.actionName, t); AppendUsing(t); } CpxConditionAttribute con = GetAttribute <CpxConditionAttribute>(t); if (con != null) { if (!t.IsSubclassOf(typeof(CpxCondition))) { Debug.LogError(t.Name + " is not for CpxCondition"); continue; } if (_conditions.ContainsKey(con.conditionName)) { throw new Exception(string.Format("condition: key = {0} occupied by {1}", con.conditionName, _conditions[con.conditionName])); } _conditions.Add(con.conditionName, t); AppendUsing(t); } } } }
private void CollectTypes() { IEnumerable <Assembly> assembles = UnityEditorReflectionTool.GetCustomAssembles(); foreach (var a in assembles) { Type[] ts = a.GetTypes(); IEnumerable <Type> types = ts.Where(t => t.IsClass && !t.IsAbstract); foreach (var t in types) { if (IsSupportedTypes(t) && !_types.Contains(t)) { _types.Add(t); AppendUsing(t); } } } }
private void CollectTypes() { AppendUsing(typeof(TreeFactory)); IEnumerable <Assembly> assembles = UnityEditorReflectionTool.GetCustomAssembles(); foreach (var a in assembles) { Type[] ts = a.GetTypes(); IEnumerable <Type> types = ts.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(TreeCore))); foreach (var t in types) { TreeAttribute act = GetAttribute <TreeAttribute>(t); if (act != null) { _treeTypes.Add(act.type, t); AppendUsing(t); } } } }
public static void Register() { IEnumerable <Assembly> assembles = UnityEditorReflectionTool.GetCustomAssembles().ToArray(); foreach (var a in assembles) { Type[] ts = a.GetTypes(); IEnumerable <Type> types = ts.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(MonoBehaviour))); foreach (var t in types) { object[] attributes = t.GetCustomAttributes(typeof(MonoDllAttribute), false); if (attributes.Length == 0) { continue; } MonoDllAttribute att = attributes[0] as MonoDllAttribute; if (att != null) { MonoDllFactory.Register(att.name, t); } } } }