protected virtual bool TextRecipeGUI() { Type TargetType = target.GetType(); bool doUpdate = false; EditorGUI.BeginDisabledGroup(true); EditorGUILayout.Popup("Recipe Type", 0, new string[] { "WardrobeCollection" }); EditorGUI.EndDisabledGroup(); PreRecipeGUI(ref doUpdate); FieldInfo CompatibleRacesField = TargetType.GetField("compatibleRaces", BindingFlags.Public | BindingFlags.Instance); //WardrobeCollections use the WardrobeSlot field to allow the user to define a Collection Group FieldInfo WardrobeSlotField = TargetType.GetField("wardrobeSlot", BindingFlags.Public | BindingFlags.Instance); string wardrobeSlot = (string)WardrobeSlotField.GetValue(target); List <string> compatibleRaces = (List <string>)CompatibleRacesField.GetValue(target); //FieldInfos FieldInfo WardrobeCollectionList = TargetType.GetField("wardrobeCollection", BindingFlags.Public | BindingFlags.Instance); FieldInfo ArbitraryRecipesList = TargetType.GetField("arbitraryRecipes", BindingFlags.Public | BindingFlags.Instance); //field values WardrobeCollectionList wardrobeCollection = (WardrobeCollectionList)WardrobeCollectionList.GetValue(target); List <string> arbitraryRecipes = (List <string>)ArbitraryRecipesList.GetValue(target); if (slotEditor == null || slotEditor.GetType() != typeof(WardrobeCollectionMasterEditor)) { slotEditor = new WardrobeCollectionMasterEditor(_recipe, compatibleRaces, wardrobeCollection, arbitraryRecipes); } else { (slotEditor as WardrobeCollectionMasterEditor).UpdateVals(compatibleRaces, wardrobeCollection, arbitraryRecipes); } //wardrobe collection also has a 'cover image' field if (DrawCoverImagesUI(TargetType)) { doUpdate = true; } //CompatibleRaces drop area if (DrawCompatibleRacesUI(TargetType)) { doUpdate = true; } EditorGUILayout.Space(); //Draw the Wardrobe slot field as a WardrobeCollection Group text field. EditorGUILayout.HelpBox("When a collection is placed on an avatar it replaces any other collections belonging to this group and unloads that collections recipes", MessageType.Info); var newWardrobeSlot = EditorGUILayout.DelayedTextField("Collection Group", wardrobeSlot); if (newWardrobeSlot != wardrobeSlot) { WardrobeSlotField.SetValue(target, newWardrobeSlot); doUpdate = true; } EditorGUILayout.Space(); return(doUpdate); }
protected virtual bool TextRecipeGUI() { Type TargetType = target.GetType(); bool doUpdate = false; EditorGUI.BeginDisabledGroup(true); EditorGUILayout.Popup("Recipe Type", 0, new string[] { "WardrobeCollection" }); EditorGUI.EndDisabledGroup(); PreRecipeGUI(ref doUpdate); FieldInfo CompatibleRacesField = TargetType.GetField("compatibleRaces", BindingFlags.Public | BindingFlags.Instance); List <string> compatibleRaces = (List <string>)CompatibleRacesField.GetValue(target); //FieldInfos FieldInfo WardrobeCollectionList = TargetType.GetField("wardrobeCollection", BindingFlags.Public | BindingFlags.Instance); FieldInfo ArbitraryRecipesList = TargetType.GetField("arbitraryRecipes", BindingFlags.Public | BindingFlags.Instance); //field values WardrobeCollectionList wardrobeCollection = (WardrobeCollectionList)WardrobeCollectionList.GetValue(target); List <string> arbitraryRecipes = (List <string>)ArbitraryRecipesList.GetValue(target); if (slotEditor == null || slotEditor.GetType() != typeof(WardrobeCollectionMasterEditor)) { slotEditor = new WardrobeCollectionMasterEditor(_recipe, compatibleRaces, wardrobeCollection, arbitraryRecipes); } else { (slotEditor as WardrobeCollectionMasterEditor).UpdateVals(compatibleRaces, wardrobeCollection, arbitraryRecipes); } //wardrobe collection also has a 'cover image' field if (DrawCoverImagesUI(TargetType)) { doUpdate = true; } //CompatibleRaces drop area if (DrawCompatibleRacesUI(TargetType)) { doUpdate = true; } EditorGUILayout.Space(); return(doUpdate); }