private void CopyToggle(MenuToggle _element, bool ignoreUnityUI) { if (ignoreUnityUI) { uiToggle = null; } else { uiToggle = _element.uiToggle; } uiText = null; label = _element.label; isOn = _element.isOn; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; toggleType = _element.toggleType; varID = _element.varID; appendState = _element.appendState; onTexture = _element.onTexture; offTexture = _element.offTexture; actionListOnClick = _element.actionListOnClick; uiSelectableHideStyle = _element.uiSelectableHideStyle; onText = _element.onText; offText = _element.offText; onTextLineID = _element.onTextLineID; offTextLineID = _element.offTextLineID; isClickable = _element.isClickable; base.Copy(_element); }
/** * Initialises the element when it is created within MenuManager. */ public override void Declare() { uiToggle = null; uiText = null; label = "Toggle"; isOn = false; isVisible = true; isClickable = true; toggleType = AC_ToggleType.CustomScript; numSlots = 1; varID = 0; SetSize(new Vector2(15f, 5f)); anchor = TextAnchor.MiddleLeft; appendState = true; onTexture = null; offTexture = null; textEffects = TextEffects.None; outlineSize = 2f; actionListOnClick = null; uiSelectableHideStyle = UISelectableHideStyle.DisableObject; onText = "On"; offText = "Off"; onTextLineID = -1; offTextLineID = -1; base.Declare(); }
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 void CopyToggle (MenuToggle _element) { label = _element.label; isOn = _element.isOn; textEffects = _element.textEffects; anchor = _element.anchor; toggleType = _element.toggleType; varID = _element.varID; appendState = _element.appendState; onTexture = _element.onTexture; offTexture = _element.offTexture; base.Copy (_element); }
public void CopyToggle(MenuToggle _element) { uiToggle = _element.uiToggle; uiText = null; label = _element.label; isOn = _element.isOn; textEffects = _element.textEffects; anchor = _element.anchor; toggleType = _element.toggleType; varID = _element.varID; appendState = _element.appendState; onTexture = _element.onTexture; offTexture = _element.offTexture; base.Copy(_element); }
public void CopyToggle(MenuToggle _element) { uiToggle = _element.uiToggle; uiText = null; label = _element.label; isOn = _element.isOn; textEffects = _element.textEffects; anchor = _element.anchor; toggleType = _element.toggleType; varID = _element.varID; appendState = _element.appendState; onTexture = _element.onTexture; offTexture = _element.offTexture; actionListOnClick = _element.actionListOnClick; base.Copy (_element); }
private void CopyToggle(MenuToggle _element) { uiToggle = _element.uiToggle; uiText = null; label = _element.label; isOn = _element.isOn; textEffects = _element.textEffects; outlineSize = _element.outlineSize; anchor = _element.anchor; toggleType = _element.toggleType; varID = _element.varID; appendState = _element.appendState; onTexture = _element.onTexture; offTexture = _element.offTexture; actionListOnClick = _element.actionListOnClick; base.Copy(_element); }
public override void Declare () { label = "Toggle"; isOn = false; isVisible = true; isClickable = true; toggleType = AC_ToggleType.CustomScript; numSlots = 1; varID = 0; SetSize (new Vector2 (15f, 5f)); anchor = TextAnchor.MiddleLeft; appendState = true; onTexture = null; offTexture = null; textEffects = TextEffects.None; base.Declare (); }
public override void Declare() { uiToggle = null; uiText = null; label = "Toggle"; isOn = false; isVisible = true; isClickable = true; toggleType = AC_ToggleType.CustomScript; numSlots = 1; varID = 0; SetSize(new Vector2(15f, 5f)); anchor = TextAnchor.MiddleLeft; appendState = true; onTexture = null; offTexture = null; textEffects = TextEffects.None; base.Declare(); }
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(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuToggle)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source != MenuSource.AdventureCreator) { uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source, "The Unity UI Toggle 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"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label", "The text that's displayed on-screen"); appendState = CustomGUILayout.Toggle("Append state to label?", appendState, apiPrefix + ".appendState", "If True, then the state (On/Off) will be added to the display label"); if (appendState) { onText = CustomGUILayout.TextField("'On' state text:", onText, apiPrefix + ".onText", "The text suffix when the toggle is 'on'"); offText = CustomGUILayout.TextField("'Off' state text:", offText, apiPrefix + ".offText", "The text suffix when the toggle is 'off'"); } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment"); textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text"); if (textEffects != TextEffects.None) { outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness"); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("'On' texture:", "The background texture when in the 'on' state"), GUILayout.Width(145f)); onTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (onTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".onTexture"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("'Off' texture:", "The background texture when in the 'off' state"), GUILayout.Width(145f)); offTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (offTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".offTexture"); EditorGUILayout.EndHorizontal(); } toggleType = (AC_ToggleType)CustomGUILayout.EnumPopup("Toggle type:", toggleType, apiPrefix + ".toggleType", "What the value of the toggle represents"); if (toggleType == AC_ToggleType.CustomScript) { isOn = CustomGUILayout.Toggle("On by default?", isOn, apiPrefix + ".isOn", "If True, then the toggle will be in its 'on' state by default"); ShowClipHelp(); } else if (toggleType == AC_ToggleType.Variable) { varID = AdvGame.GlobalVariableGUI("Global boolean var:", varID, VariableType.Boolean, "The global Boolean variable whose value is linked to the Toggle"); } isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable", "If True, the slider is interactive and can be modified by the user"); if (isClickable) { if (toggleType != AC_ToggleType.Subtitles) { actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick", "An ActionList asset that will 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(Menu menu) { string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuToggle)"; MenuSource source = menu.menuSource; EditorGUILayout.BeginVertical("Button"); if (source != MenuSource.AdventureCreator) { uiToggle = LinkedUiGUI <Toggle> (uiToggle, "Linked Toggle:", source); uiSelectableHideStyle = (UISelectableHideStyle)CustomGUILayout.EnumPopup("When invisible:", uiSelectableHideStyle, apiPrefix + ".uiSelectableHideStyle"); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Button"); } label = CustomGUILayout.TextField("Label text:", label, apiPrefix + ".label"); appendState = CustomGUILayout.Toggle("Append state to label?", appendState, apiPrefix + ".appendState"); if (appendState) { onText = CustomGUILayout.TextField("'On' state text:", onText, apiPrefix + ".onText"); offText = CustomGUILayout.TextField("'Off' state text:", offText, apiPrefix + ".offText"); } if (source == MenuSource.AdventureCreator) { anchor = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor"); textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects"); if (textEffects != TextEffects.None) { outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize"); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("'On' texture:", GUILayout.Width(145f)); onTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (onTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".onTexture"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("'Off' texture:", GUILayout.Width(145f)); offTexture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (offTexture, false, GUILayout.Width(70f), GUILayout.Height(30f), apiPrefix + ".offTexture"); EditorGUILayout.EndHorizontal(); } toggleType = (AC_ToggleType)CustomGUILayout.EnumPopup("Toggle type:", toggleType, apiPrefix + ".toggleType"); if (toggleType == AC_ToggleType.CustomScript) { isOn = CustomGUILayout.Toggle("On by default?", isOn, apiPrefix + ".isOn"); ShowClipHelp(); } else if (toggleType == AC_ToggleType.Variable) { varID = AdvGame.GlobalVariableGUI("Global boolean var:", varID, VariableType.Boolean); } isClickable = CustomGUILayout.Toggle("User can change value?", isClickable, apiPrefix + ".isClickable"); if (isClickable) { if (toggleType != AC_ToggleType.Subtitles) { actionListOnClick = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on click:", actionListOnClick, false, apiPrefix + ".actionListOnClick"); } alternativeInputButton = CustomGUILayout.TextField("Alternative input button:", alternativeInputButton, apiPrefix + ".alternativeInputButton"); } EditorGUILayout.EndVertical(); base.ShowGUI(menu); }
public override void ShowGUI () { EditorGUILayout.BeginVertical ("Button"); label = EditorGUILayout.TextField ("Label text:", label); anchor = (TextAnchor) EditorGUILayout.EnumPopup ("Text alignment:", anchor); textEffects = (TextEffects) EditorGUILayout.EnumPopup ("Text effect:", textEffects); appendState = EditorGUILayout.Toggle ("Append state to label?", appendState); 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 = EditorGUILayout.IntField ("Global Variable ID:", varID); } EditorGUILayout.EndVertical (); base.ShowGUI (); }