private void CopySlider(MenuSlider _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiSlider = null; } else { uiSlider = _element.uiSlider; } label = _element.label; isClickable = _element.isClickable; textEffects = _element.textEffects; outlineSize = _element.outlineSize; amount = _element.amount; minValue = _element.minValue; maxValue = _element.maxValue; anchor = _element.anchor; sliderTexture = _element.sliderTexture; sliderType = _element.sliderType; sliderDisplayType = _element.sliderDisplayType; blockSize = _element.blockSize; useFullWidth = _element.useFullWidth; varID = _element.varID; numberOfSteps = _element.numberOfSteps; actionListOnChange = _element.actionListOnChange; uiSelectableHideStyle = _element.uiSelectableHideStyle; base.Copy(_element); }
/** * Initialises the MenuElement when it is created within MenuManager. */ public override void Declare() { uiSlider = null; label = "Slider"; isVisible = true; isClickable = true; numSlots = 1; amount = 1f; minValue = 0f; maxValue = 1f; anchor = TextAnchor.MiddleLeft; sliderType = AC_SliderType.CustomScript; sliderDisplayType = SliderDisplayType.FillBar; blockSize = new Vector2(0.05f, 1f); useFullWidth = false; varID = 0; textEffects = TextEffects.None; outlineSize = 2f; numberOfSteps = 0; actionListOnChange = null; uiSelectableHideStyle = UISelectableHideStyle.DisableObject; base.Declare(); }
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 void CopySlider(MenuSlider _element) { uiSlider = _element.uiSlider; label = _element.label; isClickable = _element.isClickable; textEffects = _element.textEffects; amount = _element.amount; anchor = _element.anchor; sliderTexture = _element.sliderTexture; sliderType = _element.sliderType; sliderDisplayType = _element.sliderDisplayType; blockSize = _element.blockSize; useFullWidth = _element.useFullWidth; varID = _element.varID; numberOfSteps = _element.numberOfSteps; base.Copy(_element); }
public void CopySlider(MenuSlider _element) { uiSlider = _element.uiSlider; label = _element.label; isClickable = _element.isClickable; textEffects = _element.textEffects; amount = _element.amount; anchor = _element.anchor; sliderTexture = _element.sliderTexture; sliderType = _element.sliderType; sliderDisplayType = _element.sliderDisplayType; blockSize = _element.blockSize; useFullWidth = _element.useFullWidth; varID = _element.varID; numberOfSteps = _element.numberOfSteps; base.Copy (_element); }
public override void Declare() { uiSlider = null; label = "Slider"; isVisible = true; isClickable = true; numSlots = 1; amount = 1f; anchor = TextAnchor.MiddleLeft; sliderType = AC_SliderType.CustomScript; sliderDisplayType = SliderDisplayType.FillBar; blockSize = new Vector2(0.05f, 1f); useFullWidth = false; varID = 0; textEffects = TextEffects.None; numberOfSteps = 0; base.Declare(); }
public override void Declare() { uiSlider = null; label = "Slider"; isVisible = true; isClickable = true; numSlots = 1; amount = 1f; anchor = TextAnchor.MiddleLeft; sliderType = AC_SliderType.CustomScript; sliderDisplayType = SliderDisplayType.FillBar; blockSize = new Vector2 (0.05f, 1f); useFullWidth = false; varID = 0; textEffects = TextEffects.None; numberOfSteps = 0; base.Declare (); }
private void CopySlider(MenuSlider _element) { uiSlider = _element.uiSlider; label = _element.label; isClickable = _element.isClickable; textEffects = _element.textEffects; amount = _element.amount; minValue = _element.minValue; maxValue = _element.maxValue; anchor = _element.anchor; sliderTexture = _element.sliderTexture; sliderType = _element.sliderType; sliderDisplayType = _element.sliderDisplayType; blockSize = _element.blockSize; useFullWidth = _element.useFullWidth; varID = _element.varID; numberOfSteps = _element.numberOfSteps; actionListOnChange = _element.actionListOnChange; base.Copy(_element); }
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); if (textEffects != TextEffects.None) { outlineSize = EditorGUILayout.Slider("Effect size:", outlineSize, 1f, 5f); } 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 ShowGUI(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSlider)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); sliderType = (AC_SliderType)CustomGUILayout.EnumPopup("Slider affects:", sliderType, apiPrefix + ".sliderType"); if (source == MenuSource.AdventureCreator) { label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label"); } if (sliderType == AC_SliderType.CustomScript) { ShowClipHelp(); amount = CustomGUILayout.Slider("Default value:", amount, minValue, maxValue, apiPrefix + ".amount"); } else if (sliderType == AC_SliderType.FloatVariable) { varID = AdvGame.GlobalVariableGUI("Global float var:", varID, VariableType.Float); } 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)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on change:", actionListOnChange, false, apiPrefix + ".actionListOnChange"); } else { minValue = 0f; maxValue = 1f; } if (source == MenuSource.AdventureCreator) { numberOfSteps = CustomGUILayout.IntField("Number of steps:", numberOfSteps, apiPrefix + ".numberOfSteps"); } if (source == MenuSource.AdventureCreator) { useFullWidth = CustomGUILayout.Toggle("Use full width?", useFullWidth, apiPrefix + ".useFullWidth"); sliderDisplayType = (SliderDisplayType)CustomGUILayout.EnumPopup("Display type:", sliderDisplayType, apiPrefix + ".sliderDisplayType"); if (sliderDisplayType == SliderDisplayType.MoveableBlock) { blockSize = EditorGUILayout.Vector2Field("Block size:", blockSize); } } else { uiSlider = LinkedUiGUI <Slider> (uiSlider, "Linked Slider:", source); uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable"); 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(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuSlider)"; MenuSource source = menu.menuSource; CustomGUILayout.BeginVertical(); sliderType = (AC_SliderType)CustomGUILayout.EnumPopup("Slider affects:", sliderType, apiPrefix + ".sliderType", "What the slider's value represents"); if (source == MenuSource.AdventureCreator) { label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen"); } if (sliderType == AC_SliderType.CustomScript) { ShowClipHelp(); amount = CustomGUILayout.Slider("Default value:", amount, minValue, maxValue, apiPrefix + ".amount", "The slider's default value"); } else if (sliderType == AC_SliderType.FloatVariable) { varID = AdvGame.GlobalVariableGUI("Global float var:", varID, VariableType.Float, "The global Float variable whose value is linked to the slider"); } 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); } else { minValue = 0f; maxValue = 1f; } actionListOnChange = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on change:", actionListOnChange, false, apiPrefix + ".actionListOnChange"); if (source == MenuSource.AdventureCreator) { numberOfSteps = CustomGUILayout.IntField("Number of steps:", numberOfSteps, apiPrefix + ".numberOfSteps", "The number of descrete values the slider can have"); } if (source == MenuSource.AdventureCreator) { sliderOrientation = (SliderOrientation)CustomGUILayout.EnumPopup("Orientation:", sliderOrientation, apiPrefix + ".sliderOrientation", "Which way the slider is orientated"); if (sliderOrientation == SliderOrientation.Horizontal) { useFullWidth = CustomGUILayout.Toggle("Use full width?", useFullWidth, apiPrefix + ".useFullWidth", "If True, then the slider will be drawn across the whole width of the element. Otherwise, it will be drawn across only half."); } sliderDisplayType = (SliderDisplayType)CustomGUILayout.EnumPopup("Display type:", sliderDisplayType, apiPrefix + ".sliderDisplayType", "The display type of the slider"); if (sliderDisplayType == SliderDisplayType.MoveableBlock) { blockSize = EditorGUILayout.Vector2Field(new GUIContent("Block size:", "The dimensions of the block"), blockSize); } } 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(); CustomGUILayout.BeginVertical(); } isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable", "If True, the slider is interactive and can be modified by the user"); CustomGUILayout.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) { 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); }
private void CopySlider(MenuSlider _element) { uiSlider = _element.uiSlider; label = _element.label; isClickable = _element.isClickable; textEffects = _element.textEffects; amount = _element.amount; minValue = _element.minValue; maxValue = _element.maxValue; anchor = _element.anchor; sliderTexture = _element.sliderTexture; sliderType = _element.sliderType; sliderDisplayType = _element.sliderDisplayType; blockSize = _element.blockSize; useFullWidth = _element.useFullWidth; varID = _element.varID; numberOfSteps = _element.numberOfSteps; actionListOnChange = _element.actionListOnChange; base.Copy (_element); }