protected void LookAtLastLevel() { MadGUI.PropertyField(lookAtLastLevel, "Look At Previous Level", "When scene is loaded, it will automatically " + "go to the previously played level (but only if previous scene is of type Level."); GUILayout.Label("If above is disabled or cannot be determined, then..."); MadGUI.PropertyFieldEnumPopup(lookAtLevel, "Look At Level"); }
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(); }
private void GUIStartupProperty(SerializedProperty method, SerializedProperty value, string label) { MadGUI.PropertyFieldEnumPopup(method, label); if (method.enumValueIndex != (int)MadLevelAnimator.ApplyMethod.DoNotChange) { using (MadGUI.Indent()) { MadGUI.PropertyField(value, ""); EditorGUILayout.Space(); } } }
protected void HandleMobileBack() { MadGUI.PropertyField(handleMobileBackButton, "Handle Mobile 'Back'", "Handles mobile 'back' action by loading selected level."); MadGUI.Indent(() => { MadGUI.PropertyFieldEnumPopup(handleMobileBackButtonAction, "Action"); if (s.handleMobileBackButtonAction == MadLevelAbstractLayout.OnMobileBack.LoadSpecifiedLevel) { MadGUI.Indent(() => { MadGUI.PropertyField(handleMobileBackButtonLevelName, "Level Name", MadGUI.StringNotEmpty); }); } }); }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); MadGUI.PropertyField(dragBounds, "Drag Area"); EditorGUILayout.Space(); MadGUI.ConditionallyEnabled(HasBackground(), () => { if (MadGUI.Button("Resize Drag Area To Background", Color.yellow)) { ResizeDragAreaToBackground(); } }); EditorGUILayout.Space(); MadGUI.PropertyFieldEnumPopup(scaleMode, "Allow Scaling"); MadGUI.ConditionallyEnabled(script.scaleMode == MadFreeDraggable.ScaleMode.Free, () => { MadGUI.Indent(() => { MadGUI.PropertyField(scalingMin, "Scaling Min"); MadGUI.PropertyField(scalingMax, "Scaling Max"); }); }); EditorGUILayout.Space(); MadGUI.PropertyField(moveEasing, "Move Easing"); MadGUI.ConditionallyEnabled(moveEasing.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(moveEasingType, "Type"); MadGUI.PropertyField(moveEasingDuration, "Duration"); }); }); EditorGUILayout.Space(); MadGUI.PropertyField(scaleEasing, "Scale Easing"); MadGUI.ConditionallyEnabled(scaleEasing.boolValue, () => { MadGUI.Indent(() => { MadGUI.PropertyField(scaleEasingType, "Type"); MadGUI.PropertyField(scaleEasingDuration, "Duration"); }); }); serializedObject.ApplyModifiedProperties(); }
protected override void DrawInspector() { MadGUI.PropertyFieldEnumPopup(moveFrom, "From"); if (moveFrom.enumValueIndex >= 2) { using (MadGUI.Indent()) { MadGUI.PropertyField(moveFromPosition, "Position"); } } MadGUI.PropertyFieldEnumPopup(moveTo, "To"); if (moveTo.enumValueIndex >= 2) { using (MadGUI.Indent()) { MadGUI.PropertyField(moveToPosition, "Position"); } } }
protected override void DrawInspector() { MadGUI.PropertyFieldEnumPopup(rotateFrom, "From"); if (rotateFrom.enumValueIndex >= 2) { using (MadGUI.Indent()) { MadGUI.PropertyField(rotateFromValue, "Value"); } } MadGUI.PropertyFieldEnumPopup(rotateTo, "To"); if (rotateTo.enumValueIndex >= 2) { using (MadGUI.Indent()) { MadGUI.PropertyField(rotateToValue, "Value"); } } }
protected override void DrawInspector() { MadGUI.PropertyFieldEnumPopup(colorFrom, "From"); if (colorFrom.enumValueIndex == (int)MadAnimColor.ValueType.Value) { using (MadGUI.Indent()) { MadGUI.PropertyField(colorFromValue, "Value"); } } MadGUI.PropertyFieldEnumPopup(colorTo, "To"); if (colorTo.enumValueIndex == (int)MadAnimColor.ValueType.Value) { using (MadGUI.Indent()) { MadGUI.PropertyField(colorToValue, "Value"); } } }
protected void LoadLevel() { MadGUI.PropertyFieldEnumPopup(loadLevel, "Load Level..."); switch (s.loadLevel) { case MadLevelAbstractLayout.LoadLevel.Immediately: // do nothing break; case MadLevelAbstractLayout.LoadLevel.WithDelay: using (MadGUI.Indent()) { MadGUI.PropertyField(loadLevelLoadLevelDelay, "Delay"); if (loadLevelLoadLevelDelay.floatValue < 0) { loadLevelLoadLevelDelay.floatValue = Mathf.Max(0, loadLevelLoadLevelDelay.floatValue); } } break; case MadLevelAbstractLayout.LoadLevel.SendMessage: using (MadGUI.Indent()) { MadGUI.Info("By choosing this option you are responsible for loading the level. " + "Activated MadLevelIcon will be passed as message argument."); MadGUI.PropertyField(loadLevelMessageReceiver, "Receiver", MadGUI.ObjectIsSet); MadGUI.PropertyField(loadLevelMessageName, "Method Name", MadGUI.StringNotEmpty); MadGUI.PropertyField(loadLevelMessageIncludeChildren, "Include Children"); } break; case MadLevelAbstractLayout.LoadLevel.DoNotLoad: // do nothing break; default: Debug.LogError("Unknown option: " + s.loadLevel); break; } }
private void GUIModifier(SerializedProperty modifierProperty) { var animationName = modifierProperty.FindPropertyRelative("animationName"); var modifierFunction = modifierProperty.FindPropertyRelative("modifierFunction"); var baseOperator = modifierProperty.FindPropertyRelative("baseOperator"); var firstParameter = modifierProperty.FindPropertyRelative("firstParameter"); var valueOperator = modifierProperty.FindPropertyRelative("valueOperator"); var secondParameter = modifierProperty.FindPropertyRelative("secondParameter"); //var function = modifierProperty.FindPropertyRelative("modifierFunction"); //var method = modifierProperty.FindPropertyRelative("method"); GUIAnimationName(animationName); MadGUI.PropertyFieldEnumPopup(modifierFunction, "Function"); if (modifierFunction.enumValueIndex == (int)MadLevelAnimator.Modifier.ModifierFunc.Predefined) { MadGUI.PropertyFieldEnumPopup(baseOperator, "Base Operator"); using (MadGUI.Indent()) { EditorGUILayout.LabelField("Expression"); EditorGUILayout.BeginHorizontal(); MadGUI.PropertyFieldEnumPopup(firstParameter, "", GUILayout.Width(150)); //MadGUI.LookLikeControls(0, 0); MadGUI.PropertyFieldEnumPopup(valueOperator, "", GUILayout.Width(100)); EditorGUILayout.PropertyField(secondParameter, new GUIContent(""), GUILayout.Width(80)); //MadGUI.LookLikeControls(0); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); } //MadGUI.PropertyFieldEnumPopup(function, "Function"); //MadGUI.PropertyFieldEnumPopup(method, "Method"); }
protected void TwoStepActivation() { MadGUI.PropertyFieldEnumPopup(twoStepActivationType, "Two Step Activation"); MadGUI.ConditionallyEnabled( twoStepActivationType.enumValueIndex != (int)MadLevelAbstractLayout.TwoStepActivationType.Disabled, () => { MadGUI.Indent(() => { if (MadGUI.Foldout("On Activate", false)) { MadGUI.Indent(() => { ActivateAction( onIconActivatePlayAudio, onIconActivatePlayAudioClip, onIconActivatePlayAudioVolume, onIconActivateMessage, onIconActivateMessageReceiver, onIconActivateMessageMethodName, onIconActivateMessageIncludeChildren ); }); } if (MadGUI.Foldout("On Deactivate", false)) { MadGUI.Indent(() => { ActivateAction( onIconDeactivatePlayAudio, onIconDeactivatePlayAudioClip, onIconDeactivatePlayAudioVolume, onIconDeactivateMessage, onIconDeactivateMessageReceiver, onIconDeactivateMessageMethodName, onIconDeactivateMessageIncludeChildren ); }); } }); }); }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); MadGUI.BeginBox("Test Mode"); using (MadGUI.Indent()) { MadGUI.PropertyField(testMode, "Enabled"); var ignoreObject = GameObject.Find("/_mlm_ignore"); if (testMode.boolValue && ignoreObject == null) { new GameObject("_mlm_ignore"); } else if (!testMode.boolValue && ignoreObject != null) { DestroyImmediate(ignoreObject); } MadGUI.PropertyField(testLevelToLoad, "Load Level"); } MadGUI.EndBox(); MadGUI.BeginBox("Loading"); using (MadGUI.Indent()) { MadGUI.PropertyFieldEnumPopup(loadingMethod, "Method"); MadGUI.PropertyField(delayLoadingSeconds, "Delay"); MadGUI.PropertyField(loadingBar, "Loading Bar", ValidateLoadingBar); if (!ValidateLoadingBar(loadingBar)) { MadGUI.Error("Attached object does not have MadSprite, UISprite (NGUI) or Image (uGUI) component. " + "Please make sure that you've assigned a valid game object."); } using (MadGUI.Indent()) { MadGUI.PropertyField(loadingBarSmooth, "Smooth"); using (MadGUI.EnabledIf(loadingBarSmooth.boolValue)) { MadGUI.PropertyField(loadingBarSmoothSpeed, "Smooth Speed"); MadGUI.PropertyField(waitForBarToFillUp, "Wait To Fill Up"); } } } MadGUI.EndBox(); MadGUI.BeginBox("When Loaded"); using (MadGUI.Indent()) { MadGUI.PropertyFieldEnumPopup(whenLevelLoaded, ""); EditorGUILayout.Space(); if (whenLevelLoaded.enumValueIndex == (int)LoadingScreen.WhenLevelLoaded.WaitAndShow) { using (MadGUI.Indent()) { MadGUI.PropertyField(waitAndShowSeconds, "Seconds"); EditorGUILayout.Space(); } } if (whenLevelLoaded.enumValueIndex != (int)LoadingScreen.WhenLevelLoaded.ShowImmediately) { GUIGameObjectList("Enable Objects", changeEnable); GUIGameObjectList("Disable Objects", changeDisable); } EditorGUILayout.Space(); GUILayout.Label("Don't Destroy Objects", "HeaderLabel"); var arrayList = new MadGUI.ArrayList <string>(ignoreObjects, property => { MadGUI.PropertyField(property, ""); }); arrayList.drawOrderButtons = false; arrayList.Draw(); GUILayout.Label("Notify", "HeaderLabel"); FieldMessage(onLoadedMessage); } MadGUI.EndBox(); MadGUI.BeginBox("When Level Shown"); using (MadGUI.Indent()) { MadGUI.PropertyField(timeScaleToOneWhenShown, "Set Time Scale To One"); GUILayout.Label("Notify", "HeaderLabel"); FieldMessage(onLevelShowMessage); } MadGUI.EndBox(); 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; } serializedObject.UpdateIfDirtyOrScript(); 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); EditorGUI.BeginChangeCheck(); index = EditorGUILayout.Popup("Group", index, names); if (EditorGUI.EndChangeCheck()) { MadUndo.RecordObject2(script, "Changed Group"); script.configurationGroup = IndexToGroup(script.currentConfiguration, index).id; script.dirty = true; EditorUtility.SetDirty(script); } GUI.enabled = true; } EditorGUILayout.Space(); MadGUI.PropertyField(iconTemplate, "Icon Template", MadGUI.ObjectIsSet); if (script.iconTemplate != null) { var prefabType = PrefabUtility.GetPrefabType(script.iconTemplate); if (prefabType == PrefabType.None) { MadGUI.Warning("It's recommended to use prefab as a template. All visible icon instances will be linked to this prefab."); } } using (MadGUI.Indent()) { MadGUI.PropertyFieldEnumPopup(enumerationType, "Enumeration"); using (MadGUI.Indent()) { MadGUI.PropertyField(enumerationOffset, "Offset"); } } EditorGUILayout.Space(); MadGUI.PropertyField(backgroundTexture, "Background Texture"); EditorGUILayout.Space(); MadGUI.Info("Use the button below if you've updated your icon template and you want to replace all icons in your layout with it."); if (MadGUI.Button("Replace All Icons", Color.yellow)) { ReplaceAllIcons(); } MadGUI.Info("More customization options are available in the Draggable object."); if (MadGUI.Button("Select Draggable", Color.magenta)) { SelectDraggable(); } }); EditorGUILayout.Space(); GUILayout.Label("Mechanics", "HeaderLabel"); MadGUI.Indent(() => { LookAtLastLevel(); EditorGUILayout.Space(); HandleMobileBack(); EditorGUILayout.Space(); TwoStepActivation(); EditorGUILayout.Space(); LoadLevel(); }); 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(); }