public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(m_DisableWhenNotVisible, true); bool hasScreen = m_MaterialScreen.screenView != null; if (hasScreen) { EditorGUILayout.PropertyField(m_OptionsControlledByScreenView, true); } else { EditorGUILayout.HelpBox("Please place on a ScreenView", MessageType.Warning); } if (!m_MaterialScreen.optionsControlledByScreenView && hasScreen) { bool fadeIn = m_FadeIn.boolValue; bool scaleIn = m_ScaleIn.boolValue; bool slideIn = m_SlideIn.boolValue; bool rippleIn = m_RippleIn.boolValue; bool fadeOut = m_FadeOut.boolValue; bool scaleOut = m_ScaleOut.boolValue; bool slideOut = m_SlideOut.boolValue; bool rippleOut = m_RippleOut.boolValue; if (fadeIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_FadeIn); EditorGUILayout.PropertyField(m_FadeInTweenType, new GUIContent("Tween type")); if (m_FadeInTweenType.enumValueIndex == 0) { m_MaterialScreen.fadeInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.fadeInCustomCurve)); } EditorGUILayout.PropertyField(m_FadeInAlpha, new GUIContent("Initial Alpha")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_FadeIn); } if (scaleIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_ScaleIn); EditorGUILayout.PropertyField(m_ScaleInTweenType, new GUIContent("Tween type")); if (m_ScaleInTweenType.enumValueIndex == 0) { m_MaterialScreen.scaleInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.scaleInCustomCurve)); } EditorGUILayout.PropertyField(m_ScaleInScale, new GUIContent("Initial Scale")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_ScaleIn); } if (slideIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_SlideIn); EditorGUILayout.PropertyField(m_SlideInTweenType, new GUIContent("Tween type")); if (m_SlideInTweenType.enumValueIndex == 0) { m_MaterialScreen.slideInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.slideInCustomCurve)); } EditorGUILayout.PropertyField(m_SlideInDirection, new GUIContent("From the")); EditorGUILayout.PropertyField(m_AutoSlideInAmount, new GUIContent("Auto distance")); if (m_AutoSlideInAmount.boolValue) { EditorGUILayout.PropertyField(m_SlideInPercent, new GUIContent("Auto distance percent")); } else { EditorGUILayout.PropertyField(m_SlideInAmount, new GUIContent("Distance")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_SlideIn); } if (rippleIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_RippleIn); EditorGUILayout.PropertyField(m_RippleInTweenType, new GUIContent("Tween type")); if (m_RippleInTweenType.enumValueIndex == 0) { m_MaterialScreen.rippleInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.rippleInCustomCurve)); } EditorGUILayout.PropertyField(m_RippleInType, new GUIContent("Position type")); if (m_RippleInType.enumValueIndex == 1) { EditorGUILayout.PropertyField(m_RippleInPosition, new GUIContent("Position")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_RippleIn); } EditorGUILayout.Space(); if (fadeOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_FadeOut); EditorGUILayout.PropertyField(m_FadeOutTweenType, new GUIContent("Tween type")); if (m_FadeOutTweenType.enumValueIndex == 0) { m_MaterialScreen.fadeOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.fadeOutCustomCurve)); } EditorGUILayout.PropertyField(m_FadeOutAlpha, new GUIContent("Initial Alpha")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_FadeOut); } if (scaleOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_ScaleOut); EditorGUILayout.PropertyField(m_ScaleOutTweenType, new GUIContent("Tween type")); if (m_ScaleOutTweenType.enumValueIndex == 0) { m_MaterialScreen.scaleOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.scaleOutCustomCurve)); } EditorGUILayout.PropertyField(m_ScaleOutScale, new GUIContent("Initial Scale")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_ScaleOut); } if (slideOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_SlideOut); EditorGUILayout.PropertyField(m_SlideOutTweenType, new GUIContent("Tween type")); if (m_SlideOutTweenType.enumValueIndex == 0) { m_MaterialScreen.slideOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.slideOutCustomCurve)); } EditorGUILayout.PropertyField(m_SlideOutDirection, new GUIContent("From the")); EditorGUILayout.PropertyField(m_AutoSlideOutAmount, new GUIContent("Auto distance")); if (m_AutoSlideOutAmount.boolValue) { EditorGUILayout.PropertyField(m_SlideOutPercent, new GUIContent("Auto distance percent")); } else { EditorGUILayout.PropertyField(m_SlideOutAmount, new GUIContent("Distance")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_SlideOut); } if (rippleOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_RippleOut); EditorGUILayout.PropertyField(m_RippleOutTweenType, new GUIContent("Tween type")); if (m_RippleOutTweenType.enumValueIndex == 0) { m_MaterialScreen.rippleOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_MaterialScreen.rippleOutCustomCurve)); } EditorGUILayout.PropertyField(m_RippleOutType, new GUIContent("Position type")); if (m_RippleOutType.enumValueIndex == 1) { EditorGUILayout.PropertyField(m_RippleOutPosition, new GUIContent("Position")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_RippleOut); } EditorGUILayout.PropertyField(m_TransitionDuration); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { m_ScreenView = (ScreenView)target; serializedObject.Update(); EditorGUILayout.PropertyField(m_AutoTrackScreens); if (!m_AutoTrackScreens.boolValue) { EditorGUILayout.PropertyField(m_MaterialScreens, true); } EditorGUILayout.PropertyField(m_OnlyShowSelectedScreen); MaterialScreen[] materialScreen = m_ScreenView.materialScreen; if (materialScreen.Length > 0) { string[] names = new string[materialScreen.Length]; for (int i = 0; i < materialScreen.Length; i++) { names[i] = (i + 1) + " - " + materialScreen[i].name; } m_ScreenView.currentScreen = EditorGUILayout.Popup("Current screen", m_ScreenView.currentScreen, names); m_ScreenView.screensDirty = true; EditorGUILayout.Space(); } bool controllingAnyScreenConfigs = false; for (int i = 0; i < m_ScreenView.materialScreen.Length; i++) { MaterialScreen t = m_ScreenView.materialScreen[i]; if (t.optionsControlledByScreenView) { controllingAnyScreenConfigs = true; break; } } if (controllingAnyScreenConfigs) { bool fadeIn = m_FadeIn.boolValue; bool scaleIn = m_ScaleIn.boolValue; bool slideIn = m_SlideIn.boolValue; bool rippleIn = m_RippleIn.boolValue; bool fadeOut = m_FadeOut.boolValue; bool scaleOut = m_ScaleOut.boolValue; bool slideOut = m_SlideOut.boolValue; bool rippleOut = m_RippleOut.boolValue; if (fadeIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_FadeIn); EditorGUILayout.PropertyField(m_FadeInTweenType, new GUIContent("Tween type")); if (m_FadeInTweenType.enumValueIndex == 0) { m_ScreenView.fadeInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.fadeInCustomCurve)); } EditorGUILayout.PropertyField(m_FadeInAlpha, new GUIContent("Initial Alpha")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_FadeIn); } if (scaleIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_ScaleIn); EditorGUILayout.PropertyField(m_ScaleInTweenType, new GUIContent("Tween type")); if (m_ScaleInTweenType.enumValueIndex == 0) { m_ScreenView.scaleInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.scaleInCustomCurve)); } EditorGUILayout.PropertyField(m_ScaleInScale, new GUIContent("Initial Scale")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_ScaleIn); } if (slideIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_SlideIn); EditorGUILayout.PropertyField(m_SlideInTweenType, new GUIContent("Tween type")); if (m_SlideInTweenType.enumValueIndex == 0) { m_ScreenView.slideInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.slideInCustomCurve)); } EditorGUILayout.PropertyField(m_SlideInDirection, new GUIContent("From the")); EditorGUILayout.PropertyField(m_AutoSlideInAmount, new GUIContent("Auto distance")); if (m_AutoSlideInAmount.boolValue) { EditorGUILayout.PropertyField(m_SlideInPercent, new GUIContent("Auto distance percent")); } else { EditorGUILayout.PropertyField(m_SlideInAmount, new GUIContent("Distance")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_SlideIn); } if (rippleIn) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_RippleIn); EditorGUILayout.PropertyField(m_RippleInTweenType, new GUIContent("Tween type")); if (m_RippleInTweenType.enumValueIndex == 0) { m_ScreenView.rippleInCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.rippleInCustomCurve)); } EditorGUILayout.PropertyField(m_RippleInType, new GUIContent("Position type")); if (m_RippleInType.enumValueIndex == 1) { EditorGUILayout.PropertyField(m_RippleInPosition, new GUIContent("Position")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_RippleIn); } EditorGUILayout.Space(); if (fadeOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_FadeOut); EditorGUILayout.PropertyField(m_FadeOutTweenType, new GUIContent("Tween type")); if (m_FadeOutTweenType.enumValueIndex == 0) { m_ScreenView.fadeOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.fadeOutCustomCurve)); } EditorGUILayout.PropertyField(m_FadeOutAlpha, new GUIContent("Initial Alpha")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_FadeOut); } if (scaleOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_ScaleOut); EditorGUILayout.PropertyField(m_ScaleOutTweenType, new GUIContent("Tween type")); if (m_ScaleOutTweenType.enumValueIndex == 0) { m_ScreenView.scaleOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.scaleOutCustomCurve)); } EditorGUILayout.PropertyField(m_ScaleOutScale, new GUIContent("Initial Scale")); } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_ScaleOut); } if (slideOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_SlideOut); EditorGUILayout.PropertyField(m_SlideOutTweenType, new GUIContent("Tween type")); if (m_SlideOutTweenType.enumValueIndex == 0) { m_ScreenView.slideOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.slideOutCustomCurve)); } EditorGUILayout.PropertyField(m_SlideOutDirection, new GUIContent("From the")); EditorGUILayout.PropertyField(m_AutoSlideOutAmount, new GUIContent("Auto distance")); if (m_AutoSlideOutAmount.boolValue) { EditorGUILayout.PropertyField(m_SlideOutPercent, new GUIContent("Auto distance percent")); } else { EditorGUILayout.PropertyField(m_SlideOutAmount, new GUIContent("Distance")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_SlideOut); } if (rippleOut) { using (new GUILayout.VerticalScope("Box")) { EditorGUILayout.PropertyField(m_RippleOut); EditorGUILayout.PropertyField(m_RippleOutTweenType, new GUIContent("Tween type")); if (m_RippleOutTweenType.enumValueIndex == 0) { m_ScreenView.rippleOutCustomCurve = Tween.CheckCurve(EditorGUILayout.CurveField(m_ScreenView.rippleOutCustomCurve)); } EditorGUILayout.PropertyField(m_RippleOutType, new GUIContent("Position type")); if (m_RippleOutType.enumValueIndex == 1) { EditorGUILayout.PropertyField(m_RippleOutPosition, new GUIContent("Position")); } } EditorGUILayout.Space(); } else { EditorGUILayout.PropertyField(m_RippleOut); } EditorGUILayout.PropertyField(m_TransitionDuration); EditorGUILayout.PropertyField(m_TransitionType, new GUIContent("Default transition type")); } else { EditorGUILayout.LabelField("Not controlling any MaterialScreen settings", EditorStyles.boldLabel); } EditorGUILayout.PropertyField(m_OnScreenBeginTransition); EditorGUILayout.PropertyField(m_OnScreenEndTransition); serializedObject.ApplyModifiedProperties(); }