// PUBLIC STATIC /// <summary> /// Determines whether this instance is AUMOM compatible manager mono script the specified aMonoScript. /// </summary> /// <returns> /// <c>true</c> if this instance is AUMOM compatible manager mono script the specified aMonoScript; otherwise, <c>false</c>. /// </returns> /// <param name='aMonoScript'> /// If set to <c>true</c> a mono script. /// </param> public static bool IsCompatibleManagerMonoScript(MonoScript aMonoScript) { Object[] allValidScriptableObjects = EditorWindowUtility.GetAllObjectsBySuperClassAndInterface(typeof(BaseManager)); // MonoScript scriptableObject_monoscript; //FIND THE SCRIPTABLE OBJECT THAT MATCHES THE MONOSCRIPT foreach (ScriptableObject scriptableObject in allValidScriptableObjects) { //Debug.Log (" valid: " + scriptableObject); scriptableObject_monoscript = MonoScript.FromScriptableObject(scriptableObject); //Debug.Log (" CHECKING2 : " + scriptableObject_monoscript.GetClass().FullName + " , " + aMonoScript.GetClass().FullName); if (scriptableObject_monoscript.GetClass().FullName == aMonoScript.GetClass().FullName) { // Debug.Log (" FOUND: " + aMonoScript); break; } } return(aMonoScript.name.StartsWith("M") == true); }
public void _doLayoutScriptablesTable() { /////////////////////////////////////////////////////////////////// //MAKE THE TABLE ITEMS /////////////////////////////////////////////////////////////////// List <MonoScript> monoScriptsOfBaseManager = EditorWindowUtility.GetAllAssetMonoScriptsBySuperClassAndInterface(typeof(BaseManager)).ToList(); /* * Debug.Log ("ALL MONOSCRIPTS (MANY)" + monoScriptsOfBaseManager.Count); * foreach (MonoScript monoScript in monoScriptsOfBaseManager) { * * Debug.Log (" ms: " + monoScript.name); * * } */ List <ScriptableObject> scriptableObjectsOfBaseManager = EditorWindowUtility.GetAllObjectsBySuperClassAndInterface(typeof(BaseManager)).Cast <ScriptableObject>().ToList(); //Debug.Log ("ALL SCRIPTABLES (LESS) " + scriptableObjectsOfBaseManager.Count); foreach (ScriptableObject scriptableObject in scriptableObjectsOfBaseManager) { //Debug.Log (" so: " + scriptableObject); } //***************************************************** //***************************************************** //** HELP BOX //***************************************************** //***************************************************** //***************************************************** EditorGUI.indentLevel++; EditorGUILayout.HelpBox("Compatible? Your project has " + monoScriptsOfBaseManager.Count + " MonoScripts and " + scriptableObjectsOfBaseManager.Count + " ScriptableObjects", MessageType.Info); EditorGUI.indentLevel--; //EditorGUILayout.LabelField ("Scripts"); EditorGUI.indentLevel++; /////////////////////////////////////////////////////////////////// //MAKE THE TABLE HEADER /////////////////////////////////////////////////////////////////// // GUILayoutOption[] header1GUILayoutOptions = new GUILayoutOption[2]; header1GUILayoutOptions[0] = GUILayout.MaxWidth(250); header1GUILayoutOptions[1] = GUILayout.MinWidth(250); // GUILayoutOption[] header2GUILayoutOptions = new GUILayoutOption[2]; header2GUILayoutOptions[0] = GUILayout.MaxWidth(80); header2GUILayoutOptions[1] = GUILayout.MinWidth(80); // GUILayoutOption[] header3GUILayoutOptions = new GUILayoutOption[2]; header3GUILayoutOptions[0] = GUILayout.MaxWidth(80); header3GUILayoutOptions[1] = GUILayout.MinWidth(80); // GUILayoutOption[] header4GUILayoutOptions = new GUILayoutOption[2]; header4GUILayoutOptions[0] = GUILayout.MaxWidth(100); header4GUILayoutOptions[1] = GUILayout.MinWidth(100); // /// EditorGUILayout.BeginHorizontal(); EditorGUILayout.TextArea("NAME", EditorStyles.label, header1GUILayoutOptions); EditorGUILayout.TextArea("[STATUS]", EditorStyles.label, header2GUILayoutOptions); EditorGUILayout.TextArea("OPTION", EditorStyles.label, header3GUILayoutOptions); EditorGUILayout.TextArea("UPDATE()?", EditorStyles.label, header4GUILayoutOptions); EditorGUILayout.EndHorizontal(); //***************************************************** //***************************************************** //** LIST OF MANAGER CANDIDATES //***************************************************** //***************************************************** UMOMManagerCandidate managerCandidate; //SORT ALPHABETICALLY (MANUAL SORT NEEDED BECAUSE OUR LIST IS A GENERIC, I THINK) monoScriptsOfBaseManager.Sort ( delegate(MonoScript monoScript1, MonoScript monoScript2) { return(monoScript1.name.CompareTo(monoScript2.name)); } ); //LIST OUT foreach (MonoScript monoScript in monoScriptsOfBaseManager) { managerCandidate = UMOMManagerCandidate.FromMonoScriptAsset(monoScript, scriptableObjectsOfBaseManager, _managers_serializedproperty); managerCandidate.doLayoutGUI(); } //_getEditorPopupForIManagerScripts(); //EditorGUI.indentLevel --; // //EditorGUILayout.LabelField ("Assets"); //EditorGUI.indentLevel ++; //_getEditorPopupForIManagerAssets(); EditorGUI.indentLevel--; }