public override void OnInspectorGUI() { UIEditor.DrawImage("UIDraggableLabel"); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Draggable Properties", UIStyle.LabelBold); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openSelectable = EditorGUILayout.Foldout(_openSelectable, new GUIContent("Selectable"), true, UIStyle.FoldoutBoldMini); if (_openSelectable) { base.OnInspectorGUI(); } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Properties", UIStyle.LabelBoldMini); EditorGUILayout.PropertyField(m_replaceable, new GUIContent("Replaceable", "Can be replaced with another UI Draggable elements.")); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Draggable Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_onDragged, new GUIContent("On Dragged")); EditorGUILayout.PropertyField(m_onDropped, new GUIContent("On Dropped")); EditorGUILayout.PropertyField(m_onChanged, new GUIContent("On Changed")); GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); UIEditor.DrawImage("UIScreenLabel"); // UIScreen Properties GUILayout.BeginVertical("Box"); GUILayout.Label("UI Screen Properties", UIStyle.LabelBold); GUILayout.BeginVertical("helpBox"); GUILayout.Label("Properties", UIStyle.LabelBoldMini); m_Layer.intValue = EditorGUILayout.Popup(new GUIContent("UIScreen Layer", "UI Screens with different layers may overlap."), m_Layer.intValue, new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); EditorGUILayout.PropertyField(m_StartSelectable, new GUIContent("Select on start", "Selected UI Element will be highlighted on UI Screen start.")); EditorGUILayout.PropertyField(m_Archive, new GUIContent("Add To History", "If it is added to the History, you can go back to it by Escape or [Previous UIScreen]")); EditorGUILayout.PropertyField(m_isCustomPosition, new GUIContent("Custom Position", "When displaying UI Screen it always set in center of the canvas. This allows you to freely set position many UIScreen in the editor.")); GUILayout.EndVertical(); GUILayout.EndVertical(); // UIScreen Events GUILayout.BeginVertical("Box"); GUILayout.Label("UI Screen Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_unityEvent_OnScreenOpen); EditorGUILayout.PropertyField(m_unityEvent_OnScreenClose); GUILayout.EndVertical(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }
private void DrawActionSetup(ActionsSerialized thisAction) { m_isEventOpen = thisAction.isEventOpen.boolValue; m_isUIScreenOpen = thisAction.isUIScreenOpen.boolValue; m_isSceneLoaderOpen = thisAction.isSceneLoaderOpen.boolValue; EditorGUI.indentLevel++; /////////////////////////////////// EditorGUILayout.BeginVertical("ObjectFieldThumb"); EditorGUILayout.BeginHorizontal("ObjectPickerToolbar"); m_isEventOpen = EditorGUILayout.Foldout(m_isEventOpen, new GUIContent("Invoke Event", "Call event after a specified action."), true, "Foldout"); if (thisAction.isEvent.boolValue) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } thisAction.isEvent.boolValue = GUILayout.Toggle(thisAction.isEvent.boolValue, thisAction.isEvent.boolValue ? " ENABLE " : " DISABLE ", UIStyle.Toggle); if (thisAction.isEvent.boolValue) { GUI.backgroundColor = colorBacgroundEnable; } else { GUI.backgroundColor = colorBacgroundDisable; } EditorGUILayout.EndHorizontal(); thisAction.isEventOpen.boolValue = m_isEventOpen; if (m_isEventOpen) { EditorGUILayout.BeginVertical("Box"); EditorGUI.indentLevel++; EditorGUILayout.Space(); EditorGUILayout.PropertyField(thisAction.unityEvent, new GUIContent("On Action")); EditorGUILayout.Space(); EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); } GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); /////////////////////////////////// EditorGUILayout.BeginVertical("ObjectFieldThumb"); EditorGUILayout.BeginHorizontal("ObjectPickerToolbar"); m_isUIScreenOpen = EditorGUILayout.Foldout(m_isUIScreenOpen, new GUIContent("Open UI Screen", "Open UIScreen after a specified action."), true, "Foldout"); if (thisAction.isUIScreen.boolValue) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } thisAction.isUIScreen.boolValue = GUILayout.Toggle(thisAction.isUIScreen.boolValue, thisAction.isUIScreen.boolValue ? " ENABLE " : " DISABLE ", UIStyle.Toggle); if (thisAction.isUIScreen.boolValue) { GUI.backgroundColor = colorBacgroundEnable; } else { GUI.backgroundColor = colorBacgroundDisable; } EditorGUILayout.EndHorizontal(); thisAction.isUIScreenOpen.boolValue = m_isUIScreenOpen; if (m_isUIScreenOpen) { EditorGUILayout.BeginVertical("Box"); EditorGUI.indentLevel++; EditorGUILayout.Space(); UIScreen[] uiScreen = UIEditor.GetUIScreens(); string[] uiScreenNames = UIEditor.GetUIScreensNames(uiScreen); int idScreen = Array.FindIndex(uiScreen, obj => obj == thisAction.uiScreen.GetValue <UIScreen>()); idScreen = (idScreen < 0) ? 0 : idScreen; idScreen = EditorGUILayout.Popup(new GUIContent("UIScreen", "Choose UIScreen to open."), idScreen, uiScreenNames); if (uiScreen.Length > 0) { thisAction.uiScreen.SetValue(uiScreen[idScreen]); } if (GUILayout.Button(new GUIContent("Ping", "Show connected UIScreen to this UIButton.")) && thisAction.uiScreen.GetValue <UIScreen>() != null) { EditorGUIUtility.PingObject(thisAction.uiScreen.GetValue <UIScreen>().GetInstanceID()); bezier = 1f; } EditorGUILayout.Space(); EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); } GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); /////////////////////////////////// EditorGUILayout.BeginVertical("ObjectFieldThumb"); EditorGUILayout.BeginHorizontal("ObjectPickerToolbar"); m_isSceneLoaderOpen = EditorGUILayout.Foldout(m_isSceneLoaderOpen, new GUIContent("Load Scene", "Open Scene after a specified action."), true, "Foldout"); if (thisAction.isSceneLoader.boolValue) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.red; } thisAction.isSceneLoader.boolValue = GUILayout.Toggle(thisAction.isSceneLoader.boolValue, thisAction.isSceneLoader.boolValue ? " ENABLE " : " DISABLE ", UIStyle.Toggle); if (thisAction.isSceneLoader.boolValue) { GUI.backgroundColor = colorBacgroundEnable; } else { GUI.backgroundColor = colorBacgroundDisable; } EditorGUILayout.EndHorizontal(); thisAction.isSceneLoaderOpen.boolValue = m_isSceneLoaderOpen; if (m_isSceneLoaderOpen) { EditorGUILayout.BeginVertical("Box"); EditorGUI.indentLevel++; EditorGUILayout.Space(); if (UISceneManager.Instance) { // get scene list List <SceneProperties> sceneProperties = GetAllScenes(UISceneManager.Instance.sceneProperties); string[] scenesNames = ConvertScenesToString(sceneProperties); int idScene = -1; idScene = sceneProperties.FindIndex(obj => obj.buildIndex == thisAction.buildIndex.intValue); idScene = (idScene < 0) ? 0 : idScene; idScene = EditorGUILayout.Popup(new GUIContent("Scene", "Choose Scene to open."), idScene, scenesNames); if (sceneProperties.Count > 0) { thisAction.buildIndex.intValue = sceneProperties[idScene].buildIndex; } EditorGUILayout.Space(); if (GUILayout.Button(new GUIContent("Open Scene Manager", "Show UI Scene Manager in inspector."))) { EditorGUIUtility.PingObject(UISceneManager.Instance.gameObject); Selection.activeGameObject = UISceneManager.Instance.gameObject; } } else { GUILayout.Label("Create UI Scene Manager first"); GUILayout.Label("Find it in \"Create/KreliStudio/UI SceneManager\"."); EditorGUILayout.Space(); } EditorGUI.indentLevel--; EditorGUILayout.EndVertical(); } GUI.backgroundColor = Color.white; /* * EditorGUILayout.BeginVertical("HelpBox"); * GUILayout.Label("Sound & Vibration",UIStyle.LabelBoldMini); * EditorGUILayout.PropertyField(thisAction.isSound, new GUIContent("Play Sound")); * if (thisAction.isSound.boolValue) * { * EditorGUILayout.PropertyField(thisAction.sound.FindPropertyRelative("clip"), new GUIContent("Clip")); * EditorGUILayout.Slider(thisAction.sound.FindPropertyRelative("volume"), 0f, 1f, new GUIContent("Volume")); * EditorGUILayout.Slider(thisAction.sound.FindPropertyRelative("pitch"), 0.1f, 3f, new GUIContent("Pitch")); * } * EditorGUILayout.PropertyField(thisAction.isVibration, new GUIContent("Vibration")); * if (thisAction.isVibration.boolValue) * { * EditorGUILayout.IntSlider(thisAction.vibrate, 10, 1000, new GUIContent("Duration")); * } * * EditorGUILayout.EndVertical();*/ EditorGUILayout.EndVertical(); /////////////////////////////////// EditorGUI.indentLevel--; }
public override void OnInspectorGUI() { serializedObject.Update(); if (GUI.changed) { Debug.Log("Button changed"); } UIEditor.DrawImage("UIButtonLabel"); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Button Properties", UIStyle.LabelBold); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openSelectable = EditorGUILayout.Foldout(_openSelectable, new GUIContent("Selectable"), true, UIStyle.FoldoutBoldMini); if (_openSelectable) { base.OnInspectorGUI(); } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); ///////////////////////////////// GUILayout.BeginHorizontal(); GUILayout.Label("UI Button Actions", UIStyle.LabelBold); if (GUILayout.Button(EditorGUIUtility.IconContent("Toolbar Minus"), "selectionRect")) { SetAllOpen(false); } if (GUILayout.Button(EditorGUIUtility.IconContent("Toolbar Plus"), "selectionRect")) { SetAllOpen(true); } EditorGUILayout.EndHorizontal(); /////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnClick_FieldsOpen.target = GUILayout.Toggle(m_OnClick_FieldsOpen.target, "Actions On Click()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnClickActions_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnClickActions_SerializedObject.isOpen.boolValue = m_OnClick_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnClick_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnClickActions_SerializedObject); } } GUILayout.EndVertical(); if (m_OnClick_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } /////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnDoubleClick_FieldsOpen.target = GUILayout.Toggle(m_OnDoubleClick_FieldsOpen.target, "Actions On Double Click()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnDoubleClick_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnDoubleClick_SerializedObject.isOpen.boolValue = m_OnDoubleClick_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnDoubleClick_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnDoubleClick_SerializedObject); } } GUILayout.EndVertical(); if (m_OnDoubleClick_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } /////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnLongClick_FieldsOpen.target = GUILayout.Toggle(m_OnLongClick_FieldsOpen.target, "Actions On Long Click()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnLongClick_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnLongClick_SerializedObject.isOpen.boolValue = m_OnLongClick_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnLongClick_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnLongClick_SerializedObject); } } GUILayout.EndVertical(); if (m_OnLongClick_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } ///////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnPointEnter_FieldsOpen.target = GUILayout.Toggle(m_OnPointEnter_FieldsOpen.target, "Actions On Pointer Enter()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnPointerEnter_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnPointerEnter_SerializedObject.isOpen.boolValue = m_OnPointEnter_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointEnter_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnPointerEnter_SerializedObject); } } GUILayout.EndVertical(); if (m_OnPointEnter_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } ///////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnPointExit_FieldsOpen.target = GUILayout.Toggle(m_OnPointExit_FieldsOpen.target, "Actions On Pointer Exit()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnPointerExit_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnPointerExit_SerializedObject.isOpen.boolValue = m_OnPointExit_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointExit_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnPointerExit_SerializedObject); } } GUILayout.EndVertical(); if (m_OnPointExit_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } /////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnPointDown_FieldsOpen.target = GUILayout.Toggle(m_OnPointDown_FieldsOpen.target, "Actions On Pointer Down()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnPointerDown_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnPointerDown_SerializedObject.isOpen.boolValue = m_OnPointDown_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointDown_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnPointerDown_SerializedObject); } } GUILayout.EndVertical(); if (m_OnPointDown_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } /////////////////////////////////// GUI.backgroundColor = Color.gray; GUILayout.BeginVertical("HelpBox"); GUI.backgroundColor = Color.white; EditorGUILayout.BeginHorizontal(); m_OnPointUp_FieldsOpen.target = GUILayout.Toggle(m_OnPointUp_FieldsOpen.target, "Actions On Pointer Up()", UIStyle.ButtonMini); DrawActionMiniIcon(p_OnPointerUp_SerializedObject); EditorGUILayout.EndHorizontal(); p_OnPointerUp_SerializedObject.isOpen.boolValue = m_OnPointUp_FieldsOpen.target; using (var group = new EditorGUILayout.FadeGroupScope(m_OnPointUp_FieldsOpen.faded)) { if (group.visible) { DrawActionSetup(p_OnPointerUp_SerializedObject); } } GUILayout.EndVertical(); if (m_OnPointUp_FieldsOpen.target) { EditorGUILayout.Space(); EditorGUILayout.Space(); } ///////////////////////////////// GUILayout.EndVertical(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { UIEditor.DrawImage("UISidePanelLabel"); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Side Panel Properties", UIStyle.LabelBold); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openReferences = EditorGUILayout.Foldout(_openReferences, new GUIContent("References", "Place here references to objects."), true, UIStyle.FoldoutBoldMini); if (_openReferences) { EditorGUILayout.PropertyField(m_panel, new GUIContent("Panel")); EditorGUILayout.PropertyField(m_background, new GUIContent("Background")); if (m_isButton.boolValue) { EditorGUILayout.PropertyField(m_button, new GUIContent("Button")); } else { EditorGUILayout.PropertyField(m_swipe, new GUIContent("Swipe")); } } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Content Panel", UIStyle.LabelBoldMini); int isPanelFadeInt = (m_isPanelFade.boolValue) ? 1 : 0; isPanelFadeInt = EditorGUILayout.Popup(new GUIContent("Panel", "Always visible or fade animation when open and close."), isPanelFadeInt, new string[] { "Normal", "Fade" }); m_isPanelFade.boolValue = (isPanelFadeInt != 0) ? true : false; m_oldSide.intValue = m_side.intValue; m_side.intValue = EditorGUILayout.Popup("Side", m_side.intValue, new string[] { "Left", "Top", "Right", "Bottom" }); if (m_side.intValue != m_oldSide.intValue && m_isButton.boolValue && m_button.GetValue <RectTransform>()) { switch (m_side.intValue) { case 0: // Left m_buttonAnchorsPosition.vector2Value = new Vector2(0f, 0.5f); m_buttonOffsetPosition.vector2Value = new Vector2(m_button.GetValue <RectTransform>().rect.width / 2f, 0f); break; case 1: // Top m_buttonAnchorsPosition.vector2Value = new Vector2(0.5f, 1f); m_buttonOffsetPosition.vector2Value = new Vector2(0f, -m_button.GetValue <RectTransform>().rect.height / 2f); break; case 2: // Right m_buttonAnchorsPosition.vector2Value = new Vector2(1f, 0.5f); m_buttonOffsetPosition.vector2Value = new Vector2(-m_button.GetValue <RectTransform>().rect.width / 2f, 0f); break; case 3: // Bottom m_buttonAnchorsPosition.vector2Value = new Vector2(0.5f, 0f); m_buttonOffsetPosition.vector2Value = new Vector2(0f, m_button.GetValue <RectTransform>().rect.height / 2f); break; } } GUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(m_widthMove, new GUIContent("Width")); int isPercentInt = (m_isPercent.boolValue) ? 1 : 0; isPercentInt = EditorGUILayout.Popup(isPercentInt, new string[] { "Pixel", "Percent" }); m_isPercent.boolValue = (isPercentInt != 0) ? true : false; if (m_isPercent.boolValue) { m_widthMove.floatValue = Mathf.Clamp(m_widthMove.floatValue, 0f, 100f); } else if (m_widthMove.floatValue < 0) { m_widthMove.floatValue = 0; } GUILayout.EndHorizontal(); EditorGUILayout.PropertyField(m_speed, new GUIContent("Movement Speed", "Speed of panel open and close animations.")); m_speed.floatValue = Mathf.Clamp(m_speed.floatValue, 0.1f, 10f); GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Background", UIStyle.LabelBoldMini); int isBackgroundFadeInt = (m_isBackgroundFade.boolValue) ? 1 : 0; isBackgroundFadeInt = EditorGUILayout.Popup(new GUIContent("Background", "Set background to invisible or smooth fade."), isBackgroundFadeInt, new string[] { "None", "Fade" }); m_isBackgroundFade.boolValue = (isBackgroundFadeInt != 0) ? true : false; EditorGUILayout.PropertyField(m_closeOnBackground, new GUIContent("Close On Click", "Close side panel when clicked background (works with None and Fade background too).")); if (m_isBackgroundFade.boolValue) { EditorGUILayout.PropertyField(m_backgroundFade, new GUIContent("Fade Alpha")); m_backgroundFade.floatValue = Mathf.Clamp01(m_backgroundFade.floatValue); } GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Controls", UIStyle.LabelBoldMini); int isButtonInt = (m_isButton.boolValue) ? 1 : 0; isButtonInt = EditorGUILayout.Popup(new GUIContent("Control type", "Button or swipe to control open and close side panel."), isButtonInt, new string[] { "Swipe", "Button" }); m_isButton.boolValue = (isButtonInt != 0) ? true : false; if (m_isButton.boolValue) { int isStickyInt = (m_isSticky.boolValue) ? 1 : 0; isStickyInt = EditorGUILayout.Popup(new GUIContent("Sticky Button", "Attach button to panel and move button with panel."), isStickyInt, new string[] { "None", "Stick To Panel" }); m_isSticky.boolValue = (isStickyInt != 0) ? true : false; EditorGUILayout.PropertyField(m_buttonAnchorsPosition, new GUIContent("Anchors Position", "Set anchors position of button.")); EditorGUILayout.PropertyField(m_buttonOffsetPosition, new GUIContent("Offset Position", "Set position offset from anchors to button.")); } else { int isElasticInt = (m_isElastic.boolValue) ? 1 : 0; isElasticInt = EditorGUILayout.Popup(new GUIContent("Drag Type", "Simillar like Scroll Rect can be elastic or clamped."), isElasticInt, new string[] { "Clamped", "Elastic" }); m_isElastic.boolValue = (isElasticInt != 0) ? true : false; int isFullScreenSwipeInt = (m_isFullScreenSwipe.boolValue) ? 1 : 0; isFullScreenSwipeInt = EditorGUILayout.Popup(new GUIContent("Drag Area", "Set dragable area to full screen or small area close to side panel."), isFullScreenSwipeInt, new string[] { "Side", "Full Screen" }); m_isFullScreenSwipe.boolValue = (isFullScreenSwipeInt != 0) ? true : false; } GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Side Panel Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_onOpen, new GUIContent("On Open")); EditorGUILayout.PropertyField(m_onClose, new GUIContent("On Close")); GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); if (EditorApplication.isPlaying) { return; } else { targetScript.Setup(); } }
public override void OnInspectorGUI() { UIEditor.DrawImage("UICarouselPanelLabel"); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Carousel Panel Properties", UIStyle.LabelBold); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; m_openReferences = EditorGUILayout.Foldout(m_openReferences, new GUIContent("References", "Place here references to objects."), true, UIStyle.FoldoutBoldMini); if (m_openReferences) { EditorGUILayout.PropertyField(m_content, new GUIContent("Content")); EditorGUILayout.PropertyField(m_iconBar, new GUIContent("Icon Bar")); if (m_isButtons.boolValue) { EditorGUILayout.PropertyField(m_previousButton, new GUIContent("Previous Button")); EditorGUILayout.PropertyField(m_nextButton, new GUIContent("Next Button")); } } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Content Panel", UIStyle.LabelBold); int isHorizontalInt = (m_isHorizontal.boolValue) ? 1 : 0; isHorizontalInt = EditorGUILayout.Popup(new GUIContent("Orientation", "Place carousel panel in a specific orientation."), isHorizontalInt, new string[] { "Vertical", "Horizontal" }); m_isHorizontal.boolValue = (isHorizontalInt != 0) ? true : false; EditorGUILayout.PropertyField(m_spaceOffset, new GUIContent("Space Offset", "Space distance between carousels items.")); if (m_spaceOffset.floatValue <= 0.01f) { m_spaceOffset.floatValue = 0.01f; } int isEffestInt = (m_isEffect.boolValue) ? 1 : 0; isEffestInt = EditorGUILayout.Popup(new GUIContent("Scale Effect", "Scale objects in the center of the carousel."), isEffestInt, new string[] { "Disable", "Enable" }); m_isEffect.boolValue = (isEffestInt != 0) ? true : false; if (m_isEffect.boolValue) { EditorGUILayout.PropertyField(m_effectRange, new GUIContent("Effect Range", "Start scaling in the area.")); EditorGUILayout.PropertyField(m_effectScale, new GUIContent("Effect Scale")); } int isIconBarInt = (m_isIconBar.boolValue) ? 1 : 0; isIconBarInt = EditorGUILayout.Popup(new GUIContent("Icon Bar", "Show the bar with elements icon."), isIconBarInt, new string[] { "Disable", "Enable" }); m_isIconBar.boolValue = (isIconBarInt != 0) ? true : false; if (m_isIconBar.boolValue) { int isColorInt = (m_isColor.boolValue) ? 1 : 0; isColorInt = EditorGUILayout.Popup(new GUIContent("Animation Type"), isColorInt, new string[] { "Sprite", "Color" }); m_isColor.boolValue = (isColorInt != 0) ? true : false; if (m_isColor.boolValue) { EditorGUILayout.PropertyField(m_iconOn, new GUIContent("Sprite")); EditorGUILayout.PropertyField(m_colorOff, new GUIContent("Deselected")); EditorGUILayout.PropertyField(m_colorOn, new GUIContent("Selected")); } else { EditorGUILayout.PropertyField(m_iconOff, new GUIContent("Deselected")); EditorGUILayout.PropertyField(m_iconOn, new GUIContent("Selected")); } } GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Controls", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_startingPage, new GUIContent("Start Element", "Select this element at start.")); int isButtonInt = (m_isButtons.boolValue) ? 1 : 0; isButtonInt = EditorGUILayout.Popup(new GUIContent("Button", "Show buttons to control carousel (previous and next)."), isButtonInt, new string[] { "Disable", "Enable" }); m_isButtons.boolValue = (isButtonInt != 0) ? true : false; int isFastSwipeInt = (m_isOneSwipeMove.boolValue) ? 1 : 0; isFastSwipeInt = EditorGUILayout.Popup(new GUIContent("Fast Swipe", "Fast swipe and jumps by one element or scroll with proportional swipe force."), isFastSwipeInt, new string[] { "Scrolling", "Move By One" }); m_isOneSwipeMove.boolValue = (isFastSwipeInt != 0) ? true : false; GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Carousel Panel Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_onSelected, new GUIContent("On Selected")); GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { UIEditor.DrawImage("UIRadialSliderLabel"); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Radial Slider Properties", UIStyle.LabelBold); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openSelectable = EditorGUILayout.Foldout(_openSelectable, new GUIContent("Selectable"), true, UIStyle.FoldoutBoldMini); if (_openSelectable) { base.OnInspectorGUI(); } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openReferences = EditorGUILayout.Foldout(_openReferences, new GUIContent("References", "Place here references to objects."), true, UIStyle.FoldoutBoldMini); if (_openReferences) { EditorGUILayout.PropertyField(m_fillArea, new GUIContent("Fill Area")); EditorGUILayout.PropertyField(m_fillText, new GUIContent("Text Area")); EditorGUILayout.PropertyField(m_handle, new GUIContent("Handle")); } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Properties", UIStyle.LabelBoldMini); EditorGUILayout.PropertyField(m_wholeNumbers, new GUIContent("Whole Numbers", " Round values to integer.")); EditorGUILayout.PropertyField(m_minValue, new GUIContent("Min Value")); if (m_maxValue.floatValue < m_minValue.floatValue) { m_minValue.floatValue = m_maxValue.floatValue; } EditorGUILayout.PropertyField(m_maxValue, new GUIContent("Max Value")); if (m_maxValue.floatValue < m_minValue.floatValue) { m_maxValue.floatValue = m_minValue.floatValue; } EditorGUILayout.Slider(m_value, m_minValue.floatValue, m_maxValue.floatValue, new GUIContent("Value")); if (m_wholeNumbers.boolValue) { m_minValue.floatValue = Mathf.Round(m_minValue.floatValue); m_maxValue.floatValue = Mathf.Round(m_maxValue.floatValue); m_value.floatValue = Mathf.Round(m_value.floatValue); } GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Slider Format", UIStyle.LabelBoldMini); m_textFormat.intValue = EditorGUILayout.Popup("Text Format", m_textFormat.intValue, new string[] { "none", "value", "value | max value", "percent" }); m_fillOrigin.intValue = EditorGUILayout.Popup("Fill Origin", m_fillOrigin.intValue, new string[] { "Bottom", "Right", "Top", "Left" }); EditorGUILayout.PropertyField(m_handleOffset, new GUIContent("Handle Offset", "Distance of handle from center.")); EditorGUILayout.PropertyField(m_rotateHandle, new GUIContent("Handle Rotation", "Rotate handle when move around.")); EditorGUILayout.PropertyField(m_clockwise, new GUIContent("Clockwise")); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Radial Slider Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_onValueChanged, new GUIContent("On Value Changed")); GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); /////////////// if (EditorApplication.isPlaying) { return; } else { targetScript.Setup(); } }
public override void OnInspectorGUI() { UIEditor.DrawImage("UISceneManagerLabel"); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Scene Manager Properties", UIStyle.LabelBold); m_openTab.intValue = GUILayout.Toolbar(m_openTab.intValue, new string[] { "Scenes", "Loading Screens", "Events" }); switch (m_openTab.intValue) { case 0: // get scene list //m_startScene.intValue = EditorGUILayout.Popup("Start Scene", m_startScene.intValue, new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); GUILayout.BeginVertical("HelpBox"); List <SceneProperties> sceneProperties = UISceneManager.Instance.sceneProperties; string[] scenesNames = ConvertScenesToString(sceneProperties); int idScene = -1; idScene = sceneProperties.FindIndex(obj => obj.buildIndex == m_startScene.intValue); idScene = (idScene < 0) ? 0 : idScene; idScene = EditorGUILayout.Popup(new GUIContent("Start Scene", "Start scene opens when the application is launched together with the UIManager scene."), idScene, scenesNames); if (sceneProperties.Count > 0) { m_startScene.intValue = sceneProperties[idScene].buildIndex; } GUILayout.EndVertical(); GUILayout.BeginVertical("HelpBox"); EditorGUI.indentLevel++; _openScreneReview = EditorGUILayout.Foldout(_openScreneReview, new GUIContent("Scene Review"), true, UIStyle.FoldoutBoldMini); if (_openScreneReview) { GUILayout.Label("Current Scene", UIStyle.LabelBoldMini); GUI.enabled = false; EditorGUILayout.PropertyField(m_currnetScene.FindPropertyRelative("scene"), new GUIContent("Scene")); if (m_currnetScene.FindPropertyRelative("buildIndex").intValue >= 0) { EditorGUILayout.PropertyField(m_currnetScene.FindPropertyRelative("buildIndex"), new GUIContent("Build Index")); } else { EditorGUILayout.LabelField("Build Index", "Not added to build settings", "TextField"); } EditorGUILayout.PropertyField(m_currnetScene.FindPropertyRelative("loadSceneMode"), new GUIContent("Load Scene Mode")); GUI.enabled = true; GUILayout.Label("Previous Scene", UIStyle.LabelBoldMini); GUI.enabled = false; EditorGUILayout.PropertyField(m_previousScene.FindPropertyRelative("scene"), new GUIContent("Scene")); if (m_previousScene.FindPropertyRelative("buildIndex").intValue >= 0) { EditorGUILayout.PropertyField(m_previousScene.FindPropertyRelative("buildIndex"), new GUIContent("Build Index")); } else { EditorGUILayout.LabelField("Build Index", "Not added to build settings", "TextField"); } EditorGUILayout.PropertyField(m_previousScene.FindPropertyRelative("loadSceneMode"), new GUIContent("Load Scene Mode")); } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUI.enabled = true; GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Scene List", UIStyle.LabelBoldMini); scrollPosScene = EditorGUILayout.BeginScrollView(scrollPosScene, false, true); m_sceneProperties.DoLayoutList(); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); break; case 1: /*GUILayout.BeginVertical("HelpBox"); * m_startLoadingScreen.intValue = EditorGUILayout.Popup(new GUIContent("Start Loading Screen"),m_startLoadingScreen.intValue, GetLoadingScreens()); * GUILayout.EndVertical();*/ GUILayout.BeginVertical("HelpBox"); scrollPosLoading = EditorGUILayout.BeginScrollView(scrollPosLoading, false, true); m_loadingScreens.DoLayoutList(); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); break; case 2: GUILayout.BeginVertical("HelpBox"); GUILayout.Label("UI Scene Manager Events", UIStyle.LabelBoldMini); EditorGUILayout.PropertyField(m_onSceneLoaded, new GUIContent("On Scene Loaded")); EditorGUILayout.PropertyField(m_onSceneUnloaded, new GUIContent("On Scene Unloaded")); GUILayout.EndVertical(); break; } GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); UIEditor.DrawImage("UIManagerLabel"); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Manager Properties", UIStyle.LabelBold); m_openTab.intValue = GUILayout.Toolbar(m_openTab.intValue, new string[] { "Debugger", "UI Screens" }); switch (m_openTab.intValue) { case 0: GUILayout.BeginVertical("HelpBox"); GUILayout.Label("Debugger", UIStyle.LabelBoldMini); EditorGUILayout.PropertyField(m_debugUIElements, new GUIContent("Debug UI Elements", "Show debug logs in console from all UI elements.")); EditorGUILayout.PropertyField(m_debugEvents, new GUIContent("Debug Events", "Show debug logs in console from events.")); EditorGUILayout.PropertyField(m_debugUIScreen, new GUIContent("Debug UI Screen", "Show debug logs in console from all UI Screen.")); EditorGUILayout.PropertyField(m_debugUIScene, new GUIContent("Debug UI Scene", "Show debug logs in console from all UI Scene.")); GUILayout.EndVertical(); break; case 1: /*GUILayout.BeginVertical("HelpBox"); * GUILayout.Label("UI Screens", UIStyle.LabelBoldMini); * EditorGUILayout.PropertyField(m_startScreen, new GUIContent("Start UI Screen")); * * GUILayout.EndVertical();*/ GUILayout.BeginVertical("HelpBox"); GUI.enabled = true; GUILayout.Label("Preview (In Game Mode)", UIStyle.LabelBoldMini); GUI.enabled = false; EditorGUILayout.PropertyField(m_currentLayer, new GUIContent("Current Layer", "The layer on which the currently active UI Screen is.")); GUI.enabled = true; EditorGUI.indentLevel++; _openUIScreen = EditorGUILayout.Foldout(_openUIScreen, new GUIContent("UI Screens", "All UI Screens from UI Manager."), true); GUI.enabled = false; if (_openUIScreen) { int size = m_screens.FindPropertyRelative("Array.size").intValue; for (int i = 0; i < size; i++) { EditorGUILayout.PropertyField(m_screens.GetArrayElementAtIndex(i), new GUIContent("UI Screen")); } } GUI.enabled = true; _openLayers = EditorGUILayout.Foldout(_openLayers, new GUIContent("Layers", "All layers with open UI Screen on them."), true); GUI.enabled = false; if (_openLayers) { int size = m_currentScreens.FindPropertyRelative("Array.size").intValue; for (int i = 0; i < size; i++) { EditorGUILayout.PropertyField(m_currentScreens.GetArrayElementAtIndex(i), new GUIContent("Layer " + i)); } } GUI.enabled = true; _openHistory = EditorGUILayout.Foldout(_openHistory, new GUIContent("History", "History Stack with UIScreen (use escape button or [Previous UIScreen] to use history stack)."), true); GUI.enabled = false; if (_openHistory) { int size = m_historyStack.FindPropertyRelative("Array.size").intValue; for (int i = 0; i < size; i++) { EditorGUILayout.PropertyField(m_historyStack.GetArrayElementAtIndex(i), new GUIContent("History " + i)); } } EditorGUI.indentLevel--; GUILayout.EndVertical(); GUI.enabled = true; break; } GUILayout.EndVertical(); EditorGUILayout.Space(); GUILayout.BeginVertical("Box"); GUILayout.Label("UI Manager Events", UIStyle.LabelBold); EditorGUILayout.PropertyField(m_onSwitchedScreen); GUILayout.EndVertical(); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }