public void ShowGUI(string apiPrefix, List <string> binList) { Upgrade(); label = CustomGUILayout.TextField("Name:", label, apiPrefix + ".label", "The item's Editor name"); altLabel = CustomGUILayout.TextField("Label (if not name):", altLabel, apiPrefix + ".altLabel", "The item's in-game name, if not label"); bool isPronoun = !canBeLowerCase; isPronoun = CustomGUILayout.Toggle("Name is pronoun?", isPronoun, "!" + apiPrefix + ".canBeLowerCase", "If False, the name will be lower-cased when inside sentences."); canBeLowerCase = !isPronoun; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Category:", "The category that the item belongs to"), GUILayout.Width(146f)); if (KickStarter.inventoryManager.bins.Count > 0) { int binNumber = KickStarter.inventoryManager.GetBinSlot(binID); binNumber = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID"); binID = KickStarter.inventoryManager.bins[binNumber].id; } else { binID = -1; EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f)); } EditorGUILayout.EndHorizontal(); carryOnStart = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart", "If True, the Player carries the item when the game begins"); if (carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory) { carryOnStartNotDefault = CustomGUILayout.Toggle("Non-default Player(s)?", carryOnStartNotDefault, apiPrefix + ".carryOnStartNotDefault", "If True, then a Player prefab that is not the default carries the item when the game begins"); if (carryOnStartNotDefault) { carryOnStartIDs = ChoosePlayerGUI(carryOnStartIDs, apiPrefix + ".carryOnStartID"); } } canCarryMultiple = CustomGUILayout.Toggle("Can carry multiple?", canCarryMultiple, apiPrefix + ".canCarryMultiple", "If True, then multiple instances of the item can be carried at once"); if (carryOnStart && canCarryMultiple) { count = CustomGUILayout.IntField("Quantity on start:", count, apiPrefix + ".count", "The number of instances that the player is carrying when the game begins"); } else { count = 1; } if (canCarryMultiple) { if (maxCount == 0) { maxCount = 999; } maxCount = CustomGUILayout.IntField("Slot capacity:", maxCount, apiPrefix + ".maxCount", "The number of instances of the item that can occupy a single inventory slot"); if (maxCount < 1) { maxCount = 1; } if (maxCount > 1) { itemStackingMode = (ItemStackingMode)CustomGUILayout.EnumPopup("Selection mode:", itemStackingMode, apiPrefix + ".itemStackingMode", "How to select items when multiple are in a given slot"); } } overrideUseSyntax = CustomGUILayout.Toggle("Override 'Use' syntax?", overrideUseSyntax, apiPrefix + ".overrideUseSyntax", "If True, then the item has its own 'Use X on Y' syntax when selected"); if (overrideUseSyntax) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f)); hotspotPrefix1.label = EditorGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix2.label = EditorGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); } linkedPrefab = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Linked prefab:", linkedPrefab, false, apiPrefix + ".linkedPrefab", "A GameObject that can be associated with the item, for the creation of e.g. 3D inventory items (through scripting only)"); if (linkedPrefab != null) { EditorGUILayout.HelpBox("This reference is accessible through scripting, or via Inventory parameter in the 'Object: Add or remove' Action.", MessageType.Info); } CustomGUILayout.DrawUILine(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Main graphic:", "The item's main graphic"), GUILayout.Width(145)); tex = (Texture)CustomGUILayout.ObjectField <Texture> (tex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".tex"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Active graphic:", "The item's 'highlighted' graphic"), GUILayout.Width(145)); activeTex = (Texture)CustomGUILayout.ObjectField <Texture> (activeTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".activeTex"); EditorGUILayout.EndHorizontal(); if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Selected graphic:", "The item's 'selected' graphic"), GUILayout.Width(145)); selectedTex = (Texture)CustomGUILayout.ObjectField <Texture> (selectedTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".selectedTex"); EditorGUILayout.EndHorizontal(); } if (AdvGame.GetReferences().cursorManager != null) { CursorManager cursorManager = AdvGame.GetReferences().cursorManager; if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel) { cursorIcon.ShowGUI(true, true, "Cursor (optional):", cursorManager.cursorRendering, apiPrefix + ".cursorIcon", "A Cursor that, if assigned, will be used in place of the 'tex' Texture when the item is selected on the cursor"); CustomGUILayout.DrawUILine(); } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Standard interactions", CustomStyles.subHeader); if (KickStarter.settingsManager && KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.cursorManager) { List <string> iconList = new List <string> (); foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons) { iconList.Add(icon.id.ToString() + ": " + icon.label); } if (KickStarter.cursorManager.cursorIcons.Count > 0) { foreach (InvInteraction interaction in interactions) { EditorGUILayout.BeginHorizontal(); int invNumber = GetIconSlot(interaction.icon.id); invNumber = EditorGUILayout.Popup(invNumber, iconList.ToArray()); interaction.icon = KickStarter.cursorManager.cursorIcons[invNumber]; int i = interactions.IndexOf(interaction); string autoName = label + "_" + interaction.icon.label; interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList, autoName, apiPrefix + ".interactions[" + i + "].actionList", "The ActionList to run when the interaction is triggered"); if (GUILayout.Button(string.Empty, CustomStyles.IconCog)) { SideInteractionMenu(interactions.IndexOf(interaction)); } EditorGUILayout.EndHorizontal(); } } else { EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning); } if (GUILayout.Button("Add interaction")) { Undo.RecordObject(KickStarter.inventoryManager, "Add new interaction"); interactions.Add(new InvInteraction(KickStarter.cursorManager.cursorIcons[0])); } } else { string autoName = label + "_Use"; useActionList = ActionListAssetMenu.AssetGUI("Use:", useActionList, autoName, apiPrefix + ".useActionList", "The ActionList asset to run when using the item is used"); if (KickStarter.cursorManager && KickStarter.cursorManager.allowInteractionCursorForInventory && KickStarter.cursorManager.cursorIcons.Count > 0) { int useCursor_int = KickStarter.cursorManager.GetIntFromID(useIconID) + 1; if (useIconID == -1) { useCursor_int = 0; } useCursor_int = CustomGUILayout.Popup("Use cursor icon:", useCursor_int, KickStarter.cursorManager.GetLabelsArray(true), apiPrefix + ".useIconID", "The Cursor to show when hovering over the item"); if (useCursor_int == 0) { useIconID = -1; } else if (KickStarter.cursorManager.cursorIcons.Count > (useCursor_int - 1)) { useIconID = KickStarter.cursorManager.cursorIcons[useCursor_int - 1].id; } } else { useIconID = 0; } autoName = label + "_Examine"; lookActionList = ActionListAssetMenu.AssetGUI("Examine:", lookActionList, autoName, apiPrefix + ".lookActionList", "The ActionListAsset to run when the item is examined"); } if (KickStarter.settingsManager && KickStarter.settingsManager.CanSelectItems(false)) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Unhandled interactions", CustomStyles.subHeader); string autoName = label + "_Unhandled_Hotspot"; unhandledActionList = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", unhandledActionList, autoName, apiPrefix + ".unhandledActionList", "The ActionList asset to run when using the item on a Hotspot is unhandled"); autoName = label + "_Unhandled_Combine"; unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", unhandledCombineActionList, autoName, apiPrefix + ".unhandledCombineActionList", "The ActionListAsset to run when using the item on another InvItem is unhandled"); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Combine interactions", CustomStyles.subHeader); for (int i = 0; i < combineActionList.Count; i++) { EditorGUILayout.BeginHorizontal(); int invNumber = KickStarter.inventoryManager.GetArraySlot(combineID[i]); invNumber = EditorGUILayout.Popup(invNumber, KickStarter.inventoryManager.GetLabelList()); combineID[i] = KickStarter.inventoryManager.items[invNumber].id; string autoName = label + "_Combine_" + KickStarter.inventoryManager.GetLabelList()[invNumber]; combineActionList[i] = ActionListAssetMenu.AssetGUI(string.Empty, combineActionList[i], autoName, apiPrefix + ".combineActionList[" + i + "]", "A List of all 'Combine' InvInteraction objects associated with the item"); if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth)) { Undo.RecordObject(KickStarter.inventoryManager, "Delete combine event"); combineActionList.RemoveAt(i); combineID.RemoveAt(i); break; } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add combine event")) { Undo.RecordObject(KickStarter.inventoryManager, "Add new combine event"); combineActionList.Add(null); combineID.Add(0); } // List all "reverse" inventory combinations string reverseCombinations = string.Empty; foreach (InvItem otherItem in KickStarter.inventoryManager.items) { if (otherItem != this) { if (otherItem.combineID.Contains(id)) { reverseCombinations += "- " + otherItem.label + "\n"; continue; } } } if (reverseCombinations.Length > 0) { EditorGUILayout.Space(); EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info); } if (KickStarter.inventoryManager.invVars.Count > 0) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Properties", CustomStyles.subHeader); RebuildProperties(); // UI for setting property values if (vars.Count > 0) { foreach (InvVar invVar in vars) { invVar.ShowGUI(apiPrefix + ".GetProperty (" + invVar.id + ")"); } } else { EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info); } } }