public override void OnInspectorGUI() { serializedObject.Update(); SetBackgroundColor(DoozyColors.BLUE, DoozyColors.L_BLUE); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeader(DoozyResources.HeaderBarUIButtonSound); DrawInfoBar(soundModule.IsSoundModuleEnabled, false); DrawTitleAndRemoveButton(" " + GetSubtitle, (SoundModule)target); DrawHelpBox(showHelp && !soundModule.IsSoundModuleEnabled, HELP_MESSAGE_EVENT_DISABLED, ""); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeaderToolbar(target as SoundModule, debugThis); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { EditorGUILayout.PropertyField(soundSource, new GUIContent() { text = "" }, GUILayout.Width(WIDTH_4)); valueSoundSource = (SoundModule.SoundSource)soundSource.enumValueIndex; switch (valueSoundSource) { case SoundModule.SoundSource.String: EditorGUILayout.PropertyField(soundName, new GUIContent() { text = "" }, GUILayout.Width(WIDTH_3 + 27f)); break; case SoundModule.SoundSource.AudioClip: EditorGUILayout.PropertyField(audioClip, new GUIContent() { text = "" }, GUILayout.Width(WIDTH_3 + 27f)); break; } SaveCurrentColorsAndResetColors(); if (GUILayout.Button("PLAY", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_6))) { DoozyEditorUtility.StopAllClips(); DoozyEditorUtility.PlayAudioClip(soundModule.GetLoadedSound()); } if (GUILayout.Button("STOP", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_6))) { DoozyEditorUtility.StopAllClips(); } LoadPreviousColors(); } EditorGUILayout.EndHorizontal(); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); switch (valueSoundSource) { case SoundModule.SoundSource.String: DrawHelpBox(showHelp, HELP_MESSAGE_STRING, "String"); break; case SoundModule.SoundSource.AudioClip: DrawHelpBox(showHelp, HELP_MESSAGE_AUDIOCLIP, "AudioClip"); break; } DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { EditorGUILayout.LabelField("Volume", GUILayout.Width(48)); volume.floatValue = EditorGUILayout.Slider(volume.floatValue, 0f, 1f, GUILayout.Width(WIDTH_1 - 50)); } EditorGUILayout.EndHorizontal(); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DoozyEditorUtility.ResetColors(); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); SetBackgroundColor(DoozyColors.BLUE, DoozyColors.L_BLUE); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeader(DoozyResources.HeaderBarUIButtonEffect); DrawInfoBar(effectModule.IsEffectModuleEnabled, false); DrawTitleAndRemoveButton(" " + GetSubtitle, (EffectModule)target); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeaderToolbar(target as EffectModule, debugThis); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS * 2); EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { EditorGUILayout.PropertyField(pSystem, new GUIContent { text = "" }, GUILayout.Width(160)); EditorGUILayout.PropertyField(effectAction, new GUIContent { text = "" }, GUILayout.Width(50)); withChildren.boolValue = EditorGUILayout.ToggleLeft("With Children", withChildren.boolValue, GUILayout.Width(92)); if ((EffectModule.EffectAction)effectAction.enumValueIndex == EffectModule.EffectAction.Stop) { GUILayout.Space(4); clearOnStop.boolValue = EditorGUILayout.ToggleLeft("Clear On Stop", clearOnStop.boolValue, GUILayout.Width(122)); } else { EditorGUILayout.LabelField("Emit Count", GUILayout.Width(66)); EditorGUILayout.PropertyField(emitCount, new GUIContent { text = "" }, GUILayout.Width(35)); } } EditorGUILayout.EndHorizontal(); DrawHelpBox(showHelp, HELP_MESSAGE_PARTICLE_SYSTEM, HELP_MESSAGE_PARTICLE_SYSTEM_TITLE); DrawHelpBox(showHelp, HELP_MESSAGE_EFFECT_ACTION, HELP_MESSAGE_EFFECT_ACTION_TITLE); DrawHelpBox(showHelp, HELP_MESSAGE_WITH_CHILDREN, HELP_MESSAGE_WITH_CHILDREN_TITLE); if ((EffectModule.EffectAction)effectAction.enumValueIndex == EffectModule.EffectAction.Stop) { DrawHelpBox(showHelp, HELP_MESSAGE_CLEAR_ON_STOP, HELP_MESSAGE_CLEAR_ON_STOP_TITLE); } else { DrawHelpBox(showHelp, HELP_MESSAGE_EMIT_COUNT, HELP_MESSAGE_EMIT_COUNT_TITLE); } DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS / 2); EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { EditorGUILayout.LabelField("Override Sorting Layer", GUILayout.Width(WIDTH_3 - 4)); EditorGUILayout.PropertyField(overrideSortingLayer, new GUIContent { text = "" }, GUILayout.Width(WIDTH_6 - 1)); EditorGUILayout.LabelField("Override Sorting Order", GUILayout.Width(WIDTH_3 - 4)); EditorGUILayout.PropertyField(overrideSortingOrder, new GUIContent { text = "" }, GUILayout.Width(WIDTH_6 - 1)); } EditorGUILayout.EndHorizontal(); DrawHelpBox(showHelp, HELP_MESSAGE_OVERRIDE_SORTING_LAYER, HELP_MESSAGE_OVERRIDE_SORTING_LAYER_TITLE); DrawHelpBox(showHelp, HELP_MESSAGE_OVERRIDE_SORTING_ORDER, HELP_MESSAGE_OVERRIDE_SORTING_ORDER_TITLE); if ((EffectModule.OverrideSortingOrder)overrideSortingOrder.enumValueIndex == EffectModule.OverrideSortingOrder.Yes) { DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS / 2); EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { EditorGUILayout.LabelField("Reset Sorting Order to be", GUILayout.Width(WIDTH_3 + 12)); EditorGUILayout.PropertyField(resetSortingOrderToBe, new GUIContent { text = "" }, GUILayout.Width(90)); EditorGUILayout.LabelField("of the UIButon.", GUILayout.Width(WIDTH_4 - 14)); EditorGUILayout.LabelField("Steps", GUILayout.Width(35)); EditorGUILayout.PropertyField(orderInLayerSteps, new GUIContent { text = "" }, GUILayout.Width(35)); } EditorGUILayout.EndHorizontal(); DrawHelpBox(showHelp, HELP_MESSAGE_RESET_SORTING_ORDER, HELP_MESSAGE_RESET_SORTING_ORDER_TITLE); DrawHelpBox(showHelp, HELP_MESSAGE_STEPS, HELP_MESSAGE_STEPS_TITLE); } DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DoozyEditorUtility.ResetColors(); serializedObject.ApplyModifiedProperties(); }
private void DrawEventZone(UIButton.ReactTo eventType, SerializedProperty useEventType, SerializedProperty animatorModule, SerializedProperty soundModule, SerializedProperty effectModule) { EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { SaveCurrentColorsAndResetColors(); if (useEventType.boolValue) { if (GUILayout.Button("Disable " + eventType.ToString(), skin.GetStyle(DoozyStyle.StyleName.BtnRed.ToString()), GUILayout.Width(WIDTH_3 + 20), GUILayout.Height(HEIGHT_1))) { useEventType.boolValue = !useEventType.boolValue; } DoozyEditorUtility.VerticalSpace(1); if (animatorModule.objectReferenceValue == null) { if (GUILayout.Button("+ ANIMATOR", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_5 + 16), GUILayout.Height(HEIGHT_1))) { animatorModule.objectReferenceValue = AddAnimatorModule(eventType); } } else { if (GUILayout.Button("- ANIMATOR", skin.GetStyle(DoozyStyle.StyleName.BtnRed.ToString()), GUILayout.Width(WIDTH_5 + 16), GUILayout.Height(HEIGHT_1))) { RemoveAnimatorModule(eventType); } } DoozyEditorUtility.VerticalSpace(1); if (soundModule.objectReferenceValue == null) { if (GUILayout.Button("+ SOUND", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_5 - 8), GUILayout.Height(HEIGHT_1))) { soundModule.objectReferenceValue = AddSoundModule(eventType); } } else { if (GUILayout.Button("- SOUND", skin.GetStyle(DoozyStyle.StyleName.BtnRed.ToString()), GUILayout.Width(WIDTH_5 - 8), GUILayout.Height(HEIGHT_1))) { RemoveSoundModule(eventType); } } DoozyEditorUtility.VerticalSpace(1); if (effectModule.objectReferenceValue == null) { if (GUILayout.Button("+ EFFECT", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_5 - 8), GUILayout.Height(HEIGHT_1))) { effectModule.objectReferenceValue = AddEffectModule(eventType); } } else { if (GUILayout.Button("- EFFECT", skin.GetStyle(DoozyStyle.StyleName.BtnRed.ToString()), GUILayout.Width(WIDTH_5 - 8), GUILayout.Height(HEIGHT_1))) { RemoveEffectModule(eventType); } } } else { if (GUILayout.Button(eventType.ToString() + " is DISABLED", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_1), GUILayout.Height(HEIGHT_1))) { useEventType.boolValue = !useEventType.boolValue; } } GUILayout.FlexibleSpace(); LoadPreviousColors(); } EditorGUILayout.EndHorizontal(); }
static void LoadSymbol() { DoozyEditorUtility.AddScriptingDefineSymbol(DoozyConstants.SYMBOL_UIBUTTON); }
public override void OnInspectorGUI() { serializedObject.Update(); SetBackgroundColor(DoozyColors.BLUE, DoozyColors.L_BLUE); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeader(DoozyResources.HeaderBarUIButton); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DrawHeaderToolbar(target as UIButton, debugThis); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region Allow multiple clicks / Disable button interval EditorGUILayout.BeginHorizontal(GUILayout.Width(WIDTH_1)); { SaveCurrentColorsAndResetColors(); if (allowMultipleClicks.boolValue) { if (GUILayout.Button("Disable Multiple Clicks", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_1))) { allowMultipleClicks.boolValue = !allowMultipleClicks.boolValue; } LoadPreviousColors(); } else { EditorGUILayout.BeginVertical(); { DoozyEditorUtility.VerticalSpace(3); if (GUILayout.Button("Enable Multiple Clicks", skin.GetStyle(DoozyStyle.StyleName.BtnBlue.ToString()), GUILayout.Width(WIDTH_3))) { allowMultipleClicks.boolValue = !allowMultipleClicks.boolValue; } } EditorGUILayout.EndVertical(); LoadPreviousColors(); EditorGUILayout.LabelField("Disable Interval", skin.GetStyle(DoozyStyle.StyleName.LabelMidRight.ToString()), GUILayout.Width(WIDTH_3 - 16)); disableButtonInterval.floatValue = EditorGUILayout.FloatField(disableButtonInterval.floatValue, GUILayout.Width(WIDTH_3)); } } EditorGUILayout.EndHorizontal(); DrawHelpBox(showHelp && allowMultipleClicks.boolValue, HELP_MESSAGE_MULTIPLE_CLICKS_ENABLED); DrawHelpBox(showHelp && !allowMultipleClicks.boolValue, HELP_MESSAGE_MULTIPLE_CLICKS_DISABLED); #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnHoverEnter DrawEventZone(UIButton.ReactTo.OnHoverEnter, useOnHoverEnter, onHoverEnterAnimatorModule, onHoverEnterSoundModule, onHoverEnterEffectModule); if (useOnHoverEnter.boolValue) { EditorGUILayout.PropertyField(onHoverEnterDisableInterval, new GUIContent() { text = "Disable Interval" }, GUILayout.Width(WIDTH_1)); DrawHelpBox(showHelp, HELP_MESSAGE_ON_HOVER_ENTER_DISABLE_INTERVAL); EditorGUILayout.PropertyField(OnHoverEnter, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnHoverExit DrawEventZone(UIButton.ReactTo.OnHoverExit, useOnHoverExit, onHoverExitAnimatorModule, onHoverExitSoundModule, onHoverExitEffectModule); if (useOnHoverExit.boolValue) { EditorGUILayout.PropertyField(onHoverExitDisableInterval, new GUIContent() { text = "Disable Interval" }, GUILayout.Width(WIDTH_1)); DrawHelpBox(showHelp, HELP_MESSAGE_ON_HOVER_EXIT_DISABLE_INTERVAL); EditorGUILayout.PropertyField(OnHoverExit, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnPointerDown DrawEventZone(UIButton.ReactTo.OnPointerDown, useOnPointerDown, onPointerDownAnimatorModule, onPointerDownSoundModule, onPointerDownEffectModule); if (useOnPointerDown.boolValue) { EditorGUILayout.PropertyField(OnPointerDown, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnPointerUp DrawEventZone(UIButton.ReactTo.OnPointerUp, useOnPointerUp, onPointerUpAnimatorModule, onPointerUpSoundModule, onPointerUpEffectModule); if (useOnPointerUp.boolValue) { EditorGUILayout.PropertyField(OnPointerUp, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnClick DrawEventZone(UIButton.ReactTo.OnClick, useOnClick, onClickAnimatorModule, onClickSoundModule, onClickEffectModule); if (useOnClick.boolValue) { EditorGUILayout.PropertyField(singleClickMode, GUILayout.Width(WIDTH_1)); if ((UIButton.SingleClickMode)singleClickMode.enumValueIndex == UIButton.SingleClickMode.Instant) { DrawHelpBox(showHelp, HELP_MESSAGE_SINGLE_CLICK_MODE_INSTANT); } else { DrawHelpBox(showHelp, HELP_MESSAGE_SINGLE_CLICK_MODE_DELAYED); } EditorGUILayout.PropertyField(OnClick, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnDoubleClick DrawEventZone(UIButton.ReactTo.OnDoubleClick, useOnDoubleClick, onDoubleClickAnimatorModule, onDoubleClickSoundModule, onDoubleClickEffectModule); if (useOnDoubleClick.boolValue) { EditorGUILayout.PropertyField(doubleClickRegisterInterval, new GUIContent() { text = "Double Click Interval" }, GUILayout.Width(WIDTH_1)); DrawHelpBox(showHelp, HELP_MESSAGE_DOUBLE_CLICK_INTERVAL); EditorGUILayout.PropertyField(OnDoubleClick, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); #region OnLongClick DrawEventZone(UIButton.ReactTo.OnLongClick, useOnLongClick, onLongClickAnimatorModule, onLongClickSoundModule, onLongClickEffectModule); if (useOnLongClick.boolValue) { EditorGUILayout.PropertyField(longClickRegisterInterval, new GUIContent() { text = "Long Click Interval" }, GUILayout.Width(WIDTH_1)); DrawHelpBox(showHelp, HELP_MESSAGE_LONG_CLICK_INTERVAL); EditorGUILayout.PropertyField(OnLongClick, GUILayout.Width(WIDTH_1)); DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); } #endregion DoozyEditorUtility.VerticalSpace(VERTICAL_SPACE_BETWEEN_ELEMENTS); DoozyEditorUtility.ResetColors(); serializedObject.ApplyModifiedProperties(); }