还原水插件
This commit is contained in:
@@ -147,21 +147,6 @@ namespace WaveHarmonic.Crest
|
||||
/// </summary>
|
||||
sealed class Stripped : DecoratedProperty
|
||||
{
|
||||
public enum Style
|
||||
{
|
||||
None,
|
||||
PlatformTab,
|
||||
}
|
||||
|
||||
readonly bool _KeepIndent;
|
||||
readonly Style _Style;
|
||||
|
||||
public Stripped(Style style = Style.None, bool indent = false)
|
||||
{
|
||||
_KeepIndent = indent;
|
||||
_Style = style;
|
||||
}
|
||||
|
||||
internal override bool NeedsControlRectangle(SerializedProperty property) => false;
|
||||
|
||||
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
|
||||
@@ -170,33 +155,11 @@ namespace WaveHarmonic.Crest
|
||||
DecoratedDrawer.s_TemporaryColor = true;
|
||||
DecoratedDrawer.s_PreviousColor = GUI.color;
|
||||
|
||||
if (_Style == Style.PlatformTab)
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
EditorGUILayout.LabelField(label);
|
||||
EditorGUI.indentLevel -= 1;
|
||||
}
|
||||
|
||||
GUI.color = new(0, 0, 0, 0);
|
||||
|
||||
if (!_KeepIndent) EditorGUI.indentLevel -= 1;
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
if (!_KeepIndent) EditorGUI.indentLevel += 1;
|
||||
|
||||
if (_Style == Style.PlatformTab)
|
||||
{
|
||||
EditorGUILayout.Space(4);
|
||||
EditorGUILayout.EndBuildTargetSelectionGrouping();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed class PlatformTabs : DecoratedProperty
|
||||
{
|
||||
static readonly GUIContent s_DefaultTab = new(EditorGUIUtility.IconContent("d_Settings").image, "Default");
|
||||
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
|
||||
{
|
||||
property.intValue = Editor.Reflected.EditorGUILayout.BeginBuildTargetSelectionGrouping(s_DefaultTab);
|
||||
EditorGUI.indentLevel += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,15 +621,29 @@ namespace WaveHarmonic.Crest
|
||||
|
||||
sealed class InlineToggle : DecoratedProperty
|
||||
{
|
||||
// Add extra y offset. Needed for foldouts in foldouts so far.
|
||||
readonly bool _Fix;
|
||||
|
||||
public InlineToggle(bool fix = false)
|
||||
{
|
||||
_Fix = fix;
|
||||
}
|
||||
|
||||
internal override bool NeedsControlRectangle(SerializedProperty property)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
internal override void OnGUI(Rect position, SerializedProperty property, GUIContent label, DecoratedDrawer drawer)
|
||||
{
|
||||
var r = position;
|
||||
r.x -= 16f;
|
||||
|
||||
// Prevent click events blocking next property.
|
||||
// Align with Space offset.
|
||||
if (drawer.Space > 0) r.y += drawer.Space + 2f;
|
||||
if (_Fix) r.y += EditorGUIUtility.singleLineHeight + 2f;
|
||||
// Seems to be needed.
|
||||
r.width = 16f * (1f + EditorGUI.indentLevel);
|
||||
|
||||
// Hide text.
|
||||
r.height = EditorGUIUtility.singleLineHeight;
|
||||
label.text = "";
|
||||
|
||||
using (new EditorGUI.PropertyScope(r, label, property))
|
||||
@@ -677,9 +654,6 @@ namespace WaveHarmonic.Crest
|
||||
property.boolValue = EditorGUI.Toggle(r, property.boolValue);
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
// Pull up next property. Extra space might be margin/padding.
|
||||
GUILayout.Space(-(EditorGUIUtility.singleLineHeight + 2f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user