public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); GUI.color = Color.yellow; if (GUILayout.Button("<< Back To Layer Listing")) { Selection.activeGameObject = layer.parent.gameObject; } GUI.color = Color.white; GUILayout.Space(16); MadGUI.PropertyField(texture, "Texture"); MadGUI.PropertyField(tint, "Tint"); EditorGUILayout.Space(); MadGUI.PropertyField(scaleMode, "Scale Mode"); MadGUI.PropertyField(repeatX, "Repeat X"); MadGUI.PropertyField(repeatY, "Repeat Y"); MadGUI.ConditionallyEnabled(layer.scaleMode == MadLevelBackgroundLayer.ScaleMode.Fill && !layer.repeatX && !layer.repeatY, () => { if (MadGUI.Foldout("Margin", false)) { MadGUI.Indent(() => { MadGUI.PropertyField(fillMarginLeft, "Left"); MadGUI.PropertyField(fillMarginTop, "Top"); MadGUI.PropertyField(fillMarginRight, "Right"); MadGUI.PropertyField(fillMarginBottom, "Bottom"); }); } }); MadGUI.ConditionallyEnabled(!layer.repeatX && !layer.repeatY, () => { MadGUI.PropertyField(dontStretch, "Don't Stretch"); }); if (scaleMode.enumValueIndex == (int)MadLevelBackgroundLayer.ScaleMode.Manual) { MadGUI.PropertyField(align, "Align"); EditorGUILayout.Space(); MadGUI.PropertyFieldVector2Compact(position, "Position", 70); MadGUI.PropertyFieldVector2Compact(scale, "Scale", 70); } else { MadGUI.PropertyFieldVector2Compact(position, "Position", 70); } EditorGUILayout.Space(); MadGUI.PropertyField(followSpeed, "Follow Speed"); MadGUI.PropertyFieldVector2Compact(scrollSpeed, "Auto Scroll", 70); if (serializedObject.ApplyModifiedProperties()) { layer.SetDirty(); } }
public override void OnInspectorGUI() { serializedObject.UpdateIfDirtyOrScript(); GUI.color = Color.yellow; if (GUILayout.Button("<< Back To Layer Listing")) { Selection.activeGameObject = layer.parent.gameObject; } GUI.color = Color.white; GUILayout.Space(16); MadGUI.PropertyField(texture, "Texture"); MadGUI.PropertyField(tint, "Tint"); EditorGUILayout.Space(); MadGUI.PropertyField(scaleMode, "Scale Mode"); if (scaleMode.enumValueIndex == (int)MadLevelBackgroundLayer.ScaleMode.Manual) { MadGUI.PropertyField(align, "Align"); EditorGUILayout.Space(); MadGUI.PropertyFieldVector2Compact(position, "Position", 70); MadGUI.PropertyFieldVector2Compact(scale, "Scale", 70); } else { MadGUI.PropertyFieldVector2Compact(position, "Position", 70); } EditorGUILayout.Space(); MadGUI.PropertyField(followSpeed, "Follow Speed"); MadGUI.PropertyFieldVector2Compact(scrollSpeed, "Auto Scroll", 70); if (serializedObject.ApplyModifiedProperties()) { layer.SetDirty(); } }