public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); MadGUI.PropertyField(animationName, "Animation TypeID"); EditorGUILayout.Space(); DrawInspector(); EditorGUILayout.Space(); MadGUI.PropertyField(duration, "Duration"); MadGUI.PropertyField(delay, "Delay"); MadGUI.PropertyFieldSlider(offset, 0, 1, "Offset"); EditorGUILayout.Space(); MadGUI.PropertyField(useAnimationCurve, "Use Animation Curve"); using (MadGUI.Indent()) { if (!useAnimationCurve.boolValue) { MadGUI.PropertyFieldEnumPopup(easing, "Easing"); } else { MadGUI.PropertyField(animationCurve, "Curve"); } } MadGUI.PropertyFieldEnumPopup(wrapMode, "Wrap Mode"); MadGUI.PropertyField(queue, "Queue"); EditorGUILayout.Space(); MadGUI.PropertyField(playOnAwake, "Play On Awake"); MadGUI.PropertyField(destroyObjectOnFinish, "Destroy On Finish"); MadGUI.PropertyField(sendMessageOnFinish, "Send Message On Finish"); if (sendMessageOnFinish.boolValue) { using (MadGUI.Indent()) { MadGUI.PropertyField(messageReceiver, "Receiver", MadGUI.ObjectIsSet); MadGUI.PropertyField(messageName, "Method TypeID", MadGUI.StringNotEmpty); } } MadGUI.PropertyField(playAnimationOnFinish, "Play Animation On Finish"); if (playAnimationOnFinish.boolValue) { using (MadGUI.Indent()) { MadGUI.PropertyField(playAnimationOnFinishName, "TypeID", MadGUI.StringNotEmpty); MadGUI.PropertyField(playAnimationOnFinishFromTheBeginning, "From The Beginning"); } } MadGUI.PropertyField(ignoreTimeScale, "Ignore Time Scale"); serializedObject.ApplyModifiedProperties(); }
void ActivateAction( SerializedProperty playAudio, SerializedProperty playAudioClip, SerializedProperty playAudioVolume, SerializedProperty message, SerializedProperty messageReceiver, SerializedProperty messageMethodName, SerializedProperty messageIncludeChildren ) { MadGUI.PropertyField(playAudio, "Play Audio"); MadGUI.ConditionallyEnabled(playAudio.boolValue, () => { MadGUI.Indent(() => { if (playAudio.boolValue && !FoundAudioListener()) { if (MadGUI.ErrorFix("There's no AudioListener on the scene. Do you want me to add an " + "AudioListener to Camera 2D?", "Add")) { var camera = MadTransform.FindParent <Camera>((target as Component).transform); if (camera == null) { camera = FindObjectOfType(typeof(Camera)) as Camera; } if (camera != null) { camera.gameObject.AddComponent <AudioListener>(); } else { Debug.LogError("There's no camera on this scene!"); } } } MadGUI.PropertyField(playAudioClip, "Audio Clip", MadGUI.ObjectIsSet); MadGUI.PropertyFieldSlider(playAudioVolume, 0, 1, "Volume"); }); }); MadGUI.PropertyField(message, "Send Message"); MadGUI.ConditionallyEnabled(message.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(messageReceiver, "Receiver", MadGUI.ObjectIsSet); MadGUI.PropertyField(messageMethodName, "Method Name", MadGUI.StringNotEmpty); MadGUI.PropertyField(messageIncludeChildren, "Include Children"); if (message.boolValue) { MadGUI.Info("This should look like this:\nvoid " + messageMethodName.stringValue + "(MadLevelIcon icon)"); } }); }); }
protected void SectionSprite(DisplayFlag flags) { serializedObject.Update(); MadGUI.PropertyField(visible, "Visible"); if ((flags & DisplayFlag.WithoutMaterial) == 0) { MadGUI.PropertyField(texture, "Texture", MadGUI.ObjectIsSet); MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(textureRepeat, "Repeat"); MadGUI.PropertyFieldVector2(textureOffset, "Offset"); }); } MadGUI.PropertyField(tint, "Tint"); if ((flags & DisplayFlag.WithoutSize) == 0) { if (GUILayout.Button(new GUIContent("Resize To Texture", "Resizes this sprite to match texture size"))) { var sprite = target as MadSprite; MadUndo.RecordObject2(sprite, "Resize To Texture"); sprite.ResizeToTexture(); EditorUtility.SetDirty(sprite); } } MadGUI.PropertyField(pivotPoint, "Pivot Point"); MadGUI.PropertyField(guiDepth, "GUI Depth"); if ((flags & DisplayFlag.WithoutFill) == 0) { MadGUI.PropertyField(fillType, "Fill Type"); EditorGUILayout.Slider(fillValue, 0, 1, "Fill Value"); if (sprite.fillType == MadSprite.FillType.RadialCCW || sprite.fillType == MadSprite.FillType.RadialCW) { MadGUI.PropertyFieldSlider(radialFillOffset, -1, 1, "Offset"); MadGUI.PropertyFieldSlider(radialFillLength, 0, 1, "Length"); } } serializedObject.ApplyModifiedProperties(); }
protected void SectionSprite(DisplayFlag flags) { serializedObject.Update(); GUIDepthCheck(); MadGUI.PropertyField(panel, "Panel", MadGUI.ObjectIsSet); EditorGUILayout.Space(); MadGUI.PropertyField(visible, "Visible"); if ((flags & DisplayFlag.WithoutMaterial) == 0) { MadGUI.PropertyFieldEnumPopup(inputType, "Input Type"); MadGUI.Indent(() => { switch (sprite.inputType) { case MadSprite.InputType.SingleTexture: MadGUI.PropertyField(texture, "Texture", MadGUI.ObjectIsSet); MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(textureRepeat, "Repeat"); MadGUI.PropertyFieldVector2(textureOffset, "Offset"); }); break; case MadSprite.InputType.TextureAtlas: MadGUI.PropertyField(textureAtlas, "Texture Atlas", MadGUI.ObjectIsSet); if (sprite.textureAtlas != null) { MadAtlasUtil.AtlasField(textureAtlasSpriteGUID, sprite.textureAtlas, "Sprite", this); } break; default: Debug.LogError("Unknown input type: " + sprite.inputType); break; } }); } MadGUI.PropertyField(hasPremultipliedAlpha, "Has Pre-Alpha"); MadGUI.PropertyField(tint, "Tint"); EditorGUILayout.Space(); if ((flags & DisplayFlag.WithoutSize) == 0) { EditorGUILayout.Space(); GUI.backgroundColor = Color.yellow; if (GUILayout.Button(new GUIContent("Resize To Texture", "Resizes this sprite to match texture size"))) { MadUndo.RecordObject2(sprite, "Resize To Texture"); sprite.ResizeToTexture(); EditorUtility.SetDirty(sprite); } GUI.backgroundColor = Color.white; EditorGUILayout.Space(); } EditorGUILayout.Space(); MadGUI.PropertyField(pivotPoint, "Pivot Point"); if (sprite.pivotPoint == MadSprite.PivotPoint.Custom) { MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(customPivotPoint, "Custom Pivot Point"); }); } MadGUI.PropertyField(guiDepth, "GUI Depth"); EditorGUILayout.Space(); if ((flags & DisplayFlag.WithoutFill) == 0) { MadGUI.PropertyField(fillType, "Fill Type"); EditorGUILayout.Slider(fillValue, 0, 1, "Fill Value"); if (sprite.fillType == MadSprite.FillType.RadialCCW || sprite.fillType == MadSprite.FillType.RadialCW) { MadGUI.PropertyFieldSlider(radialFillOffset, -1, 1, "Offset"); MadGUI.PropertyFieldSlider(radialFillLength, 0, 1, "Length"); } } if (showLiveBounds) { GUILayout.Label("Sprite Border", "HeaderLabel"); EditorGUILayout.Space(); if (sprite.CanDraw()) { FieldLiveBounds(); } else { MadGUI.Info("More settings will be available when the sprite texture or atlas is set."); } } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { if (MadTrialEditor.isTrialVersion && MadTrialEditor.expired) { MadTrialEditor.OnEditorGUIExpired("Mad Level Manager"); return; } newSetupMethod = (MadLevelGridLayout.SetupMethod)EditorGUILayout.EnumPopup("Setup Method", script.setupMethod); if (newSetupMethod != script.setupMethod) { if (newSetupMethod == MadLevelGridLayout.SetupMethod.Generate && EditorUtility.DisplayDialog( "Are you sure?", "Are you sure that you want to switch to Generate setup method? If you've made any changes to grid " + "object, these changes will be lost!", "Set to Generate", "Cancel")) { script.setupMethod = newSetupMethod; script.deepClean = true; EditorUtility.SetDirty(script); } else if (EditorUtility.DisplayDialog( "Are you sure?", "Are you sure that you want to switch to Manual setup method? Be aware that after doing this:\n" + "- You won't be able to change your level group (currently " + script.currentConfiguration.FindGroupById(script.configurationGroup).name + ")\n" + "- You won't be able to regenerate grid without losing custom changes", "Set to Manual", "Cancel")) { script.setupMethod = newSetupMethod; EditorUtility.SetDirty(script); } } serializedObject.UpdateIfDirtyOrScript(); if (script.setupMethod == MadLevelGridLayout.SetupMethod.Generate) { RebuildButton(); } GUILayout.Label("Fundaments", "HeaderLabel"); MadGUI.Indent(() => { ConfigurationField(); if (script.currentConfiguration != null) { var group = script.currentConfiguration.FindGroupById(script.configurationGroup); int index = GroupToIndex(script.currentConfiguration, group); var names = GroupNames(script.currentConfiguration); GUI.enabled = script.setupMethod == MadLevelGridLayout.SetupMethod.Generate; EditorGUI.BeginChangeCheck(); index = EditorGUILayout.Popup("Group", index, names); if (EditorGUI.EndChangeCheck()) { script.configurationGroup = IndexToGroup(script.currentConfiguration, index).id; Rebuild(); } GUI.enabled = true; } EditorGUILayout.Space(); GUI.enabled = generate; IconTemplateField(); EditorGUILayout.Space(); using (MadGUI.Indent()) { MadGUI.PropertyFieldEnumPopup(enumerationType, "Enumeration"); using (MadGUI.Indent()) { MadGUI.PropertyField(enumerationOffset, "Offset"); } MadGUI.PropertyFieldVector2(iconScale, "Scale"); MadGUI.PropertyFieldVector2(iconOffset, "Offset"); } EditorGUILayout.Space(); GUI.enabled = true; MadGUI.PropertyField(leftSlideSprite, "Prev Page Sprite"); MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(leftSlideScale, "Scale"); MadGUI.PropertyFieldVector2(leftSlideOffset, "Offset"); }); MadGUI.PropertyField(rightSlideSprite, "Next Page Sprite"); MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(rightSlideScale, "Scale"); MadGUI.PropertyFieldVector2(rightSlideOffset, "Offset"); }); }); EditorGUILayout.Space(); GUILayout.Label("Dimensions", "HeaderLabel"); using (MadGUI.Indent()) { MadGUI.PropertyField(pixelsWidth, "Pixels Width"); MadGUI.PropertyField(pixelsHeight, "Pixels Height"); EditorGUILayout.Space(); GUI.enabled = generate; MadGUI.PropertyField(gridHeight, "Grid Rows"); MadGUI.PropertyField(gridWidth, "Grid Columns"); EditorGUILayout.Space(); MadGUI.PropertyField(limitLevelsPerPage, "Limit Levels Per Page"); using (MadGUI.EnabledIf(script.limitLevelsPerPage)) { MadGUI.PropertyField(levelsPerPage, "Levels Per Page"); } EditorGUILayout.Space(); MadGUI.PropertyFieldEnumPopup(horizontalAlign, "Horizontal Align"); MadGUI.PropertyFieldEnumPopup(verticalAlign, "Vertical Align"); GUI.enabled = true; EditorGUILayout.Space(); } GUILayout.Label("Paging", "HeaderLabel"); using (MadGUI.Indent()) { MadGUI.PropertyFieldEnumPopup(pagingMethod, "Paging Method"); using (MadGUI.Indent()) { MadGUI.PropertyField(pagingInvert, "Invert"); if (IsPagingMethodZoom()) { MadGUI.PropertyField(pagesZoomScale, "Zoom Scale"); } } EditorGUILayout.Space(); MadGUI.PropertyField(pagesOffsetFromResolution, "Dynamic Offset"); using (MadGUI.Indent()) { if (pagesOffsetFromResolution.boolValue) { MadGUI.PropertyFieldSlider(pagesOffsetPercent, 0, 3, "Offset %"); } else { MadGUI.PropertyField(pagesOffsetManual, "Pixels Offset"); } } } EditorGUILayout.Space(); GUILayout.Label("Mechanics", "HeaderLabel"); MadGUI.Indent(() => { LookAtLastLevel(); EditorGUILayout.Space(); HandleMobileBack(); EditorGUILayout.Space(); TwoStepActivation(); EditorGUILayout.Space(); LoadLevel(); EditorGUILayout.Space(); IgnoreInput(); }); GUILayout.Label("Debug", "HeaderLabel"); MadGUI.Indent(() => { MadGUI.PropertyField(hideManagerdObjects, "Hide Managed", "Hides managed by Mad Level Manager objects from the Hierarchy. If you want to have a look at what the hierarchy " + "looks like exacly, you can unckeck this option. Be aware that all direct changes to generated " + "objects will be lost!"); }); serializedObject.ApplyModifiedProperties(); }