private void CopyDialogList(MenuDialogList _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = _element.uiSlots; } textEffects = _element.textEffects; outlineSize = _element.outlineSize; displayType = _element.displayType; testIcon = _element.testIcon; anchor = _element.anchor; labels = _element.labels; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; maxSlots = _element.maxSlots; markAlreadyChosen = _element.markAlreadyChosen; alreadyChosenFontColour = _element.alreadyChosenFontColour; alreadyChosenFontHighlightedColour = _element.alreadyChosenFontHighlightedColour; showIndexNumbers = _element.showIndexNumbers; uiHideStyle = _element.uiHideStyle; linkUIGraphic = _element.linkUIGraphic; base.Copy(_element); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; fixedOption = false; displayType = ConversationDisplayType.TextOnly; testIcon = null; optionToShow = 1; numSlots = 0; SetSize(new Vector2(20f, 5f)); maxSlots = 10; anchor = TextAnchor.MiddleLeft; textEffects = TextEffects.None; outlineSize = 2f; markAlreadyChosen = false; alreadyChosenFontColour = Color.white; alreadyChosenFontHighlightedColour = Color.white; showIndexNumbers = false; uiHideStyle = UIHideStyle.DisableObject; linkUIGraphic = LinkUIGraphic.ImageComponent; resetOffsetWhenRestart = true; base.Declare(); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; numSlots = 1; maxSlots = 5; showActive = true; SetSize(new Vector2(20f, 5f)); anchor = TextAnchor.MiddleCenter; actionListOnClick = null; textEffects = TextEffects.None; outlineSize = 2f; uiHideStyle = UIHideStyle.DisableObject; fixedOption = false; optionToShow = 0; autoHandle = true; parameterID = -1; linkUIGraphic = LinkUIGraphic.ImageComponent; base.Declare(); }
private void CopyProfilesList(MenuProfilesList _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = _element.uiSlots; } textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; maxSlots = _element.maxSlots; actionListOnClick = _element.actionListOnClick; showActive = _element.showActive; uiHideStyle = _element.uiHideStyle; autoHandle = _element.autoHandle; parameterID = _element.parameterID; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; linkUIGraphic = _element.linkUIGraphic; base.Copy(_element); }
private void CopySavesList(MenuSavesList _element) { uiSlots = _element.uiSlots; newSaveText = _element.newSaveText; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; saveListType = _element.saveListType; maxSlots = _element.maxSlots; actionListOnSave = _element.actionListOnSave; displayType = _element.displayType; blankSlotTexture = _element.blankSlotTexture; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; importProductName = _element.importProductName; importSaveFilename = _element.importSaveFilename; checkImportBool = _element.checkImportBool; checkImportVar = _element.checkImportVar; parameterID = _element.parameterID; showNewSaveOption = _element.showNewSaveOption; autoHandle = _element.autoHandle; uiHideStyle = _element.uiHideStyle; base.Copy(_element); }
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(); }
private void CopyDialogList(MenuDialogList _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = new UISlot[_element.uiSlots.Length]; for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i] = new UISlot(_element.uiSlots[i]); } } textEffects = _element.textEffects; outlineSize = _element.outlineSize; displayType = _element.displayType; testIcon = _element.testIcon; anchor = _element.anchor; labels = _element.labels; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; maxSlots = _element.maxSlots; markAlreadyChosen = _element.markAlreadyChosen; alreadyChosenFontColour = _element.alreadyChosenFontColour; alreadyChosenFontHighlightedColour = _element.alreadyChosenFontHighlightedColour; showIndexNumbers = _element.showIndexNumbers; uiHideStyle = _element.uiHideStyle; linkUIGraphic = _element.linkUIGraphic; resetOffsetWhenRestart = _element.resetOffsetWhenRestart; base.Copy(_element); }
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); craftingType = (CraftingElementType)EditorGUILayout.EnumPopup("Crafting element type:", craftingType); if (craftingType == CraftingElementType.Ingredients) { numSlots = EditorGUILayout.IntSlider("Number of slots:", numSlots, 1, 12); if (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); } } } else { numSlots = 1; } 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, numSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } } isClickable = true; EditorGUILayout.EndVertical(); PopulateList(source); base.ShowGUI(menu); }
/** * <summary>Enables the visibility of the linked UI Button.</summary> * <param name = "uiHideStyle">The method by which the UI element is hidden (DisableObject, ClearContent, DisableInteractibility) </param> */ public void ShowUIElement(UIHideStyle uiHideStyle) { if (Application.isPlaying && uiButton != null && uiButton.gameObject != null) { if (uiHideStyle == UIHideStyle.DisableObject && !uiButton.gameObject.activeSelf) { uiButton.gameObject.SetActive(true); } } }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; numSlots = 4; SetSize(new Vector2(6f, 10f)); textEffects = TextEffects.None; outlineSize = 2f; craftingType = CraftingElementType.Ingredients; displayType = ConversationDisplayType.IconOnly; uiHideStyle = UIHideStyle.DisableObject; items = new List <InvItem>(); }
private void CopyProfilesList(MenuProfilesList _element) { uiSlots = _element.uiSlots; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; maxSlots = _element.maxSlots; actionListOnClick = _element.actionListOnClick; showActive = _element.showActive; uiHideStyle = _element.uiHideStyle; base.Copy(_element); }
public override void ShowGUI(Menu menu) { MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); showActive = EditorGUILayout.Toggle("Include active?", showActive); maxSlots = EditorGUILayout.IntField("Max no. of slots:", maxSlots); if (source == MenuSource.AdventureCreator) { numSlots = EditorGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots); 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 (source == MenuSource.AdventureCreator) { anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); if (textEffects != TextEffects.None) { outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f); } } actionListOnClick = ActionListAssetMenu.AssetGUI("ActionList after selecting:", actionListOnClick, "", menu.title + "_" + title + "_After_Selecting"); 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(menu); }
/** * <summary>Disables the visibility of the linked UI Button.</summary> * <param name = "uiHideStyle">The method by which the UI element is hidden (DisableObject, ClearContent, DisableInteractibility) </param> */ public void HideUIElement(UIHideStyle uiHideStyle) { if (Application.isPlaying && uiButton != null && uiButton.gameObject != null && uiButton.gameObject.activeSelf) { if (uiHideStyle == UIHideStyle.DisableObject) { uiButton.gameObject.SetActive(false); } else if (uiHideStyle == UIHideStyle.ClearContent) { SetImage(null); SetText(""); } } }
private void CopyCrafting(MenuCrafting _element) { uiSlots = _element.uiSlots; isClickable = _element.isClickable; textEffects = _element.textEffects; outlineSize = _element.outlineSize; numSlots = _element.numSlots; craftingType = _element.craftingType; displayType = _element.displayType; uiHideStyle = _element.uiHideStyle; PopulateList(MenuSource.AdventureCreator); base.Copy(_element); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; numSlots = 4; SetSize(new Vector2(6f, 10f)); textEffects = TextEffects.None; outlineSize = 2f; craftingType = CraftingElementType.Ingredients; displayType = ConversationDisplayType.IconOnly; uiHideStyle = UIHideStyle.DisableObject; actionListOnWrongIngredients = null; linkUIGraphic = LinkUIGraphic.ImageComponent; items = new List <InvItem>(); autoCreate = true; inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple; }
private void CopyProfilesList(MenuProfilesList _element) { uiSlots = _element.uiSlots; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; maxSlots = _element.maxSlots; actionListOnClick = _element.actionListOnClick; showActive = _element.showActive; uiHideStyle = _element.uiHideStyle; autoHandle = _element.autoHandle; parameterID = _element.parameterID; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; base.Copy(_element); }
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 MenuElement when it is created within MenuManager. */ public virtual void Declare() { linkedUiID = 0; fontScaleFactor = 2f; fontColor = Color.white; fontHighlightColor = Color.white; highlightTexture = null; orientation = ElementOrientation.Vertical; positionType = AC_PositionType2.Aligned; sizeType = AC_SizeType.Automatic; gridWidth = 3; lineID = -1; hoverSound = null; clickSound = null; dragOffset = Vector2.zero; changeCursor = false; cursorID = 0; uiHideStyle = UIHideStyle.DisableObject; }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; newSaveText = "New save"; emptySlotText = string.Empty; emptySlotTextLineID = -1; isVisible = true; isClickable = true; numSlots = 1; maxSlots = 5; SetSize(new Vector2(20f, 5f)); anchor = TextAnchor.MiddleCenter; saveListType = AC_SaveListType.Save; actionListOnSave = null; newSaveSlot = false; textEffects = TextEffects.None; outlineSize = 2f; displayType = SaveDisplayType.LabelOnly; blankSlotTexture = null; allowEmptySlots = false; fixedOption = false; optionToShow = 1; hideIfNotValid = false; importProductName = ""; importSaveFilename = ""; checkImportBool = false; checkImportVar = 0; showNewSaveOption = true; autoHandle = true; parameterID = -1; uiHideStyle = UIHideStyle.DisableObject; linkUIGraphic = LinkUIGraphic.ImageComponent; base.Declare(); }
private void CopySavesList(MenuSavesList _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlots = null; } else { uiSlots = new UISlot[_element.uiSlots.Length]; for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i] = new UISlot(_element.uiSlots[i]); } } newSaveText = _element.newSaveText; emptySlotText = _element.emptySlotText; emptySlotTextLineID = _element.emptySlotTextLineID; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; saveListType = _element.saveListType; maxSlots = _element.maxSlots; actionListOnSave = _element.actionListOnSave; displayType = _element.displayType; blankSlotTexture = _element.blankSlotTexture; allowEmptySlots = _element.allowEmptySlots; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; hideIfNotValid = _element.hideIfNotValid; importProductName = _element.importProductName; importSaveFilename = _element.importSaveFilename; checkImportBool = _element.checkImportBool; checkImportVar = _element.checkImportVar; parameterID = _element.parameterID; showNewSaveOption = _element.showNewSaveOption; autoHandle = _element.autoHandle; uiHideStyle = _element.uiHideStyle; linkUIGraphic = _element.linkUIGraphic; base.Copy(_element); }
private void CopyDialogList(MenuDialogList _element) { uiSlots = _element.uiSlots; textEffects = _element.textEffects; outlineSize = _element.outlineSize; displayType = _element.displayType; testIcon = _element.testIcon; anchor = _element.anchor; labels = _element.labels; fixedOption = _element.fixedOption; optionToShow = _element.optionToShow; maxSlots = _element.maxSlots; markAlreadyChosen = _element.markAlreadyChosen; alreadyChosenFontColour = _element.alreadyChosenFontColour; showIndexNumbers = _element.showIndexNumbers; uiHideStyle = _element.uiHideStyle; base.Copy(_element); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiSlots = null; isVisible = true; isClickable = true; numSlots = 1; maxSlots = 5; showActive = true; SetSize(new Vector2(20f, 5f)); anchor = TextAnchor.MiddleCenter; actionListOnClick = null; textEffects = TextEffects.None; outlineSize = 2f; uiHideStyle = UIHideStyle.DisableObject; base.Declare(); }
/** * 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>(); }
/** * <summary>Copies the values of another MenuElement onto itself.</summary> * <param name = "_element">The MenuElement to copy values from</param> */ public virtual void Copy(MenuElement _element) { linkedUiID = _element.linkedUiID; ID = _element.ID; isEditing = false; title = _element.title; slotSize = _element.slotSize; sizeType = _element.sizeType; positionType = _element.positionType; relativeRect = _element.relativeRect; numSlots = _element.numSlots; lineID = _element.lineID; slotSpacing = _element.slotSpacing; font = _element.font; fontScaleFactor = _element.fontScaleFactor; fontColor = _element.fontColor; fontHighlightColor = _element.fontHighlightColor; highlightTexture = _element.highlightTexture; isVisible = _element.isVisible; isClickable = _element.isClickable; orientation = _element.orientation; gridWidth = _element.gridWidth; backgroundTexture = _element.backgroundTexture; hoverSound = _element.hoverSound; clickSound = _element.clickSound; relativePosition = _element.relativePosition; dragOffset = Vector2.zero; changeCursor = _element.changeCursor; cursorID = _element.cursorID; uiHideStyle = _element.uiHideStyle; alternativeInputButton = _element.alternativeInputButton; }
protected void LimitUISlotVisibility(UISlot[] uiSlots, int _numSlots, UIHideStyle uiHideStyle) { if (uiSlots == null) { return; } if (!isVisible && _numSlots > 0) { return; } for (int i = 0; i < uiSlots.Length; i++) { if (i < _numSlots) { uiSlots[i].ShowUIElement(uiHideStyle); } else { uiSlots[i].HideUIElement(uiHideStyle); } } }
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(Menu menu) { MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); fixedOption = EditorGUILayout.Toggle("Fixed option number?", fixedOption); if (fixedOption) { numSlots = 1; slotSpacing = 0f; optionToShow = EditorGUILayout.IntSlider("Option to display:", optionToShow, 1, 10); } else { maxSlots = EditorGUILayout.IntField("Maximum no. of slots:", maxSlots); if (source == MenuSource.AdventureCreator) { numSlots = EditorGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots); 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); } } } displayType = (ConversationDisplayType)EditorGUILayout.EnumPopup("Display type:", displayType); markAlreadyChosen = EditorGUILayout.Toggle("Mark options already used?", markAlreadyChosen); if (markAlreadyChosen) { alreadyChosenFontColour = (Color)EditorGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour); } if (source == MenuSource.AdventureCreator) { if (displayType == ConversationDisplayType.IconOnly) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Test icon:", GUILayout.Width(145f)); testIcon = (Texture2D)EditorGUILayout.ObjectField(testIcon, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f)); EditorGUILayout.EndHorizontal(); } else { anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); if (textEffects != TextEffects.None) { outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f); } } } else { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); uiHideStyle = (UIHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiHideStyle); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); if (fixedOption) { uiSlots = ResizeUISlots(uiSlots, 1); } else { uiSlots = ResizeUISlots(uiSlots, maxSlots); } for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } } if (displayType == ConversationDisplayType.TextOnly) { showIndexNumbers = EditorGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers); } ChangeCursorGUI(menu); EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
/** * <summary>Disables the visibility of the linked UI Button.</summary> * <param name = "uiHideStyle">The method by which the UI element is hidden (DisableObject, ClearContent) </param> */ public void HideUIElement(UIHideStyle uiHideStyle) { if (Application.isPlaying && uiButton != null && uiButton.gameObject != null && uiButton.gameObject.activeSelf) { if (uiHideStyle == UIHideStyle.DisableObject) { uiButton.gameObject.SetActive (false); } else { SetImage (null); SetText (""); } } }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCrafting)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); craftingType = (CraftingElementType)CustomGUILayout.EnumPopup("Crafting element type:", craftingType, apiPrefix + ".craftingType"); if (craftingType == CraftingElementType.Ingredients) { numSlots = CustomGUILayout.IntSlider("Number of slots:", numSlots, 1, 12); if (source == MenuSource.AdventureCreator) { slotSpacing = EditorGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 20f); orientation = (ElementOrientation)CustomGUILayout.EnumPopup("Slot orientation:", orientation, apiPrefix + ".orientation"); if (orientation == ElementOrientation.Grid) { gridWidth = CustomGUILayout.IntSlider("Grid size:", gridWidth, 1, 10, apiPrefix + ".gridWidth"); } } } else { numSlots = 1; actionListOnWrongIngredients = ActionListAssetMenu.AssetGUI("ActionList on fail:", actionListOnWrongIngredients, apiPrefix + ".actionListOnWrongIngredients", "ActionList_On_Fail_Recipe"); if (actionListOnWrongIngredients != null) { EditorGUILayout.HelpBox("This ActionList will only be run if the result is calculated manually via the 'Inventory: Crafting' Action.", MessageType.Info); } } 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 (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); uiSlots = ResizeUISlots(uiSlots, numSlots); for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } linkUIGraphic = (LinkUIGraphic)EditorGUILayout.EnumPopup("Link graphics to:", linkUIGraphic); } isClickable = true; EditorGUILayout.EndVertical(); PopulateList(source); base.ShowGUI(menu); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuDialogList)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); fixedOption = CustomGUILayout.Toggle("Fixed option number?", fixedOption, apiPrefix + ".fixedOption"); if (fixedOption) { numSlots = 1; slotSpacing = 0f; optionToShow = CustomGUILayout.IntSlider("Option to display:", optionToShow, 1, 10, apiPrefix + ".optionToShow"); } else { maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots"); resetOffsetWhenRestart = CustomGUILayout.ToggleLeft("Always reset offset when turn on?", resetOffsetWhenRestart, apiPrefix + ".resetOffsetWhenRestart"); if (source == MenuSource.AdventureCreator) { numSlots = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots"); 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"); } } } 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); } markAlreadyChosen = CustomGUILayout.Toggle("Mark options already used?", markAlreadyChosen, apiPrefix + ".markAlreadyChosen"); if (markAlreadyChosen) { alreadyChosenFontColour = (Color)CustomGUILayout.ColorField("'Already chosen' colour:", alreadyChosenFontColour, apiPrefix + ".alreadyChosenFontColour"); alreadyChosenFontHighlightedColour = (Color)CustomGUILayout.ColorField("'Already chosen' highlighted colour:", alreadyChosenFontHighlightedColour, apiPrefix + ".alreadyChosenFontHighlightedColour"); } if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); if (fixedOption) { uiSlots = ResizeUISlots(uiSlots, 1); } else { 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); } if (displayType == ConversationDisplayType.TextOnly || displayType == ConversationDisplayType.IconAndText) { showIndexNumbers = CustomGUILayout.Toggle("Prefix with index numbers?", showIndexNumbers, apiPrefix + ".showIndexNumbers"); } ChangeCursorGUI(menu); EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSavesList)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); saveListType = (AC_SaveListType)CustomGUILayout.EnumPopup("List type:", saveListType, apiPrefix + ".savesListType", "How this list behaves"); if (saveListType == AC_SaveListType.Save) { if (fixedOption || !allowEmptySlots) { showNewSaveOption = CustomGUILayout.Toggle("Show 'New save' option?", showNewSaveOption, apiPrefix + ".showNewSaveOption", "If True, a slot that represents a 'new save' space can be displayed if appropriate"); } if ((!fixedOption && allowEmptySlots) || showNewSaveOption) { newSaveText = CustomGUILayout.TextField("'New save' text:", newSaveText, apiPrefix + ".newSaveText", "The display text when a slot represents a 'new save' space"); } autoHandle = CustomGUILayout.Toggle("Save when click on?", autoHandle, apiPrefix + ".autoHandle"); if (autoHandle) { ActionListGUI("ActionList after saving:", menu.title, "AfterSaving", apiPrefix, "An ActionList asset that runs after the game is saved"); } else { ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file"); } } else if (saveListType == AC_SaveListType.Load) { autoHandle = CustomGUILayout.Toggle("Load when click on?", autoHandle, apiPrefix + ".autoHandle"); if (autoHandle) { ActionListGUI("ActionList after loading:", menu.title, "AfterLoading", apiPrefix, "An ActionList asset that runs after the game is loaded"); } else { ActionListGUI("ActionList when click:", menu.title, "OnClick", apiPrefix, "An ActionList asset that runs after the user clicks on a save file"); } } else if (saveListType == AC_SaveListType.Import) { autoHandle = true; #if UNITY_STANDALONE importProductName = CustomGUILayout.TextField("Import product name:", importProductName, apiPrefix + ".importProductName", "The name of the project to import files from"); importSaveFilename = CustomGUILayout.TextField("Import save filename:", importSaveFilename, apiPrefix + ".importSaveFilename", "The filename syntax of import files"); ActionListGUI("ActionList after import:", menu.title, "After_Import", apiPrefix, "An ActionList asset that runs after a save file is imported"); checkImportBool = CustomGUILayout.Toggle("Require Bool to be true?", checkImportBool, apiPrefix + ".checkImportBool", "If True, then a specific Boolean global variable must = True for an import file to be listed"); if (checkImportBool) { if (KickStarter.variablesManager != null) { ShowVarGUI(KickStarter.variablesManager.vars); } else { EditorGUILayout.HelpBox("A Variables Manager is required.", MessageType.Warning); } } #else EditorGUILayout.HelpBox("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning); #endif } displayType = (SaveDisplayType)CustomGUILayout.EnumPopup("Display type:", displayType, apiPrefix + ".displayType", "How save files are displayed"); fixedOption = CustomGUILayout.Toggle("Fixed Save ID only?", fixedOption, apiPrefix + ".fixedOption", "If True, then only one save slot will be shown"); if (fixedOption) { numSlots = 1; slotSpacing = 0f; optionToShow = CustomGUILayout.IntField("ID to display:", optionToShow, apiPrefix + ".optionToShow", "The index number of the save slot to show"); if (saveListType == AC_SaveListType.Load) { hideIfNotValid = CustomGUILayout.Toggle("Hide if no save file found?", hideIfNotValid, apiPrefix + ".hideIfNotValid", "If True, then the element will be hidden if the slot ID it represents is not filled with a valid save"); } } else { maxSlots = CustomGUILayout.IntField("Maximum number of slots:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of slots that can be displayed at once"); allowEmptySlots = CustomGUILayout.Toggle("Allow empty slots?", allowEmptySlots, apiPrefix + ".allowEmptySlots", "If True, then all slots will be shown even if they are not already assigned a save file."); if (source == MenuSource.AdventureCreator) { if (allowEmptySlots) { numSlots = maxSlots; } else { numSlots = CustomGUILayout.IntSlider("Test slots:", numSlots, 1, maxSlots, apiPrefix + ".numSlots"); } slotSpacing = CustomGUILayout.Slider("Slot spacing:", slotSpacing, 0f, 30f, 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 (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); uiHideStyle = (UIHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiHideStyle, apiPrefix + ".uiHideStyle", "The method by which this element (or slots within it) are hidden from view when made invisible"); EditorGUILayout.LabelField("Linked button objects", EditorStyles.boldLabel); if (fixedOption) { uiSlots = ResizeUISlots(uiSlots, 1); } else { uiSlots = ResizeUISlots(uiSlots, maxSlots); } for (int i = 0; i < uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI(i, source); } linkUIGraphic = (LinkUIGraphic)CustomGUILayout.EnumPopup("Link graphics to:", linkUIGraphic, "", "What Image component the element's graphics should be linked to"); } EditorGUILayout.EndVertical(); base.ShowGUI(menu); }