protected void ChangeCursorGUI(MenuSource source) { changeCursor = EditorGUILayout.Toggle("Change cursor when over?", changeCursor); if (changeCursor) { CursorManager cursorManager = AdvGame.GetReferences().cursorManager; if (cursorManager != null) { int cursorIndex = cursorManager.GetIntFromID(cursorID); cursorIndex = EditorGUILayout.Popup("Cursor ID:", cursorIndex, cursorManager.GetLabelsArray()); cursorID = cursorManager.cursorIcons[cursorIndex].id; } else { EditorGUILayout.HelpBox("No Cursor Manager found!", MessageType.Warning); } } }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (uiButton == null) { if (AdvGame.GetReferences().cursorManager) { CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID); if (_icon != null) { icon = _icon; label = _icon.label; icon.Reset(); } } base.RecalculateSize(source); } }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { PopulateList(source); isFilled = new bool [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache(uiSlots); } if (!isVisible) { LimitUISlotVisibility(uiSlots, 0, uiHideStyle); } base.RecalculateSize(source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical("Button"); if (source != MenuSource.AdventureCreator) { uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } labelType = (AC_LabelType)EditorGUILayout.EnumPopup("Label type:", labelType); if (source == MenuSource.AdventureCreator || labelType == AC_LabelType.Normal) { label = EditorGUILayout.TextField("Label text:", label); } if (labelType == AC_LabelType.GlobalVariable) { variableID = AdvGame.GlobalVariableGUI("Global Variable:", variableID); } else if (labelType == AC_LabelType.DialogueLine) { useCharacterColour = EditorGUILayout.Toggle("Use Character text colour?", useCharacterColour); if (sizeType == AC_SizeType.Manual) { autoAdjustHeight = EditorGUILayout.Toggle("Auto-adjust height to fit?", autoAdjustHeight); } } if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker) { updateIfEmpty = EditorGUILayout.Toggle("Update if string is empty?", updateIfEmpty); } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); } EditorGUILayout.EndVertical(); base.ShowGUI(source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { items = GetItemList(); if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { if (Application.isPlaying) { numSlots = Mathf.Clamp(items.Count, 0, maxSlots); } else { numSlots = Mathf.Clamp(numSlots, 0, maxSlots); } } else { numSlots = maxSlots; } if (uiHideStyle == UIHideStyle.DisableObject) { if (numSlots > items.Count) { offset = 0; numSlots = items.Count; } } LimitOffset(items.Count); labels = new string [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache(uiSlots); } if (!isVisible) { LimitUISlotVisibility(uiSlots, 0, uiHideStyle); } base.RecalculateSize(source); }
private void OnRemoveMenuItem() { if (MenuSource.Count == 0) { return; } var menucount = MenuSource.Count(t => !t.IsSeparator);//不把菜单项分隔符计算在内 var menuItemName = "菜单" + menucount; var index = MenuSource.IndexOf(MenuSource.FirstOrDefault(t => t.Text == menuItemName)); if (index == -1) { return; } var menu = MenuSource.ElementAtOrDefault(index); menuHub.Unregister(menuName, menu); MenuSource.RemoveAt(index); }
public override void RecalculateSize(MenuSource source) { if (Application.isPlaying && uiDropdown != null) { if (optionsArray.Count > selected && selected > -1 && uiDropdown.itemText != null) { uiDropdown.captionText.text = optionsArray[selected]; } for (int i = 0; i < optionsArray.Count; i++) { if (uiDropdown.options.Count > i && uiDropdown.options[i] != null) { uiDropdown.options[i].text = optionsArray[i]; } } } base.RecalculateSize(source); }
public override void RecalculateSize(MenuSource source) { PopulateList(); if (inventoryBoxType == AC_InventoryBoxType.HostpotBased) { if (!Application.isPlaying) { numSlots = Mathf.Clamp(numSlots, 0, maxSlots); } else { numSlots = items.Count; } } else { numSlots = maxSlots; if (source != MenuSource.AdventureCreator) { if (numSlots > items.Count) { offset = 0; numSlots = items.Count; } } LimitOffset(items.Count); } labels = new string [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache(uiSlots); } if (!isVisible) { LimitUISlotVisibility(uiSlots, 0); } base.RecalculateSize(source); }
public override void ShowGUI(MenuSource source) { 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); } actionListOnClick = ActionListAssetMenu.AssetGUI("ActionList after selecting:", actionListOnClick); 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) { uiImage = LinkedUiGUI <Image> (uiImage, "Linked Image:", source); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } graphicType = (AC_GraphicType)EditorGUILayout.EnumPopup("Graphic type:", graphicType); if (graphicType == AC_GraphicType.Normal) { graphic.ShowGUI(false); } EditorGUILayout.EndVertical(); base.ShowGUI(source); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuInput)"; MenuSource source = menu.menuSource; CustomGUILayout.BeginVertical(); if (source == MenuSource.AdventureCreator) { inputType = (AC_InputType)CustomGUILayout.EnumPopup("Input type:", inputType, apiPrefix + ".inputType", "What kind of characters can be entered in by the player"); label = EditorGUILayout.TextField("Default text:", label); if (inputType == AC_InputType.AlphaNumeric) { allowSpaces = CustomGUILayout.Toggle("Allow spaces?", allowSpaces, apiPrefix + ".allowSpace", "If True, then spaces are recognised"); } else if (inputType == AC_InputType.NumbericOnly) { allowDecimals = CustomGUILayout.Toggle("Allow decimals?", allowDecimals, apiPrefix + ".allowDecimals", "If True, then decimals are recognised"); } characterLimit = CustomGUILayout.IntField("Character limit:", characterLimit, apiPrefix + ".characterLimit", "The character limit on text that can be entered"); #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_2018_3_OR_NEWER EditorGUILayout.HelpBox("For the character limit to be obeyed on Android and iOS, Unity 2018.3 or later must be used.", MessageType.Info); #endif linkedButton = CustomGUILayout.TextField("'Enter' key's linked Button:", linkedButton, apiPrefix + ".linkedPrefab", "The name of the MenuButton element that is synced with the 'Return' key when this element is active"); requireSelection = CustomGUILayout.ToggleLeft("Require selection to accept input?", requireSelection, apiPrefix + ".requireSelection", "If True, then the element will need to be selected before it receives input"); } else { #if TextMeshProIsPresent uiInput = LinkedUiGUI <TMPro.TMP_InputField> (uiInput, "Linked InputField:", source); #else uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source); #endif uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible"); } CustomGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuTimer)"; MenuSource source = menu.menuSource; CustomGUILayout.BeginVertical(); timerType = (AC_TimerType)CustomGUILayout.EnumPopup("Timer type:", timerType, apiPrefix + ".timerType", "What the value of the timer represents"); if (timerType == AC_TimerType.LoadingProgress && AdvGame.GetReferences().settingsManager&& !AdvGame.GetReferences().settingsManager.useAsyncLoading) { EditorGUILayout.HelpBox("Loading progress cannot be displayed unless asynchonised loading is enabled within the Settings Manager.", MessageType.Warning); } else if (timerType == AC_TimerType.Conversation) { autoSetVisibility = CustomGUILayout.Toggle("Auto-set visibility?", autoSetVisibility, apiPrefix + ".autoSetVisibility", "If True, the Timer will be hidden if the active Conversation is not timed"); } doInvert = CustomGUILayout.Toggle("Invert value?", doInvert, apiPrefix + ".doInvert", "If True, then the value will be inverted, and the timer will move in the opposite direction"); smoothingFactor = CustomGUILayout.Slider("Value smoothing:", smoothingFactor, 0f, 1f, ".smoothingFactor", "The amount of smoothing to apply (0 = no smoothing)"); if (source == MenuSource.AdventureCreator) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Timer texture:", "The texture of the slider bar"), GUILayout.Width(145f)); timerTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (timerTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".timerTexture"); EditorGUILayout.EndHorizontal(); } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source, "The Unity UI Slider this is linked to"); uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible"); } CustomGUILayout.EndVertical(); if (source == MenuSource.AdventureCreator) { EndGUI(apiPrefix); } }
private void PopulateList(MenuSource source) { if (Application.isPlaying) { if (craftingType == CraftingElementType.Ingredients) { items = new List <InvItem>(); foreach (InvItem _item in KickStarter.runtimeInventory.craftingItems) { items.Add(_item); } } else if (craftingType == CraftingElementType.Output) { SetOutput(source, true); return; } } else { items = new List <InvItem>(); if (AdvGame.GetReferences().inventoryManager != null) { foreach (InvItem _item in AdvGame.GetReferences().inventoryManager.items) { items.Add(_item); if (craftingType == CraftingElementType.Output) { return; } else if (items.Count >= numSlots) { return; } } } return; } }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical("Button"); if (source == MenuSource.AdventureCreator) { displayType = (AC_DisplayType)EditorGUILayout.EnumPopup("Display type:", displayType); GetCursorGUI(); if (displayType != AC_DisplayType.IconOnly) { anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); } if (displayType != AC_DisplayType.TextOnly) { overrideTexture = EditorGUILayout.Toggle("Override icon texture?", overrideTexture); if (overrideTexture) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Active texture:", GUILayout.Width(145f)); activeTexture = (Texture2D)EditorGUILayout.ObjectField(activeTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f)); EditorGUILayout.EndHorizontal(); } } } else { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); displayType = (AC_DisplayType)EditorGUILayout.EnumPopup("Display type:", displayType); GetCursorGUI(); } EditorGUILayout.EndVertical(); base.ShowGUI(source); }
private void GetCursorGUI(string apiPrefix, MenuSource source) { fixedIcon = CustomGUILayout.Toggle("For fixed icon?", fixedIcon, apiPrefix + ".fixedIcon", "If True, the element will always be associated with the same single icon. If False, the element will represent all available icons."); if (fixedIcon) { numSlots = 1; if (AdvGame.GetReferences().cursorManager&& AdvGame.GetReferences().cursorManager.cursorIcons.Count > 0) { int iconInt = AdvGame.GetReferences().cursorManager.GetIntFromID(iconID); iconInt = EditorGUILayout.Popup("Cursor:", iconInt, AdvGame.GetReferences().cursorManager.GetLabelsArray()); iconID = AdvGame.GetReferences().cursorManager.cursorIcons [iconInt].id; } else { iconID = -1; } } else { maxSlots = CustomGUILayout.IntField("Maximum # of icons:", maxSlots, apiPrefix + ".maxSlots", "The maximum number of icons that can be shown at once"); if (KickStarter.cursorManager != null && maxSlots > KickStarter.cursorManager.cursorIcons.Count) { maxSlots = KickStarter.cursorManager.cursorIcons.Count; } if (source == MenuSource.AdventureCreator) { 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"); } } } }
public void SetOutput(MenuSource source, bool autoCreate) { items = new List <InvItem>(); activeRecipe = KickStarter.runtimeInventory.CalculateRecipe(autoCreate); if (activeRecipe != null) { foreach (InvItem assetItem in AdvGame.GetReferences().inventoryManager.items) { if (assetItem.id == activeRecipe.resultID) { InvItem newItem = new InvItem(assetItem); newItem.count = 1; items.Add(newItem); } } } if (!autoCreate) { base.RecalculateSize(source); } }
/** * <summary>Creates and displays the correct InvItem, based on the current Recipe, provided craftingType = CraftingElementType.Output.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public void SetOutput(MenuSource source) { if (craftingType != CraftingElementType.Output) { return; } items = new List <InvItem>(); activeRecipe = KickStarter.runtimeInventory.CalculateRecipe(); if (activeRecipe != null) { AdvGame.RunActionListAsset(activeRecipe.actionListOnCreate); foreach (InvItem assetItem in AdvGame.GetReferences().inventoryManager.items) { if (assetItem.id == activeRecipe.resultID) { InvItem newItem = new InvItem(assetItem); newItem.count = 1; items.Add(newItem); } } KickStarter.eventManager.Call_OnCraftingSucceed(activeRecipe); } else { if (!autoCreate && actionListOnWrongIngredients != null) { actionListOnWrongIngredients.Interact(); } } /*if (!autoCreate) * { * base.RecalculateSize (source); * }*/ }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (AdvGame.GetReferences().cursorManager) { CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID); if (_icon != null) { icon = _icon; if (Application.isPlaying) { label = KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage()); } else { label = _icon.label; } icon.Reset(); } } base.RecalculateSize(source); }
public override void RecalculateSize(MenuSource source) { if (Application.isPlaying && uiDropdown != null) { if (uiDropdown.captionText != null) { string _label = GetOptionLabel(selected); if (!string.IsNullOrEmpty(_label)) { uiDropdown.captionText.text = _label; } } for (int i = 0; i < GetNumOptions(); i++) { if (uiDropdown.options.Count > i && uiDropdown.options[i] != null) { uiDropdown.options[i].text = GetOptionLabel(i); } } } base.RecalculateSize(source); }
public override void ShowGUI(MenuSource source) { if (source != MenuSource.AdventureCreator) { EditorGUILayout.HelpBox("This Element type is not necessary in Unity's UI, as it can be recreated using ScrollBars and ScrollRects.", MessageType.Info); return; } EditorGUILayout.BeginVertical("Button"); label = EditorGUILayout.TextField("Button text:", label); anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); dragType = (DragElementType)EditorGUILayout.EnumPopup("Drag type:", dragType); if (dragType == DragElementType.SingleElement) { elementName = EditorGUILayout.TextField("Element name:", elementName); } dragRect = EditorGUILayout.RectField("Drag boundary:", dragRect); EditorGUILayout.EndVertical(); base.ShowGUI(source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical("Button"); timerType = (AC_TimerType)EditorGUILayout.EnumPopup("Timer type:", timerType); doInvert = EditorGUILayout.Toggle("Invert value?", doInvert); if (source == MenuSource.AdventureCreator) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Timer texture:", GUILayout.Width(145f)); timerTexture = (Texture2D)EditorGUILayout.ObjectField(timerTexture, typeof(Texture2D), false, GUILayout.Width(70f), GUILayout.Height(30f)); EditorGUILayout.EndHorizontal(); } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source); } EditorGUILayout.EndVertical(); if (source == MenuSource.AdventureCreator) { EndGUI(); } }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical("Button"); if (source == MenuSource.AdventureCreator) { label = EditorGUILayout.TextField("Default text:", label); inputType = (AC_InputType)EditorGUILayout.EnumPopup("Input type:", inputType); if (inputType == AC_InputType.AlphaNumeric) { allowSpaces = EditorGUILayout.Toggle("Allow spaces?", allowSpaces); } characterLimit = EditorGUILayout.IntField("Character limit:", characterLimit); anchor = (TextAnchor)EditorGUILayout.EnumPopup("Text alignment:", anchor); textEffects = (TextEffects)EditorGUILayout.EnumPopup("Text effect:", textEffects); linkedButton = EditorGUILayout.TextField("'Enter' key's linked Button:", linkedButton); } else { uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source); } EditorGUILayout.EndVertical(); base.ShowGUI(source); }
private void PopulateList(MenuSource source) { if (Application.isPlaying) { if (craftingType == CraftingElementType.Ingredients) { items = new List <InvItem>(); foreach (InvItem _item in KickStarter.runtimeInventory.craftingItems) { items.Add(_item); } } else if (craftingType == CraftingElementType.Output) { SetOutput(source, true); return; } } else { items = new List <InvItem>(); return; } }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source == MenuSource.AdventureCreator) { label = EditorGUILayout.TextField ("Label text:", label); anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); useFullWidth = EditorGUILayout.Toggle ("Use full width?", useFullWidth); sliderDisplayType = (SliderDisplayType) EditorGUILayout.EnumPopup ("Display type:", sliderDisplayType); EditorGUILayout.BeginHorizontal (); if (sliderDisplayType == SliderDisplayType.FillBar) { EditorGUILayout.LabelField ("Fill-bar texture:", GUILayout.Width (145f)); } else if (sliderDisplayType == SliderDisplayType.MoveableBlock) { EditorGUILayout.LabelField ("Movable block texture:", GUILayout.Width (145f)); } sliderTexture = (Texture2D) EditorGUILayout.ObjectField (sliderTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); if (sliderDisplayType == SliderDisplayType.MoveableBlock) { blockSize = EditorGUILayout.Vector2Field ("Block size:", blockSize); } } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } sliderType = (AC_SliderType) EditorGUILayout.EnumPopup ("Slider affects:", sliderType); if (sliderType == AC_SliderType.CustomScript) { ShowClipHelp (); amount = EditorGUILayout.Slider ("Default value:", amount, minValue, maxValue); } else if (sliderType == AC_SliderType.FloatVariable) { varID = AdvGame.GlobalVariableGUI ("Global float var:", varID); if (varID >= 0 && AdvGame.GetReferences () && AdvGame.GetReferences ().variablesManager) { GVar _var = AdvGame.GetReferences ().variablesManager.GetVariable (varID); if (_var != null && _var.type != VariableType.Float) { EditorGUILayout.HelpBox ("The chosen Variable must be a Float.", MessageType.Warning); } } } if (sliderType == AC_SliderType.CustomScript || sliderType == AC_SliderType.FloatVariable) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Min. value:", GUILayout.Width (80f)); minValue = EditorGUILayout.FloatField (minValue); EditorGUILayout.LabelField ("Max. value:", GUILayout.Width (80f)); maxValue = EditorGUILayout.FloatField (maxValue); EditorGUILayout.EndHorizontal (); maxValue = Mathf.Max (minValue, maxValue); actionListOnChange = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on change:", actionListOnChange, typeof (ActionListAsset), false); } else { minValue = 0f; maxValue = 1f; } if (source == MenuSource.AdventureCreator) { numberOfSteps = EditorGUILayout.IntField ("Number of steps:", numberOfSteps); } isClickable = EditorGUILayout.Toggle ("User can change value?", isClickable); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void RecalculateSize(MenuSource source) { clickAlpha = 0f; base.RecalculateSize (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); 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 { categoryID = -1; numSlots = 1; } if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); 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 (source); }
public void SetOutput(MenuSource source, bool autoCreate) { items = new List<InvItem>(); activeRecipe = KickStarter.runtimeInventory.CalculateRecipe (autoCreate); if (activeRecipe != null) { foreach (InvItem assetItem in AdvGame.GetReferences ().inventoryManager.items) { if (assetItem.id == activeRecipe.resultID) { InvItem newItem = new InvItem (assetItem); newItem.count = 1; items.Add (newItem); } } } if (!autoCreate) { base.RecalculateSize (source); } }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != MenuSource.AdventureCreator) { uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } label = EditorGUILayout.TextField ("Label text:", label); appendState = EditorGUILayout.Toggle ("Append state to label?", appendState); if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("'On' texture:", GUILayout.Width (145f)); onTexture = (Texture2D) EditorGUILayout.ObjectField (onTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("'Off' texture:", GUILayout.Width (145f)); offTexture = (Texture2D) EditorGUILayout.ObjectField (offTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); } toggleType = (AC_ToggleType) EditorGUILayout.EnumPopup ("Toggle type:", toggleType); if (toggleType == AC_ToggleType.CustomScript) { isOn = EditorGUILayout.Toggle ("On by default?", isOn); ShowClipHelp (); } else if (toggleType == AC_ToggleType.Variable) { varID = AdvGame.GlobalVariableGUI ("Boolean variable:", varID); if (varID >= 0 && AdvGame.GetReferences () && AdvGame.GetReferences ().variablesManager) { GVar _var = AdvGame.GetReferences ().variablesManager.GetVariable (varID); if (_var != null && _var.type != VariableType.Boolean) { EditorGUILayout.HelpBox ("The chosen Variable must be a Boolean.", MessageType.Warning); } } } if (toggleType != AC_ToggleType.Subtitles) { actionListOnClick = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on click:", actionListOnClick, typeof (ActionListAsset), false); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source == MenuSource.AdventureCreator) { label = EditorGUILayout.TextField ("Default text:", label); inputType = (AC_InputType) EditorGUILayout.EnumPopup ("Input type:", inputType); if (inputType == AC_InputType.AlphaNumeric) { allowSpaces = EditorGUILayout.Toggle ("Allow spaces?", allowSpaces); } characterLimit = EditorGUILayout.IntField ("Character limit:", characterLimit); anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); linkedButton = EditorGUILayout.TextField ("'Enter' key's linked Button:", linkedButton); } else { uiInput = LinkedUiGUI <InputField> (uiInput, "Linked InputField:", source); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuCycle)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source != AC.MenuSource.AdventureCreator) { cycleUIBasis = (CycleUIBasis)CustomGUILayout.EnumPopup("UI basis:", cycleUIBasis, apiPrefix + ".cycleUIBasis", "What kind of UI element the Cycle is linked to"); if (cycleUIBasis == CycleUIBasis.Button) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source, "The Unity UI Button this is linked to"); } else if (cycleUIBasis == CycleUIBasis.Dropdown) { #if UNITY_5_3_OR_NEWER uiDropdown = LinkedUiGUI <Dropdown> (uiDropdown, "Linked Dropdown:", source); #else EditorGUILayout.HelpBox("This option is only available with Unity 5.4 or newer.", MessageType.Info); #endif } uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle", "The method by which this element is hidden from view when made invisible"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } cycleType = (AC_CycleType)CustomGUILayout.EnumPopup("Cycle type:", cycleType, apiPrefix + ".cycleType", "What the value links to"); if (source == MenuSource.AdventureCreator || cycleUIBasis == CycleUIBasis.Button) { label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen, which prefixes the varying text"); } if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable) { int numOptions = optionsArray.Count; numOptions = EditorGUILayout.IntField("Number of choices:", optionsArray.Count); if (numOptions < 0) { numOptions = 0; } if (numOptions < optionsArray.Count) { optionsArray.RemoveRange(numOptions, optionsArray.Count - numOptions); } else if (numOptions > optionsArray.Count) { if (numOptions > optionsArray.Capacity) { optionsArray.Capacity = numOptions; } for (int i = optionsArray.Count; i < numOptions; i++) { optionsArray.Add(""); } } for (int i = 0; i < optionsArray.Count; i++) { optionsArray [i] = CustomGUILayout.TextField("Choice #" + i.ToString() + ":", optionsArray [i], apiPrefix + ".optionsArray[" + i.ToString() + "]"); } if (cycleType == AC_CycleType.CustomScript) { if (optionsArray.Count > 0) { selected = CustomGUILayout.IntField("Default option #:", selected, apiPrefix + ".selected"); } ShowClipHelp(); } else if (cycleType == AC_CycleType.Variable) { varID = AdvGame.GlobalVariableGUI("Global integer var:", varID, VariableType.Integer, "The Global Integer variable that's value will be synced with the cycle"); } actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick", "The ActionList asset to run when the element is clicked on"); } alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton", "The name of the input button that triggers the element when pressed"); EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source == MenuSource.AdventureCreator) { label = EditorGUILayout.TextField ("Label text:", label); anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); useFullWidth = EditorGUILayout.Toggle ("Use full width?", useFullWidth); sliderDisplayType = (SliderDisplayType) EditorGUILayout.EnumPopup ("Display type:", sliderDisplayType); EditorGUILayout.BeginHorizontal (); if (sliderDisplayType == SliderDisplayType.FillBar) { EditorGUILayout.LabelField ("Fill-bar texture:", GUILayout.Width (145f)); } else if (sliderDisplayType == SliderDisplayType.MoveableBlock) { EditorGUILayout.LabelField ("Movable block texture:", GUILayout.Width (145f)); } sliderTexture = (Texture2D) EditorGUILayout.ObjectField (sliderTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); if (sliderDisplayType == SliderDisplayType.MoveableBlock) { blockSize = EditorGUILayout.Vector2Field ("Block size:", blockSize); } } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } sliderType = (AC_SliderType) EditorGUILayout.EnumPopup ("Slider affects:", sliderType); if (sliderType == AC_SliderType.CustomScript) { amount = EditorGUILayout.Slider ("Default value:", amount, 0f, 1f); ShowClipHelp (); } else if (sliderType == AC_SliderType.FloatVariable) { varID = EditorGUILayout.IntField ("Global Variable ID:", varID); } if (source == MenuSource.AdventureCreator) { numberOfSteps = EditorGUILayout.IntField ("Number of steps:", numberOfSteps); } isClickable = EditorGUILayout.Toggle ("User can change value?", isClickable); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { if (source != MenuSource.AdventureCreator) { EditorGUILayout.HelpBox ("This Element type is not necessary in Unity's UI, as it can be recreated using ScrollBars and ScrollRects.", MessageType.Info); return; } EditorGUILayout.BeginVertical ("Button"); label = EditorGUILayout.TextField ("Button text:", label); anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); dragType = (DragElementType) EditorGUILayout.EnumPopup ("Drag type:", dragType); if (dragType == DragElementType.SingleElement) { elementName = EditorGUILayout.TextField ("Element name:", elementName); } dragRect = EditorGUILayout.RectField ("Drag boundary:", dragRect); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void RecalculateSize(MenuSource source) { newSaveSlot = false; if (Application.isPlaying) { if (saveListType == AC_SaveListType.Import) { if (checkImportBool) { KickStarter.saveSystem.GatherImportFiles (importProductName, importSaveFilename, checkImportVar); } else { KickStarter.saveSystem.GatherImportFiles (importProductName, importSaveFilename, -1); } } if (fixedOption) { numSlots = 1; } else { if (saveListType == AC_SaveListType.Import) { numSlots = SaveSystem.GetNumImportSlots (); } else { numSlots = SaveSystem.GetNumSlots (); if (saveListType == AC_SaveListType.Save && numSlots < KickStarter.settingsManager.maxSaves && showNewSaveOption) { newSaveSlot = true; numSlots ++; } } if (numSlots > maxSlots) { numSlots = maxSlots; } offset = Mathf.Min (offset, GetMaxOffset ()); } } labels = new string [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache (uiSlots); } if (!isVisible) { LimitUISlotVisibility (uiSlots, 0); } base.RecalculateSize (source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (uiButton == null) { if (AdvGame.GetReferences ().cursorManager) { CursorIcon _icon = AdvGame.GetReferences ().cursorManager.GetCursorIconFromID (iconID); if (_icon != null) { icon = _icon; label = _icon.label; icon.Reset (); } } base.RecalculateSize (source); } }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source == MenuSource.AdventureCreator) { displayType = (AC_DisplayType) EditorGUILayout.EnumPopup ("Display type:", displayType); GetCursorGUI (); if (displayType != AC_DisplayType.IconOnly) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } } else { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); displayType = (AC_DisplayType) EditorGUILayout.EnumPopup ("Display type:", displayType); GetCursorGUI (); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
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); }
public override void ShowGUI(Menu menu) { MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source != AC.MenuSource.AdventureCreator) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source); uiSelectableHideStyle = (UISelectableHideStyle)EditorGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } label = EditorGUILayout.TextField("Label text:", label); 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); } } cycleType = (AC_CycleType)EditorGUILayout.EnumPopup("Cycle type:", cycleType); if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable) { int numOptions = optionsArray.Count; numOptions = EditorGUILayout.IntField("Number of choices:", optionsArray.Count); if (numOptions < 0) { numOptions = 0; } if (numOptions < optionsArray.Count) { optionsArray.RemoveRange(numOptions, optionsArray.Count - numOptions); } else if (numOptions > optionsArray.Count) { if (numOptions > optionsArray.Capacity) { optionsArray.Capacity = numOptions; } for (int i = optionsArray.Count; i < numOptions; i++) { optionsArray.Add(""); } } for (int i = 0; i < optionsArray.Count; i++) { optionsArray [i] = EditorGUILayout.TextField("Choice #" + i.ToString() + ":", optionsArray [i]); } if (cycleType == AC_CycleType.CustomScript) { if (optionsArray.Count > 0) { selected = EditorGUILayout.IntField("Default option #:", selected); } ShowClipHelp(); } else if (cycleType == AC_CycleType.Variable) { varID = EditorGUILayout.IntField("Global Variable ID:", varID); } actionListOnClick = (ActionListAsset)EditorGUILayout.ObjectField("ActionList on click:", actionListOnClick, typeof(ActionListAsset), false); } alternativeInputButton = EditorGUILayout.TextField("Alternative input button:", alternativeInputButton); EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != AC.MenuSource.AdventureCreator) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } label = EditorGUILayout.TextField ("Label text:", label); if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } cycleType = (AC_CycleType) EditorGUILayout.EnumPopup ("Cycle type:", cycleType); if (cycleType == AC_CycleType.CustomScript || cycleType == AC_CycleType.Variable) { int numOptions = optionsArray.Count; numOptions = EditorGUILayout.IntField ("Number of choices:", optionsArray.Count); if (numOptions < 0) { numOptions = 0; } if (numOptions < optionsArray.Count) { optionsArray.RemoveRange (numOptions, optionsArray.Count - numOptions); } else if (numOptions > optionsArray.Count) { if(numOptions > optionsArray.Capacity) { optionsArray.Capacity = numOptions; } for (int i=optionsArray.Count; i<numOptions; i++) { optionsArray.Add (""); } } for (int i=0; i<optionsArray.Count; i++) { optionsArray [i] = EditorGUILayout.TextField ("Choice #" + i.ToString () + ":", optionsArray [i]); } if (cycleType == AC_CycleType.CustomScript) { if (optionsArray.Count > 0) { selected = EditorGUILayout.IntField ("Default option #:", selected); } ShowClipHelp (); } else if (cycleType == AC_CycleType.Variable) { varID = EditorGUILayout.IntField ("Global Variable ID:", varID); } actionListOnClick = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on click:", actionListOnClick, typeof (ActionListAsset), false); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public void LinkedUiGUI(int i, MenuSource source) { uiButton = (UnityEngine.UI.Button) EditorGUILayout.ObjectField ("Linked Button (" + (i+1).ToString () + "):", uiButton, typeof (UnityEngine.UI.Button), true); uiButtonID = Menu.FieldToID <UnityEngine.UI.Button> (uiButton, uiButtonID); uiButton = Menu.IDToField <UnityEngine.UI.Button> (uiButton, uiButtonID, source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); numPages = EditorGUILayout.IntField ("Number of starting pages:", numPages); if (numPages > 0) { showPage = EditorGUILayout.IntSlider ("Preview page:", showPage, 1, numPages); startFromPage = EditorGUILayout.Toggle ("Start from this page?", startFromPage); if (numPages != pages.Count) { if (numPages > pages.Count) { while (numPages > pages.Count) { pages.Add (new JournalPage ()); } } else { pages.RemoveRange (numPages, pages.Count - numPages); } } if (showPage > 0 && pages.Count >= showPage-1) { EditorGUILayout.LabelField ("Page " + showPage + " text:"); pages[showPage-1].text = EditorGUILayout.TextArea (pages[showPage-1].text); if (pages[showPage-1].text.Contains ("*")) { EditorGUILayout.HelpBox ("Errors will occur if pages contain '*' characters.", MessageType.Error); } else if (pages[showPage-1].text.Contains ("|")) { EditorGUILayout.HelpBox ("Errors will occur if pages contain '|' characters.", MessageType.Error); } } } else { numPages = 1; } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } else { EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != MenuSource.AdventureCreator) { uiButton = LinkedUiGUI <UnityEngine.UI.Button> (uiButton, "Linked Button:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } label = EditorGUILayout.TextField ("Button text:", label); if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } hotspotLabel = EditorGUILayout.TextField ("Hotspot label override:", hotspotLabel); if (source == MenuSource.AdventureCreator) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Click texture:", GUILayout.Width (145f)); clickTexture = (Texture2D) EditorGUILayout.ObjectField (clickTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); } buttonClickType = (AC_ButtonClickType) EditorGUILayout.EnumPopup ("Click type:", buttonClickType); if (buttonClickType == AC_ButtonClickType.TurnOffMenu) { doFade = EditorGUILayout.Toggle ("Do transition?", doFade); } else if (buttonClickType == AC_ButtonClickType.Crossfade) { switchMenuTitle = EditorGUILayout.TextField ("Menu to switch to:", switchMenuTitle); } else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot) { inventoryBoxTitle = EditorGUILayout.TextField ("Element to affect:", inventoryBoxTitle); shiftInventory = (AC_ShiftInventory) EditorGUILayout.EnumPopup ("Offset type:", shiftInventory); shiftAmount = EditorGUILayout.IntField ("Offset amount:", shiftAmount); onlyShowWhenEffective = EditorGUILayout.Toggle ("Only show when effective?", onlyShowWhenEffective); } else if (buttonClickType == AC_ButtonClickType.OffsetJournal) { inventoryBoxTitle = EditorGUILayout.TextField ("Journal to affect:", inventoryBoxTitle); shiftInventory = (AC_ShiftInventory) EditorGUILayout.EnumPopup ("Offset type:", shiftInventory); loopJournal = EditorGUILayout.Toggle ("Cycle pages?", loopJournal); } else if (buttonClickType == AC_ButtonClickType.RunActionList) { ActionListGUI (); } else if (buttonClickType == AC_ButtonClickType.CustomScript) { allowContinuousClick = EditorGUILayout.Toggle ("Accept held-down clicks?", allowContinuousClick); ShowClipHelp (); } else if (buttonClickType == AC_ButtonClickType.SimulateInput) { simulateInput = (SimulateInputType) EditorGUILayout.EnumPopup ("Simulate:", simulateInput); inputAxis = EditorGUILayout.TextField ("Input axis:", inputAxis); if (simulateInput == SimulateInputType.Axis) { simulateValue = EditorGUILayout.FloatField ("Input value:", simulateValue); } } ChangeCursorGUI (source); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != MenuSource.AdventureCreator) { uiImage = LinkedUiGUI <Image> (uiImage, "Linked Image:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } graphicType = (AC_GraphicType) EditorGUILayout.EnumPopup ("Graphic type:", graphicType); if (graphicType == AC_GraphicType.Normal) { graphic.ShowGUI (false); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void RecalculateSize(MenuSource source) { PopulateList (source); isFilled = new bool [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache (uiSlots); } if (!isVisible) { LimitUISlotVisibility (uiSlots, 0); } base.RecalculateSize (source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { PopulateList (); if (inventoryBoxType == AC_InventoryBoxType.HotspotBased) { if (!Application.isPlaying) { numSlots = Mathf.Clamp (numSlots, 0, maxSlots); } else { //numSlots = items.Count; numSlots = Mathf.Clamp (items.Count, 0, maxSlots); } } else { numSlots = maxSlots; if (source != MenuSource.AdventureCreator) { if (numSlots > items.Count) { offset = 0; numSlots = items.Count; } } LimitOffset (items.Count); } labels = new string [numSlots]; if (Application.isPlaying && uiSlots != null) { ClearSpriteCache (uiSlots); } if (!isVisible) { LimitUISlotVisibility (uiSlots, 0); } base.RecalculateSize (source); }
private void PopulateList(MenuSource source) { if (Application.isPlaying) { if (craftingType == CraftingElementType.Ingredients) { items = new List<InvItem>(); foreach (InvItem _item in KickStarter.runtimeInventory.craftingItems) { items.Add (_item); } } else if (craftingType == CraftingElementType.Output) { SetOutput (source, true); return; } } else { items = new List<InvItem>(); return; } }
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); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { graphic.Reset(); SetUIGraphic(); base.RecalculateSize(source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (Application.isPlaying) { numSlots = KickStarter.options.GetNumProfiles (); if (!showActive) { numSlots --; } if (numSlots > maxSlots) { numSlots = maxSlots; } offset = Mathf.Min (offset, GetMaxOffset ()); } labels = new string [numSlots]; if (!isVisible) { LimitUISlotVisibility (uiSlots, 0); } base.RecalculateSize (source); }
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(MenuSource source) { 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); } actionListOnClick = ActionListAssetMenu.AssetGUI ("ActionList after selecting:", actionListOnClick); 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); }
public override void ShowGUI(MenuSource source) { 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); } } 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); } } ChangeCursorGUI (source); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (pages == null || pages.Count == 0) { pages.Clear (); pages.Add (new JournalPage ()); } numPages = pages.Count; for (int i=0; i<pages.Count; i++) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Page #" + (i+1).ToString () + ":"); if (GUILayout.Button ("-", GUILayout.Width (20f))) { Undo.RecordObject (this, "Delete journal page"); pages.RemoveAt (i); break; } EditorGUILayout.EndHorizontal (); pages[i].text = EditorGUILayout.TextArea (pages[i].text); GUILayout.Box ("", GUILayout.ExpandWidth (true), GUILayout.Height(1)); } if (GUILayout.Button ("Create new page", EditorStyles.miniButton)) { Undo.RecordObject (this, "Create journal page"); pages.Add (new JournalPage ()); } numPages = pages.Count; EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); if (numPages > 1) { showPage = EditorGUILayout.IntSlider ("Preview page #:", showPage, 1, numPages); startFromPage = EditorGUILayout.Toggle ("Start from this page?", startFromPage); } else { showPage = 1; } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } else { EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source); } actionListOnAddPage = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on add page:", actionListOnAddPage, typeof (ActionListAsset), false); EditorGUILayout.EndVertical (); base.ShowGUI (source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (Application.isPlaying) { if (KickStarter.playerInput.activeConversation) { numOptions = KickStarter.playerInput.activeConversation.GetCount(); if (fixedOption) { if (numOptions < optionToShow) { numSlots = 0; } else { numSlots = 1; labels = new string[numSlots]; labels[0] = KickStarter.playerInput.activeConversation.GetOptionName(optionToShow - 1); labels[0] = AddIndexNumber(labels[0], optionToShow); icons = new Texture2D[numSlots]; icons[0] = KickStarter.playerInput.activeConversation.GetOptionIcon(optionToShow - 1); chosens = new bool[numSlots]; chosens[0] = KickStarter.playerInput.activeConversation.OptionHasBeenChosen(optionToShow - 1); } } else { numSlots = numOptions; if (numSlots > maxSlots) { numSlots = maxSlots; } labels = new string[numSlots]; icons = new Texture2D[numSlots]; chosens = new bool[numSlots]; for (int i = 0; i < numSlots; i++) { labels[i] = KickStarter.playerInput.activeConversation.GetOptionName(i + offset); labels[i] = AddIndexNumber(labels[i], i + offset + 1); icons[i] = KickStarter.playerInput.activeConversation.GetOptionIcon(i + offset); chosens[i] = KickStarter.playerInput.activeConversation.OptionHasBeenChosen(i + offset); if (markAlreadyChosen && source != MenuSource.AdventureCreator) { if (chosens[i + offset]) { uiSlots[i + offset].SetColour(alreadyChosenFontColour); } else { uiSlots[i + offset].RestoreColour(); } } } LimitOffset(numOptions); } } else { numSlots = 0; } } else if (fixedOption) { numSlots = 1; offset = 0; labels = new string[numSlots]; icons = new Texture2D[numSlots]; chosens = new bool[numSlots]; } if (Application.isPlaying && uiSlots != null) { ClearSpriteCache(uiSlots); } if (!isVisible) { LimitUISlotVisibility(uiSlots, 0, uiHideStyle); } base.RecalculateSize(source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); timerType = (AC_TimerType) EditorGUILayout.EnumPopup ("Timer type:", timerType); if (timerType == AC_TimerType.LoadingProgress && AdvGame.GetReferences ().settingsManager != null && !AdvGame.GetReferences ().settingsManager.useAsyncLoading) { EditorGUILayout.HelpBox ("Loading progress cannot be displayed unless asynchonised loading is enabled within the Settings Manager.", MessageType.Warning); } doInvert = EditorGUILayout.Toggle ("Invert value?", doInvert); if (source == MenuSource.AdventureCreator) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Timer texture:", GUILayout.Width (145f)); timerTexture = (Texture2D) EditorGUILayout.ObjectField (timerTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source); } EditorGUILayout.EndVertical (); if (source == MenuSource.AdventureCreator) { EndGUI (); } }
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); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { if (source == MenuSource.AdventureCreator) { Deselect (); } base.RecalculateSize (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != MenuSource.AdventureCreator) { uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } labelType = (AC_LabelType) EditorGUILayout.EnumPopup ("Label type:", labelType); if (labelType == AC_LabelType.Normal) { label = EditorGUILayout.TextField ("Label text:", label); } else if (source == MenuSource.AdventureCreator) { label = EditorGUILayout.TextField ("Placeholder text:", label); } if (labelType == AC_LabelType.GlobalVariable) { variableID = AdvGame.GlobalVariableGUI ("Global Variable:", variableID); } else if (labelType == AC_LabelType.DialogueLine) { useCharacterColour = EditorGUILayout.Toggle ("Use Character text colour?", useCharacterColour); if (sizeType == AC_SizeType.Manual) { autoAdjustHeight = EditorGUILayout.Toggle ("Auto-adjust height to fit?", autoAdjustHeight); } } if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker) { updateIfEmpty = EditorGUILayout.Toggle ("Update if string is empty?", updateIfEmpty); } else if (labelType == AC_LabelType.InventoryProperty) { if (AdvGame.GetReferences ().inventoryManager) { if (AdvGame.GetReferences ().inventoryManager.invVars != null && AdvGame.GetReferences ().inventoryManager.invVars.Count > 0) { InvVar[] invVars = AdvGame.GetReferences ().inventoryManager.invVars.ToArray (); List<string> invVarNames = new List<string>(); int itemPropertyNumber = 0; for (int i=0; i<invVars.Length; i++) { if (invVars[i].id == itemPropertyID) { itemPropertyNumber = i; } invVarNames.Add (invVars[i].id + ": " + invVars[i].label); } itemPropertyNumber = EditorGUILayout.Popup ("Inventory property:", itemPropertyNumber, invVarNames.ToArray ()); itemPropertyID = invVars[itemPropertyNumber].id; inventoryPropertyType = (InventoryPropertyType) EditorGUILayout.EnumPopup ("Inventory item source:", inventoryPropertyType); } else { EditorGUILayout.HelpBox ("No Inventory properties defined!", MessageType.Warning); } } else { EditorGUILayout.HelpBox ("No Inventory Manager assigned!", MessageType.Warning); } } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); fixedOption = EditorGUILayout.Toggle ("Fixed option number?", fixedOption); if (fixedOption) { numSlots = 1; slotSpacing = 0f; optionToShow = EditorGUILayout.IntField ("Option to display:", optionToShow); } else { 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); } displayType = (SaveDisplayType) EditorGUILayout.EnumPopup ("Display:", displayType); if (displayType != SaveDisplayType.LabelOnly) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Empty slot texture:", GUILayout.Width (145f)); blankSlotTexture = (Texture2D) EditorGUILayout.ObjectField (blankSlotTexture, typeof (Texture2D), false, GUILayout.Width (70f), GUILayout.Height (30f)); EditorGUILayout.EndHorizontal (); } saveListType = (AC_SaveListType) EditorGUILayout.EnumPopup ("List type:", saveListType); if (saveListType == AC_SaveListType.Save) { showNewSaveOption = EditorGUILayout.Toggle ("Show 'New save' option?", showNewSaveOption); if (showNewSaveOption) { newSaveText = EditorGUILayout.TextField ("'New save' text:", newSaveText); } autoHandle = EditorGUILayout.Toggle ("Save when click on?", autoHandle); if (autoHandle) { ActionListGUI ("ActionList after saving:"); } else { ActionListGUI ("ActionList when click:"); } } else if (saveListType == AC_SaveListType.Load) { autoHandle = EditorGUILayout.Toggle ("Load when click on?", autoHandle); if (autoHandle) { ActionListGUI ("ActionList after loading:"); } else { ActionListGUI ("ActionList when click:"); } } else if (saveListType == AC_SaveListType.Import) { autoHandle = true; #if UNITY_STANDALONE importProductName = EditorGUILayout.TextField ("Import product name:", importProductName); importSaveFilename = EditorGUILayout.TextField ("Import save filename:", importSaveFilename); ActionListGUI ("ActionList after import:"); checkImportBool = EditorGUILayout.Toggle ("Require Bool to be true?", checkImportBool); if (checkImportBool) { checkImportVar = EditorGUILayout.IntField ("Global Variable ID:", checkImportVar); } #else EditorGUILayout.HelpBox ("This feature is only available for standalone platforms (PC, Mac, Linux)", MessageType.Warning); #endif } if (source != MenuSource.AdventureCreator) { EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); if (fixedOption) { uiSlots = ResizeUISlots (uiSlots, 1); } else { uiSlots = ResizeUISlots (uiSlots, maxSlots); } for (int i=0; i<uiSlots.Length; i++) { uiSlots[i].LinkedUiGUI (i, source); } } EditorGUILayout.EndVertical (); base.ShowGUI (source); }
/** * <summary>Recalculates the element's size. * This should be called whenever a Menu's shape is changed.</summary> * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param> */ public override void RecalculateSize(MenuSource source) { graphic.Reset (); base.RecalculateSize (source); }
public override void ShowGUI(MenuSource source) { EditorGUILayout.BeginVertical ("Button"); if (source != MenuSource.AdventureCreator) { uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source); EditorGUILayout.EndVertical (); EditorGUILayout.BeginVertical ("Button"); } labelType = (AC_LabelType) EditorGUILayout.EnumPopup ("Label type:", labelType); if (source == MenuSource.AdventureCreator || labelType == AC_LabelType.Normal) { label = EditorGUILayout.TextField ("Label text:", label); } if (labelType == AC_LabelType.GlobalVariable) { variableID = AdvGame.GlobalVariableGUI ("Global Variable:", variableID); } else if (labelType == AC_LabelType.DialogueLine) { useCharacterColour = EditorGUILayout.Toggle ("Use Character text colour?", useCharacterColour); if (sizeType == AC_SizeType.Manual) { autoAdjustHeight = EditorGUILayout.Toggle ("Auto-adjust height to fit?", autoAdjustHeight); } } if (labelType == AC_LabelType.Hotspot || labelType == AC_LabelType.DialogueLine || labelType == AC_LabelType.DialogueSpeaker) { updateIfEmpty = EditorGUILayout.Toggle ("Update if string is empty?", updateIfEmpty); } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); } EditorGUILayout.EndVertical (); base.ShowGUI (source); }