public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); MadGUI.PropertyField(dragArea, "Drag Area"); MadGUI.PropertyFieldVector2(dragStartPosition, "Drag Start Position"); MadGUI.PropertyField(scaling, "Allow Scaling"); MadGUI.ConditionallyEnabled(scaling.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(scalingMin, "Scaling Min"); MadGUI.PropertyField(scalingMax, "Scaling Max"); }); }); MadGUI.PropertyField(moveEasing, "Move Easing"); MadGUI.ConditionallyEnabled(moveEasing.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(moveEasingType, "Type"); MadGUI.PropertyField(moveEasingDuration, "Duration"); }); }); MadGUI.PropertyField(scaleEasing, "Scale Easing"); MadGUI.ConditionallyEnabled(scaleEasing.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(scaleEasingType, "Type"); MadGUI.PropertyField(scaleEasingDuration, "Duration"); }); }); serializedObject.ApplyModifiedProperties(); }
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(); }
public override void OnInspectorGUI() { 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 { script.setupMethod = newSetupMethod; EditorUtility.SetDirty(script); } } serializedObject.UpdateIfDirtyOrScript(); if (script.setupMethod == MadLevelGridLayout.SetupMethod.Generate) { RebuildButton(); } GUILayout.Label("Fundaments", "HeaderLabel"); MadGUI.Indent(() => { MadGUI.PropertyField(configuration, "Configuration", MadGUI.ObjectIsSet); GUI.enabled = generate; MadGUI.PropertyField(iconTemplate, "Icon Template", MadGUI.ObjectIsSet); MadGUI.Indent(() => { MadGUI.PropertyFieldVector2(iconScale, "Scale"); MadGUI.PropertyFieldVector2(iconOffset, "Offset"); }); 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"); }); }); GUILayout.Label("Dimensions", "HeaderLabel"); MadGUI.Indent(() => { MadGUI.PropertyField(pixelsWidth, "Pixels Width"); MadGUI.PropertyField(pixelsHeight, "Pixels Height"); GUI.enabled = generate; MadGUI.PropertyField(gridHeight, "Grid Rows"); MadGUI.PropertyField(gridWidth, "Grid Columns"); GUI.enabled = true; MadGUI.PropertyField(pagesOffsetFromResolution, "Page Offset Auto"); MadGUI.ConditionallyEnabled(!pagesOffsetFromResolution.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(pagesOffsetManual, "Pixels Offset"); }); }); }); GUILayout.Label("Mechanics", "HeaderLabel"); MadGUI.Indent(() => { MadGUI.PropertyField(lookAtLastLevel, "Look At Last Level", "When scene is loaded, it will automatically " + "go to the page of previously played level (but only if previous scene is of type Level."); HandleMobileBack(); TwoStepActivation(); }); 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(); }
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(); }