protected void FieldSmoothEffect() { smoothEffectAnimBool.target = effectSmoothChange.boolValue; MadGUI.PropertyField(effectSmoothChange, "Smooth Effect"); if (EditorGUILayout.BeginFadeGroup(smoothEffectAnimBool.faded)) { MadGUI.Indent(() => { MadGUI.PropertyField(effectSmoothChangeSpeed, "Speed"); MadGUI.PropertyFieldEnumPopup(effectSmoothChangeDirection, "Direction"); FieldNotify(effectSmoothChangeFinishedNotify, "On Finished"); }); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); }
protected void FieldLabel2() { MadGUI.PropertyField(label, "Label"); using (MadGUI.EnabledIf((target as EnergyBarUGUIBase).label != null)) { using (MadGUI.Indent()) { MadGUI.PropertyField(labelFormat, "Format"); formatHelpAnimBool.target = MadGUI.Foldout("Label Format Help", false); if (EditorGUILayout.BeginFadeGroup(formatHelpAnimBool.faded)) { EditorGUILayout.HelpBox(FormatHelp, MessageType.None); } EditorGUILayout.EndFadeGroup(); } } }
void GUIAction(SerializedProperty prop, bool withInterval) { var changeBar = prop.FindPropertyRelative("changeBar"); var changeBarType = prop.FindPropertyRelative("changeBarType"); var changeBarValue = prop.FindPropertyRelative("changeBarValue"); var sendMessage = prop.FindPropertyRelative("sendMessage"); var intervaled = prop.FindPropertyRelative("intervaled"); var timeInterval = prop.FindPropertyRelative("timeInterval"); var signals = prop.FindPropertyRelative("signals"); MadGUI.PropertyFieldToggleGroup(changeBar, "Change Bar", () => { MadGUI.Indent(() => { MadGUI.PropertyField(changeBarType, "Change Method"); MadGUI.Indent(() => { string example; switch ((SimpleEvent.Action.Type)changeBarType.enumValueIndex) { case SimpleEvent.Action.Type.DecreaseByPercent: case SimpleEvent.Action.Type.IncreaseByPercent: case SimpleEvent.Action.Type.SetToPercent: example = " (0.0 - 1.0)"; break; default: example = ""; break; } MadGUI.PropertyField(changeBarValue, "Value" + example); intervaled.boolValue = withInterval; if (withInterval) { MadGUI.PropertyField(timeInterval, "Time Interval"); } }); }); }); MadGUI.PropertyFieldToggleGroup(sendMessage, "Send Message", () => { MadGUI.Indent(() => { ArrayList(signals, "Signals", (signalProp) => { GUISignal(signalProp); }); }); }); }
protected void FieldLabel() { bool classic = labelFont == null; // true if classic GUI version MadGUI.PropertyFieldToggleGroup2(labelEnabled, "Draw Label", () => { MadGUI.Indent(() => { if (classic) { EditorGUILayout.PropertyField(labelSkin, new GUIContent("Label Skin")); } else { MadGUI.PropertyField(labelFont, "Label Font"); MadGUI.PropertyField(labelScale, "Label Scale"); } labelPosition.vector2Value = EditorGUILayout.Vector2Field("Label Position", labelPosition.vector2Value); var t = target as EnergyBarBase; var rect = t.DrawAreaRect; PropertySpecialNormalized(labelPosition, labelPositionNormalized, new Vector2(rect.width, rect.height)); if (labelPivot != null) { MadGUI.PropertyField(labelPivot, "Pivot Point"); } EditorGUILayout.PropertyField(labelFormat, new GUIContent("Label Format")); if (MadGUI.Foldout("Label Format Help", false)) { EditorGUILayout.HelpBox(FormatHelp, MessageType.None); } EditorGUILayout.PropertyField(labelColor, new GUIContent("Label Color")); if (classic) { MadGUI.PropertyFieldToggleGroup2(labelOutlineEnabled, "Label Outline", () => { MadGUI.Indent(() => { EditorGUILayout.PropertyField(labelOutlineColor, new GUIContent("Outline Color")); }); }); } }); }); }
private void SectionTextures() { GUILayout.Label("Textures", "HeaderLabel"); using (MadGUI.Indent()) { FieldBackgroundSprites(); EditorGUILayout.Space(); FieldSprite(spriteObject, "Object Sprite", MadGUI.ObjectIsSet); using (MadGUI.Indent()) { MadGUI.PropertyField(spriteObject.FindPropertyRelative("material"), "Material"); } MadGUI.PropertyFieldVector2(spriteObjectPivot, "Object Pivot"); EditorGUILayout.Space(); FieldForegroundSprites(); } }
private void SectionTextures() { GUILayout.Label("Textures", "HeaderLabel"); using (MadGUI.Indent()) { FieldBackgroundSprites(); EditorGUILayout.Space(); MadGUI.PropertyField(spriteBar, "Bar", MadGUI.ObjectIsSet); #if !UNITY_5 EnsureReadable(spriteBar); #endif EditorGUILayout.Space(); FieldForegroundSprites(); } }
private void SectionEffects() { GUILayout.Label("Effects", "HeaderLabel"); using (MadGUI.Indent()) { FieldSmoothEffect(); blinkEffectAnimBool.target = effectBlink.boolValue; MadGUI.PropertyField(effectBlink, "Blink"); if (EditorGUILayout.BeginFadeGroup(blinkEffectAnimBool.faded)) { MadGUI.Indent(() => { MadGUI.PropertyFieldEnumPopup(effectBlinkOperator, "Operator"); MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); } }
void GUISignal(SerializedProperty prop) { var receiverType = prop.FindPropertyRelative("receiverType"); var receiver = prop.FindPropertyRelative("receiver"); var methodName = prop.FindPropertyRelative("methodName"); var argument = prop.FindPropertyRelative("argument"); MadGUI.PropertyField(receiverType, "Receiver Type"); if (receiverType.enumValueIndex == (int)SimpleEvent.Signal.ReceiverType.FixedGameObject) { MadGUI.Indent(() => { MadGUI.PropertyField(receiver, "Receiver Object"); }); } MadGUI.PropertyField(methodName, "Method Name"); MadGUI.PropertyField(argument, "Method Argument"); string argumentStr; switch ((SimpleEvent.Signal.MessageArgument)argument.intValue) { case SimpleEvent.Signal.MessageArgument.BarValue: argumentStr = "int value"; break; case SimpleEvent.Signal.MessageArgument.BarValuePercent: argumentStr = "float valuePercent"; break; case SimpleEvent.Signal.MessageArgument.Caller: argumentStr = "GameObject caller"; break; default: Debug.LogError("Unknown option: " + argument.intValue); argumentStr = "-error-"; break; } MadGUI.Info("Receiver: OnEvent(" + argumentStr + ")"); }
protected void SectionPositionAndSize() { var script = target as EnergyBar3DBase; Section("Position & Size", () => { if (MadGUI.Button("Make Pixel-Perfect", Color.yellow)) { script.transform.localPosition = MadMath.Round(script.transform.localPosition); script.transform.localScale = new Vector3(1, 1, 1); EditorUtility.SetDirty(script); } if (!IsAnchored()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Anchor"); if (MadGUI.Button("Create", Color.yellow)) { CreateAnchor(); } EditorGUILayout.EndHorizontal(); } else { var anchor = GetAnchor(); var serAnchor = new SerializedObject(anchor); MadAnchorInspector.DrawInspector(serAnchor); } EditorGUI.BeginChangeCheck(); script.pivot = (EnergyBar3DBase.Pivot) EditorGUILayout.EnumPopup("Pivot Point", script.pivot); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(script); } MadGUI.PropertyField(guiDepth, "GUI Depth"); EditorGUILayout.Space(); MadGUI.PropertyFieldEnumPopup(lookAtMode, "Look At"); MadGUI.Indent(() => { if(lookAtMode.enumValueIndex == (int) EnergyBar3DBase.LookAtMode.CustomObject) { MadGUI.PropertyField(lookAtObject, "Target Object", MadGUI.ObjectIsSet); } }); }); }
private void SectionTextures() { GUILayout.Label("Textures", "HeaderLabel"); using (MadGUI.Indent()) { FieldSprite(spriteIcon, "Icon", MadGUI.ObjectIsSet); #if !UNITY_5 EnsureReadable(spriteIcon.FindPropertyRelative("sprite")); #endif using (MadGUI.Indent()) { MadGUI.PropertyField(spriteIcon.FindPropertyRelative("material"), "Material"); } EditorGUILayout.Space(); FieldSprite(spriteSlot, "Slot"); using (MadGUI.Indent()) { MadGUI.PropertyField(spriteSlot.FindPropertyRelative("material"), "Material"); } } }
private void SectionTransform() { Section("Object Transform", () => { MadGUI.PropertyFieldToggleGroup2(transformTranslate, "Translate", () => { MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(translateFunctionStart, "Start Point"); MadGUI.PropertyFieldVector2(translateFunctionEnd, "End Point"); }); }); MadGUI.PropertyFieldToggleGroup2(transformRotate, "Rotate", () => { MadGUI.Indent(() => { MadGUI.PropertyField(rotateFunctionStart, "Start Angle"); MadGUI.PropertyField(rotateFunctionEnd, "End Angle"); }); }); MadGUI.PropertyFieldToggleGroup2(transformScale, "Scale", () => { MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(scaleFunctionStart, "Start Scale"); MadGUI.PropertyFieldVector2(scaleFunctionEnd, "End Scale"); }); }); }); }
public override void OnInspectorGUI() { serializedObject.Update(); script = target as FilledRenderer3D; if (MadGUI.Foldout("Textures", true)) { MadGUI.BeginBox(); FieldBackgroundTextures(); EditorGUILayout.PropertyField(textureBar, new GUIContent("Bar Texture")); CheckTextureIsReadable(script.textureBar); CheckTextureFilterTypeNotPoint(script.textureBar); FieldForegroundTextures(); FieldPremultipliedAlpha(); MadGUI.EndBox(); } if (showPositionAndSize && MadGUI.Foldout("Position & Size", true)) { MadGUI.BeginBox(); if (MadGUI.Button("Make Pixel-Perfect")) { script.transform.localPosition = MadMath.Round(script.transform.localPosition); script.transform.localScale = new Vector3(1, 1, 1); EditorUtility.SetDirty(script); } if (!IsAnchored()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Anchor"); if (GUILayout.Button("Create")) { CreateAnchor(); } EditorGUILayout.EndHorizontal(); } else { var anchor = GetAnchor(); var serAnchor = new SerializedObject(anchor); MadAnchorInspector.DrawInspector(serAnchor); } EditorGUI.BeginChangeCheck(); script.pivot = (EnergyBar3DBase.Pivot) EditorGUILayout.EnumPopup("Pivot Point", script.pivot); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(script); } MadGUI.PropertyField(guiDepth, "GUI Depth"); MadGUI.EndBox(); } if (MadGUI.Foldout("Appearance", false)) { MadGUI.BeginBox(); var dir = (EnergyBarRenderer.GrowDirection) growDirection.enumValueIndex; if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { GUI.enabled = false; } EditorGUILayout.PropertyField(textureBarColorType, new GUIContent("Bar Color Type")); EditorGUI.indentLevel++; switch ((EnergyBarRenderer.ColorType)textureBarColorType.enumValueIndex) { case EnergyBarRenderer.ColorType.Solid: EditorGUILayout.PropertyField(textureBarColor, new GUIContent("Bar Color")); break; case EnergyBarRenderer.ColorType.Gradient: EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); break; } EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.PropertyField(growDirection, new GUIContent("Grow Direction")); if (dir == EnergyBarRenderer.GrowDirection.RadialCW || dir == EnergyBarRenderer.GrowDirection.RadialCCW) { MadGUI.Indent(() => { EditorGUILayout.Slider(radialOffset, -1, 1, "Offset"); EditorGUILayout.Slider(radialLength, 0, 1, "Length"); }); } else if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); } FieldLabel(); MadGUI.EndBox(); } if (MadGUI.Foldout("Effects", false)) { MadGUI.BeginBox(); FieldSmoothEffect(); MadGUI.PropertyFieldToggleGroup2(effectBurn, "Burn Out", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBurnTextureBar, "Burn Texture Bar"); MadGUI.PropertyField(effectBurnTextureBarColor, "Burn Color"); }); }); MadGUI.PropertyFieldToggleGroup2(effectBlink, "Blink", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); }); MadGUI.PropertyFieldToggleGroup2(effectFollow, "Sprite Follow", () => { MadGUI.Indent(() => { if (GUI.enabled && !GrowDirectionSupportedByFollowEffect()) { MadGUI.Error("This effect cannot be used with selected grow direction. " + "Please read manual for more information."); } MadGUI.PropertyField(effectFollowObject, "Texture or GameObject", "This can be Texture, MadSprite or any other GameObject."); if (!VerifyFollowObject()) { MadGUI.Error("You can put here only Texture2D or GameObject."); } MadGUI.PropertyField(effectFollowColor, "Color"); MadGUI.PropertyField(effectFollowRotation, "Rotation"); if (MadGUI.Foldout("Scale", false)) { MadGUI.Indent(() => { MadGUI.PropertyField(effectFollowScaleX, "X"); MadGUI.PropertyField(effectFollowScaleY, "Y"); MadGUI.PropertyField(effectFollowScaleZ, "Z"); }); } }); }); MadGUI.EndBox(); } EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }
private void SectionEffects() { GUILayout.Label("Effects", "HeaderLabel"); using (MadGUI.Indent()) { FieldSmoothEffect(); burnEffectAnimBool.target = effectBurn.boolValue; MadGUI.PropertyField(effectBurn, "Burn"); if (EditorGUILayout.BeginFadeGroup(burnEffectAnimBool.faded)) { MadGUI.Indent(() => { FieldSprite(effectBurnSprite, "Bar Texture"); MadGUI.PropertyFieldEnumPopup(effectBurnDirection, "Direction"); if (effectBurnDirection.enumValueIndex != (int) EnergyBarBase.BurnDirection.OnlyWhenDecreasing && !effectSmoothChange.boolValue) { if ( MadGUI.WarningFix( "Burning when increasing will be visible only if the Smooth effect is enabled.", "Enable Smooth Effect")) { effectSmoothChange.boolValue = true; } } MadGUI.PropertyField(effectSmoothChangeSpeed, "Speed"); }); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); blinkEffectAnimBool.target = effectBlink.boolValue; MadGUI.PropertyField(effectBlink, "Blink"); if (EditorGUILayout.BeginFadeGroup(blinkEffectAnimBool.faded)) { MadGUI.Indent(() => { MadGUI.PropertyFieldEnumPopup(effectBlinkOperator, "Operator"); MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); EditorGUILayout.Space(); } EditorGUILayout.EndFadeGroup(); // tiledEffectAnimBool.target = effectTiled.boolValue; // MadGUI.PropertyField(effectTiled, "Tiled"); // if (EditorGUILayout.BeginFadeGroup(tiledEffectAnimBool.faded)) { // MadGUI.Indent(() => { // EditorGUILayout.BeginHorizontal(); // MadGUI.PropertyField(effectTiledSprite, "Sprite", MadGUI.ObjectIsSet); // EditorGUILayout.PropertyField(effectTiledTint, new GUIContent(""), GUILayout.Width(90)); // EditorGUILayout.EndHorizontal(); // // EnsureSpriteRepeated(effectTiledSprite); // // MadGUI.PropertyFieldVector2(effectTiledTiling, "Tiling"); // MadGUI.PropertyFieldVector2(effectTiledStartOffset, "Start Offset"); // MadGUI.PropertyFieldVector2(effectTiledOffsetChangeSpeed, "Speed"); // }); // EditorGUILayout.Space(); // } // EditorGUILayout.EndFadeGroup(); // // followEffectAnimBool.target = effectFollow.boolValue; // MadGUI.PropertyField(effectFollow, "Follow"); // if (EditorGUILayout.BeginFadeGroup(followEffectAnimBool.faded)) { // using (MadGUI.Indent()) { // if (!GrowDirectionSupportedByFollowEffect()) { // MadGUI.Error("This effect cannot be used with selected grow direction. " // + "Please read manual for more information."); // } // // MadGUI.PropertyField(effectFollowObject, "GameObject"); // MadGUI.PropertyField(effectFollowOffset, "Position Offset"); // // EditorGUILayout.Space(); // // MadGUI.PropertyField(effectFollowColor, "Color"); // MadGUI.PropertyField(effectFollowRotation, "Rotation"); // if (MadGUI.Foldout("Scale", false)) { // MadGUI.Indent(() => { // MadGUI.PropertyField(effectFollowScaleX, "X"); // MadGUI.PropertyField(effectFollowScaleY, "Y"); // MadGUI.PropertyField(effectFollowScaleZ, "Z"); // }); // } // } // } EditorGUILayout.Space(); EditorGUILayout.EndFadeGroup(); } }
public override void OnInspectorGUI() { ClearActionQueue(); serializedObject.Update(); var t = target as EnergyBarTransformRenderer; if (MadGUI.Foldout("Textures", true)) { MadGUI.BeginBox(); FieldBackgroundTextures(); MadGUI.Indent(() => { EditorGUILayout.LabelField("Object Texture"); GUITexture(textureObjectTexture, textureObjectColor); MadGUI.PropertyFieldVector2(transformAnchor, "Texture Anchor"); }); EditorGUILayout.Space(); CheckTextureIsReadable(t.textureObject.texture); CheckTextureFilterTypeNotPoint(t.textureObject.texture); FieldForegroundTextures(); FieldPremultipliedAlpha(); MadGUI.EndBox(); } if (MadGUI.Foldout("Position & Size", true)) { MadGUI.BeginBox(); MadGUI.PropertyFieldVector2(screenPosition, "Position"); EditorGUI.indentLevel++; PropertySpecialNormalized(screenPosition, screenPositionNormalized); MadGUI.PropertyField(pivot, "Pivot"); MadGUI.PropertyField(anchorObject, "Anchor"); MadGUI.PropertyField(anchorCamera, "Anchor Camera", "Camera on which world coordinates will be translated to " + "screen coordinates."); EditorGUI.indentLevel--; MadGUI.PropertyField(guiDepth, "GUI Depth"); PropertySpecialResizeMode(size, resizeMode); FieldRelativeToTransform(); MadGUI.EndBox(); } if (MadGUI.Foldout("Object Transform", true)) { MadGUI.BeginBox(); MadGUI.PropertyFieldToggleGroup2(transformTranslate, "Translate", () => { MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(translateFunctionStart, "Start Point"); MadGUI.PropertyFieldVector2(translateFunctionEnd, "End Point"); }); }); MadGUI.PropertyFieldToggleGroup2(transformRotate, "Rotate", () => { MadGUI.Indent(() => { MadGUI.PropertyField(rotateFunctionStart, "Start Angle"); MadGUI.PropertyField(rotateFunctionEnd, "End Angle"); }); }); MadGUI.PropertyFieldToggleGroup2(transformScale, "Scale", () => { MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(scaleFunctionStart, "Start Scale"); MadGUI.PropertyFieldVector2(scaleFunctionEnd, "End Scale"); }); }); MadGUI.EndBox(); } if (MadGUI.Foldout("Appearance", false)) { MadGUI.BeginBox(); FieldLabel(); MadGUI.EndBox(); } serializedObject.ApplyModifiedProperties(); ExecuteActionQueue(); }
public override void OnCustomInspector() { serializedObject.Update(); Header(); Section("Textures", () => { FieldTextureMode(); EditorGUILayout.Space(); if (script.textureMode != EnergyBar3DBase.TextureMode.TextureAtlas || script.atlas != null) { FieldBackgroundTextures(); EditorGUILayout.Space(); FieldSprite(textureBar, atlasTextureBarGUID, "Bar Texture"); EditorGUILayout.Space(); CheckTextureIsReadable(script.textureBar); CheckTextureFilterTypeNotPoint(script.textureBar); FieldForegroundTextures(); FieldPremultipliedAlpha(); } }); if (showPositionAndSize) { SectionPositionAndSize(); } Section("Appearance", () => { var dir = (EnergyBarRenderer.GrowDirection) growDirection.enumValueIndex; if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { GUI.enabled = false; } EditorGUILayout.PropertyField(textureBarColorType, new GUIContent("Bar Color Type")); EditorGUI.indentLevel++; switch ((EnergyBarRenderer.ColorType) textureBarColorType.enumValueIndex) { case EnergyBarRenderer.ColorType.Solid: EditorGUILayout.PropertyField(textureBarColor, new GUIContent("Bar Color")); break; case EnergyBarRenderer.ColorType.Gradient: EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); break; } EditorGUI.indentLevel--; GUI.enabled = true; MadGUI.PropertyFieldEnumPopup(growDirection, "Grow Direction"); if (dir == EnergyBarRenderer.GrowDirection.RadialCW || dir == EnergyBarRenderer.GrowDirection.RadialCCW) { MadGUI.Indent(() => { EditorGUILayout.Slider(radialOffset, -1, 1, "Offset"); EditorGUILayout.Slider(radialLength, 0, 1, "Length"); }); } else if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); } FieldLabel(); }); Section("Effects", () => { FieldSmoothEffect(); MadGUI.PropertyFieldToggleGroup2(effectBurn, "Burn Out", () => { MadGUI.Indent(() => { FieldSprite(effectBurnTextureBar, atlasEffectBurnTextureBarGUID, "Burn Texture Bar"); MadGUI.PropertyField(effectBurnTextureBarColor, "Burn Color"); }); }); MadGUI.PropertyFieldToggleGroup2(effectBlink, "Blink", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); }); MadGUI.PropertyFieldToggleGroup2(effectFollow, "Sprite Follow", () => { MadGUI.Indent(() => { if (GUI.enabled && !GrowDirectionSupportedByFollowEffect()) { MadGUI.Error("This effect cannot be used with selected grow direction. " + "Please read manual for more information."); } MadGUI.PropertyField(effectFollowObject, "Texture or GameObject", "This can be Texture, MadSprite or any other GameObject."); if (!VerifyFollowObject()) { MadGUI.Error("You can put here only Texture2D or GameObject."); } MadGUI.PropertyField(effectFollowColor, "Color"); MadGUI.PropertyField(effectFollowRotation, "Rotation"); if (MadGUI.Foldout("Scale", false)) { MadGUI.Indent(() => { MadGUI.PropertyField(effectFollowScaleX, "X"); MadGUI.PropertyField(effectFollowScaleY, "Y"); MadGUI.PropertyField(effectFollowScaleZ, "Z"); }); } }); }); }); EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); }
private void SectionEffects() { GUILayout.Label("Effects", "HeaderLabel"); using (MadGUI.Indent()) { FieldSmoothEffect(); } }
public override void OnInspectorGUI() { serializedObject.Update(); var t = target as SimpleEvent; var collider = t.GetComponent <Collider>(); if (collider != null) { if (!collider.isTrigger) { if (MadGUI.ErrorFix("This game object collider must be marked as 'Trigger'. Change it?")) { collider.isTrigger = true; } } } else { if (MadGUI.ErrorFix("This game object doesn't have a collider. Attach it now?")) { collider = t.gameObject.AddComponent <MeshCollider>(); collider.isTrigger = true; } } MadGUI.PropertyField(energyBar, "Energy Bar"); MadGUI.PropertyField(targetType, "Trigger With"); MadGUI.Indent(() => { switch ((SimpleEvent.Target)targetType.enumValueIndex) { case SimpleEvent.Target.GameObjects: GUITargetGameObjects(); break; case SimpleEvent.Target.Tags: GUITargetTags(); break; default: Debug.LogError("Unknown option: " + targetType.enumValueIndex); break; } }); if (MadGUI.Foldout("On Trigger Enter", false)) { MadGUI.Indent(() => { GUIAction(onTriggerEnterAction, false); }); } if (MadGUI.Foldout("On Trigger Stay", false)) { MadGUI.Indent(() => { GUIAction(onTriggerStayAction, true); }); } if (MadGUI.Foldout("On Trigger Leave", false)) { MadGUI.Indent(() => { GUIAction(onTriggerLeaveAction, false); }); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { ClearActionQueue(); serializedObject.Update(); var t = target as EnergyBarRenderer; if (MadGUI.Foldout("Textures", true)) { MadGUI.BeginBox(); FieldBackgroundTextures(); EditorGUILayout.PropertyField(textureBar, new GUIContent("Bar Texture")); CheckTextureIsReadable(t.textureBar); CheckTextureFilterTypeNotPoint(t.textureBar); FieldForegroundTextures(); FieldPremultipliedAlpha(); MadGUI.EndBox(); } if (MadGUI.Foldout("Position & Size", true)) { MadGUI.BeginBox(); MadGUI.PropertyFieldVector2(screenPosition, "Position"); EditorGUI.indentLevel++; PropertySpecialNormalized(screenPosition, screenPositionNormalized); MadGUI.PropertyField(pivot, "Pivot"); MadGUI.PropertyField(anchorObject, "Anchor"); MadGUI.PropertyField(anchorCamera, "Anchor Camera", "Camera on which world coordinates will be translated to " + "screen coordinates."); EditorGUI.indentLevel--; MadGUI.PropertyField(guiDepth, "GUI Depth"); PropertySpecialResizeMode(size, resizeMode); FieldRelativeToTransform(); MadGUI.EndBox(); } if (MadGUI.Foldout("Appearance", false)) { MadGUI.BeginBox(); var dir = (EnergyBarRenderer.GrowDirection)growDirection.enumValueIndex; if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { GUI.enabled = false; } EditorGUILayout.PropertyField(textureBarColorType, new GUIContent("Bar Color Type")); EditorGUI.indentLevel++; switch ((EnergyBarRenderer.ColorType)textureBarColorType.enumValueIndex) { case EnergyBarRenderer.ColorType.Solid: EditorGUILayout.PropertyField(textureBarColor, new GUIContent("Bar Color")); break; case EnergyBarRenderer.ColorType.Gradient: EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); break; } EditorGUI.indentLevel--; GUI.enabled = true; EditorGUILayout.PropertyField(growDirection, new GUIContent("Grow Direction")); if (dir == EnergyBarRenderer.GrowDirection.RadialCW || dir == EnergyBarRenderer.GrowDirection.RadialCCW) { MadGUI.Indent(() => { EditorGUILayout.Slider(radialOffset, -1, 1, "Offset"); EditorGUILayout.Slider(radialLength, 0, 1, "Length"); }); } else if (dir == EnergyBarRenderer.GrowDirection.ColorChange) { EditorGUILayout.PropertyField(textureBarGradient, new GUIContent("Bar Gradient")); } FieldLabel(); MadGUI.EndBox(); } if (MadGUI.Foldout("Effects", false)) { MadGUI.BeginBox(); FieldSmoothEffect(); MadGUI.PropertyFieldToggleGroup2(effectBurn, "Burn Out Effect", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBurnTextureBar, "Burn Texture Bar"); MadGUI.PropertyField(effectBurnTextureBarColor, "Burn Color"); }); }); MadGUI.PropertyFieldToggleGroup2(effectBlink, "Blink Effect", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); }); #if MAD_DEBUG MadGUI.PropertyFieldToggleGroup2(effectEdge, "Edge Effect", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectEdgeTexture, "Edge Texture"); MadGUI.PropertyField(effectEdgeIn, "Fade In Buffer"); MadGUI.PropertyField(effectEdgeOut, "Fade Out Buffer"); MadGUI.PropertyField(effectEdgeRotateAngle, "Rotation"); }); }); #endif MadGUI.EndBox(); } EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); ExecuteActionQueue(); }
public override void OnInspectorGUI() { serializedObject.Update(); var t = target as SimpleEvent; var collider = t.GetComponent <Collider>(); #if !UNITY_4_1 && !UNITY_4_2 var collider2d = t.GetComponent <Collider2D>(); #endif if (collider != null #if !UNITY_4_1 && !UNITY_4_2 || collider2d != null #endif ) { if (collider != null) { if (!collider.isTrigger) { if (MadGUI.ErrorFix("This game object collider must be marked as 'Trigger'. Change it?")) { collider.isTrigger = true; } } } #if !UNITY_4_1 && !UNITY_4_2 else { if (!collider2d.isTrigger) { if (MadGUI.ErrorFix("This game object collider must be marked as 'Trigger'. Change it?")) { collider2d.isTrigger = true; } } } #endif } else { if (MadGUI.ErrorFix("This game object doesn't have a collider. Attach it now?")) { #if !UNITY_4_1 && !UNITY_4_2 if (EditorUtility.DisplayDialog("Choose Collider Type", "Which collider type do you want to create? 2D or 3D?", "2D", "3D")) { var c = t.gameObject.AddComponent <BoxCollider2D>(); c.isTrigger = true; } else { #endif var c = t.gameObject.AddComponent <BoxCollider>(); c.isTrigger = true; #if !UNITY_4_1 && !UNITY_4_2 } #endif } } MadGUI.PropertyField(energyBar, "Energy Bar"); MadGUI.PropertyField(targetType, "Trigger With"); MadGUI.Indent(() => { switch ((SimpleEvent.Target)targetType.enumValueIndex) { case SimpleEvent.Target.GameObjects: GUITargetGameObjects(); break; case SimpleEvent.Target.Tags: GUITargetTags(); break; default: Debug.LogError("Unknown option: " + targetType.enumValueIndex); break; } }); if (MadGUI.Foldout("On Trigger Enter", false)) { MadGUI.Indent(() => { GUIAction(onTriggerEnterAction, false); }); } if (MadGUI.Foldout("On Trigger Stay", false)) { MadGUI.Indent(() => { GUIAction(onTriggerStayAction, true); }); } if (MadGUI.Foldout("On Trigger Leave", false)) { MadGUI.Indent(() => { GUIAction(onTriggerLeaveAction, false); }); } serializedObject.ApplyModifiedProperties(); }
override public void OnInspectorGUI() { serializedObject.Update(); valueCurrent.intValue = (int)EditorGUILayout.Slider("Current Value", valueCurrent.intValue, valueMin.intValue, valueMax.intValue); MadGUI.PropertyField(valueMin, "Min Value"); MadGUI.PropertyField(valueMax, "Max Value"); int fillDirectionPrev = fillDirection.enumValueIndex; MadGUI.PropertyField(fillDirection, "Fill Direction"); if (fillDirectionPrev != fillDirection.enumValueIndex) { SetFillDirection((UISprite.FillDirection)fillDirection.enumValueIndex, fillDirectionInvert.boolValue); } bool invertFillPrev = fillDirectionInvert.boolValue; MadGUI.PropertyField(fillDirectionInvert, "Invert Fill"); if (invertFillPrev != fillDirectionInvert.boolValue) { SetFillDirection((UISprite.FillDirection)fillDirection.enumValueIndex, fillDirectionInvert.boolValue); } MadGUI.PropertyField(colorType, "Bar Color Type"); switch ((UIFillProgressBar.ColorType)colorType.enumValueIndex) { case UIFillProgressBar.ColorType.Solid: t.bar.color = EditorGUILayout.ColorField("Bar Color", t.bar.color); EditorUtility.SetDirty(t.bar); break; case UIFillProgressBar.ColorType.Gradient: MadGUI.PropertyField(colorGradient, "Bar Color Gradient"); break; default: Debug.LogError("unknown option: " + colorType.enumValueIndex); break; } if (MadGUI.Foldout("Position", true)) { MadGUI.BeginBox(); { MadGUI.PropertyField(anchorObject, "Anchor", "Object to attach to"); MadGUI.PropertyField(anchorCamera, "Anchor Camera", "Camera on which anchored object is visible"); MadGUI.PropertyField(anchor3d, "Anchor 3D", "If enabled bar will be positioned in real 3D position. Useful when Using 3D interface in NGUI."); MadGUI.PropertyFieldVector2(anchorOffset, "Anchor Offset"); } MadGUI.EndBox(); } if (MadGUI.Foldout("Effects", true)) { MadGUI.BeginBox(); { FieldSmoothEffect(); bool burnEnabledPrev = effectBurn.boolValue; MadGUI.PropertyFieldToggleGroup2(effectBurn, "Burn Out Effect", () => { MadGUI.Indent(() => { if (burnEnabledPrev != effectBurn.boolValue) { SetBurnEffect(effectBurn.boolValue); } if (effectBurn.boolValue) { ((UISprite)effectBurnBar.objectReferenceValue).color = EditorGUILayout.ColorField("Burn Color", ((UISprite)effectBurnBar.objectReferenceValue).color); } }); }); MadGUI.PropertyFieldToggleGroup2(effectBlink, "Blink Effect", () => { MadGUI.Indent(() => { MadGUI.PropertyField(effectBlinkValue, "Value"); MadGUI.PropertyField(effectBlinkRatePerSecond, "Rate (per second)"); MadGUI.PropertyField(effectBlinkColor, "Color"); }); }); } MadGUI.EndBox(); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { ClearActionQueue(); serializedObject.Update(); if (MadGUI.Foldout("Textures", true)) { MadGUI.BeginBox(); MadGUI.PropertyField(repeatCount, "Repeat Count"); MadGUI.PropertyField(icon, "Icon"); CheckTextureIsGUI(icon.objectReferenceValue as Texture2D); CheckTextureFilterTypeNotPoint(icon.objectReferenceValue as Texture2D); MadGUI.Indent(() => { MadGUI.PropertyField(iconColor, "Icon Tint"); }); MadGUI.PropertyField(iconSlot, "Slot Icon"); CheckTextureIsGUI(iconSlot.objectReferenceValue as Texture2D); CheckTextureFilterTypeNotPoint(iconSlot.objectReferenceValue as Texture2D); MadGUI.Indent(() => { MadGUI.PropertyField(iconSlotColor, "Slot Icon Tint"); }); FieldPremultipliedAlpha(); MadGUI.EndBox(); } if (MadGUI.Foldout("Position & Size", true)) { MadGUI.BeginBox(); MadGUI.PropertyFieldVector2(startPosition, "Start Position"); EditorGUI.indentLevel++; PropertySpecialNormalized(startPosition, startPositionNormalized); MadGUI.PropertyField(pivot, "Pivot"); MadGUI.PropertyField(anchorObject, "Anchor"); EditorGUI.indentLevel--; MadGUI.PropertyField(guiDepth, "GUI Depth"); PropertySpecialResizeMode(iconSize, resizeMode, "Icon "); // switch ((EnergyBarOnGUIBase.ResizeMode) resizeMode.enumValueIndex) { // case EnergyBarOnGUIBase.ResizeMode.Constant: // PropertyFieldToggleGroupInv2(iconSizeCalculate, "Manual Size", () => { // Indent(() => { // PropertyFieldVector2(iconSize, "Icon Size"); // }); // }); // break; // // case EnergyBarOnGUIBase.ResizeMode.Stretch: // PropertyFieldVector2(iconSize, "Icon Size"); // break; // // case EnergyBarOnGUIBase.ResizeMode.KeepRatio: // EditorGUI.BeginChangeCheck(); // // float y = EditorGUILayout.FloatField("Icon Height", iconSize.vector2Value.y); // if (EditorGUI.EndChangeCheck()) { // var vec = new Vector2(iconSize.vector2Value.x, y); // iconSize.vector2Value = vec; // } // break; // } MadGUI.PropertyFieldVector2(positionDelta, "Icons Distance"); FieldRelativeToTransform(); MadGUI.EndBox(); } if (MadGUI.Foldout("Appearance", false)) { MadGUI.BeginBox(); FieldLabel(); MadGUI.EndBox(); } if (MadGUI.Foldout("Effects", false)) { MadGUI.BeginBox(); MadGUI.PropertyField(effect, "Grow Effect"); if (effect.enumValueIndex == (int)EnergyBarRepeatRenderer.Effect.Cut) { MadGUI.PropertyField(cutDirection, "Cut Direction"); } FieldSmoothEffect(); MadGUI.EndBox(); } serializedObject.ApplyModifiedProperties(); ExecuteActionQueue(); }