-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove custom drawers for components, various housekeeping
- Loading branch information
Showing
12 changed files
with
19 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 2 additions & 46 deletions
48
Assets/LDtkUnity/Editor/CustomEditor/LDtkComponentLevelEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,11 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace LDtkUnity.Editor | ||
{ | ||
[CustomEditor(typeof(LDtkComponentLevel), true)] | ||
[CanEditMultipleObjects] | ||
internal sealed class LDtkComponentLevelEditor : UnityEditor.Editor | ||
{ | ||
private SerializedProperty _identifier; | ||
private SerializedProperty _size; | ||
private SerializedProperty _bgColor; | ||
private SerializedProperty _smartColor; | ||
private SerializedProperty _worldDepth; | ||
private SerializedProperty _neighbors; | ||
|
||
private void OnEnable() | ||
{ | ||
_identifier = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_IDENTIFIER); | ||
_size = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_SIZE); | ||
_bgColor = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_BG_COLOR); | ||
_smartColor = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_SMART_COLOR); | ||
_worldDepth = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_WORLD_DEPTH); | ||
_neighbors = serializedObject.FindProperty(LDtkComponentLevel.PROPERTY_NEIGHBOURS); | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
serializedObject.Update(); | ||
|
||
EditorGUILayout.PropertyField(_identifier); | ||
EditorGUILayout.PropertyField(_size); | ||
EditorGUILayout.PropertyField(_bgColor); | ||
EditorGUILayout.PropertyField(_smartColor); | ||
EditorGUILayout.PropertyField(_worldDepth); | ||
DrawNeighbours(); | ||
|
||
serializedObject.ApplyModifiedProperties(); | ||
} | ||
|
||
private void DrawNeighbours() | ||
{ | ||
if (_neighbors.arraySize <= 0) | ||
{ | ||
return; | ||
} | ||
|
||
GUILayout.Label("Neighbours", EditorStyles.miniBoldLabel); | ||
for (int i = 0; i < _neighbors.arraySize; i++) | ||
{ | ||
SerializedProperty prop = _neighbors.GetArrayElementAtIndex(i); | ||
EditorGUILayout.PropertyField(prop); | ||
} | ||
} | ||
|
||
} | ||
} |
46 changes: 1 addition & 45 deletions
46
Assets/LDtkUnity/Editor/CustomEditor/LDtkComponentProjectEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,11 @@ | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace LDtkUnity.Editor | ||
{ | ||
[CustomEditor(typeof(LDtkComponentProject), true)] | ||
[CanEditMultipleObjects] | ||
internal sealed class LDtkComponentProjectEditor : UnityEditor.Editor | ||
{ | ||
private static readonly GUIContent ProjectContent = new GUIContent | ||
{ | ||
text = "Json Data", | ||
tooltip = "Reference to the Json. Call FromJson in this component to get it's data" | ||
}; | ||
|
||
private static readonly GUIContent LevelsContent = new GUIContent | ||
{ | ||
text = "This project uses separate level files. The levels are instead available from their separate levels.", | ||
}; | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
SerializedProperty projectProp = serializedObject.FindProperty(LDtkComponentProject.PROPERTY_PROJECT); | ||
|
||
using (new EditorGUI.DisabledScope(true)) | ||
{ | ||
EditorGUILayout.PropertyField(projectProp, ProjectContent); | ||
} | ||
|
||
TryDrawExternalLevelsLabel(); | ||
} | ||
|
||
private void TryDrawExternalLevelsLabel() | ||
{ | ||
SerializedProperty levelsProp = serializedObject.FindProperty(LDtkComponentProject.PROPERTY_SEPARATE_LEVELS); | ||
if (!levelsProp.boolValue) | ||
{ | ||
return; | ||
} | ||
|
||
using (new EditorGUILayout.HorizontalScope()) | ||
{ | ||
using (new EditorGUIUtility.IconSizeScope(Vector2.one * 16)) | ||
{ | ||
GUIContent iconContent = new GUIContent | ||
{ | ||
image = LDtkIconUtility.LoadLevelFileIcon() | ||
}; | ||
EditorGUILayout.LabelField(iconContent, GUILayout.Width(18)); | ||
} | ||
|
||
EditorGUILayout.HelpBox(LevelsContent); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters