/// <summary> /// Draw the part of fields in <see cref="AdaptationBase">. /// </summary> //public static void Draw(SerializedObject serializedObject) public override void OnInspectorGUI() { AdaptationBase adaptation = (AdaptationBase)target; var supportedProp = serializedObject.FindProperty("supportedOrientations"); var portraitProp = serializedObject.FindProperty("portraitOrDefaultAdaptation"); var landscapeProp = serializedObject.FindProperty("landscapeAdaptation"); (bool landscapeCompatible, bool portraitCompatible) = NotchSolutionUtilityEditor.GetOrientationCompatibility(); if (portraitCompatible && landscapeCompatible) { EditorGUILayout.PropertyField(supportedProp); EditorGUILayout.Separator(); } bool dual = supportedProp.enumValueIndex == (int)SupportedOrientations.Dual; if (dual) { EditorGUILayout.LabelField("Portrait Orientation", EditorStyles.boldLabel); } portraitProp.Next(enterChildren: true); if (portraitCompatible && landscapeCompatible) { EditorGUI.indentLevel++; } DrawGenButton(adaptation, forPortrait: true); for (int i = 0; i < 3; i++) { EditorGUILayout.PropertyField(portraitProp); portraitProp.Next(enterChildren: false); } if (portraitCompatible && landscapeCompatible) { EditorGUI.indentLevel--; } if (dual) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Landscape Orientation", EditorStyles.boldLabel); landscapeProp.Next(enterChildren: true); EditorGUI.indentLevel++; DrawGenButton(adaptation, forPortrait: false); for (int i = 0; i < 3; i++) { EditorGUILayout.PropertyField(landscapeProp); landscapeProp.Next(enterChildren: false); } EditorGUI.indentLevel--; } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { var orientationType = serializedObject.FindProperty("orientationType"); var portrait = serializedObject.FindProperty("portraitOrDefaultPaddings"); var landscape = serializedObject.FindProperty("landscapePaddings"); var influence = serializedObject.FindProperty("influence"); var flipPadding = serializedObject.FindProperty("flipPadding"); (bool landscapeCompatible, bool portraitCompatible) = NotchSolutionUtilityEditor.GetOrientationCompatibility(); if (portraitCompatible && landscapeCompatible) { EditorGUILayout.PropertyField(orientationType); EditorGUILayout.Separator(); } bool dual = orientationType.enumValueIndex == (int)SupportedOrientations.Dual; if (dual) { EditorGUILayout.LabelField("Portrait Orientation", EditorStyles.boldLabel); } if (portraitCompatible && landscapeCompatible) { EditorGUI.indentLevel++; } for (int i = 0; i < 4; i++) { portrait.Next(enterChildren: true); EditorGUILayout.PropertyField(portrait); } if (portraitCompatible && landscapeCompatible) { EditorGUI.indentLevel--; } if (dual) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Landscape Orientation", EditorStyles.boldLabel); EditorGUI.indentLevel++; for (int i = 0; i < 4; i++) { landscape.Next(enterChildren: true); EditorGUILayout.PropertyField(landscape); } EditorGUI.indentLevel--; } EditorGUILayout.Separator(); EditorGUILayout.PropertyField(influence); EditorGUILayout.PropertyField(flipPadding); serializedObject.ApplyModifiedProperties(); }