public void ShowManagementTab(ScriptableObject _target) { ScriptableObject target = _target; SerializedObject so = new SerializedObject(target); SerializedProperty gameObjectsProperty = so.FindProperty("managementObjects"); // EditorGUILayout.PropertyField(gameObjectsProperty, true); // True means show children //thisWindow.addItem = EditorGUILayout.ObjectField(thisWindow.addItem, typeof(ManagementObject), true); GUILayout.Space(20); managementbarInt = GUILayout.Toolbar(managementbarInt, managementbarStrings); switch (managementbarInt) { // displayed alle scriptable objects case 0: if (thisWindow.managementObjects.Count > 0) { GUILayout.Space(5); orderTypeInt = GUILayout.Toolbar(orderTypeInt, orderTypeString); trelloScroll = EditorGUILayout.BeginScrollView(trelloScroll); foreach (ManagementObject obj in thisWindow.managementObjects.ToArray()) { if (obj?.itemStatus == ManagementStatus.ToDo) { // Saves ordening for the user of the tool if (orderTypeInt == 0) { GetList(obj, true); } else if (orderTypeInt == 1 && obj?.itemType == ManagementType.Mechanic) { GetList(obj, true); } else if (orderTypeInt == 2 && obj?.itemType == ManagementType.Art) { GetList(obj, true); } else if (orderTypeInt == 3 && obj?.itemType == ManagementType.Bug) { GetList(obj, true); } else if (orderTypeInt == 4 && obj?.itemType == ManagementType.UI) { GetList(obj, true); } } } EditorGUILayout.EndScrollView(); } break; // displayed alle voltooide scriptable objects case 1: if (thisWindow.managementObjects.Count > 0) { foreach (ManagementObject obj in thisWindow.managementObjects.ToArray()) { if (obj?.itemStatus == ManagementStatus.Completed) { GetList(obj, false); } } } break; // displayed het tab waar je de scriptable objects kan aanmaken case 2: tempItemName = EditorGUILayout.TextField("Task Name", tempItemName); tempItemManagementtype = (ManagementType)EditorGUILayout.EnumPopup("Task Type", tempItemManagementtype); tempItemDescription = EditorGUILayout.TextField("Task Description", tempItemDescription); if (GUILayout.Button("ADD")) { foreach (char i in tempItemName) { // checkt of er een "illegaal" character (/) in de naam zit en verwijdert deze voor de path if (i.ToString() == "/") { tempItemName.Remove(i); } } ManagementObject temp = MakeScriptableObject.CreateObject(tempItemName, ManagementStatus.ToDo, tempItemManagementtype, tempItemDescription); thisWindow.managementObjects.Add(temp); tempItemName = ""; tempItemManagementtype = ManagementType.Art; tempItemDescription = ""; so.ApplyModifiedProperties(); } break; // displayed het tab waar de scriptable objects kunnen worden geëdit case 3: GUILayout.Label("Edit Object", EditorStyles.boldLabel); editObject.itemName = EditorGUILayout.TextField("Task Name", editObject.itemName); editObject.itemType = (ManagementType)EditorGUILayout.EnumPopup("Task Type", editObject.itemType); editObject.itemDescription = EditorGUILayout.TextField("Task Description", editObject.itemDescription); GUI.skin.button.fontSize = 14; GUI.skin.button.fontStyle = FontStyle.Bold; GUI.color = thisWindow.RGBColor(127f, 191f, 63f); if (GUILayout.Button("Complete Edit")) { // Slaat de wijzigingen op en stuurt de gebruiker terug naar het main view tab. managementbarInt = 0; EditorUtility.SetDirty(editObject); AssetDatabase.SaveAssets(); } GUI.skin.button.fontSize = 12; GUI.skin.button.fontStyle = FontStyle.Normal; GUI.color = Color.white; break; default: break; } so.ApplyModifiedProperties(); }
public void ShowSceneRequirementsTab(ScriptableObject _target) { GUILayout.Space(20); ScriptableObject target = _target; SerializedObject so = new SerializedObject(target); SerializedProperty gameObjectsProperty = so.FindProperty("sceneRequirements"); // EditorGUILayout.PropertyField(gameObjectsProperty, true); // True means show children GUILayout.Label("Add an Object", EditorStyles.boldLabel); SerializedObject so2 = new SerializedObject(target); SerializedProperty AddObjects = so.FindProperty("addObject"); EditorGUILayout.PropertyField(AddObjects, new GUIContent("Drag objects here"), false); // True means show children // thisWindow.addObject = EditorGUILayout.ObjectField(thisWindow, true); if (thisWindow.addObject != null) { // thisWindow.sceneRequirements.Add(thisWindow.addObject); foreach (GameObject obj in thisWindow.addObject) { thisWindow.sceneRequirements.Add(obj); } thisWindow.addObject = null; } GUILayout.Space(10f); // checks if there are already any assigned objects if (thisWindow.sceneRequirements.Count > 0) { GUILayout.Label("All Required Objects", EditorStyles.boldLabel); foreach (Object obj in thisWindow.sceneRequirements.ToArray()) { if (obj != null) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(obj, typeof(GameObject), true); GUI.color = thisWindow.RGBColor(191f, 63f, 63f); if (GUILayout.Button("X")) { thisWindow.sceneRequirements.Remove(obj); } GUI.color = Color.white; EditorGUILayout.EndHorizontal(); if (obj.GetType() != typeof(GameObject)) { thisWindow.sceneRequirements.Remove(obj); } } else { thisWindow.sceneRequirements.Remove(obj); } } } GUI.color = thisWindow.RGBColor(127f, 191f, 63f); if (GUILayout.Button("Import Game Essentials")) { ImportGameAssets(); } GUI.color = Color.white; so.ApplyModifiedProperties(); }