private void CopyInventoryBox(MenuInventoryBox _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = _element.uiSlots; } isClickable = _element.isClickable; textEffects = _element.textEffects; outlineSize = _element.outlineSize; inventoryBoxType = _element.inventoryBoxType; numSlots = _element.numSlots; maxSlots = _element.maxSlots; limitToCategory = _element.limitToCategory; limitToDefinedInteractions = _element.limitToDefinedInteractions; categoryID = _element.categoryID; selectItemsAfterTaking = _element.selectItemsAfterTaking; displayType = _element.displayType; uiHideStyle = _element.uiHideStyle; categoryIDs = _element.categoryIDs; linkUIGraphic = _element.linkUIGraphic; UpdateLimitCategory(); items = GetItemList(); base.Copy(_element); Upgrade(); }
private void CopyInventoryBox(MenuInventoryBox _element) { uiSlots = _element.uiSlots; isClickable = _element.isClickable; textEffects = _element.textEffects; outlineSize = _element.outlineSize; inventoryBoxType = _element.inventoryBoxType; numSlots = _element.numSlots; maxSlots = _element.maxSlots; limitToCategory = _element.limitToCategory; limitToDefinedInteractions = _element.limitToDefinedInteractions; categoryID = _element.categoryID; selectItemsAfterTaking = _element.selectItemsAfterTaking; displayType = _element.displayType; uiHideStyle = _element.uiHideStyle; categoryIDs = _element.categoryIDs; UpdateLimitCategory(); PopulateList(); base.Copy(_element); Upgrade(); }
public void CopyInventoryBox(MenuInventoryBox _element) { uiSlots = _element.uiSlots; isClickable = _element.isClickable; textEffects = _element.textEffects; inventoryBoxType = _element.inventoryBoxType; numSlots = _element.numSlots; maxSlots = _element.maxSlots; limitToCategory = _element.limitToCategory; categoryID = _element.categoryID; selectItemsAfterTaking = _element.selectItemsAfterTaking; displayType = _element.displayType; PopulateList(); base.Copy(_element); }
public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; inventoryBoxType = AC_InventoryBoxType.Default; numSlots = 0; SetSize(new Vector2(6f, 10f)); maxSlots = 10; limitToCategory = false; selectItemsAfterTaking = true; categoryID = -1; displayType = ConversationDisplayType.IconOnly; textEffects = TextEffects.None; items = new List <InvItem>(); }
private void CopyInventoryBox(MenuInventoryBox _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = _element.uiSlots; } uiPointerState = _element.uiPointerState; isClickable = _element.isClickable; textEffects = _element.textEffects; outlineSize = _element.outlineSize; inventoryBoxType = _element.inventoryBoxType; numSlots = _element.numSlots; maxSlots = _element.maxSlots; limitToCategory = _element.limitToCategory; limitToDefinedInteractions = _element.limitToDefinedInteractions; categoryID = _element.categoryID; selectItemsAfterTaking = _element.selectItemsAfterTaking; displayType = _element.displayType; uiHideStyle = _element.uiHideStyle; categoryIDs = _element.categoryIDs; linkUIGraphic = _element.linkUIGraphic; UpdateLimitCategory(); items = GetItemList(); base.Copy(_element); if (Application.isPlaying) { if (!(inventoryBoxType == AC_InventoryBoxType.HotspotBased && maxSlots == 1)) { alternativeInputButton = ""; } } Upgrade(); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; inventoryBoxType = AC_InventoryBoxType.Default; numSlots = 0; SetSize(new Vector2(6f, 10f)); maxSlots = 10; limitToCategory = false; limitToDefinedInteractions = true; selectItemsAfterTaking = true; categoryID = -1; displayType = ConversationDisplayType.IconOnly; textEffects = TextEffects.None; outlineSize = 2f; uiHideStyle = UIHideStyle.DisableObject; items = new List <InvItem>(); categoryIDs = new List <int>(); linkUIGraphic = LinkUIGraphic.ImageComponent; }
public override void ShowGUI(Menu menu) { string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); inventoryBoxType = (AC_InventoryBoxType)CustomGUILayout.EnumPopup("Inventory box type:", inventoryBoxType, apiPrefix + ".inventoryBoxType"); if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); isClickable = true; } else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected) { isClickable = false; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { isClickable = true; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.Container) { isClickable = true; maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); selectItemsAfterTaking = CustomGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking, apiPrefix + ".selectItemsAfterTaking"); } else { isClickable = true; if (source == MenuSource.AdventureCreator) { numSlots = CustomGUILayout.IntField("Test slots:", numSlots, apiPrefix + ".numSlots"); } maxSlots = CustomGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30, apiPrefix + ".maxSlots"); } if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { limitToDefinedInteractions = CustomGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions, apiPrefix + ".limitToDefinedInteractions"); } displayType = (ConversationDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType"); if (displayType == ConversationDisplayType.IconAndText && source == MenuSource.AdventureCreator) { EditorGUILayout.HelpBox("'Icon And Text' mode is only available for Unity UI-based Menus.", MessageType.Warning); } if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator) { slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f, apiPrefix + ".slotSpacing"); orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation"); if (orientation == ElementOrientation.Grid) { gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth"); } } if (inventoryBoxType == AC_InventoryBoxType.CustomScript) { ShowClipHelp(); } uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When slot is empty:", uiHideStyle, apiPrefix + ".uiHideStyle"); if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); uiSlots = ResizeUISlots(uiSlots, maxSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic); } EditorGUILayout.EndVertical(); if (CanBeLimitedByCategory()) { ShowCategoriesUI(apiPrefix); } base.ShowGUI(menu); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical("Button"); if (source == MenuSource.AdventureCreator) { textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); if (textEffects != TextEffects.None) { outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f); } } displayType = (ConversationDisplayType)EditorGUILayout.EnumPopup("Display:", displayType); inventoryBoxType = (AC_InventoryBoxType)EditorGUILayout.EnumPopup("Inventory box type:", inventoryBoxType); if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { limitToCategory = EditorGUILayout.Toggle("Limit to category?", limitToCategory); if (limitToCategory) { if (AdvGame.GetReferences().inventoryManager) { List <string> binList = new List <string>(); List <InvBin> bins = AdvGame.GetReferences().inventoryManager.bins; foreach (InvBin bin in bins) { binList.Add(bin.label); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Category:", GUILayout.Width(146f)); if (binList.Count > 0) { int binNumber = GetBinSlot(categoryID, bins); binNumber = EditorGUILayout.Popup(binNumber, binList.ToArray()); categoryID = bins[binNumber].id; } else { categoryID = -1; EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f)); } EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.HelpBox("No Inventory Manager defined!", MessageType.Warning); categoryID = -1; } } else { categoryID = -1; } maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); isClickable = true; } else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected) { isClickable = false; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { isClickable = true; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.Container) { isClickable = true; maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); selectItemsAfterTaking = EditorGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking); } else { isClickable = true; if (source == MenuSource.AdventureCreator) { numSlots = EditorGUILayout.IntField("Test slots:", numSlots); } maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); } if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { limitToDefinedInteractions = EditorGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions); } if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator) { slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f); orientation = (ElementOrientation)EditorGUILayout.EnumPopup("Slot orientation:", orientation); if (orientation == ElementOrientation.Grid) { gridWidth = EditorGUILayout.IntSlider("Grid size:", gridWidth, 1, 10); } } if (inventoryBoxType == AC_InventoryBoxType.CustomScript) { ShowClipHelp(); } if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); uiHideStyle = (UIHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiHideStyle); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); uiSlots = ResizeUISlots(uiSlots, maxSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } } EditorGUILayout.EndVertical(); base.ShowGUI(source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source == MenuSource.AdventureCreator) { textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } displayType = (ConversationDisplayType) EditorGUILayout.EnumPopup ("Display:", displayType); inventoryBoxType = (AC_InventoryBoxType) EditorGUILayout.EnumPopup ("Inventory box type:", inventoryBoxType); if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { limitToCategory = EditorGUILayout.Toggle ("Limit to category?", limitToCategory); if (limitToCategory) { if (AdvGame.GetReferences ().inventoryManager) { List<string> binList = new List<string>(); List<InvBin> bins = AdvGame.GetReferences ().inventoryManager.bins; foreach (InvBin bin in bins) { binList.Add (bin.label); } EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Category:", GUILayout.Width (146f)); if (binList.Count > 0) { int binNumber = GetBinSlot (categoryID, bins); binNumber = EditorGUILayout.Popup (binNumber, binList.ToArray()); categoryID = bins[binNumber].id; } else { categoryID = -1; EditorGUILayout.LabelField ("No categories defined!", EditorStyles.miniLabel, GUILayout.Width (146f)); } EditorGUILayout.EndHorizontal (); } else { EditorGUILayout.HelpBox ("No Inventory Manager defined!", MessageType.Warning); categoryID = -1; } } else { categoryID = -1; } maxSlots = EditorGUILayout.IntSlider ("Max number of slots:", maxSlots, 1, 30); isClickable = true; } else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected) { isClickable = false; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { isClickable = true; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.Container) { isClickable = true; maxSlots = EditorGUILayout.IntSlider ("Max number of slots:", maxSlots, 1, 30); selectItemsAfterTaking = EditorGUILayout.Toggle ("Select item after taking?", selectItemsAfterTaking); } else { isClickable = true; if (source == MenuSource.AdventureCreator) { numSlots = EditorGUILayout.IntField ("Test slots:", numSlots); } maxSlots = EditorGUILayout.IntSlider ("Max number of slots:", maxSlots, 1, 30); } if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { limitToDefinedInteractions = EditorGUILayout.ToggleLeft ("Only show items referenced in Interactions?", limitToDefinedInteractions); } if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator) { slotSpacing = EditorGUILayout.Slider ("Slot spacing:", slotSpacing, 0f, 20f); orientation = (ElementOrientation) EditorGUILayout.EnumPopup ("Slot orientation:", orientation); if (orientation == ElementOrientation.Grid) { gridWidth = EditorGUILayout.IntSlider ("Grid size:", gridWidth, 1, 10); } } if (inventoryBoxType == AC_InventoryBoxType.CustomScript) { ShowClipHelp (); } if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); uiSlots = ResizeUISlots (uiSlots, maxSlots); for (int i=0; i<uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI (i, source); } } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
private void CopyInventoryBox(MenuInventoryBox _element) { uiSlots = _element.uiSlots; isClickable = _element.isClickable; textEffects = _element.textEffects; inventoryBoxType = _element.inventoryBoxType; numSlots = _element.numSlots; maxSlots = _element.maxSlots; limitToCategory = _element.limitToCategory; limitToDefinedInteractions = _element.limitToDefinedInteractions; categoryID = _element.categoryID; selectItemsAfterTaking = _element.selectItemsAfterTaking; displayType = _element.displayType; PopulateList (); base.Copy (_element); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; inventoryBoxType = AC_InventoryBoxType.Default; numSlots = 0; SetSize (new Vector2 (6f, 10f)); maxSlots = 10; limitToCategory = false; limitToDefinedInteractions = true; selectItemsAfterTaking = true; categoryID = -1; displayType = ConversationDisplayType.IconOnly; textEffects = TextEffects.None; items = new List<InvItem>(); }
public override void ShowGUI(Menu menu) { MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source == MenuSource.AdventureCreator) { textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); if (textEffects != TextEffects.None) { outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f); } } displayType = (ConversationDisplayType)EditorGUILayout.EnumPopup("Display:", displayType); inventoryBoxType = (AC_InventoryBoxType)EditorGUILayout.EnumPopup("Inventory box type:", inventoryBoxType); if (inventoryBoxType == AC_InventoryBoxType.Default || inventoryBoxType == AC_InventoryBoxType.CustomScript) { maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); isClickable = true; } else if (inventoryBoxType == AC_InventoryBoxType.DisplaySelected) { isClickable = false; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { isClickable = true; maxSlots = 1; } else if (inventoryBoxType == AC_InventoryBoxType.Container) { isClickable = true; maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); selectItemsAfterTaking = EditorGUILayout.Toggle("Select item after taking?", selectItemsAfterTaking); } else { isClickable = true; if (source == MenuSource.AdventureCreator) { numSlots = EditorGUILayout.IntField("Test slots:", numSlots); } maxSlots = EditorGUILayout.IntSlider("Max number of slots:", maxSlots, 1, 30); } if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { limitToDefinedInteractions = EditorGUILayout.ToggleLeft("Only show items referenced in Interactions?", limitToDefinedInteractions); } if (inventoryBoxType != AC_InventoryBoxType.DisplaySelected && inventoryBoxType != AC_InventoryBoxType.DisplayLastSelected && source == MenuSource.AdventureCreator) { slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f); orientation = (ElementOrientation)EditorGUILayout.EnumPopup("Slot orientation:", orientation); if (orientation == ElementOrientation.Grid) { gridWidth = EditorGUILayout.IntSlider("Grid size:", gridWidth, 1, 10); } } if (inventoryBoxType == AC_InventoryBoxType.CustomScript) { ShowClipHelp(); } uiHideStyle = (UIHideStyle)EditorGUILayout.EnumPopup("When slot is empty:", uiHideStyle); if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); uiSlots = ResizeUISlots(uiSlots, maxSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } } EditorGUILayout.EndVertical(); ShowCategoriesUI(); base.ShowGUI(menu); }