Add assets

This commit is contained in:
2025-05-08 16:03:30 +09:00
parent cd4ebdb0a7
commit 57b037e0a9
977 changed files with 91747 additions and 28 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d3d98e8e45af4d73979ff529b984130
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9c5f31dda5b0248c797c52b951d63b00
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(AssetsOnlyAttribute))]
public class AssetsOnlyAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
property.allowSceneObject = false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd9e1c6dc2e2a6f41993a36ad5dad550
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(BlockquoteAttribute))]
public class BlockquoteAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
BlockquoteAttribute blockquote = (BlockquoteAttribute)attribute;
GUIStyle style = EditorStyles.label;
style.wordWrap = true;
LucidEditorGUILayout.Blockquote(blockquote.text);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0ed2d80f5f80a459faf430e73df69e01
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomGroupProcessor(typeof(BoxGroupAttribute))]
public class BoxGroupAttributeProcessor : PropertyGroupProcessor
{
public override void BeginPropertyGroup()
{
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel);
LucidEditorGUILayout.BeginBoxGroup(attribute.name, GUILayout.MinWidth(0));
}
public override void EndPropertyGroup()
{
LucidEditorGUILayout.EndBoxGroup();
LucidEditorGUILayout.EndLayoutIndent();
EditorGUILayout.Space(2);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aa8e0443ca95e4acb8ff72f33ad827a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(DisableIfAttribute))]
public class DisableIfAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
DisableIfAttribute disableIf = (DisableIfAttribute)attribute;
property.isEditable = !ReflectionUtil.GetValueBool(property.parentObject, disableIf.condition);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 46b525001269a42df899b926cd739bd5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using UnityEngine;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(DisableInEditModeAttribute))]
public class DisableInEditModeAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
DisableInEditModeAttribute disableInEditMode = (DisableInEditModeAttribute)attribute;
property.isEditable = Application.isPlaying;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa2ac94d8dc9d4c0fa7e5289272fd97b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using UnityEngine;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(DisableInPlayModeAttribute))]
public class DisableInPlayModeAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
DisableInPlayModeAttribute disableInPlayMode = (DisableInPlayModeAttribute)attribute;
property.isEditable = !Application.isPlaying;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a24d5c4bf91846fab0bb55cd9ccf693
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(EnableIfAttribute))]
public class EnableIfAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
EnableIfAttribute enableIf = (EnableIfAttribute)attribute;
property.isEditable = ReflectionUtil.GetValueBool(property.parentObject, enableIf.condition);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 87c012206409c4a19846bf9f9785a777
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomGroupProcessor(typeof(FoldoutGroupAttribute))]
public class FoldoutGroupAttributeProcessor : PropertyGroupProcessor
{
private LocalPersistentData<bool> expanded;
public override void Initialize()
{
expanded = GetLocalPersistentData<bool>("exanded");
}
public override void BeginPropertyGroup()
{
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel);
expanded.Value = LucidEditorGUILayout.BeginFoldoutGroup(expanded.Value, attribute.name, GUILayout.MinWidth(0));
group.isExpanded = expanded.Value;
}
public override void EndPropertyGroup()
{
LucidEditorGUILayout.EndFoldoutGroup();
LucidEditorGUILayout.EndLayoutIndent();
EditorGUILayout.Space(2);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82b7d9f997ddd4538b703ba85fc2ad57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(GUIColorAttribute))]
public class GUIColorAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
GUIColorAttribute guiColor = (GUIColorAttribute)attribute;
LucidEditorUtility.PushGUIColor(guiColor.useCustomColor ? guiColor.customColor : guiColor.color.ToColor());
}
public override void OnAfterDrawProperty()
{
LucidEditorUtility.PopGUIColor();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e0a6e890fd919487c9db767e6da2b42b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomGroupProcessor(typeof(GroupAttribute))]
public class GroupAttributeProcessor : PropertyGroupProcessor
{
public override void BeginPropertyGroup()
{
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel);
EditorGUILayout.BeginVertical(GUI.skin.box, GUILayout.MinWidth(0));
}
public override void EndPropertyGroup()
{
EditorGUILayout.EndVertical();
LucidEditorGUILayout.EndLayoutIndent();
EditorGUILayout.Space(2);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 881f22c00ad84426d9c0ac07a3a097e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(HelpBoxAttribute))]
public class HelpBoxAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
HelpBoxAttribute helpBox = (HelpBoxAttribute)attribute;
EditorGUILayout.HelpBox(helpBox.message, (MessageType)helpBox.type);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cd2f68c11fb2d4dfe9dcbbf14f1bcbcd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(HelpBoxIfAttribute))]
public class HelpBoxIfAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
HelpBoxIfAttribute helpBoxIf = (HelpBoxIfAttribute)attribute;
if (ReflectionUtil.GetValueBool(property.parentObject, helpBoxIf.condition))
{
EditorGUILayout.HelpBox(helpBoxIf.message, (MessageType)helpBoxIf.type);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d6392ca7b5094ba0b13c8e20d83ccd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(HideIfAttribute))]
public class HideIfAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
HideIfAttribute hideIf = (HideIfAttribute)attribute;
property.isHidden |= ReflectionUtil.GetValueBool(property.parentObject, hideIf.condition);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 869bf746267a8451984148ee2382bcee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(HideLabelAttribute))]
public class HideLabelAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
property.hideLabel = true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a318ee3a513dc4de3aa50762a65136cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomGroupProcessor(typeof(HorizontalGroupAttribute))]
public class HorizontalGroupAttributeProcessor : PropertyGroupProcessor
{
public override void BeginPropertyGroup()
{
HorizontalGroupAttribute horizontalGroupAttribute = (HorizontalGroupAttribute)attribute;
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel);
EditorGUILayout.BeginHorizontal();
LucidEditorUtility.horizontalGroupCount++;
}
public override void EndPropertyGroup()
{
LucidEditorUtility.horizontalGroupCount--;
EditorGUILayout.EndHorizontal();
LucidEditorGUILayout.EndLayoutIndent();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba7ac005c37994f3080a24e976c6f223
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(HorizontalLineAttribute))]
public class HorizontalLineAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
HorizontalLineAttribute horizontalLine = (HorizontalLineAttribute)attribute;
EditorGUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
if (horizontalLine.useCustomColor)
{
LucidEditorGUILayout.Line(horizontalLine.customColor);
}
else
{
LucidEditorGUILayout.Line(horizontalLine.color.ToColor());
}
EditorGUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ae9d18acdc457450ea42f886ab9a9158
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(IndentAttribute))]
public class IndentAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
IndentAttribute indent = (IndentAttribute)attribute;
property.indent = indent.indent;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c5248ff57c43c4e6fa6108ce82ad2181
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(LabelTextAttribute))]
public class LabelTextAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
property.displayName = ((LabelTextAttribute)attribute).label;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1de31754c47e417482f0a6c1785ff2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(LabelWidthAttribute))]
public class LabelWidthAttributeProcessor : PropertyProcessor
{
private float defaultWidth;
public override void OnBeforeDrawProperty()
{
defaultWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = ((LabelWidthAttribute)attribute).width;
}
public override void OnAfterDrawProperty()
{
EditorGUIUtility.labelWidth = defaultWidth;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa081df837cda49f39fffedcc6eb4eb8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(OnValueChangedAttribute))]
public class OnValueChangedAttributeProcessor : PropertyProcessor
{
public override void OnAfterDrawProperty()
{
if (property.changed)
{
OnValueChangedAttribute onValueChanged = (OnValueChangedAttribute)attribute;
ReflectionUtil.Invoke(property.parentObject, onValueChanged.methodName, property.serializedProperty.GetValue<object>());
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d257440bc9b64dc9a8e3c0ec7ecab97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(PropertyOrderAttribute))]
public class PropertyOrderAttributeProcessor : PropertyProcessor
{
public override void OnBeforeInspectorGUI()
{
PropertyOrderAttribute propertyOrder = (PropertyOrderAttribute)attribute;
property.order = propertyOrder.propertyOrder;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 66e1690dd88604788ba6880d96dedf78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(ReadOnlyAttribute))]
public class ReadOnlyAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
property.isEditable = false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c93f8adb1ea444432a967b800380c5ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(RequiredAttribute))]
public class RequiredAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
RequiredAttribute required = (RequiredAttribute)attribute;
if (property.serializedProperty.propertyType == SerializedPropertyType.ObjectReference &&
property.serializedProperty.objectReferenceValue == null)
{
EditorGUILayout.HelpBox(required.message == null ? $"{property.displayName} is required." : required.message, MessageType.Error);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a9f019eeb7b7447c869ced7a62600ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(SectionHeaderAttribute))]
public class SectionHeaderAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
EditorGUILayout.Space(7);
LucidEditorGUILayout.SectionHeader(((SectionHeaderAttribute)attribute).title);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a5b42575366d54c149b27a0c47737719
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(ShowIfAttribute))]
public class ShowIfAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
ShowIfAttribute showIf = (ShowIfAttribute)attribute;
property.isHidden |= !ReflectionUtil.GetValueBool(property.parentObject, showIf.condition);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49b75efbae43a4c3abd9941511dd16f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomGroupProcessor(typeof(TabGroupAttribute))]
public class TabGroupAttributeProcessor : PropertyGroupProcessor
{
private LocalPersistentData<int> selected;
private string[] tabArray;
public override void Initialize()
{
selected = GetLocalPersistentData<int>("selected");
List<string> tabList = new List<string>();
foreach (InspectorProperty property in group.childProperties)
{
TabGroupAttribute att = property.GetAttribute<TabGroupAttribute>();
if (!tabList.Contains(att.tabName)) tabList.Add(att.tabName);
}
tabArray = tabList.ToArray();
}
public override void BeginPropertyGroup()
{
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel);
selected.Value = LucidEditorGUILayout.BeginTabGroup(selected.Value, tabArray, GUILayout.MinWidth(0));
foreach (InspectorProperty property in group.childProperties)
{
TabGroupAttribute att = property.GetAttribute<TabGroupAttribute>();
if (att != null)
{
property.isHidden |= att.tabName != tabArray[selected.Value];
}
}
}
public override void EndPropertyGroup()
{
LucidEditorGUILayout.EndFoldoutGroup();
LucidEditorGUILayout.EndLayoutIndent();
EditorGUILayout.Space(2);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d45600b0c539d4c6fa756bdd48e5d574
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(TitleHeaderAttribute))]
public class TitleHeaderAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
EditorGUILayout.Space(7);
LucidEditorGUILayout.TitleHeader(((TitleHeaderAttribute)attribute).title);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4bf9692430a8b4778bf1d8710eed95f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
[CustomAttributeProcessor(typeof(ValidateInputAttribute))]
public class ValidateInputAttributeProcessor : PropertyProcessor
{
public override void OnBeforeDrawProperty()
{
ValidateInputAttribute validateInput = (ValidateInputAttribute)attribute;
if (!ReflectionUtil.InvokeBool(property.parentObject, validateInput.condition, property.serializedProperty.GetValue<object>()))
{
EditorGUILayout.HelpBox(validateInput.message == null ? $"{property.displayName} is not valid." : validateInput.message, (MessageType)validateInput.type);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab179775f6cfb40d7bcc4874fffa5412
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,125 @@
using UnityEngine;
using UnityEditor;
namespace Cainos.LucidEditor
{
public static class EditorColors
{
public static Color background
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.219f, 0.219f, 0.219f);
else return new Color(0.784f, 0.784f, 0.784f);
}
}
public static Color field
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.165f, 0.165f, 0.165f);
else return new Color(0.941f, 0.941f, 0.941f);
}
}
public static Color tab
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.235f, 0.235f, 0.235f);
else return new Color(0.8f, 0.8f, 0.8f);
}
}
public static Color text
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.725f, 0.725f, 0.725f);
else return new Color(0.141f, 0.141f, 0.141f);
}
}
public static Color textSelected
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.486f, 0.675f, 0.945f);
else return new Color(0.05f, 0.275f, 0.552f);
}
}
public static Color line
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.1f, 0.1f, 0.1f);
else return new Color(0.5f, 0.5f, 0.5f);
}
}
public static Color thinLine
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.188f, 0.188f, 0.188f);
else return new Color(0.73f, 0.73f, 0.73f);
}
}
public static Color button
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.345f, 0.345f, 0.345f);
else return new Color(0.894f, 0.894f, 0.894f);
}
}
public static Color buttonSelected
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.27f, 0.376f, 0.49f);
else return new Color(0.549f, 0.725f, 0.752f);
}
}
public static Color box
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.27f, 0.27f, 0.27f);
else return new Color(0.73f, 0.73f, 0.73f);
}
}
public static Color helpBox
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(0.25f, 0.25f, 0.25f);
else return new Color(0.81f, 0.81f, 0.81f);
}
}
public static Color warning
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(1f, 0.755f, 0.035f);
else return new Color(0.788f, 0.592f, 0f);
}
}
public static Color error
{
get
{
if (EditorGUIUtility.isProSkin) return new Color(1f, 0.431f, 0.247f);
else return new Color(0.695f, 0.040f, 0.053f);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7804f7f08ea1e435f83285a1bbfd9307
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 35da294de93e241ddad74d97647c0672
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 168c31088fec14fb3aac63ab5a655dde
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
namespace Cainos.LucidEditor.Experimental
{
internal class SimpleTreeView : TreeView
{
private TreeMenuItem[] baseElements;
public Action<Rect, int> drawItemCallback;
public Func<int, float> itemHeightCallback;
public event Action<IList<int>> onSelectionChanged;
public SimpleTreeView(TreeViewState treeViewState) : base(treeViewState) { }
public void Setup(TreeMenuItem[] baseElements)
{
this.baseElements = baseElements;
Reload();
}
protected override TreeViewItem BuildRoot()
{
return new TreeViewItem { id = -1, depth = -1, displayName = "Root" };
}
protected override void RowGUI(RowGUIArgs args)
{
if (drawItemCallback != null)
{
Rect contentRect = args.rowRect;
contentRect.width -= GetContentIndent(args.item);
contentRect.x += GetContentIndent(args.item);
drawItemCallback.Invoke(contentRect, args.item.id);
}
else
{
base.RowGUI(args);
}
}
protected override float GetCustomRowHeight(int row, TreeViewItem item)
{
if (itemHeightCallback != null)
{
return itemHeightCallback.Invoke(item.id);
}
return base.GetCustomRowHeight(row, item);
}
protected override IList<TreeViewItem> BuildRows(TreeViewItem root)
{
var rows = GetRows() ?? new List<TreeViewItem>();
rows.Clear();
foreach (var baseElement in baseElements)
{
var baseItem = CreateTreeViewItem(baseElement);
root.AddChild(baseItem);
rows.Add(baseItem);
if (baseElement.childElements.Count > 0)
{
if (IsExpanded(baseItem.id))
{
AddChildrenRecursive(baseElement, baseItem, rows);
}
else
{
baseItem.children = CreateChildListForCollapsedParent();
}
}
}
SetupDepthsFromParentsAndChildren(root);
return rows;
}
protected override void SelectionChanged(IList<int> selectedIds)
{
onSelectionChanged?.Invoke(selectedIds);
}
private void AddChildrenRecursive(TreeMenuItem model, TreeViewItem item, IList<TreeViewItem> rows)
{
foreach (var childElement in model.childElements)
{
var childItem = CreateTreeViewItem(childElement);
item.AddChild(childItem);
rows.Add(childItem);
if (childElement.childElements.Count > 0)
{
if (IsExpanded(childElement.id))
{
AddChildrenRecursive(childElement, childItem, rows);
}
else
{
childItem.children = CreateChildListForCollapsedParent();
}
}
}
}
private TreeViewItem CreateTreeViewItem(TreeMenuItem model)
{
return new TreeViewItem { id = model.id, displayName = model.name };
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6808df22776e34bc9bdf425dc8012a27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,78 @@
using System;
using UnityEngine;
using UnityEditor;
namespace Cainos.LucidEditor.Experimental
{
public class TextFieldPopup : PopupWindowContent
{
public string text;
public Action<string> onValueChanged;
public Action onSubmit;
public Action onCancel;
private bool submit;
private bool initialized;
private bool didFocus = false;
private Rect size;
public void Show(Rect position)
{
size = position;
size.height = EditorGUIUtility.singleLineHeight;
PopupWindow.Show(position, this);
}
public override void OnGUI(Rect rect)
{
if (!initialized)
{
initialized = true;
onValueChanged?.Invoke(text);
}
if (LucidGUIEvent.GetKeyDown(KeyCode.Return))
{
submit = true;
editorWindow.Close();
}
string textFieldName = $"{GetType().Name}:{nameof(text)}";
using (var scope = new EditorGUI.ChangeCheckScope())
{
GUI.SetNextControlName(textFieldName);
Rect fieldRect = EditorGUILayout.GetControlRect();
fieldRect.xMin -= 2.7f;
fieldRect.xMax += 2.7f;
fieldRect.yMin -= 2.7f;
fieldRect.yMax += 2.7f;
text = EditorGUI.TextField(fieldRect, text);
if (scope.changed)
{
onValueChanged?.Invoke(text);
}
}
if (!didFocus)
{
GUI.FocusControl(textFieldName);
didFocus = true;
}
}
public override Vector2 GetWindowSize()
{
return new Vector2(size.width, EditorGUIUtility.singleLineHeight);
}
public override void OnClose()
{
base.OnClose();
if (submit) onSubmit?.Invoke();
else onCancel?.Invoke();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c25190bd6c58843cc9794694a38a740e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,62 @@
using System.Collections.Generic;
using UnityEngine;
namespace Cainos.LucidEditor.Experimental
{
public sealed class Toolbar
{
private List<GUIContent> _items = new List<GUIContent>();
public IReadOnlyList<GUIContent> items => _items;
public int selected;
public GUIStyle style = null;
public GUI.ToolbarButtonSize size = GUI.ToolbarButtonSize.FitToContents;
public void AddItem(string item)
{
_items.Add(new GUIContent(item));
}
public void AddItem(GUIContent item)
{
_items.Add(item);
}
public bool RemoveItem(string item)
{
return _items.RemoveAll(x => x.text == item) > 0;
}
public bool RemoveItem(GUIContent item)
{
return _items.Remove(item);
}
public void Clear()
{
_items.Clear();
}
public int Show(Rect rect)
{
return Show(rect, selected);
}
private int Show(Rect rect, int selected)
{
this.selected = GUI.Toolbar(rect, selected, _items.ToArray(), style == null ? GUI.skin.button : style, size);
return this.selected;
}
public int ShowLayout(params GUILayoutOption[] options)
{
return ShowLayout(selected, options);
}
private int ShowLayout(int selected, params GUILayoutOption[] options)
{
this.selected = GUILayout.Toolbar(selected, _items.ToArray(), style == null ? GUI.skin.button : style, size, options);
return this.selected;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d113573c2d819423b815b8fbc1c07a21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
namespace Cainos.LucidEditor.Experimental
{
public class TreeMenu
{
private List<TreeMenuItem> baseElements = new List<TreeMenuItem>();
private SimpleTreeView simpleTreeView;
private TreeViewState state;
private int currentId = 0;
private List<TreeMenuItem> _selectedItems = new List<TreeMenuItem>();
public IReadOnlyList<TreeMenuItem> selectedItems => Array.AsReadOnly(_selectedItems.ToArray());
public event Action<IReadOnlyList<TreeMenuItem>> onSelectionChanged;
public Action<Rect, TreeMenuItem> drawItemCallback;
public Func<TreeMenuItem, float> itemHeightCallback;
public string searchString
{
get
{
return _searchString;
}
set
{
_searchString = value;
if (simpleTreeView != null) simpleTreeView.searchString = _searchString;
}
}
private string _searchString;
public void AddItem(string path)
{
string[] hierarchy = path.Split('/');
string currentPath = string.Empty;
TreeMenuItem parent = null;
for (int i = 0; i < hierarchy.Length; i++)
{
currentPath += hierarchy[i];
if (parent == null)
{
parent = baseElements.Find(x => x.name == hierarchy[i]);
if (parent == null)
{
parent = CreateItem(currentPath);
baseElements.Add(parent);
}
}
else
{
TreeMenuItem newParent = null;
foreach (TreeMenuItem child in parent.childElements)
{
if (child.name == hierarchy[i])
{
newParent = child;
parent = child;
break;
}
}
if (newParent == null)
{
newParent = CreateItem(currentPath);
parent.Add(newParent);
parent = newParent;
}
}
currentPath += '/';
}
}
private TreeMenuItem CreateItem(string path)
{
TreeMenuItem item = new TreeMenuItem(path);
item.id = currentId;
currentId++;
return item;
}
public void Show(Rect position)
{
if (simpleTreeView == null) Setup();
simpleTreeView.OnGUI(position);
}
public void ShowLayout(params GUILayoutOption[] options)
{
if (simpleTreeView == null) Setup();
simpleTreeView.OnGUI(EditorGUILayout.GetControlRect(false, simpleTreeView.totalHeight, options));
}
public void Setup()
{
state = new TreeViewState();
simpleTreeView = new SimpleTreeView(state);
simpleTreeView.searchString = _searchString;
simpleTreeView.Setup(baseElements.ToArray());
simpleTreeView.onSelectionChanged += (idList) =>
{
_selectedItems.Clear();
foreach (int id in idList)
{
TreeMenuItem item = FindItem(id);
if (item != null) _selectedItems.Add(item);
}
onSelectionChanged?.Invoke(_selectedItems);
};
if (drawItemCallback != null)
{
simpleTreeView.drawItemCallback = (rect, id) =>
{
drawItemCallback.Invoke(rect, FindItem(id));
};
}
if (itemHeightCallback != null)
{
simpleTreeView.itemHeightCallback = (id) =>
{
return itemHeightCallback.Invoke(FindItem(id));
};
}
}
private TreeMenuItem FindItem(int id)
{
TreeMenuItem item = null;
foreach(TreeMenuItem child in baseElements)
{
item = FindItem(child, id);
if (item != null) return item;
}
return null;
}
private TreeMenuItem FindItem(TreeMenuItem root, int id)
{
if (root.id == id) return root;
TreeMenuItem item = null;
foreach (TreeMenuItem child in root.childElements)
{
item = FindItem(child, id);
if (item != null) return item;
}
return null;
}
}
public class TreeMenuItem
{
public TreeMenuItem(string path)
{
this.path = path;
depth = path.Count(x => x == '/');
_name = path.Split('/').Last();
}
public readonly string path;
public readonly int depth;
internal int id;
public string name
{
get
{
return _name;
}
}
private string _name;
public TreeMenuItem parent { get; private set; }
private List<TreeMenuItem> _childElements = new List<TreeMenuItem>();
public IReadOnlyList<TreeMenuItem> childElements => _childElements;
public void Add(TreeMenuItem child)
{
if (child.parent != null)
{
child.parent.Remove(child);
}
_childElements.Add(child);
child.parent = this;
}
public bool Remove(TreeMenuItem child)
{
if (_childElements.Contains(child))
{
_childElements.Remove(child);
child.parent = null;
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8763dd98783e24b7d9684eec2742d817
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 773c5a058d566448f9a2348d09e813de
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,59 @@
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
public static class InspectorColorExtensions
{
public static Color ToColor(this InspectorColor color)
{
switch (color)
{
default:
case InspectorColor.Clear: return Color.clear;
case InspectorColor.Red: return Color.red;
case InspectorColor.Green: return Color.green;
case InspectorColor.Blue: return Color.blue;
case InspectorColor.Orange: return new Color(1f, 0.5f, 0f);
case InspectorColor.Purple: return new Color(0.5f, 0f, 1f);
case InspectorColor.Pink: return new Color(1f, 0.4f, 1f);
case InspectorColor.Indigo: return new Color(0.3f, 0f, 0.5f);
case InspectorColor.Cyan: return Color.cyan;
case InspectorColor.Magenta: return Color.magenta;
case InspectorColor.Yellow: return Color.yellow;
case InspectorColor.White: return Color.white;
case InspectorColor.Gray: return Color.gray;
case InspectorColor.Grey: return Color.grey;
case InspectorColor.Black: return Color.black;
case InspectorColor.EditorText: return EditorColors.text;
case InspectorColor.EditorTextSelected: return EditorColors.textSelected;
case InspectorColor.EditorBackground: return EditorColors.background;
case InspectorColor.EditorLine: return EditorColors.line;
case InspectorColor.EditorThinLine: return EditorColors.thinLine;
case InspectorColor.EditorWarning: return EditorColors.warning;
case InspectorColor.EditorError: return EditorColors.error;
}
}
}
public static class InspectorButtonSizeExtensions
{
public static float GetHeight(this InspectorButtonSize size)
{
switch (size)
{
default:
case InspectorButtonSize.Small:
return EditorGUIUtility.singleLineHeight;
case InspectorButtonSize.Medium:
return EditorGUIUtility.singleLineHeight * 1.5f;
case InspectorButtonSize.Large:
return EditorGUIUtility.singleLineHeight * 2f;
case InspectorButtonSize.ExtraLarge:
return EditorGUIUtility.singleLineHeight * 4f;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d1c97af8bccf49119723b6c0b99dd96
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,304 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEditor;
namespace Cainos.LucidEditor
{
public static class SerializedPropertyExtensions
{
public static bool TryGetAttribute<TAttribute>(this SerializedProperty property, out TAttribute result) where TAttribute : Attribute
{
return TryGetAttribute<TAttribute>(property, false, out result);
}
public static bool TryGetAttribute<TAttribute>(this SerializedProperty property, bool inherit, out TAttribute result) where TAttribute : Attribute
{
TAttribute att = GetAttribute<TAttribute>(property, inherit);
result = att;
return att != null;
}
public static TAttribute GetAttribute<TAttribute>(this SerializedProperty property, bool inherit = false) where TAttribute : Attribute
{
if (property == null)
{
throw new ArgumentNullException(nameof(property));
}
Type targetObjectType = property.GetParentObject().GetType();
if (targetObjectType == null)
{
throw new ArgumentException($"Could not find the {nameof(targetObjectType)} of {nameof(property)}");
}
foreach (var pathSegment in property.propertyPath.Split('.'))
{
FieldInfo fieldInfo = ReflectionUtil.GetField(targetObjectType, pathSegment, (BindingFlags)(-1), inherit);
if (fieldInfo != null)
{
return (TAttribute)fieldInfo.GetCustomAttribute<TAttribute>(inherit);
}
PropertyInfo propertyInfo = targetObjectType.GetProperty(pathSegment, (BindingFlags)(-1));
if (propertyInfo != null)
{
return (TAttribute)propertyInfo.GetCustomAttribute<TAttribute>(inherit);
}
}
throw new ArgumentException($"Could not find the field or property of {nameof(property)}");
}
public static TAttribute[] GetAttributes<TAttribute>(this SerializedProperty property, bool inherit) where TAttribute : Attribute
{
if (property == null)
{
throw new ArgumentNullException(nameof(property));
}
Type targetObjectType = property.GetParentObject()?.GetType();
if (targetObjectType == null)
{
throw new ArgumentException($"Could not find the {nameof(targetObjectType)} of {nameof(property)}");
}
foreach (var pathSegment in property.propertyPath.Split('.'))
{
FieldInfo fieldInfo = ReflectionUtil.GetField(targetObjectType, pathSegment, (BindingFlags)(-1), true);
if (fieldInfo != null)
{
return (TAttribute[])fieldInfo.GetCustomAttributes<TAttribute>(inherit);
}
PropertyInfo propertyInfo = ReflectionUtil.GetProperty(targetObjectType, pathSegment, (BindingFlags)(-1), true);
if (propertyInfo != null)
{
return (TAttribute[])propertyInfo.GetCustomAttributes<TAttribute>(inherit);
}
}
throw new ArgumentException($"Could not find the field or property of {nameof(property)}");
}
public static float GetHeight(this SerializedProperty property)
{
return EditorGUI.GetPropertyHeight(property, true);
}
public static float GetHeight(this SerializedProperty property, bool includeChildren)
{
return EditorGUI.GetPropertyHeight(property, includeChildren);
}
public static float GetHeight(this SerializedProperty property, GUIContent label, bool includeChildren)
{
return EditorGUI.GetPropertyHeight(property, label, includeChildren);
}
// public static TEnum GetEnum<TEnum>(this SerializedProperty property) where TEnum : struct, Enum
// {
// return (TEnum)Enum.ToObject(typeof(TEnum), property.enumValueIndex);
// }
// public static void SetEnum<TEnum>(this SerializedProperty property, TEnum value) where TEnum : struct, Enum
// {
// property.enumValueIndex = Convert.ToInt32(value);
// }
public static T GetValue<T>(this SerializedProperty property)
{
return GetNestedObject<T>(property.propertyPath, GetSerializedPropertyRootObject(property));
}
public static bool SetValue<T>(this SerializedProperty property, T value)
{
object obj = GetSerializedPropertyRootObject(property);
string[] fieldStructure = property.propertyPath.Split('.');
for (int i = 0; i < fieldStructure.Length - 1; i++)
{
obj = GetFieldOrPropertyValue<object>(fieldStructure[i], obj);
}
string fieldName = fieldStructure.Last();
return SetFieldOrPropertyValue(fieldName, obj, value);
}
public static FieldInfo GetFieldInfo(this SerializedProperty property)
{
var parentType = property.serializedObject.targetObject.GetType();
var splits = property.propertyPath.Split('.');
var fieldInfo = ReflectionUtil.GetField(parentType, splits[0]);
for (var i = 1; i < splits.Length; i++)
{
if (splits[i] == "Array")
{
i += 2;
if (i >= splits.Length)
continue;
var type = fieldInfo.FieldType.IsArray
? fieldInfo.FieldType.GetElementType()
: fieldInfo.FieldType.GetGenericArguments()[0];
fieldInfo = ReflectionUtil.GetField(type, splits[i]);
}
else
{
fieldInfo = i + 1 < splits.Length && splits[i + 1] == "Array"
? ReflectionUtil.GetField(parentType, splits[i])
: ReflectionUtil.GetField(fieldInfo.FieldType, splits[i]);
}
if (fieldInfo == null) return null;
parentType = fieldInfo.FieldType;
}
return fieldInfo;
}
public static Type GetPropertyType(this SerializedProperty property, bool isCollectionType = false)
{
var fieldInfo = property.GetFieldInfo();
if (isCollectionType && property.isArray && property.propertyType != SerializedPropertyType.String)
return fieldInfo.FieldType.IsArray
? fieldInfo.FieldType.GetElementType()
: fieldInfo.FieldType.GetGenericArguments()[0];
return fieldInfo.FieldType;
}
internal static object SetManagedReferenceType(this SerializedProperty property, Type type)
{
object obj = (type != null) ? Activator.CreateInstance(type) : null;
property.managedReferenceValue = obj;
return obj;
}
private static UnityEngine.Object GetSerializedPropertyRootObject(SerializedProperty property)
{
return property.serializedObject.targetObject as UnityEngine.Object;
}
private static T GetNestedObject<T>(string path, object obj, bool includeAllBases = false)
{
string[] parts = path.Split('.');
for (int i = 0; i < parts.Length; i++)
{
string part = parts[i];
if (part == "Array")
{
var regex = new Regex(@"[^0-9]");
var countText = regex.Replace(parts[i + 1], "");
int index = 0;
if (!int.TryParse(countText, out index))
{
index = -1;
}
obj = Enumerable.ElementAt((obj as IEnumerable<object>), index);
i++;
}
else
{
obj = GetFieldOrPropertyValue<object>(part, obj, includeAllBases);
}
}
return (T)obj;
}
public static object GetParentObject(this SerializedProperty property)
{
if (property == null) return null;
var path = property.propertyPath.Replace(".Array.data[", "[");
object obj = property.serializedObject.targetObject;
var elements = path.Split('.');
foreach (var element in elements.Take(elements.Length - 1))
{
if (element.Contains("["))
{
var elementName = element.Substring(0, element.IndexOf("["));
var index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", ""));
obj = ReflectionUtil.GetValue(obj, elementName, index);
}
else
{
obj = ReflectionUtil.GetValue(obj, element);
}
}
return obj;
}
private static T GetFieldOrPropertyValue<T>(string fieldName, object obj, bool includeAllBases = false, BindingFlags bindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
{
FieldInfo field = obj.GetType().GetField(fieldName, bindings);
if (field != null) return (T)field.GetValue(obj);
PropertyInfo property = obj.GetType().GetProperty(fieldName, bindings);
if (property != null) return (T)property.GetValue(obj, null);
if (includeAllBases)
{
foreach (Type type in TypeUtil.GetBaseClassesAndInterfaces(obj.GetType()))
{
field = type.GetField(fieldName, bindings);
if (field != null) return (T)field.GetValue(obj);
property = type.GetProperty(fieldName, bindings);
if (property != null) return (T)property.GetValue(obj, null);
}
}
return default(T);
}
private static bool SetFieldOrPropertyValue(string fieldName, object obj, object value, bool includeAllBases = false, BindingFlags bindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
{
FieldInfo field = obj.GetType().GetField(fieldName, bindings);
if (field != null)
{
field.SetValue(obj, value);
return true;
}
PropertyInfo property = obj.GetType().GetProperty(fieldName, bindings);
if (property != null)
{
property.SetValue(obj, value, null);
return true;
}
if (includeAllBases)
{
foreach (Type type in TypeUtil.GetBaseClassesAndInterfaces(obj.GetType()))
{
field = type.GetField(fieldName, bindings);
if (field != null)
{
field.SetValue(obj, value);
return true;
}
property = type.GetProperty(fieldName, bindings);
if (property != null)
{
property.SetValue(obj, value, null);
return true;
}
}
}
return false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5e8e6d54dc4c477cb5b6a472790e6bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a8e2ebf111e0146a0bddf875e0c55040
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,183 @@
using Cainos.LucidEditor;
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace Cainos.LucidEditor
{
public sealed class EditableInspectorProperty : InspectorProperty
{
private MethodInfo getter;
private MethodInfo setter;
private PropertyInfo info;
private List<PropertyProcessor> processors = new List<PropertyProcessor>();
internal EditableInspectorProperty(SerializedObject serializedObject, object parentObject, string name, Attribute[] attributes) : base(serializedObject, null, parentObject, name, attributes) { }
internal override void Initialize()
{
processors.Clear();
foreach (Attribute attribute in attributes)
{
PropertyProcessor processor = ProcessorUtil.CreateAttributeProcessor(this, attribute);
if (processor != null)
{
processor.Initialize();
processors.Add(processor);
}
}
info = parentObject.GetType().GetProperty(name);
getter = this.info.GetGetMethod();
setter = this.info.GetSetMethod();
}
private string Name
{
get
{
return ObjectNames.NicifyVariableName(name);
}
}
internal override void Draw()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeDrawProperty();
if (isHidden) return;
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel + indent);
if (!isEditable) EditorGUI.BeginDisabledGroup(true);
{
//object value = ReflectionUtil.GetValue(parentObject, name);
//LucidEditorGUILayout.ReadOnlyField(Name, value, value.GetType());
if ( GetPropertyType(info, out SerializedPropertyType serialzedProertyType))
{
Draw_Internal( serialzedProertyType);
}
}
if (!isEditable) EditorGUI.EndDisabledGroup();
LucidEditorGUILayout.EndLayoutIndent();
foreach (PropertyProcessor processor in processors) processor.OnAfterDrawProperty();
}
internal void Draw_Internal(SerializedPropertyType serialzedProertyType)
{
var emptyOptions = new GUILayoutOption[0];
EditorGUILayout.BeginHorizontal(emptyOptions);
if (serialzedProertyType == SerializedPropertyType.Integer)
{
var oldValue = (int)GetValue();
var newValue = EditorGUILayout.IntField(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Float)
{
var oldValue = (float)GetValue();
var newValue = EditorGUILayout.FloatField(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Boolean)
{
var oldValue = (bool)GetValue();
var newValue = EditorGUILayout.Toggle(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.String)
{
var oldValue = (string)GetValue();
var newValue = EditorGUILayout.TextField(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Vector2)
{
var oldValue = (Vector2)GetValue();
var newValue = EditorGUILayout.Vector2Field(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Vector3)
{
var oldValue = (Vector3)GetValue();
var newValue = EditorGUILayout.Vector3Field(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Enum)
{
var oldValue = (Enum)GetValue();
var newValue = EditorGUILayout.EnumPopup(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.Color)
{
var oldValue = (Color)GetValue();
var newValue = EditorGUILayout.ColorField(Name, oldValue, emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
else if (serialzedProertyType == SerializedPropertyType.ObjectReference)
{
var oldValue = (UnityEngine.Object)GetValue();
var newValue = LucidEditorGUILayout.ObjectField(Name, oldValue, info.PropertyType, !TryGetAttribute<AssetsOnlyAttribute>(out _), emptyOptions);
if (oldValue != newValue)
SetValue(newValue);
}
EditorGUILayout.EndHorizontal();
}
private object GetValue() { return getter.Invoke(parentObject, null); }
private void SetValue(object value)
{
if (setter == null) return;
setter.Invoke(parentObject, new[] { value });
}
private bool GetPropertyType(PropertyInfo info, out SerializedPropertyType propertyType)
{
Type type = info.PropertyType;
propertyType = SerializedPropertyType.Generic;
if (type == typeof(int))
propertyType = SerializedPropertyType.Integer;
else if (type == typeof(float))
propertyType = SerializedPropertyType.Float;
else if (type == typeof(bool))
propertyType = SerializedPropertyType.Boolean;
else if (type == typeof(string))
propertyType = SerializedPropertyType.String;
else if (type == typeof(Vector2))
propertyType = SerializedPropertyType.Vector2;
else if (type == typeof(Vector3))
propertyType = SerializedPropertyType.Vector3;
else if (type == typeof(Color))
propertyType = SerializedPropertyType.Color;
else if (type.IsEnum)
propertyType = SerializedPropertyType.Enum;
else if (type.IsSubclassOf(typeof(UnityEngine.Object)))
propertyType = SerializedPropertyType.ObjectReference;
return propertyType != SerializedPropertyType.Generic;
}
internal override void OnBeforeInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeInspectorGUI();
}
internal override void OnAfterInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnAfterInspectorGUI();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f7ac5aa63dd4d054fb62f161ede208e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,95 @@
using System;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
public sealed class InspectorButton : InspectorProperty
{
public readonly MethodInfo methodInfo;
public readonly InspectorButtonSize size;
private readonly string label;
private Action action;
private List<PropertyProcessor> processors = new List<PropertyProcessor>();
internal InspectorButton(SerializedObject serializedObject, object parentObject, MethodInfo methodInfo, InspectorButtonSize size) : base(serializedObject, null, parentObject, methodInfo.Name, methodInfo.GetCustomAttributes().ToArray())
{
this.methodInfo = methodInfo;
this.size = size;
this.label = methodInfo.Name;
action = Expression.Lambda<Action>(
Expression.Call(methodInfo.IsStatic ? null : Expression.Constant(methodInfo.IsStatic ? null : parentObject), methodInfo)
).Compile();
}
internal InspectorButton(SerializedObject serializedObject, object parentObject, MethodInfo methodInfo, string label, InspectorButtonSize size) : base(serializedObject, null, parentObject, methodInfo.Name, methodInfo.GetCustomAttributes().ToArray())
{
this.methodInfo = methodInfo;
this.size = size;
this.label = label;
action = Expression.Lambda<Action>(
Expression.Call(methodInfo.IsStatic ? null : Expression.Constant(parentObject), methodInfo)
).Compile();
}
internal override void Initialize()
{
processors.Clear();
foreach (Attribute attribute in attributes)
{
PropertyProcessor processor = ProcessorUtil.CreateAttributeProcessor(this, attribute);
if (processor != null)
{
processor.Initialize();
processors.Add(processor);
}
}
}
internal override void Reset()
{
base.Reset();
displayName = label;
}
internal override void Draw()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeDrawProperty();
if (isHidden) return;
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel + indent);
if (!isEditable) EditorGUI.BeginDisabledGroup(true);
{
if (GUILayout.Button(hideLabel ? string.Empty : displayName, GUILayout.Height(size.GetHeight())))
{
action.Invoke();
}
}
if (!isEditable) EditorGUI.EndDisabledGroup();
LucidEditorGUILayout.EndLayoutIndent();
foreach (PropertyProcessor processor in processors) processor.OnAfterDrawProperty();
}
internal override void OnBeforeInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeInspectorGUI();
}
internal override void OnAfterInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnAfterInspectorGUI();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: caf111390d23e46798c4df039cd07324
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,247 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
public class InspectorField : InspectorProperty
{
public IReadOnlyList<InspectorProperty> childProperties => Array.AsReadOnly(_childProperties);
private InspectorProperty[] _childProperties;
private List<PropertyProcessor> processors = new List<PropertyProcessor>();
public bool hasChildren
{
get
{
return _childProperties != null && _childProperties.Length > 0;
}
}
public bool IsManagedReference
{
get
{
return serializedProperty.propertyType == SerializedPropertyType.ManagedReference;
}
}
public bool IsObjectReference
{
get
{
return serializedProperty.propertyType == SerializedPropertyType.ObjectReference;
}
}
internal InspectorField(SerializedProperty property, Attribute[] attributes) : base(property.serializedObject, property, property.GetParentObject(), property.name, attributes)
{
this.displayName = property.displayName;
InitializeChildProperties();
}
internal void InitializeChildProperties()
{
_childProperties = InspectorPropertyUtil.GroupProperties(InspectorPropertyUtil.CreateChildProperties(this)).ToArray();
}
internal override void Initialize()
{
processors.Clear();
foreach (Attribute attribute in attributes)
{
PropertyProcessor processor = ProcessorUtil.CreateAttributeProcessor(this, attribute);
if (processor != null)
{
processor.Initialize();
processors.Add(processor);
}
}
foreach (var child in _childProperties) child.Initialize();
}
internal override void OnBeforeInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeInspectorGUI();
foreach (var child in _childProperties) child.OnBeforeInspectorGUI();
}
internal override void OnAfterInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnAfterInspectorGUI();
foreach (var child in _childProperties) child.OnAfterInspectorGUI();
}
internal override void Reset()
{
base.Reset();
this.displayName = serializedProperty.displayName;
foreach (InspectorProperty property in _childProperties)
{
property.Reset();
}
}
internal override void Draw()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeDrawProperty();
if (isHidden) return;
using (var changeScope = new EditorGUI.ChangeCheckScope())
{
if (!isEditable) EditorGUI.BeginDisabledGroup(true);
{
LucidEditorUtility.PushIndentLevel(EditorGUI.indentLevel + this.indent);
Rect foldoutRect = Rect.zero;
if (IsManagedReference)
{
foldoutRect = EditorGUILayout.GetControlRect();
DrawSerializeReferenceField(foldoutRect, this);
if (!hasChildren)
{
serializedProperty.isExpanded = EditorGUI.Foldout(foldoutRect, serializedProperty.isExpanded, displayName, true, EditorStyles.foldoutHeader);
if (serializedProperty.isExpanded)
{
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.HelpBox("No type assigned.", MessageType.Info);
}
}
}
}
if (hasChildren)
{
if (!IsManagedReference) foldoutRect = EditorGUILayout.GetControlRect();
if (_isInGroup)
{
using (new EditorGUI.IndentLevelScope())
{
foldoutRect.xMin -= 4f;
serializedProperty.isExpanded = EditorGUI.Foldout(foldoutRect, serializedProperty.isExpanded, displayName, true, EditorStyles.foldoutHeader);
}
}
else
{
serializedProperty.isExpanded = EditorGUI.Foldout(foldoutRect, serializedProperty.isExpanded, displayName, true, EditorStyles.foldoutHeader);
}
if (serializedProperty.isExpanded)
{
using (new EditorGUI.IndentLevelScope())
{
foreach (var child in childProperties.OrderBy(x => x.order))
{
child.Draw();
}
}
}
}
else if (!IsManagedReference)
{
if (_isInGroup && serializedProperty.isArray && serializedProperty.propertyType != SerializedPropertyType.String) EditorGUI.indentLevel++;
GUIContent label;
if (hideLabel)
{
label = GUIContent.none;
}
else
{
label = new GUIContent(displayName);
}
if (LucidEditorUtility.horizontalGroupCount > 0 && serializedProperty.propertyType != SerializedPropertyType.Generic)
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Label(label, GUILayout.MinWidth(50f));
EditorGUILayout.PropertyField(serializedProperty, GUIContent.none, true, GUILayout.MinWidth(0));
}
}
else
{
EditorGUILayout.PropertyField(serializedProperty, label, true, GUILayout.MinWidth(0));
}
}
LucidEditorUtility.PopIndentLevel();
}
if (!isEditable) EditorGUI.EndDisabledGroup();
_changed = changeScope.changed;
if (_changed) serializedObject.ApplyModifiedProperties();
}
foreach (PropertyProcessor processor in processors) processor.OnAfterDrawProperty();
}
private void DrawSerializeReferenceField(Rect position, InspectorField property)
{
int maxTypePopupLineCount = 13;
position.height = EditorGUIUtility.singleLineHeight;
position.xMin += EditorGUIUtility.labelWidth;
GUIContent buttonLabel = EditorIcons.CsScriptIcon;
buttonLabel.text = (property.serializedProperty.managedReferenceValue == null ? "Null" : property.serializedProperty.managedReferenceValue.GetType().Name) +
$" ({GetManagedReferenceFieldTypeName(property.serializedProperty)})";
if (GUI.Button(position, buttonLabel, EditorStyles.objectField))
{
Type baseType = GetManagedReferenceFieldType(property.serializedProperty);
SerializeReferenceDropdown dropdown = new SerializeReferenceDropdown(
TypeCache.GetTypesDerivedFrom(baseType).Append(baseType).Where(p =>
(p.IsPublic || p.IsNestedPublic) &&
!p.IsAbstract &&
!p.IsGenericType &&
!typeof(UnityEngine.Object).IsAssignableFrom(p) &&
Attribute.IsDefined(p, typeof(SerializableAttribute))
),
maxTypePopupLineCount,
new AdvancedDropdownState()
);
dropdown.onItemSelected += item =>
{
Type type = item.type;
object obj = property.serializedProperty.SetManagedReferenceType(type);
property.serializedProperty.isExpanded = true;
property.serializedProperty.serializedObject.ApplyModifiedProperties();
property.serializedProperty.serializedObject.Update();
property.InitializeChildProperties();
};
dropdown.Show(position);
}
}
private string GetManagedReferenceFieldTypeName(SerializedProperty property)
{
string typeName = property.managedReferenceFieldTypename;
int splitIndex = typeName.IndexOf(' ');
return typeName.Substring(splitIndex + 1);
}
private Type GetManagedReferenceFieldType(SerializedProperty property)
{
string typeName = property.managedReferenceFieldTypename;
int splitIndex = typeName.IndexOf(' ');
var assembly = Assembly.Load(typeName.Substring(0, splitIndex));
return assembly.GetType(typeName.Substring(splitIndex + 1));
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06a7a89a9129b4e8ab0bdbe1e1414425
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,87 @@
using System;
using UnityEditor;
namespace Cainos.LucidEditor
{
public abstract class InspectorProperty
{
public readonly SerializedObject serializedObject;
public readonly SerializedProperty serializedProperty;
public readonly object parentObject;
public readonly string name;
public readonly Type type;
public readonly Attribute[] attributes;
public TAttribute GetAttribute<TAttribute>() where TAttribute : Attribute
{
foreach (Attribute att in attributes)
{
if (att is TAttribute)
{
return (TAttribute)att;
}
}
return null;
}
public bool TryGetAttribute<TAttribute>(out TAttribute result) where TAttribute : Attribute
{
foreach (Attribute att in attributes)
{
if (att is TAttribute)
{
result = (TAttribute)att;
return true;
}
}
result = null;
return false;
}
internal InspectorProperty(SerializedObject serializedObject, SerializedProperty serializedProperty, object parentObject, string name, Attribute[] attributes)
{
this.serializedObject = serializedObject;
if (serializedProperty != null)
{
this.serializedProperty = serializedProperty.Copy();
type = serializedProperty.GetUnderlyingType();
}
this.parentObject = parentObject;
this.displayName = name;
this.name = name;
this.attributes = attributes;
}
public int order;
public bool isHidden;
public bool isEditable = true;
public bool hideLabel;
public int indent;
public string displayName;
public bool allowSceneObject = true;
public bool isInGroup => _isInGroup;
public bool changed => _changed;
internal bool _changed;
internal bool _isInGroup;
internal abstract void Initialize();
internal abstract void OnBeforeInspectorGUI();
internal abstract void OnAfterInspectorGUI();
internal abstract void Draw();
internal virtual void Reset()
{
order = 0;
isHidden = false;
isEditable = true;
hideLabel = false;
indent = 0;
displayName = string.Empty;
allowSceneObject = true;
_changed = false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ffcdb64de16564251aeda3d6c3fd9861
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
public sealed class InspectorPropertyGroup : InspectorProperty
{
internal InspectorPropertyGroup(string path, SerializedObject serializedObject, PropertyGroupAttribute attribute) : base(serializedObject, null, null, path.Split('/').Last(), new[] { attribute })
{
this.path = path;
groupDepth = path.Split('/').Count();
processor = ProcessorUtil.CreateGroupProcessor(this, serializedObject, attribute);
displayName = name;
}
public readonly string path;
public readonly int groupDepth;
private readonly PropertyGroupProcessor processor;
public bool isExpanded = true;
private List<InspectorProperty> _childProperties = new List<InspectorProperty>();
public IReadOnlyList<InspectorProperty> childProperties => _childProperties.AsReadOnly();
internal void Add(InspectorProperty item)
{
item._isInGroup = true;
if (!_childProperties.Contains(item)) _childProperties.Add(item);
}
internal override void Draw()
{
processor?.BeginPropertyGroup();
if (isHidden) return;
if (!isEditable) EditorGUI.BeginDisabledGroup(true);
if (indent > 0) LucidEditorGUILayout.BeginLayoutIndent(indent);
{
if (isExpanded)
{
foreach (InspectorProperty property in childProperties.OrderBy(x => x.order))
{
property.Draw();
}
}
}
if (indent > 0) LucidEditorGUILayout.EndLayoutIndent();
if (!isEditable) EditorGUI.EndDisabledGroup();
processor?.EndPropertyGroup();
}
internal override void Initialize()
{
processor?.Initialize();
foreach (InspectorProperty property in childProperties.OrderBy(x => x.order))
{
property.Initialize();
}
}
internal override void Reset()
{
base.Reset();
foreach (InspectorProperty property in _childProperties)
{
property.Reset();
}
}
internal override void OnBeforeInspectorGUI()
{
foreach (InspectorProperty property in childProperties)
{
property.OnBeforeInspectorGUI();
}
}
internal override void OnAfterInspectorGUI()
{
foreach (InspectorProperty property in childProperties)
{
property.OnAfterInspectorGUI();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36f0a0863c5ba44e7a958fb7d3dc4d38
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
namespace Cainos.LucidEditor
{
public sealed class NonSerializedInspectorProperty : InspectorProperty
{
private List<PropertyProcessor> processors = new List<PropertyProcessor>();
internal NonSerializedInspectorProperty(SerializedObject serializedObject, object parentObject, string name, Attribute[] attributes) : base(serializedObject, null, parentObject, name, attributes) { }
internal override void Initialize()
{
processors.Clear();
foreach (Attribute attribute in attributes)
{
PropertyProcessor processor = ProcessorUtil.CreateAttributeProcessor(this, attribute);
if (processor != null)
{
processor.Initialize();
processors.Add(processor);
}
}
}
internal override void Draw()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeDrawProperty();
if (isHidden) return;
LucidEditorGUILayout.BeginLayoutIndent(EditorGUI.indentLevel + indent);
if (!isEditable) EditorGUI.BeginDisabledGroup(true);
{
object value = ReflectionUtil.GetValue(parentObject, name);
LucidEditorGUILayout.ReadOnlyField(name, value, value.GetType());
}
if (!isEditable) EditorGUI.EndDisabledGroup();
LucidEditorGUILayout.EndLayoutIndent();
foreach (PropertyProcessor processor in processors) processor.OnAfterDrawProperty();
}
internal override void OnBeforeInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnBeforeInspectorGUI();
}
internal override void OnAfterInspectorGUI()
{
foreach (PropertyProcessor processor in processors) processor.OnAfterInspectorGUI();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e227a45d92ce24f0aa63caee7e660d78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
using System.Linq;
using UnityEngine;
using UnityEditor;
using Cainos.LucidEditor;
namespace Cainos.LucidEditor
{
public class LucidEditor : UnityEditor.Editor
{
private InspectorProperty[] properties;
internal bool hideMonoScript;
//internal bool disableEditor;
protected virtual void OnEnable()
{
hideMonoScript = target.GetType().IsDefined(typeof(HideMonoScriptAttribute), true);
//disableEditor = target.GetType().IsDefined(typeof(DisableLucidEditorAttribute), true);
}
public override void OnInspectorGUI()
{
//if (disableEditor)
//{
// base.OnInspectorGUI();
// return;
//}
serializedObject.Update();
if (properties == null) InitializeProperties();
ResetProperties();
OnBeforeInspectorGUI();
if (!hideMonoScript) LucidEditorGUILayout.ScriptField(target);
DrawAllProperties();
OnAfterInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
private void InitializeProperties()
{
properties = InspectorPropertyUtil.GroupProperties(InspectorPropertyUtil.CreateProperties(serializedObject)).ToArray();
foreach (InspectorProperty property in properties)
{
property.Initialize();
}
}
private void ResetProperties()
{
foreach (InspectorProperty property in properties)
{
property.Reset();
}
}
private void DrawAllProperties()
{
foreach (InspectorProperty property in properties.OrderBy(x => x.order))
{
property.Draw();
}
}
private void OnBeforeInspectorGUI()
{
foreach (InspectorProperty property in properties.OrderBy(x => x.order))
{
property.OnBeforeInspectorGUI();
}
}
private void OnAfterInspectorGUI()
{
foreach (InspectorProperty property in properties.OrderBy(x => x.order))
{
property.OnAfterInspectorGUI();
}
}
}
//[CanEditMultipleObjects]
//[CustomEditor(typeof(MonoBehaviour), true)]
//internal class MonoBehaviourEditor : LucidEditor { }
//[CanEditMultipleObjects]
//[CustomEditor(typeof(ScriptableObject), true)]
//internal class ScriptableObjectEditor : LucidEditor { }
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f1c419d127e634bb7807d7e507a43a0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,942 @@
using System;
using System.Linq;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using Object = UnityEngine.Object;
namespace Cainos.LucidEditor
{
public static class LucidEditorGUI
{
public static T Field<T>(Rect position, T value)
{
return Field<T>(position, GUIContent.none, value);
}
public static T Field<T>(Rect position, string label, T value)
{
return Field<T>(position, new GUIContent(label), value);
}
public static T Field<T>(Rect position, GUIContent label, T value)
{
switch (value)
{
case int intValue:
return GenericTypeConverter<T>.Convert<int>(IntField(position, label, intValue));
case long longValue:
return GenericTypeConverter<T>.Convert<long>(LongField(position, label, longValue));
case float floatValue:
return GenericTypeConverter<T>.Convert<float>(FloatField(position, label, floatValue));
case double doubleValue:
return GenericTypeConverter<T>.Convert<double>(DoubleField(position, label, doubleValue));
case bool boolValue:
return GenericTypeConverter<T>.Convert<bool>(Toggle(position, label, boolValue));
case string stringValue:
return GenericTypeConverter<T>.Convert<string>(TextField(position, label, stringValue));
case Vector2Int vector2IntValue:
return GenericTypeConverter<T>.Convert<Vector2Int>(Vector2IntField(position, label, vector2IntValue));
case Vector2 vector2Value:
return GenericTypeConverter<T>.Convert<Vector2>(Vector2Field(position, label, vector2Value));
case Vector3Int vector3IntValue:
return GenericTypeConverter<T>.Convert<Vector3Int>(Vector3IntField(position, label, vector3IntValue));
case Vector3 vector3Value:
return GenericTypeConverter<T>.Convert<Vector3>(Vector3Field(position, label, vector3Value));
case Vector4 vector4Value:
return GenericTypeConverter<T>.Convert<Vector3>(Vector4Field(position, label, vector4Value));
case RectInt rectIntValue:
return GenericTypeConverter<T>.Convert<RectInt>(RectIntField(position, label, rectIntValue));
case Rect rectValue:
return GenericTypeConverter<T>.Convert<Rect>(RectField(position, label, rectValue));
case BoundsInt boundsIntValue:
return GenericTypeConverter<T>.Convert<BoundsInt>(BoundsIntField(position, label, boundsIntValue));
case Bounds boundsValue:
return GenericTypeConverter<T>.Convert<Bounds>(BoundsField(position, label, boundsValue));
case Color colorValue:
return GenericTypeConverter<T>.Convert<Color>(ColorField(position, label, colorValue));
case Gradient gradientValue:
return GenericTypeConverter<T>.Convert<Gradient>(GradientField(position, label, gradientValue));
case Enum enumValue:
return GenericTypeConverter<T>.Convert<Enum>(EnumPopup(position, label, enumValue));
case AnimationCurve animationCurveValue:
return GenericTypeConverter<T>.Convert<AnimationCurve>(CurveField(position, label, animationCurveValue));
case Object objectValue:
return GenericTypeConverter<T>.Convert<Object>(ObjectField(position, label, objectValue, objectValue.GetType(), true));
}
throw new ArgumentException($"Unsupported field type: {typeof(T).Name}");
}
public static void ReadOnlyField<T>(Rect position, T value)
{
EditorGUI.BeginDisabledGroup(true);
Field<T>(position, GUIContent.none, value);
EditorGUI.BeginDisabledGroup(false);
}
public static void ReadOnlyField<T>(Rect position, string label, T value)
{
EditorGUI.BeginDisabledGroup(true);
Field<T>(position, new GUIContent(label), value);
EditorGUI.BeginDisabledGroup(false);
}
public static void ReadOnlyField<T>(Rect position, GUIContent label, T value)
{
EditorGUI.BeginDisabledGroup(true);
Field<T>(position, label, value);
EditorGUI.BeginDisabledGroup(false);
}
public static object Field(Rect position, object value, Type objType)
{
return Field(position, GUIContent.none, value, objType);
}
public static object Field(Rect position, string label, object value, Type objType)
{
return Field(position, new GUIContent(label), value, objType);
}
public static object Field(Rect position, GUIContent label, object value, Type objType)
{
switch (objType)
{
case Type t when t == typeof(int):
return (object)IntField(position, label, (int)value);
case Type t when t == typeof(long):
return (object)LongField(position, label, (long)value);
case Type t when t == typeof(float):
return (object)FloatField(position, label, (float)value);
case Type t when t == typeof(double):
return (object)DoubleField(position, label, (double)value);
case Type t when t == typeof(bool):
return (object)Toggle(position, label, (bool)value);
case Type t when t == typeof(string):
return (object)TextField(position, label, (string)value);
case Type t when t == typeof(Vector2Int):
return (object)Vector2IntField(position, label, (Vector2Int)value);
case Type t when t == typeof(Vector2):
return (object)Vector2Field(position, label, (Vector2)value);
case Type t when t == typeof(Vector3Int):
return (object)Vector3IntField(position, label, (Vector3Int)value);
case Type t when t == typeof(Vector3):
return (object)Vector3Field(position, label, (Vector3)value);
case Type t when t == typeof(Vector4):
return (object)Vector4Field(position, label, (Vector4)value);
case Type t when t == typeof(RectInt):
return (object)RectIntField(position, label, (RectInt)value);
case Type t when t == typeof(Rect):
return (object)RectField(position, label, (Rect)value);
case Type t when t == typeof(BoundsInt):
return (object)BoundsIntField(position, label, (BoundsInt)value);
case Type t when t == typeof(Bounds):
return (object)BoundsField(position, label, (Bounds)value);
case Type t when t == typeof(Color):
return (object)ColorField(position, label, (Color)value);
case Type t when t == typeof(Gradient):
return (object)GradientField(position, label, (Gradient)value);
case Type t when t == typeof(Enum):
return (object)EnumPopup(position, label, (Enum)value);
case Type t when t == typeof(AnimationCurve):
return (object)CurveField(position, label, (AnimationCurve)value);
case Type t when t == typeof(UnityEngine.Object):
return (object)ObjectField(position, label, (UnityEngine.Object)value, objType, true);
}
throw new ArgumentException($"Unsupported field type: {objType.Name}");
}
public static void ReadOnlyField(Rect position, object value, Type objType)
{
ReadOnlyField(position, GUIContent.none, value, objType);
}
public static void ReadOnlyField(Rect position, string label, object value, Type objType)
{
ReadOnlyField(position, new GUIContent(label), value, objType);
}
public static void ReadOnlyField(Rect position, GUIContent label, object value, Type objType)
{
EditorGUI.BeginDisabledGroup(true);
switch (objType)
{
case Type t when t == typeof(int):
IntField(position, label, (int)value);
break;
case Type t when t == typeof(long):
LongField(position, label, (long)value);
break;
case Type t when t == typeof(float):
FloatField(position, label, (float)value);
break;
case Type t when t == typeof(double):
DoubleField(position, label, (double)value);
break;
case Type t when t == typeof(bool):
Toggle(position, label, (bool)value);
break;
case Type t when t == typeof(string):
TextField(position, label, (string)value);
break;
case Type t when t == typeof(Vector2Int):
Vector2IntField(position, label, (Vector2Int)value);
break;
case Type t when t == typeof(Vector2):
Vector2Field(position, label, (Vector2)value);
break;
case Type t when t == typeof(Vector3Int):
Vector3IntField(position, label, (Vector3Int)value);
break;
case Type t when t == typeof(Vector3):
Vector3Field(position, label, (Vector3)value);
break;
case Type t when t == typeof(Vector4):
Vector4Field(position, label, (Vector4)value);
break;
case Type t when t == typeof(RectInt):
RectIntField(position, label, (RectInt)value);
break;
case Type t when t == typeof(Rect):
RectField(position, label, (Rect)value);
break;
case Type t when t == typeof(BoundsInt):
BoundsIntField(position, label, (BoundsInt)value);
break;
case Type t when t == typeof(Bounds):
BoundsField(position, label, (Bounds)value);
break;
case Type t when t == typeof(Color):
ColorField(position, label, (Color)value);
break;
case Type t when t == typeof(Gradient):
GradientField(position, label, (Gradient)value);
break;
case Type t when t == typeof(Enum):
EnumPopup(position, label, (Enum)value);
break;
case Type t when t == typeof(AnimationCurve):
CurveField(position, label, (AnimationCurve)value);
break;
case Type t when t == typeof(UnityEngine.Object):
ObjectField(position, label, (UnityEngine.Object)value, objType, true);
break;
default:
EditorGUI.BeginDisabledGroup(false);
throw new ArgumentException($"Unsupported field type: {objType.Name}");
}
EditorGUI.BeginDisabledGroup(false);
}
public static bool PropertyField(Rect position, SerializedProperty property) => EditorGUI.PropertyField(position, property);
public static bool PropertyField(Rect position, SerializedProperty property, bool includeChildren) => EditorGUI.PropertyField(position, property, includeChildren);
public static bool PropertyField(Rect position, SerializedProperty property, GUIContent label) => EditorGUI.PropertyField(position, property, label);
public static bool PropertyField(Rect position, SerializedProperty property, GUIContent label, bool includeChildren) => EditorGUI.PropertyField(position, property, label, includeChildren);
public static void MultiPropertyField(Rect position, GUIContent[] subLabels, SerializedProperty valuesIterator, GUIContent label) => EditorGUI.MultiPropertyField(position, subLabels, valuesIterator, label);
public static void MultiPropertyField(Rect position, GUIContent[] subLabels, SerializedProperty valuesIterator) => EditorGUI.MultiPropertyField(position, subLabels, valuesIterator);
public static string TextField(Rect position, string value) => EditorGUI.TextField(position, value);
public static string TextField(Rect position, string value, GUIStyle style) => EditorGUI.TextField(position, value, style);
public static string TextField(Rect position, string label, string value) => EditorGUI.TextField(position, label, value);
public static string TextField(Rect position, string label, string value, GUIStyle style) => EditorGUI.TextField(position, label, value, style);
public static string TextField(Rect position, GUIContent label, string value) => EditorGUI.TextField(position, label, value);
public static string TextField(Rect position, GUIContent label, string value, GUIStyle style) => EditorGUI.TextField(position, label, value, style);
public static string DelayedTextField(Rect position, string value) => EditorGUI.DelayedTextField(position, value);
public static string DelayedTextField(Rect position, string value, GUIStyle style) => EditorGUI.DelayedTextField(position, value, style);
public static string DelayedTextField(Rect position, string label, string value) => EditorGUI.DelayedTextField(position, label, value);
public static string DelayedTextField(Rect position, string label, string value, GUIStyle style) => EditorGUI.DelayedTextField(position, label, value, style);
public static string DelayedTextField(Rect position, GUIContent label, string value) => EditorGUI.DelayedTextField(position, label, value);
public static string DelayedTextField(Rect position, GUIContent label, string value, GUIStyle style) => EditorGUI.DelayedTextField(position, label, value, style);
public static string TextArea(Rect position, string text) => EditorGUI.TextArea(position, text);
public static string TextArea(Rect position, string text, GUIStyle style) => EditorGUI.TextArea(position, text, style);
public static string PasswordField(Rect position, string password) => EditorGUI.PasswordField(position, password);
public static string PasswordField(Rect position, string password, GUIStyle style) => EditorGUI.PasswordField(position, password, style);
public static string PasswordField(Rect position, string label, string password) => EditorGUI.PasswordField(position, label, password);
public static string PasswordField(Rect position, string label, string password, GUIStyle style) => EditorGUI.PasswordField(position, label, password, style);
public static string PasswordField(Rect position, GUIContent label, string password) => EditorGUI.PasswordField(position, label, password);
public static string PasswordField(Rect position, GUIContent label, string password, GUIStyle style) => EditorGUI.PasswordField(position, label, password, style);
public static int IntField(Rect position, int value) => EditorGUI.IntField(position, value);
public static int IntField(Rect position, int value, GUIStyle style) => EditorGUI.IntField(position, value, style);
public static int IntField(Rect position, string label, int value) => EditorGUI.IntField(position, label, value);
public static int IntField(Rect position, string label, int value, GUIStyle style) => EditorGUI.IntField(position, label, value, style);
public static int IntField(Rect position, GUIContent label, int value) => EditorGUI.IntField(position, label, value);
public static int IntField(Rect position, GUIContent label, int value, GUIStyle style) => EditorGUI.IntField(position, label, value, style);
public static int DelayedIntField(Rect position, int value) => EditorGUI.DelayedIntField(position, value);
public static int DelayedIntField(Rect position, int value, GUIStyle style) => EditorGUI.DelayedIntField(position, value, style);
public static int DelayedIntField(Rect position, string label, int value) => EditorGUI.DelayedIntField(position, label, value);
public static int DelayedIntField(Rect position, string label, int value, GUIStyle style) => EditorGUI.DelayedIntField(position, label, value, style);
public static int DelayedIntField(Rect position, GUIContent label, int value) => EditorGUI.DelayedIntField(position, label, value);
public static int DelayedIntField(Rect position, GUIContent label, int value, GUIStyle style) => EditorGUI.DelayedIntField(position, label, value, style);
public static int IntPopup(Rect position, int selectedValue, string[] displayedOptions, int[] optionValues) => EditorGUI.IntPopup(position, selectedValue, displayedOptions, optionValues);
public static int IntPopup(Rect position, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style) => EditorGUI.IntPopup(position, selectedValue, displayedOptions, optionValues, style);
public static int IntPopup(Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues) => EditorGUI.IntPopup(position, selectedValue, displayedOptions, optionValues);
public static int IntPopup(Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style) => EditorGUI.IntPopup(position, selectedValue, displayedOptions, optionValues, style);
public static int IntPopup(Rect position, string label, int selectedValue, string[] displayedOptions, int[] optionValues) => EditorGUI.IntPopup(position, label, selectedValue, displayedOptions, optionValues);
public static int IntPopup(Rect position, string label, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style) => EditorGUI.IntPopup(position, label, selectedValue, displayedOptions, optionValues, style);
public static int IntPopup(Rect position, GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues) => EditorGUI.IntPopup(position, label, selectedValue, displayedOptions, optionValues);
public static int IntPopup(Rect position, GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style) => EditorGUI.IntPopup(position, label, selectedValue, displayedOptions, optionValues, style);
public static void IntPopup(Rect position, SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues) => EditorGUI.IntPopup(position, property, displayedOptions, optionValues);
public static void IntPopup(Rect position, SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, GUIContent label) => EditorGUI.IntPopup(position, property, displayedOptions, optionValues, label);
public static int IntSlider(Rect position, int value, int leftValue, int rightValue) => EditorGUI.IntSlider(position, value, leftValue, rightValue);
public static int IntSlider(Rect position, string label, int value, int leftValue, int rightValue) => EditorGUI.IntSlider(position, label, value, leftValue, rightValue);
public static int IntSlider(Rect position, GUIContent label, int value, int leftValue, int rightValue) => EditorGUI.IntSlider(position, label, value, leftValue, rightValue);
public static void IntSlider(Rect position, SerializedProperty property, int leftValue, int rightValue) => EditorGUI.IntSlider(position, property, leftValue, rightValue);
public static void IntSlider(Rect position, SerializedProperty property, int leftValue, int rightValue, string label) => EditorGUI.IntSlider(position, property, leftValue, rightValue, label);
public static void IntSlider(Rect position, SerializedProperty property, int leftValue, int rightValue, GUIContent label) => EditorGUI.IntSlider(position, property, leftValue, rightValue, label);
public static void MultiIntField(Rect position, GUIContent[] subLabels, int[] values) => EditorGUI.MultiIntField(position, subLabels, values);
public static float FloatField(Rect position, float value) => EditorGUI.FloatField(position, value);
public static float FloatField(Rect position, float value, GUIStyle style) => EditorGUI.FloatField(position, value, style);
public static float FloatField(Rect position, string label, float value) => EditorGUI.FloatField(position, label, value);
public static float FloatField(Rect position, string label, float value, GUIStyle style) => EditorGUI.FloatField(position, label, value, style);
public static float FloatField(Rect position, GUIContent label, float value) => EditorGUI.FloatField(position, label, value);
public static float FloatField(Rect position, GUIContent label, float value, GUIStyle style) => EditorGUI.FloatField(position, label, value, style);
public static float FloatSlider(Rect position, float value, float leftValue, float rightValue) => EditorGUI.Slider(position, value, leftValue, rightValue);
public static float FloatSlider(Rect position, string label, float value, float leftValue, float rightValue) => EditorGUI.Slider(position, label, value, leftValue, rightValue);
public static float FloatSlider(Rect position, GUIContent label, float value, float leftValue, float rightValue) => EditorGUI.Slider(position, label, value, leftValue, rightValue);
public static void FloatSlider(Rect position, SerializedProperty property, float leftValue, float rightValue) => EditorGUI.Slider(position, property, leftValue, rightValue);
public static void FloatSlider(Rect position, SerializedProperty property, float leftValue, float rightValue, string label) => EditorGUI.Slider(position, property, leftValue, rightValue, label);
public static void FloatSlider(Rect position, SerializedProperty property, float leftValue, float rightValue, GUIContent label) => EditorGUI.Slider(position, property, leftValue, rightValue, label);
public static float DelayedFloatField(Rect position, float value) => EditorGUI.DelayedFloatField(position, value);
public static float DelayedFloatField(Rect position, float value, GUIStyle style) => EditorGUI.DelayedFloatField(position, value, style);
public static float DelayedFloatField(Rect position, string label, float value) => EditorGUI.DelayedFloatField(position, label, value);
public static float DelayedFloatField(Rect position, string label, float value, GUIStyle style) => EditorGUI.DelayedFloatField(position, label, value, style);
public static float DelayedFloatField(Rect position, GUIContent label, float value) => EditorGUI.DelayedFloatField(position, label, value);
public static float DelayedFloatField(Rect position, GUIContent label, float value, GUIStyle style) => EditorGUI.DelayedFloatField(position, label, value, style);
public static void MultiFloatField(Rect position, GUIContent[] subLabels, float[] values) => EditorGUI.MultiFloatField(position, subLabels, values);
public static void MultiFloatField(Rect position, GUIContent label, GUIContent[] subLabels, float[] values) => EditorGUI.MultiFloatField(position, label, subLabels, values);
public static double DoubleField(Rect position, double value) => EditorGUI.DoubleField(position, value);
public static double DoubleField(Rect position, double value, GUIStyle style) => EditorGUI.DoubleField(position, value, style);
public static double DoubleField(Rect position, string label, double value) => EditorGUI.DoubleField(position, label, value);
public static double DoubleField(Rect position, string label, double value, GUIStyle style) => EditorGUI.DoubleField(position, label, value, style);
public static double DoubleField(Rect position, GUIContent label, double value) => EditorGUI.DoubleField(position, label, value);
public static double DoubleField(Rect position, GUIContent label, double value, GUIStyle style) => EditorGUI.DoubleField(position, label, value, style);
public static double DelayedDoubleField(Rect position, double value) => EditorGUI.DelayedDoubleField(position, value);
public static double DelayedDoubleField(Rect position, double value, GUIStyle style) => EditorGUI.DelayedDoubleField(position, value, style);
public static double DelayedDoubleField(Rect position, string label, double value) => EditorGUI.DelayedDoubleField(position, label, value);
public static double DelayedDoubleField(Rect position, string label, double value, GUIStyle style) => EditorGUI.DelayedDoubleField(position, label, value, style);
public static double DelayedDoubleField(Rect position, GUIContent label, double value) => EditorGUI.DelayedDoubleField(position, label, value);
public static double DelayedDoubleField(Rect position, GUIContent label, double value, GUIStyle style) => EditorGUI.DelayedDoubleField(position, label, value, style);
public static long LongField(Rect position, long value) => EditorGUI.LongField(position, value);
public static long LongField(Rect position, long value, GUIStyle style) => EditorGUI.LongField(position, value, style);
public static long LongField(Rect position, string label, long value) => EditorGUI.LongField(position, label, value);
public static long LongField(Rect position, string label, long value, GUIStyle style) => EditorGUI.LongField(position, label, value, style);
public static long LongField(Rect position, GUIContent label, long value) => EditorGUI.LongField(position, label, value);
public static long LongField(Rect position, GUIContent label, long value, GUIStyle style) => EditorGUI.LongField(position, label, value, style);
public static bool Toggle(Rect position, bool value) => EditorGUI.Toggle(position, value);
public static bool Toggle(Rect position, bool value, GUIStyle style) => EditorGUI.Toggle(position, value, style);
public static bool Toggle(Rect position, string label, bool value) => EditorGUI.Toggle(position, label, value);
public static bool Toggle(Rect position, string label, bool value, GUIStyle style) => EditorGUI.Toggle(position, label, value, style);
public static bool Toggle(Rect position, GUIContent label, bool value) => EditorGUI.Toggle(position, label, value);
public static bool Toggle(Rect position, GUIContent label, bool value, GUIStyle style) => EditorGUI.Toggle(position, label, value, style);
public static bool ToggleLeft(Rect position, string label, bool value) => EditorGUI.ToggleLeft(position, label, value);
public static bool ToggleLeft(Rect position, string label, bool value, GUIStyle style) => EditorGUI.ToggleLeft(position, label, value, style);
public static bool ToggleLeft(Rect position, GUIContent label, bool value) => EditorGUI.ToggleLeft(position, label, value);
public static bool ToggleLeft(Rect position, GUIContent label, bool value, GUIStyle style) => EditorGUI.ToggleLeft(position, label, value, style);
public static Vector2 Vector2Field(Rect position, string label, Vector2 value) => EditorGUI.Vector2Field(position, label, value);
public static Vector2 Vector2Field(Rect position, GUIContent label, Vector2 value) => EditorGUI.Vector2Field(position, label, value);
public static Vector2Int Vector2IntField(Rect position, string label, Vector2Int value) => EditorGUI.Vector2IntField(position, label, value);
public static Vector2Int Vector2IntField(Rect position, GUIContent label, Vector2Int value) => EditorGUI.Vector2IntField(position, label, value);
public static Vector3 Vector3Field(Rect position, string label, Vector3 value) => EditorGUI.Vector3Field(position, label, value);
public static Vector3 Vector3Field(Rect position, GUIContent label, Vector3 value) => EditorGUI.Vector3Field(position, label, value);
public static Vector3Int Vector3IntField(Rect position, string label, Vector3Int value) => EditorGUI.Vector3IntField(position, label, value);
public static Vector3Int Vector3IntField(Rect position, GUIContent label, Vector3Int value) => EditorGUI.Vector3IntField(position, label, value);
public static Vector4 Vector4Field(Rect position, string label, Vector4 value) => EditorGUI.Vector4Field(position, label, value);
public static Vector4 Vector4Field(Rect position, GUIContent label, Vector4 value) => EditorGUI.Vector4Field(position, label, value);
public static Color ColorField(Rect position, Color value) => EditorGUI.ColorField(position, value);
public static Color ColorField(Rect position, string label, Color value) => EditorGUI.ColorField(position, label, value);
public static Color ColorField(Rect position, GUIContent label, Color value) => EditorGUI.ColorField(position, label, value);
public static Color ColorField(Rect position, GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr) => EditorGUI.ColorField(position, label, value, showEyedropper, showAlpha, hdr);
public static Gradient GradientField(Rect position, Gradient gradient) => EditorGUI.GradientField(position, gradient);
public static Gradient GradientField(Rect position, string label, Gradient gradient) => EditorGUI.GradientField(position, label, gradient);
public static Gradient GradientField(Rect position, GUIContent label, Gradient gradient) => EditorGUI.GradientField(position, label, gradient);
public static Gradient GradientField(Rect position, GUIContent label, Gradient gradient, bool hdr) => EditorGUI.GradientField(position, label, gradient, hdr);
public static AnimationCurve CurveField(Rect position, AnimationCurve value) => EditorGUI.CurveField(position, value);
public static AnimationCurve CurveField(Rect position, string label, AnimationCurve value) => EditorGUI.CurveField(position, label, value);
public static AnimationCurve CurveField(Rect position, GUIContent label, AnimationCurve value) => EditorGUI.CurveField(position, label, value);
public static AnimationCurve CurveField(Rect position, AnimationCurve value, Color color, Rect ranges) => EditorGUI.CurveField(position, value, color, ranges);
public static AnimationCurve CurveField(Rect position, string label, AnimationCurve value, Color color, Rect ranges) => EditorGUI.CurveField(position, label, value, color, ranges);
public static AnimationCurve CurveField(Rect position, GUIContent label, AnimationCurve value, Color color, Rect ranges) => EditorGUI.CurveField(position, label, value, color, ranges);
public static void CurveField(Rect position, SerializedProperty property, Color color, Rect ranges) => EditorGUI.CurveField(position, property, color, ranges);
public static void CurveField(Rect position, SerializedProperty property, Color color, Rect ranges, GUIContent label) => EditorGUI.CurveField(position, property, color, ranges, label);
public static Bounds BoundsField(Rect position, Bounds value) => EditorGUI.BoundsField(position, value);
public static Bounds BoundsField(Rect position, string label, Bounds value) => EditorGUI.BoundsField(position, label, value);
public static Bounds BoundsField(Rect position, GUIContent label, Bounds value) => EditorGUI.BoundsField(position, label, value);
public static BoundsInt BoundsIntField(Rect position, BoundsInt value) => EditorGUI.BoundsIntField(position, value);
public static BoundsInt BoundsIntField(Rect position, string label, BoundsInt value) => EditorGUI.BoundsIntField(position, label, value);
public static BoundsInt BoundsIntField(Rect position, GUIContent label, BoundsInt value) => EditorGUI.BoundsIntField(position, label, value);
public static Rect RectField(Rect position, Rect value) => EditorGUI.RectField(position, value);
public static Rect RectField(Rect position, string label, Rect value) => EditorGUI.RectField(position, label, value);
public static Rect RectField(Rect position, GUIContent label, Rect value) => EditorGUI.RectField(position, label, value);
public static RectInt RectIntField(Rect position, RectInt value) => EditorGUI.RectIntField(position, value);
public static RectInt RectIntField(Rect position, string label, RectInt value) => EditorGUI.RectIntField(position, label, value);
public static RectInt RectIntField(Rect position, GUIContent label, RectInt value) => EditorGUI.RectIntField(position, label, value);
public static Enum EnumFlagsField(Rect position, Enum enumValue) => EditorGUI.EnumFlagsField(position, enumValue);
public static Enum EnumFlagsField(Rect position, Enum enumValue, GUIStyle style) => EditorGUI.EnumFlagsField(position, enumValue, style);
public static Enum EnumFlagsField(Rect position, string label, Enum enumValue) => EditorGUI.EnumFlagsField(position, label, enumValue);
public static Enum EnumFlagsField(Rect position, string label, Enum enumValue, GUIStyle style) => EditorGUI.EnumFlagsField(position, label, enumValue, style);
public static Enum EnumFlagsField(Rect position, GUIContent label, Enum enumValue) => EditorGUI.EnumFlagsField(position, label, enumValue);
public static Enum EnumFlagsField(Rect position, GUIContent label, Enum enumValue, GUIStyle style) => EditorGUI.EnumFlagsField(position, label, enumValue, style);
public static Enum EnumFlagsField(Rect position, GUIContent label, Enum enumValue, bool includeObsolete) => EditorGUI.EnumFlagsField(position, label, enumValue, includeObsolete);
public static Enum EnumFlagsField(Rect position, GUIContent label, Enum enumValue, bool includeObsolete, GUIStyle style) => EditorGUI.EnumFlagsField(position, label, enumValue, includeObsolete, style);
public static TEnum EnumFlagsField<TEnum>(Rect position, TEnum enumValue) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, enumValue);
public static TEnum EnumFlagsField<TEnum>(Rect position, TEnum enumValue, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, enumValue, style);
public static TEnum EnumFlagsField<TEnum>(Rect position, string label, TEnum enumValue) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue);
public static TEnum EnumFlagsField<TEnum>(Rect position, string label, TEnum enumValue, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue, style);
public static TEnum EnumFlagsField<TEnum>(Rect position, GUIContent label, TEnum enumValue) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue);
public static TEnum EnumFlagsField<TEnum>(Rect position, GUIContent label, TEnum enumValue, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue, style);
public static TEnum EnumFlagsField<TEnum>(Rect position, GUIContent label, TEnum enumValue, bool includeObsolete) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue, includeObsolete);
public static TEnum EnumFlagsField<TEnum>(Rect position, GUIContent label, TEnum enumValue, bool includeObsolete, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumFlagsField(position, label, enumValue, includeObsolete, style);
public static Enum EnumPopup(Rect position, Enum selected) => EditorGUI.EnumPopup(position, selected);
public static Enum EnumPopup(Rect position, Enum selected, GUIStyle style) => EditorGUI.EnumPopup(position, selected, style);
public static Enum EnumPopup(Rect position, string label, Enum selected) => EditorGUI.EnumPopup(position, label, selected);
public static Enum EnumPopup(Rect position, string label, Enum selected, GUIStyle style) => EditorGUI.EnumPopup(position, label, selected, style);
public static Enum EnumPopup(Rect position, GUIContent label, Enum selected) => EditorGUI.EnumPopup(position, label, selected);
public static Enum EnumPopup(Rect position, GUIContent label, Enum selected, GUIStyle style) => EditorGUI.EnumPopup(position, label, selected, style);
public static Enum EnumPopup(Rect position, GUIContent label, Enum selected, Func<Enum, bool> checkEnabled, bool includeObsolete) => EditorGUI.EnumPopup(position, label, selected, checkEnabled, includeObsolete);
public static Enum EnumPopup(Rect position, GUIContent label, Enum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, GUIStyle style) => EditorGUI.EnumPopup(position, label, selected, checkEnabled, includeObsolete, style);
public static TEnum EnumPopup<TEnum>(Rect position, TEnum selected) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, selected);
public static TEnum EnumPopup<TEnum>(Rect position, TEnum selected, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, selected, style);
public static TEnum EnumPopup<TEnum>(Rect position, string label, TEnum selected) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected);
public static TEnum EnumPopup<TEnum>(Rect position, string label, TEnum selected, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected, style);
public static TEnum EnumPopup<TEnum>(Rect position, GUIContent label, TEnum selected) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected);
public static TEnum EnumPopup<TEnum>(Rect position, GUIContent label, TEnum selected, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected, style);
public static TEnum EnumPopup<TEnum>(Rect position, GUIContent label, TEnum selected, Func<Enum, bool> checkEnabled, bool includeObsolete) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected, checkEnabled, includeObsolete);
public static TEnum EnumPopup<TEnum>(Rect position, GUIContent label, TEnum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, GUIStyle style) where TEnum : Enum => (TEnum)EditorGUI.EnumPopup(position, label, selected, checkEnabled, includeObsolete, style);
public static Object ObjectField(Rect position, Object obj, Type objType, bool allowSceneObjects) => EditorGUI.ObjectField(position, obj, objType, allowSceneObjects);
public static Object ObjectField(Rect position, string label, Object obj, Type objType, bool allowSceneObjects) => EditorGUI.ObjectField(position, label, obj, objType, allowSceneObjects);
public static Object ObjectField(Rect position, GUIContent label, Object obj, Type objType, bool allowSceneObjects) => EditorGUI.ObjectField(position, label, obj, objType, allowSceneObjects);
public static T ObjectField<T>(Rect position, T obj, bool allowSceneObjects) where T : Object => (T)EditorGUI.ObjectField(position, obj, typeof(T), allowSceneObjects);
public static T ObjectField<T>(Rect position, string label, T obj, bool allowSceneObjects) where T : Object => (T)EditorGUI.ObjectField(position, label, obj, typeof(T), allowSceneObjects);
public static T ObjectField<T>(Rect position, GUIContent label, T obj, bool allowSceneObjects) where T : Object => (T)EditorGUI.ObjectField(position, label, obj, typeof(T), allowSceneObjects);
public static void ObjectField(Rect position, SerializedProperty property) => EditorGUI.ObjectField(position, property);
public static void ObjectField(Rect position, SerializedProperty property, GUIContent label) => EditorGUI.ObjectField(position, property, label);
public static void ObjectField(Rect position, SerializedProperty property, Type objType) => EditorGUI.ObjectField(position, property, objType);
public static void ObjectField(Rect position, SerializedProperty property, Type objType, GUIContent label) => EditorGUI.ObjectField(position, property, objType, label);
public static void ObjectField<T>(Rect position, SerializedProperty property) => EditorGUI.ObjectField(position, property, typeof(T));
public static void ObjectField<T>(Rect position, SerializedProperty property, GUIContent label) => EditorGUI.ObjectField(position, property, typeof(T), label);
public static string TagField(Rect position, string tag) => EditorGUI.TagField(position, tag);
public static string TagField(Rect position, string tag, GUIStyle style) => EditorGUI.TagField(position, tag, style);
public static string TagField(Rect position, string label, string tag) => EditorGUI.TagField(position, label, tag);
public static string TagField(Rect position, string label, string tag, GUIStyle style) => EditorGUI.TagField(position, label, tag, style);
public static string TagField(Rect position, GUIContent label, string tag) => EditorGUI.TagField(position, label, tag);
public static string TagField(Rect position, GUIContent label, string tag, GUIStyle style) => EditorGUI.TagField(position, label, tag, style);
public static int LayerField(Rect position, int layer) => EditorGUI.LayerField(position, layer);
public static int LayerField(Rect position, int layer, GUIStyle style) => EditorGUI.LayerField(position, layer, style);
public static int LayerField(Rect position, string label, int layer) => EditorGUI.LayerField(position, label, layer);
public static int LayerField(Rect position, string label, int layer, GUIStyle style) => EditorGUI.LayerField(position, label, layer, style);
public static int LayerField(Rect position, GUIContent label, int layer) => EditorGUI.LayerField(position, label, layer);
public static int LayerField(Rect position, GUIContent label, int layer, GUIStyle style) => EditorGUI.LayerField(position, label, layer, style);
public static int MaskField(Rect position, GUIContent label, int mask, string[] displayedOptions) => EditorGUI.MaskField(position, label, mask, displayedOptions);
public static int MaskField(Rect position, GUIContent label, int mask, string[] displayedOptions, GUIStyle style) => EditorGUI.MaskField(position, label, mask, displayedOptions, style);
public static int MaskField(Rect position, string label, int mask, string[] displayedOptions) => EditorGUI.MaskField(position, label, mask, displayedOptions);
public static int MaskField(Rect position, string label, int mask, string[] displayedOptions, GUIStyle style) => EditorGUI.MaskField(position, label, mask, displayedOptions, style);
public static int MaskField(Rect position, int mask, string[] displayedOptions) => EditorGUI.MaskField(position, mask, displayedOptions);
public static int MaskField(Rect position, int mask, string[] displayedOptions, GUIStyle style) => EditorGUI.MaskField(position, mask, displayedOptions, style);
public static int Popup(Rect position, int selectedIndex, string[] displayedOptions) => EditorGUI.Popup(position, selectedIndex, displayedOptions);
public static int Popup(Rect position, int selectedIndex, string[] displayedOptions, GUIStyle style) => EditorGUI.Popup(position, selectedIndex, displayedOptions, style);
public static int Popup(Rect position, int selectedIndex, GUIContent[] displayedOptions) => EditorGUI.Popup(position, selectedIndex, displayedOptions);
public static int Popup(Rect position, int selectedIndex, GUIContent[] displayedOptions, GUIStyle style) => EditorGUI.Popup(position, selectedIndex, displayedOptions, style);
public static int Popup(Rect position, string label, int selectedIndex, string[] displayedOptions) => EditorGUI.Popup(position, label, selectedIndex, displayedOptions);
public static int Popup(Rect position, string label, int selectedIndex, string[] displayedOptions, GUIStyle style) => EditorGUI.Popup(position, label, selectedIndex, displayedOptions, style);
public static int Popup(Rect position, GUIContent label, int selectedIndex, GUIContent[] displayedOptions) => EditorGUI.Popup(position, label, selectedIndex, displayedOptions);
public static int Popup(Rect position, GUIContent label, int selectedIndex, GUIContent[] displayedOptions, GUIStyle style) => EditorGUI.Popup(position, label, selectedIndex, displayedOptions, style);
public static void LabelField(Rect position, string label) => EditorGUI.LabelField(position, label);
public static void LabelField(Rect position, string label, GUIStyle style) => EditorGUI.LabelField(position, label, style);
public static void LabelField(Rect position, GUIContent label) => EditorGUI.LabelField(position, label);
public static void LabelField(Rect position, GUIContent label, GUIStyle style) => EditorGUI.LabelField(position, label, style);
public static void LabelField(Rect position, string label, string label2) => EditorGUI.LabelField(position, label, label2);
public static void LabelField(Rect position, string label, string label2, GUIStyle style) => EditorGUI.LabelField(position, label, label2, style);
public static void LabelField(Rect position, GUIContent label, GUIContent label2) => EditorGUI.LabelField(position, label, label2);
public static void LabelField(Rect position, GUIContent label, GUIContent label2, GUIStyle style) => EditorGUI.LabelField(position, label, label2, style);
public static Rect PrefixLabel(Rect totalPosition, GUIContent label) => EditorGUI.PrefixLabel(totalPosition, label);
public static Rect PrefixLabel(Rect totalPosition, GUIContent label, GUIStyle style) => EditorGUI.PrefixLabel(totalPosition, label, style);
public static Rect PrefixLabel(Rect totalPosition, int id, GUIContent label) => EditorGUI.PrefixLabel(totalPosition, id, label);
public static Rect PrefixLabel(Rect totalPosition, int id, GUIContent label, GUIStyle style) => EditorGUI.PrefixLabel(totalPosition, id, label, style);
public static void HandlePrefixLabel(Rect totalPosition, Rect labelPosition, GUIContent label) => EditorGUI.HandlePrefixLabel(totalPosition, labelPosition, label);
public static void HandlePrefixLabel(Rect totalPosition, Rect labelPosition, GUIContent label, int id) => EditorGUI.HandlePrefixLabel(totalPosition, labelPosition, label, id);
public static void HandlePrefixLabel(Rect totalPosition, Rect labelPosition, GUIContent label, int id, GUIStyle style) => EditorGUI.HandlePrefixLabel(totalPosition, labelPosition, label, id, style);
public static void SelectableLabel(Rect position, string text) => EditorGUI.SelectableLabel(position, text);
public static void SelectableLabel(Rect position, string text, GUIStyle style) => EditorGUI.SelectableLabel(position, text, style);
public static void DrawRect(Rect rect, Color color) => EditorGUI.DrawRect(rect, color);
public static void DrawPreviewTexture(Rect position, Texture image, Material mat = null, ScaleMode scaleMode = ScaleMode.StretchToFill, float imageAspect = 0, float mipLevel = -1, ColorWriteMask colorWriteMask = ColorWriteMask.All)
=> EditorGUI.DrawPreviewTexture(position, image, mat, scaleMode, imageAspect, mipLevel, colorWriteMask);
public static void DrawTextureAlpha(Rect position, Texture image, ScaleMode scaleMode = ScaleMode.StretchToFill, float imageAspect = 0, float mipLevel = -1)
=> EditorGUI.DrawTextureAlpha(position, image, scaleMode, imageAspect, mipLevel);
public static void DrawTextureTransparent(Rect position, Texture image, ScaleMode scaleMode = ScaleMode.StretchToFill, float imageAspect = 0, float mipLevel = -1, ColorWriteMask colorWriteMask = ColorWriteMask.All, float explosure = 0)
=> EditorGUI.DrawTextureTransparent(position, image, scaleMode, imageAspect, mipLevel, colorWriteMask, explosure);
public static bool InspectorTitlebar(Rect position, bool foldout, Object targetObj, bool expandable) => EditorGUI.InspectorTitlebar(position, foldout, targetObj, expandable);
public static bool InspectorTitlebar(Rect position, bool foldout, Object[] targetObjs, bool expandable) => EditorGUI.InspectorTitlebar(position, foldout, targetObjs, expandable);
public static void MinMaxSlider(Rect position, ref float minValue, ref float maxValue, float minLimit, float maxLimit) => EditorGUI.MinMaxSlider(position, ref minValue, ref maxValue, minLimit, maxLimit);
public static void MinMaxSlider(Rect position, string label, ref float minValue, ref float maxValue, float minLimit, float maxLimit) => EditorGUI.MinMaxSlider(position, label, ref minValue, ref maxValue, minLimit, maxLimit);
public static void MinMaxSlider(Rect position, GUIContent label, ref float minValue, ref float maxValue, float minLimit, float maxLimit) => EditorGUI.MinMaxSlider(position, label, ref minValue, ref maxValue, minLimit, maxLimit);
public static void ProgressBar(Rect position, float value, string text) => EditorGUI.ProgressBar(position, value, text);
public static void HelpBox(Rect position, string message, MessageType type) => EditorGUI.HelpBox(position, message, type);
public static bool Foldout(Rect position, bool foldout, string content) => EditorGUI.Foldout(position, foldout, content);
public static bool Foldout(Rect position, bool foldout, string content, GUIStyle style) => EditorGUI.Foldout(position, foldout, content, style);
public static bool Foldout(Rect position, bool foldout, string content, bool toggleOnLabelClick) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick);
public static bool Foldout(Rect position, bool foldout, string content, bool toggleOnLabelClick, GUIStyle style) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick, style);
public static bool Foldout(Rect position, bool foldout, GUIContent content) => EditorGUI.Foldout(position, foldout, content);
public static bool Foldout(Rect position, bool foldout, GUIContent content, GUIStyle style) => EditorGUI.Foldout(position, foldout, content, style);
public static bool Foldout(Rect position, bool foldout, GUIContent content, bool toggleOnLabelClick) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick);
public static bool Foldout(Rect position, bool foldout, GUIContent content, bool toggleOnLabelClick, GUIStyle style) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick, style);
public static bool FolderFoldout(Rect position, bool foldout, string text, bool toggleOnLabelClick = true)
{
GUIContent folderContent = foldout ? EditorIcons.FolderOpenedIcon : EditorIcons.FolderIcon;
folderContent.text = text;
return EditorGUI.Foldout(position, foldout, folderContent, toggleOnLabelClick);
}
public static bool ToggleFoldout(Rect position, bool foldout, ref bool toggle, string text, bool toggleOnLabelClick = true)
{
Rect toggleRect = position;
toggleRect.x += 2f;
toggleRect.y += position.height * 0.25f;
toggleRect.width = 13f;
toggleRect.height = 13f;
Rect labelRect = position;
labelRect.xMin += 18f;
EditorGUI.LabelField(labelRect, text, EditorStyles.label);
bool value = FoldoutToggle(position, foldout);
toggle = GUI.Toggle(toggleRect, toggle, GUIContent.none, EditorStyles.toggle);
LucidGUIEvent.MouseDownEvent(labelRect, () => value = !value);
return value;
}
internal static bool FoldoutToggle(Rect position, bool foldout)
{
Rect foldoutRect = position;
foldoutRect.x -= 13.5f;
foldoutRect.y += position.height * 0.23f;
foldoutRect.width = 13f;
foldoutRect.height = 13f;
return GUI.Toggle(foldoutRect, foldout, GUIContent.none, EditorStyles.foldout);
}
public static bool FoldoutHeader(Rect position, bool foldout, string content) => EditorGUI.Foldout(position, foldout, content, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(Rect position, bool foldout, string content, bool toggleOnLabelClick) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(Rect position, bool foldout, GUIContent content) => EditorGUI.Foldout(position, foldout, content, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(Rect position, bool foldout, GUIContent content, bool toggleOnLabelClick) => EditorGUI.Foldout(position, foldout, content, toggleOnLabelClick, EditorStyles.foldoutHeader);
public static bool Button(Rect position, string content) => GUI.Button(position, content);
public static bool Button(Rect position, string content, Action action)
{
bool value = GUI.Button(position, content);
if (value) action?.Invoke();
return value;
}
public static bool Button(Rect position, string content, GUIStyle style) => GUI.Button(position, content, style);
public static bool Button(Rect position, string content, GUIStyle style, Action action)
{
bool value = GUI.Button(position, content, style);
if (value) action?.Invoke();
return value;
}
public static bool Button(Rect position, Texture image) => GUI.Button(position, image);
public static bool Button(Rect position, Texture image, Action action)
{
bool value = GUI.Button(position, image);
if (value) action?.Invoke();
return value;
}
public static bool Button(Rect position, Texture image, GUIStyle style) => GUI.Button(position, image, style);
public static bool Button(Rect position, Texture image, GUIStyle style, Action action)
{
bool value = GUI.Button(position, image, style);
if (value) action?.Invoke();
return value;
}
public static bool Button(Rect position, GUIContent content) => GUI.Button(position, content);
public static bool Button(Rect position, GUIContent content, Action action)
{
bool value = GUI.Button(position, content);
if (value) action?.Invoke();
return value;
}
public static bool Button(Rect position, GUIContent content, GUIStyle style) => GUI.Button(position, content, style);
public static bool Button(Rect position, GUIContent content, GUIStyle style, Action action)
{
bool value = GUI.Button(position, content, style);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, string content) => GUI.RepeatButton(position, content);
public static bool RepeatButton(Rect position, string content, Action action)
{
bool value = GUI.RepeatButton(position, content);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, string content, GUIStyle style) => GUI.RepeatButton(position, content, style);
public static bool RepeatButton(Rect position, string content, GUIStyle style, Action action)
{
bool value = GUI.RepeatButton(position, content, style);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, Texture image) => GUI.RepeatButton(position, image);
public static bool RepeatButton(Rect position, Texture image, Action action)
{
bool value = GUI.RepeatButton(position, image);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, Texture image, GUIStyle style) => GUI.RepeatButton(position, image, style);
public static bool RepeatButton(Rect position, Texture image, GUIStyle style, Action action)
{
bool value = GUI.RepeatButton(position, image, style);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, GUIContent content) => GUI.RepeatButton(position, content);
public static bool RepeatButton(Rect position, GUIContent content, Action action)
{
bool value = GUI.RepeatButton(position, content);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Rect position, GUIContent content, GUIStyle style) => GUI.RepeatButton(position, content, style);
public static bool RepeatButton(Rect position, GUIContent content, GUIStyle style, Action action)
{
bool value = GUI.RepeatButton(position, content, style);
if (value) action?.Invoke();
return value;
}
public static bool LinkButton(Rect position, string text)
{
Line(new Rect(position.x, position.y + position.height, position.width, position.height), EditorStyles.linkLabel.normal.textColor);
return Button(position, text, EditorStyles.linkLabel);
}
public static bool LinkButton(Rect position, string text, Action action)
{
Line(new Rect(position.x, position.y + position.height, position.width, position.height), EditorStyles.linkLabel.normal.textColor);
bool value = Button(position, text, EditorStyles.linkLabel);
if (value) action?.Invoke();
return value;
}
public static void Line(Rect position)
{
Line(position, 1f, EditorColors.line);
}
public static void Line(Rect position, Color color)
{
Line(position, 1f, color);
}
public static void Line(Rect position, float height, Color color)
{
Rect rect = position;
rect.height = height;
DrawRect(rect, color);
}
public static void Header(Rect position, string label)
{
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
}
public static void Header(Rect position, GUIContent label)
{
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
}
public static void BoxHeader(Rect position, GUIContent label)
{
BoxHeader(position, label, EditorColors.box);
}
public static void BoxHeader(Rect position, string label)
{
BoxHeader(position, label, EditorColors.box);
}
public static void BoxHeader(Rect position, GUIContent label, Color color)
{
DrawBoxHeaderArea(position, color);
Header(position, label);
}
public static void BoxHeader(Rect position, string label, Color color)
{
DrawBoxHeaderArea(position, color);
Header(position, label);
}
private static void DrawBoxHeaderArea(Rect position, Color color)
{
Rect rect = position;
rect.xMin -= 2f;
rect.yMin -= 2f;
rect.yMax += 2f;
EditorGUI.DrawRect(rect, color);
}
public static void TitleHeader(Rect position, string label)
{
TitleHeader(position, label, EditorColors.thinLine);
}
public static void TitleHeader(Rect position, GUIContent label)
{
TitleHeader(position, label, EditorColors.thinLine);
}
public static void TitleHeader(Rect position, string label, Color lineColor)
{
DrawTitleHeaderArea(position, lineColor);
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
}
public static void TitleHeader(Rect position, GUIContent label, Color lineColor)
{
DrawTitleHeaderArea(position, lineColor);
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
}
private static void DrawTitleHeaderArea(Rect position, Color lineColor)
{
Rect lineRect = position;
lineRect.y = position.yMax - 1f;
Line(lineRect, lineColor);
}
public static void SectionHeader(Rect position, GUIContent label)
{
SectionHeader(position, label, EditorColors.tab, EditorColors.thinLine);
}
public static void SectionHeader(Rect position, string label)
{
SectionHeader(position, label, EditorColors.tab, EditorColors.thinLine);
}
public static void SectionHeader(Rect position, GUIContent label, Color backgroundColor)
{
SectionHeader(position, label, backgroundColor, EditorColors.thinLine);
}
public static void SectionHeader(Rect position, string label, Color backgroundColor)
{
SectionHeader(position, label, backgroundColor, EditorColors.thinLine);
}
public static void SectionHeader(Rect position, GUIContent label, Color backgroundColor, Color lineColor)
{
DrawSectionHeaderArea(position, backgroundColor, lineColor);
Header(position, label);
}
public static void SectionHeader(Rect position, string label, Color backgroundColor, Color lineColor)
{
DrawSectionHeaderArea(position, backgroundColor, lineColor);
Header(position, label);
}
public static bool SectionFoldout(Rect position, bool foldout, string label)
{
return SectionFoldout(position, foldout, label, EditorColors.helpBox, EditorColors.thinLine, true);
}
public static bool SectionFoldout(Rect position, bool foldout, GUIContent label)
{
return SectionFoldout(position, foldout, label, EditorColors.helpBox, EditorColors.thinLine, true);
}
public static bool SectionFoldout(Rect position, bool foldout, string label, bool toggleOnLabelClick)
{
return SectionFoldout(position, foldout, label, EditorColors.helpBox, EditorColors.thinLine, toggleOnLabelClick);
}
public static bool SectionFoldout(Rect position, bool foldout, GUIContent label, bool toggleOnLabelClick)
{
return SectionFoldout(position, foldout, label, EditorColors.helpBox, EditorColors.thinLine, toggleOnLabelClick);
}
public static bool SectionFoldout(Rect position, bool foldout, string label, Color backgroundColor, Color lineColor, bool toggleOnLabelClick)
{
SectionHeader(position, label, backgroundColor, lineColor);
bool value = FoldoutToggle(position, foldout);
LucidGUIEvent.MouseDownEvent(position, () => value = !value);
return value;
}
public static bool SectionFoldout(Rect position, bool foldout, GUIContent label, Color backgroundColor, Color lineColor, bool toggleOnLabelClick)
{
SectionHeader(position, label, backgroundColor, lineColor);
bool value = FoldoutToggle(position, foldout);
LucidGUIEvent.MouseDownEvent(position, () => value = !value);
return value;
}
private static void DrawSectionHeaderArea(Rect position, Color backgroundColor, Color lineColor)
{
Rect rect = position;
rect.xMin -= 16f;
rect.xMax += 16f;
EditorGUI.DrawRect(rect, backgroundColor);
Line(rect, lineColor);
rect.y += rect.height;
Line(rect, lineColor);
}
public static void Blockquote(Rect position, string label)
{
Blockquote(position, label, EditorStyles.label);
}
public static void Blockquote(Rect position, GUIContent label)
{
Blockquote(position, label, EditorStyles.label);
}
public static void Blockquote(Rect position, string label, GUIStyle style)
{
DrawQuoteLine(position, style);
Rect labelPosition = position;
labelPosition.xMin += 7f;
EditorGUI.LabelField(labelPosition, label, style);
}
public static void Blockquote(Rect position, GUIContent label, GUIStyle style)
{
DrawQuoteLine(position, style);
Rect labelPosition = position;
labelPosition.xMin += 7f;
EditorGUI.LabelField(labelPosition, label, style);
}
internal static void DrawQuoteLine(Rect position, GUIStyle style)
{
Rect blockRect = position;
Color backgroundColor = EditorColors.text;
backgroundColor.a = 0.06f;
EditorGUI.DrawRect(blockRect, backgroundColor);
blockRect.x = position.xMin;
blockRect.width = 3;
EditorGUI.DrawRect(blockRect, EditorColors.text);
}
public static void ScriptField(Rect position, Object target)
{
EditorGUI.BeginDisabledGroup(true);
if (target is MonoBehaviour)
{
EditorGUI.ObjectField(position, "Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), typeof(MonoScript), false);
}
else if (target is ScriptableObject)
{
EditorGUI.ObjectField(position, "Script", MonoScript.FromScriptableObject((ScriptableObject)target), typeof(MonoScript), false);
}
EditorGUI.EndDisabledGroup();
}
public static void DrawBox(Rect rect)
{
DrawBox(rect, GUI.skin.box);
}
public static void DrawBox(Rect rect, GUIStyle style)
{
EditorGUI.LabelField(rect, GUIContent.none, style);
}
public static int Toolbar(Rect position, int selectedIndex, string[] displayedOptions)
{
return Toolbar(position, selectedIndex, displayedOptions, GUI.ToolbarButtonSize.Fixed);
}
public static int Toolbar(Rect position, int selectedIndex, string[] displayedOptions, GUI.ToolbarButtonSize toolbarButtonSize)
{
return GUI.Toolbar(position, selectedIndex, displayedOptions.Select(x => new GUIContent(x)).ToArray(), "LargeButton", toolbarButtonSize);
}
public static void BeginDisabledGroup(bool disabled)
{
EditorGUI.BeginDisabledGroup(disabled);
}
public static void EndDisabledGroup()
{
EditorGUI.EndDisabledGroup();
}
public static void BeginChangeCheck()
{
EditorGUI.BeginChangeCheck();
}
public static void EndChangeCheck()
{
EditorGUI.EndChangeCheck();
}
public static GUIContent BeginProperty(Rect totalPosition, GUIContent label, SerializedProperty property)
{
return EditorGUI.BeginProperty(totalPosition, label, property);
}
public static void EndProperty()
{
EditorGUI.EndProperty();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: de69ea548194a40c19a7abcbfbaa2bd3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,995 @@
using System;
using System.Linq;
using UnityEngine;
using UnityEditor;
using Object = UnityEngine.Object;
namespace Cainos.LucidEditor
{
public static class LucidEditorGUILayout
{
public static Rect GetControlRect(params GUILayoutOption[] options) => EditorGUILayout.GetControlRect(options);
public static Rect GetControlRect(bool hasLabel, params GUILayoutOption[] options) => EditorGUILayout.GetControlRect(hasLabel, options);
public static Rect GetControlRect(bool hasLabel, float height, params GUILayoutOption[] options) => EditorGUILayout.GetControlRect(hasLabel, height, options);
public static Rect GetControlRect(bool hasLabel, float height, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.GetControlRect(hasLabel, height, style, options);
public static T Field<T>(T value, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), value);
public static T Field<T>(string label, T value, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), label, value);
public static T Field<T>(GUIContent label, T value, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), label, value);
public static object Field(object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), value, objType);
public static object Field(string label, object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), label, value, objType);
public static object Field(GUIContent label, object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.Field(EditorGUILayout.GetControlRect(options), label, value, objType);
public static void ReadOnlyField<T>(T value, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), value);
public static void ReadOnlyField<T>(string label, T value, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), label, value);
public static void ReadOnlyField<T>(GUIContent label, T value, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), label, value);
public static void ReadOnlyField(object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), value, objType);
public static void ReadOnlyField(string label, object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), label, value, objType);
public static void ReadOnlyField(GUIContent label, object value, Type objType, params GUILayoutOption[] options) => LucidEditorGUI.ReadOnlyField(EditorGUILayout.GetControlRect(options), label, value, objType);
public static bool PropertyField(SerializedProperty property, params GUILayoutOption[] options) => EditorGUILayout.PropertyField(property, options);
public static bool PropertyField(SerializedProperty property, bool includeChildren, params GUILayoutOption[] options) => EditorGUILayout.PropertyField(property, includeChildren, options);
public static bool PropertyField(SerializedProperty property, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.PropertyField(property, label, options);
public static bool PropertyField(SerializedProperty property, GUIContent label, bool includeChildren, params GUILayoutOption[] options) => EditorGUILayout.PropertyField(property, label, includeChildren, options);
public static string TextField(string value, params GUILayoutOption[] options) => EditorGUILayout.TextField(value, options);
public static string TextField(string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TextField(value, style, options);
public static string TextField(string label, string value, params GUILayoutOption[] options) => EditorGUILayout.TextField(label, value, options);
public static string TextField(string label, string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TextField(label, value, style, options);
public static string TextField(GUIContent label, string value, params GUILayoutOption[] options) => EditorGUILayout.TextField(label, value, options);
public static string TextField(GUIContent label, string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TextField(label, value, style, options);
public static string DelayedTextField(string value, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(value, options);
public static string DelayedTextField(string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(value, style, options);
public static string DelayedTextField(string label, string value, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(label, value, options);
public static string DelayedTextField(string label, string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(label, value, style, options);
public static string DelayedTextField(GUIContent label, string value, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(label, value, options);
public static string DelayedTextField(GUIContent label, string value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedTextField(label, value, style, options);
public static string TextArea(string text, params GUILayoutOption[] options) => EditorGUILayout.TextArea(text, options);
public static string TextArea(string text, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TextArea(text, style, options);
public static string PasswordField(string password, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(password, options);
public static string PasswordField(string password, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(password, style, options);
public static string PasswordField(string label, string password, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(label, password, options);
public static string PasswordField(string label, string password, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(label, password, style, options);
public static string PasswordField(GUIContent label, string password, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(label, password, options);
public static string PasswordField(GUIContent label, string password, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.PasswordField(label, password, style, options);
public static int IntField(int value, params GUILayoutOption[] options) => EditorGUILayout.IntField(value, options);
public static int IntField(int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntField(value, style, options);
public static int IntField(string label, int value, params GUILayoutOption[] options) => EditorGUILayout.IntField(label, value, options);
public static int IntField(string label, int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntField(label, value, style, options);
public static int IntField(GUIContent label, int value, params GUILayoutOption[] options) => EditorGUILayout.IntField(label, value, options);
public static int IntField(GUIContent label, int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntField(label, value, style, options);
public static int DelayedIntField(int value, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(value, options);
public static int DelayedIntField(int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(value, style, options);
public static int DelayedIntField(string label, int value, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(label, value, options);
public static int DelayedIntField(string label, int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(label, value, style, options);
public static int DelayedIntField(GUIContent label, int value, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(label, value, options);
public static int DelayedIntField(GUIContent label, int value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedIntField(label, value, style, options);
public static int IntPopup(int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(selectedValue, displayedOptions, optionValues, options);
public static int IntPopup(int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(selectedValue, displayedOptions, optionValues, style, options);
public static int IntPopup(int selectedValue, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(selectedValue, displayedOptions, optionValues, options);
public static int IntPopup(int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(selectedValue, displayedOptions, optionValues, style, options);
public static int IntPopup(string label, int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(label, selectedValue, displayedOptions, optionValues, options);
public static int IntPopup(string label, int selectedValue, string[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(label, selectedValue, displayedOptions, optionValues, style, options);
public static int IntPopup(GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(label, selectedValue, displayedOptions, optionValues, options);
public static int IntPopup(GUIContent label, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(label, selectedValue, displayedOptions, optionValues, style, options);
public static void IntPopup(SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(property, displayedOptions, optionValues, options);
public static void IntPopup(SerializedProperty property, GUIContent[] displayedOptions, int[] optionValues, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.IntPopup(property, displayedOptions, optionValues, label, options);
public static int IntSlider(int value, int leftValue, int rightValue, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(value, leftValue, rightValue, options);
public static int IntSlider(string label, int value, int leftValue, int rightValue, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(label, value, leftValue, rightValue, options);
public static int IntSlider(GUIContent label, int value, int leftValue, int rightValue, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(label, value, leftValue, rightValue, options);
public static void IntSlider(SerializedProperty property, int leftValue, int rightValue, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(property, leftValue, rightValue, options);
public static void IntSlider(SerializedProperty property, int leftValue, int rightValue, string label, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(property, leftValue, rightValue, label, options);
public static void IntSlider(SerializedProperty property, int leftValue, int rightValue, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.IntSlider(property, leftValue, rightValue, label, options);
public static float FloatField(float value, params GUILayoutOption[] options) => EditorGUILayout.FloatField(value, options);
public static float FloatField(float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.FloatField(value, style, options);
public static float FloatField(string label, float value, params GUILayoutOption[] options) => EditorGUILayout.FloatField(label, value, options);
public static float FloatField(string label, float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.FloatField(label, value, style, options);
public static float FloatField(GUIContent label, float value, params GUILayoutOption[] options) => EditorGUILayout.FloatField(label, value, options);
public static float FloatField(GUIContent label, float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.FloatField(label, value, style, options);
public static float FloatSlider(float value, float leftValue, float rightValue, params GUILayoutOption[] options) => EditorGUILayout.Slider(value, leftValue, rightValue, options);
public static float FloatSlider(string label, float value, float leftValue, float rightValue, params GUILayoutOption[] options) => EditorGUILayout.Slider(label, value, leftValue, rightValue, options);
public static float FloatSlider(GUIContent label, float value, float leftValue, float rightValue, params GUILayoutOption[] options) => EditorGUILayout.Slider(label, value, leftValue, rightValue, options);
public static void FloatSlider(SerializedProperty property, float leftValue, float rightValue, params GUILayoutOption[] options) => EditorGUILayout.Slider(property, leftValue, rightValue, options);
public static void FloatSlider(SerializedProperty property, float leftValue, float rightValue, string label, params GUILayoutOption[] options) => EditorGUILayout.Slider(property, leftValue, rightValue, label, options);
public static void FloatSlider(SerializedProperty property, float leftValue, float rightValue, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.Slider(property, leftValue, rightValue, label, options);
public static float DelayedFloatField(float value, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(value, options);
public static float DelayedFloatField(float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(value, style, options);
public static float DelayedFloatField(string label, float value, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(label, value, options);
public static float DelayedFloatField(string label, float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(label, value, style, options);
public static float DelayedFloatField(GUIContent label, float value, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(label, value, options);
public static float DelayedFloatField(GUIContent label, float value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedFloatField(label, value, style, options);
public static double DoubleField(double value, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(value, options);
public static double DoubleField(double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(value, style, options);
public static double DoubleField(string label, double value, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(label, value, options);
public static double DoubleField(string label, double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(label, value, style, options);
public static double DoubleField(GUIContent label, double value, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(label, value, options);
public static double DoubleField(GUIContent label, double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DoubleField(label, value, style, options);
public static double DelayedDoubleField(double value, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(value, options);
public static double DelayedDoubleField(double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(value, style, options);
public static double DelayedDoubleField(string label, double value, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(label, value, options);
public static double DelayedDoubleField(string label, double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(label, value, style, options);
public static double DelayedDoubleField(GUIContent label, double value, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(label, value, options);
public static double DelayedDoubleField(GUIContent label, double value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.DelayedDoubleField(label, value, style, options);
public static long LongField(long value, params GUILayoutOption[] options) => EditorGUILayout.LongField(value, options);
public static long LongField(long value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LongField(value, style, options);
public static long LongField(string label, long value, params GUILayoutOption[] options) => EditorGUILayout.LongField(label, value, options);
public static long LongField(string label, long value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LongField(label, value, style, options);
public static long LongField(GUIContent label, long value, params GUILayoutOption[] options) => EditorGUILayout.LongField(label, value, options);
public static long LongField(GUIContent label, long value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LongField(label, value, style, options);
public static bool Toggle(bool value, params GUILayoutOption[] options) => EditorGUILayout.Toggle(value, options);
public static bool Toggle(bool value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Toggle(value, style, options);
public static bool Toggle(string label, bool value, params GUILayoutOption[] options) => EditorGUILayout.Toggle(label, value, options);
public static bool Toggle(string label, bool value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Toggle(label, value, style, options);
public static bool Toggle(GUIContent label, bool value, params GUILayoutOption[] options) => EditorGUILayout.Toggle(label, value, options);
public static bool Toggle(GUIContent label, bool value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Toggle(label, value, style, options);
public static bool ToggleLeft(string label, bool value, params GUILayoutOption[] options) => EditorGUILayout.ToggleLeft(label, value, options);
public static bool ToggleLeft(string label, bool value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.ToggleLeft(label, value, style, options);
public static bool ToggleLeft(GUIContent label, bool value, params GUILayoutOption[] options) => EditorGUILayout.ToggleLeft(label, value, options);
public static bool ToggleLeft(GUIContent label, bool value, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.ToggleLeft(label, value, style, options);
public static Vector2 Vector2Field(string label, Vector2 value, params GUILayoutOption[] options) => EditorGUILayout.Vector2Field(label, value, options);
public static Vector2 Vector2Field(GUIContent label, Vector2 value, params GUILayoutOption[] options) => EditorGUILayout.Vector2Field(label, value, options);
public static Vector2Int Vector2IntField(string label, Vector2Int value, params GUILayoutOption[] options) => EditorGUILayout.Vector2IntField(label, value, options);
public static Vector2Int Vector2IntField(GUIContent label, Vector2Int value, params GUILayoutOption[] options) => EditorGUILayout.Vector2IntField(label, value, options);
public static Vector3 Vector3Field(string label, Vector3 value, params GUILayoutOption[] options) => EditorGUILayout.Vector3Field(label, value, options);
public static Vector3 Vector3Field(GUIContent label, Vector3 value, params GUILayoutOption[] options) => EditorGUILayout.Vector3Field(label, value, options);
public static Vector3Int Vector3IntField(string label, Vector3Int value, params GUILayoutOption[] options) => EditorGUILayout.Vector3IntField(label, value, options);
public static Vector3Int Vector3IntField(GUIContent label, Vector3Int value, params GUILayoutOption[] options) => EditorGUILayout.Vector3IntField(label, value, options);
public static Vector4 Vector4Field(string label, Vector4 value, params GUILayoutOption[] options) => EditorGUILayout.Vector4Field(label, value, options);
public static Vector4 Vector4Field(GUIContent label, Vector4 value, params GUILayoutOption[] options) => EditorGUILayout.Vector4Field(label, value, options);
public static Color ColorField(Color value, params GUILayoutOption[] options) => EditorGUILayout.ColorField(value, options);
public static Color ColorField(string label, Color value, params GUILayoutOption[] options) => EditorGUILayout.ColorField(label, value, options);
public static Color ColorField(GUIContent label, Color value, params GUILayoutOption[] options) => EditorGUILayout.ColorField(label, value, options);
public static Color ColorField(GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options) => EditorGUILayout.ColorField(label, value, showEyedropper, showAlpha, hdr, options);
public static Gradient GradientField(Gradient gradient, params GUILayoutOption[] options) => EditorGUILayout.GradientField(gradient, options);
public static Gradient GradientField(string label, Gradient gradient, params GUILayoutOption[] options) => EditorGUILayout.GradientField(label, gradient, options);
public static Gradient GradientField(GUIContent label, Gradient gradient, params GUILayoutOption[] options) => EditorGUILayout.GradientField(label, gradient, options);
public static Gradient GradientField(GUIContent label, Gradient gradient, bool hdr, params GUILayoutOption[] options) => EditorGUILayout.GradientField(label, gradient, hdr, options);
public static AnimationCurve CurveField(AnimationCurve value, params GUILayoutOption[] options) => EditorGUILayout.CurveField(value, options);
public static AnimationCurve CurveField(string label, AnimationCurve value, params GUILayoutOption[] options) => EditorGUILayout.CurveField(label, value, options);
public static AnimationCurve CurveField(GUIContent label, AnimationCurve value, params GUILayoutOption[] options) => EditorGUILayout.CurveField(label, value, options);
public static AnimationCurve CurveField(AnimationCurve value, Color color, Rect ranges, params GUILayoutOption[] options) => EditorGUILayout.CurveField(value, color, ranges, options);
public static AnimationCurve CurveField(string label, AnimationCurve value, Color color, Rect ranges, params GUILayoutOption[] options) => EditorGUILayout.CurveField(label, value, color, ranges, options);
public static AnimationCurve CurveField(GUIContent label, AnimationCurve value, Color color, Rect ranges, params GUILayoutOption[] options) => EditorGUILayout.CurveField(label, value, color, ranges, options);
public static void CurveField(SerializedProperty property, Color color, Rect ranges, params GUILayoutOption[] options) => EditorGUILayout.CurveField(property, color, ranges, options);
public static void CurveField(SerializedProperty property, Color color, Rect ranges, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.CurveField(property, color, ranges, label, options);
public static Bounds BoundsField(Bounds value, params GUILayoutOption[] options) => EditorGUILayout.BoundsField(value, options);
public static Bounds BoundsField(string label, Bounds value, params GUILayoutOption[] options) => EditorGUILayout.BoundsField(label, value, options);
public static Bounds BoundsField(GUIContent label, Bounds value, params GUILayoutOption[] options) => EditorGUILayout.BoundsField(label, value, options);
public static BoundsInt BoundsIntField(BoundsInt value, params GUILayoutOption[] options) => EditorGUILayout.BoundsIntField(value, options);
public static BoundsInt BoundsIntField(string label, BoundsInt value, params GUILayoutOption[] options) => EditorGUILayout.BoundsIntField(label, value, options);
public static BoundsInt BoundsIntField(GUIContent label, BoundsInt value, params GUILayoutOption[] options) => EditorGUILayout.BoundsIntField(label, value, options);
public static Rect RectField(Rect value, params GUILayoutOption[] options) => EditorGUILayout.RectField(value, options);
public static Rect RectField(string label, Rect value, params GUILayoutOption[] options) => EditorGUILayout.RectField(label, value, options);
public static Rect RectField(GUIContent label, Rect value, params GUILayoutOption[] options) => EditorGUILayout.RectField(label, value, options);
public static RectInt RectIntField(RectInt value, params GUILayoutOption[] options) => EditorGUILayout.RectIntField(value, options);
public static RectInt RectIntField(string label, RectInt value, params GUILayoutOption[] options) => EditorGUILayout.RectIntField(label, value, options);
public static RectInt RectIntField(GUIContent label, RectInt value, params GUILayoutOption[] options) => EditorGUILayout.RectIntField(label, value, options);
public static Enum EnumFlagsField(Enum enumValue, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(enumValue, options);
public static Enum EnumFlagsField(Enum enumValue, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(enumValue, style, options);
public static Enum EnumFlagsField(string label, Enum enumValue, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, options);
public static Enum EnumFlagsField(string label, Enum enumValue, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, style, options);
public static Enum EnumFlagsField(GUIContent label, Enum enumValue, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, options);
public static Enum EnumFlagsField(GUIContent label, Enum enumValue, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, style, options);
public static Enum EnumFlagsField(GUIContent label, Enum enumValue, bool includeObsolete, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, includeObsolete, options);
public static Enum EnumFlagsField(GUIContent label, Enum enumValue, bool includeObsolete, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumFlagsField(label, enumValue, includeObsolete, style, options);
public static TEnum EnumFlagsField<TEnum>(TEnum enumValue, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(enumValue, options);
public static TEnum EnumFlagsField<TEnum>(TEnum enumValue, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(enumValue, style, options);
public static TEnum EnumFlagsField<TEnum>(string label, TEnum enumValue, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, options);
public static TEnum EnumFlagsField<TEnum>(string label, TEnum enumValue, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, style, options);
public static TEnum EnumFlagsField<TEnum>(GUIContent label, TEnum enumValue, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, options);
public static TEnum EnumFlagsField<TEnum>(GUIContent label, TEnum enumValue, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, style, options);
public static TEnum EnumFlagsField<TEnum>(GUIContent label, TEnum enumValue, bool includeObsolete, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, includeObsolete, options);
public static TEnum EnumFlagsField<TEnum>(GUIContent label, TEnum enumValue, bool includeObsolete, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumFlagsField(label, enumValue, includeObsolete, style, options);
public static Enum EnumPopup(Enum selected, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(selected, options);
public static Enum EnumPopup(Enum selected, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(selected, style, options);
public static Enum EnumPopup(string label, Enum selected, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, options);
public static Enum EnumPopup(string label, Enum selected, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, style, options);
public static Enum EnumPopup(GUIContent label, Enum selected, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, options);
public static Enum EnumPopup(GUIContent label, Enum selected, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, style, options);
public static Enum EnumPopup(GUIContent label, Enum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, checkEnabled, includeObsolete, options);
public static Enum EnumPopup(GUIContent label, Enum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.EnumPopup(label, selected, checkEnabled, includeObsolete, style, options);
public static TEnum EnumPopup<TEnum>(TEnum selected, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(selected, options);
public static TEnum EnumPopup<TEnum>(TEnum selected, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(selected, style, options);
public static TEnum EnumPopup<TEnum>(string label, TEnum selected, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, options);
public static TEnum EnumPopup<TEnum>(string label, TEnum selected, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, style, options);
public static TEnum EnumPopup<TEnum>(GUIContent label, TEnum selected, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, options);
public static TEnum EnumPopup<TEnum>(GUIContent label, TEnum selected, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, style, options);
public static TEnum EnumPopup<TEnum>(GUIContent label, TEnum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, checkEnabled, includeObsolete, options);
public static TEnum EnumPopup<TEnum>(GUIContent label, TEnum selected, Func<Enum, bool> checkEnabled, bool includeObsolete, GUIStyle style, params GUILayoutOption[] options) where TEnum : Enum => (TEnum)EditorGUILayout.EnumPopup(label, selected, checkEnabled, includeObsolete, style, options);
public static Object ObjectField(Object obj, Type objType, bool allowSceneObjects, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(obj, objType, allowSceneObjects, options);
public static Object ObjectField(string label, Object obj, Type objType, bool allowSceneObjects, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(label, obj, objType, allowSceneObjects, options);
public static Object ObjectField(GUIContent label, Object obj, Type objType, bool allowSceneObjects, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(label, obj, objType, allowSceneObjects, options);
public static T ObjectField<T>(T obj, bool allowSceneObjects, params GUILayoutOption[] options) where T : Object => (T)EditorGUILayout.ObjectField(obj, typeof(T), allowSceneObjects, options);
public static T ObjectField<T>(string label, T obj, bool allowSceneObjects, params GUILayoutOption[] options) where T : Object => (T)EditorGUILayout.ObjectField(label, obj, typeof(T), allowSceneObjects, options);
public static T ObjectField<T>(GUIContent label, T obj, bool allowSceneObjects, params GUILayoutOption[] options) where T : Object => (T)EditorGUILayout.ObjectField(label, obj, typeof(T), allowSceneObjects, options);
public static void ObjectField(SerializedProperty property, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, options);
public static void ObjectField(SerializedProperty property, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, label, options);
public static void ObjectField(SerializedProperty property, Type objType, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, objType, options);
public static void ObjectField(SerializedProperty property, Type objType, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, objType, label, options);
public static void ObjectField<T>(SerializedProperty property, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, typeof(T), options);
public static void ObjectField<T>(SerializedProperty property, GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.ObjectField(property, typeof(T), label, options);
public static string TagField(string tag, params GUILayoutOption[] options) => EditorGUILayout.TagField(tag, options);
public static string TagField(string tag, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TagField(tag, style, options);
public static string TagField(string label, string tag, params GUILayoutOption[] options) => EditorGUILayout.TagField(label, tag, options);
public static string TagField(string label, string tag, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TagField(label, tag, style, options);
public static string TagField(GUIContent label, string tag, params GUILayoutOption[] options) => EditorGUILayout.TagField(label, tag, options);
public static string TagField(GUIContent label, string tag, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.TagField(label, tag, style, options);
public static int LayerField(int layer, params GUILayoutOption[] options) => EditorGUILayout.LayerField(layer, options);
public static int LayerField(int layer, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LayerField(layer, style, options);
public static int LayerField(string label, int layer, params GUILayoutOption[] options) => EditorGUILayout.LayerField(label, layer, options);
public static int LayerField(string label, int layer, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LayerField(label, layer, style, options);
public static int LayerField(GUIContent label, int layer, params GUILayoutOption[] options) => EditorGUILayout.LayerField(label, layer, options);
public static int LayerField(GUIContent label, int layer, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LayerField(label, layer, style, options);
public static int MaskField(GUIContent label, int mask, string[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.MaskField(label, mask, displayedOptions, options);
public static int MaskField(GUIContent label, int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.MaskField(label, mask, displayedOptions, style, options);
public static int MaskField(string label, int mask, string[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.MaskField(label, mask, displayedOptions, options);
public static int MaskField(string label, int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.MaskField(label, mask, displayedOptions, style, options);
public static int MaskField(int mask, string[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.MaskField(mask, displayedOptions, options);
public static int MaskField(int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.MaskField(mask, displayedOptions, style, options);
public static int Popup(int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.Popup(selectedIndex, displayedOptions, options);
public static int Popup(int selectedIndex, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Popup(selectedIndex, displayedOptions, style, options);
public static int Popup(int selectedIndex, GUIContent[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.Popup(selectedIndex, displayedOptions, options);
public static int Popup(int selectedIndex, GUIContent[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Popup(selectedIndex, displayedOptions, style, options);
public static int Popup(string label, int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.Popup(label, selectedIndex, displayedOptions, options);
public static int Popup(string label, int selectedIndex, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Popup(label, selectedIndex, displayedOptions, style, options);
public static int Popup(GUIContent label, int selectedIndex, GUIContent[] displayedOptions, params GUILayoutOption[] options) => EditorGUILayout.Popup(label, selectedIndex, displayedOptions, options);
public static int Popup(GUIContent label, int selectedIndex, GUIContent[] displayedOptions, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.Popup(label, selectedIndex, displayedOptions, style, options);
public static void LabelField(string label, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, options);
public static void LabelField(string label, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, style, options);
public static void LabelField(GUIContent label, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, options);
public static void LabelField(GUIContent label, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, style, options);
public static void LabelField(string label, string label2, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, label2, options);
public static void LabelField(string label, string label2, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, label2, style, options);
public static void LabelField(GUIContent label, GUIContent label2, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, label2, options);
public static void LabelField(GUIContent label, GUIContent label2, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.LabelField(label, label2, style, options);
public static void PrefixLabel(string label) => EditorGUILayout.PrefixLabel(label);
public static void PrefixLabel(string label, GUIStyle followingStyle) => EditorGUILayout.PrefixLabel(label, followingStyle);
public static void PrefixLabel(string label, GUIStyle followingStyle, GUIStyle labelStyle) => EditorGUILayout.PrefixLabel(label, followingStyle, labelStyle);
public static void PrefixLabel(GUIContent label) => EditorGUILayout.PrefixLabel(label);
public static void PrefixLabel(GUIContent label, GUIStyle followingStyle) => EditorGUILayout.PrefixLabel(label, followingStyle);
public static void PrefixLabel(GUIContent label, GUIStyle followingStyle, GUIStyle labelStyle) => EditorGUILayout.PrefixLabel(label, followingStyle, labelStyle);
public static void SelectableLabel(string text, params GUILayoutOption[] options) => EditorGUILayout.SelectableLabel(text, options);
public static void SelectableLabel(string text, GUIStyle style, params GUILayoutOption[] options) => EditorGUILayout.SelectableLabel(text, style, options);
public static bool InspectorTitlebar(bool foldout, Object targetObj, bool expandable) => EditorGUILayout.InspectorTitlebar(foldout, targetObj, expandable);
public static bool InspectorTitlebar(bool foldout, Object[] targetObjs, bool expandable) => EditorGUILayout.InspectorTitlebar(foldout, targetObjs, expandable);
public static void MinMaxSlider(ref float minValue, ref float maxValue, float minLimit, float maxLimit, params GUILayoutOption[] options) => EditorGUILayout.MinMaxSlider(ref minValue, ref maxValue, minLimit, maxLimit, options);
public static void MinMaxSlider(string label, ref float minValue, ref float maxValue, float minLimit, float maxLimit, params GUILayoutOption[] options) => EditorGUILayout.MinMaxSlider(label, ref minValue, ref maxValue, minLimit, maxLimit, options);
public static void MinMaxSlider(GUIContent label, ref float minValue, ref float maxValue, float minLimit, float maxLimit, params GUILayoutOption[] options) => EditorGUILayout.MinMaxSlider(label, ref minValue, ref maxValue, minLimit, maxLimit, options);
public static void ProgressBar(float value, string text)
{
Rect position = EditorGUILayout.GetControlRect();
EditorGUI.ProgressBar(position, value, text);
}
public static void HelpBox(string message, MessageType type) => EditorGUILayout.HelpBox(message, type);
public static void HelpBox(string message, MessageType type, bool wide) => EditorGUILayout.HelpBox(message, type, wide);
public static bool Foldout(bool foldout, string content) => EditorGUILayout.Foldout(foldout, content);
public static bool Foldout(bool foldout, string content, GUIStyle style) => EditorGUILayout.Foldout(foldout, content, style);
public static bool Foldout(bool foldout, string content, bool toggleOnLabelClick) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick);
public static bool Foldout(bool foldout, string content, bool toggleOnLabelClick, GUIStyle style) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick, style);
public static bool Foldout(bool foldout, GUIContent content) => EditorGUILayout.Foldout(foldout, content);
public static bool Foldout(bool foldout, GUIContent content, GUIStyle style) => EditorGUILayout.Foldout(foldout, content, style);
public static bool Foldout(bool foldout, GUIContent content, bool toggleOnLabelClick) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick);
public static bool Foldout(bool foldout, GUIContent content, bool toggleOnLabelClick, GUIStyle style) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick, style);
public static bool FolderFoldout(bool foldout, string text, bool toggleOnLabelClick = true)
{
GUIContent folderContent = foldout ? EditorIcons.FolderOpenedIcon : EditorIcons.FolderIcon;
folderContent.text = text;
return EditorGUILayout.Foldout(foldout, folderContent, toggleOnLabelClick);
}
public static bool ToggleFoldout(bool foldout, ref bool toggle, string text, bool toggleOnLabelClick = true)
{
Rect position = EditorGUILayout.GetControlRect();
return LucidEditorGUI.ToggleFoldout(position, foldout, ref toggle, text, toggleOnLabelClick);
}
public static bool FoldoutHeader(bool foldout, string content) => EditorGUILayout.Foldout(foldout, content, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(bool foldout, string content, bool toggleOnLabelClick) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(bool foldout, GUIContent content) => EditorGUILayout.Foldout(foldout, content, EditorStyles.foldoutHeader);
public static bool FoldoutHeader(bool foldout, GUIContent content, bool toggleOnLabelClick) => EditorGUILayout.Foldout(foldout, content, toggleOnLabelClick, EditorStyles.foldoutHeader);
public static bool Button(string content, params GUILayoutOption[] options) => GUILayout.Button(content, options);
public static bool Button(string content, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(content, options);
if (value) action?.Invoke();
return value;
}
public static bool Button(string content, GUIStyle style, params GUILayoutOption[] options) => GUILayout.Button(content, style, options);
public static bool Button(string content, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(content, style, options);
if (value) action?.Invoke();
return value;
}
public static bool Button(Texture image, params GUILayoutOption[] options) => GUILayout.Button(image, options);
public static bool Button(Texture image, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(image, options);
if (value) action?.Invoke();
return value;
}
public static bool Button(Texture image, GUIStyle style, params GUILayoutOption[] options) => GUILayout.Button(image, style, options);
public static bool Button(Texture image, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(image, style, options);
if (value) action?.Invoke();
return value;
}
public static bool Button(GUIContent content, params GUILayoutOption[] options) => GUILayout.Button(content, options);
public static bool Button(GUIContent content, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(content, options);
if (value) action?.Invoke();
return value;
}
public static bool Button(GUIContent content, GUIStyle style, params GUILayoutOption[] options) => GUILayout.Button(content, style, options);
public static bool Button(GUIContent content, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.Button(content, style, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(string content, params GUILayoutOption[] options) => GUILayout.RepeatButton(content, options);
public static bool RepeatButton(string content, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(content, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(string content, GUIStyle style, params GUILayoutOption[] options) => GUILayout.RepeatButton(content, style, options);
public static bool RepeatButton(string content, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(content, style, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Texture image, params GUILayoutOption[] options) => GUILayout.RepeatButton(image, options);
public static bool RepeatButton(Texture image, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(image, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(Texture image, GUIStyle style, params GUILayoutOption[] options) => GUILayout.RepeatButton(image, style, options);
public static bool RepeatButton(Texture image, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(image, style, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(GUIContent content, params GUILayoutOption[] options) => GUILayout.RepeatButton(content, options);
public static bool RepeatButton(GUIContent content, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(content, options);
if (value) action?.Invoke();
return value;
}
public static bool RepeatButton(GUIContent content, GUIStyle style, params GUILayoutOption[] options) => GUILayout.RepeatButton(content, style, options);
public static bool RepeatButton(GUIContent content, GUIStyle style, Action action, params GUILayoutOption[] options)
{
bool value = GUILayout.RepeatButton(content, style, options);
if (value) action?.Invoke();
return value;
}
public static bool LinkButton(string text, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(options);
LucidEditorGUI.Line(new Rect(position.x, position.y + position.height, position.width, position.height), EditorStyles.linkLabel.normal.textColor);
return LucidEditorGUI.Button(position, text, EditorStyles.linkLabel);
}
public static bool LinkButton(string text, Action action, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(options);
LucidEditorGUI.Line(new Rect(position.x, position.y + position.height, position.width, position.height), EditorStyles.linkLabel.normal.textColor);
bool value = LucidEditorGUI.Button(position, text, EditorStyles.linkLabel);
if (value) action?.Invoke();
return value;
}
public static void Line(params GUILayoutOption[] options)
{
Line(1f, EditorColors.line, options);
}
public static void Line(Color color, params GUILayoutOption[] options)
{
Line(1f, color, options);
}
public static void Line(float height, Color color, params GUILayoutOption[] options)
{
Rect rect = EditorGUILayout.GetControlRect(false, 1f, options);
rect.height = height;
EditorGUI.DrawRect(rect, color);
}
public static void Header(string label, params GUILayoutOption[] options)
{
EditorGUILayout.LabelField(label, EditorStyles.boldLabel, options);
}
public static void Header(GUIContent label, params GUILayoutOption[] options)
{
EditorGUILayout.LabelField(label, EditorStyles.boldLabel, options);
}
public static void BoxHeader(GUIContent label, params GUILayoutOption[] options)
{
Rect rect = EditorGUILayout.GetControlRect(options);
LucidEditorGUI.BoxHeader(rect, label);
}
public static void BoxHeader(string label, params GUILayoutOption[] options)
{
Rect rect = EditorGUILayout.GetControlRect(options);
LucidEditorGUI.BoxHeader(rect, label);
}
public static void TitleHeader(string label, params GUILayoutOption[] options)
{
TitleHeader(label, EditorColors.line, options);
}
public static void TitleHeader(GUIContent label, params GUILayoutOption[] options)
{
TitleHeader(label, EditorColors.line, options);
}
public static void TitleHeader(string label, Color lineColor, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(options);
Rect lineRect = position;
lineRect.y = position.yMax - 1;
LucidEditorGUI.Line(lineRect, lineColor);
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
Space(3);
}
public static void TitleHeader(GUIContent label, Color lineColor, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(options);
Rect lineRect = position;
lineRect.y = position.yMax - 1;
LucidEditorGUI.Line(lineRect, lineColor);
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
Space(3);
}
public static void SectionHeader(GUIContent label, params GUILayoutOption[] options)
{
SectionHeader(label, EditorColors.helpBox, EditorColors.thinLine, options);
}
public static void SectionHeader(string label, params GUILayoutOption[] options)
{
SectionHeader(label, EditorColors.helpBox, EditorColors.thinLine, options);
}
public static void SectionHeader(GUIContent label, Color backgroundColor, params GUILayoutOption[] options)
{
SectionHeader(label, backgroundColor, EditorColors.thinLine, options);
}
public static void SectionHeader(string label, Color backgroundColor, params GUILayoutOption[] options)
{
SectionHeader(label, backgroundColor, EditorColors.thinLine, options);
}
public static void SectionHeader(string label, Color backgroundColor, Color lineColor, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight + 5f, options);
LucidEditorGUI.SectionHeader(position, label, backgroundColor, lineColor);
Space(1);
}
public static void SectionHeader(GUIContent label, Color backgroundColor, Color lineColor, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight + 5f, options);
LucidEditorGUI.SectionHeader(position, label, backgroundColor, lineColor);
Space(1);
}
public static bool SectionFoldout(bool foldout, string label, params GUILayoutOption[] options)
{
return SectionFoldout(foldout, label, EditorColors.tab, EditorColors.thinLine, true);
}
public static bool SectionFoldout(bool foldout, GUIContent label, params GUILayoutOption[] options)
{
return SectionFoldout(foldout, label, EditorColors.tab, EditorColors.thinLine, true);
}
public static bool SectionFoldout(bool foldout, string label, bool toggleOnLabelClick, params GUILayoutOption[] options)
{
return SectionFoldout(foldout, label, EditorColors.tab, EditorColors.thinLine, toggleOnLabelClick);
}
public static bool SectionFoldout(bool foldout, GUIContent label, bool toggleOnLabelClick, params GUILayoutOption[] options)
{
return SectionFoldout(foldout, label, EditorColors.tab, EditorColors.thinLine, toggleOnLabelClick);
}
public static bool SectionFoldout(bool foldout, string label, Color backgroundColor, Color lineColor, bool toggleOnLabelClick, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight + 5f, options);
bool value = LucidEditorGUI.SectionFoldout(position, foldout, label, backgroundColor, lineColor, toggleOnLabelClick);
Space(3);
return value;
}
public static bool SectionFoldout(bool foldout, GUIContent label, Color backgroundColor, Color lineColor, bool toggleOnLabelClick, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight + 5f, options);
bool value = LucidEditorGUI.SectionFoldout(position, foldout, label, backgroundColor, lineColor, toggleOnLabelClick);
Space(3);
return value;
}
public static void Blockquote(string label, params GUILayoutOption[] options)
{
Blockquote(label, EditorStyles.label, options);
}
public static void Blockquote(GUIContent label, params GUILayoutOption[] options)
{
Blockquote(label, EditorStyles.label, options);
}
public static void Blockquote(string label, GUIStyle style, params GUILayoutOption[] options)
{
Blockquote(new GUIContent(label), style, options);
}
public static void Blockquote(GUIContent label, GUIStyle style, params GUILayoutOption[] options)
{
Rect position = GUILayoutUtility.GetRect(label, style, options);
position.height += EditorGUIUtility.singleLineHeight * 0.5f;
EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight * 0.5f);
LucidEditorGUI.DrawQuoteLine(position, style);
Rect labelPosition = position;
labelPosition.xMin += 7f;
EditorGUI.LabelField(labelPosition, label, style);
}
public static void ScriptField(Object target, params GUILayoutOption[] options)
{
LucidEditorGUI.ScriptField(EditorGUILayout.GetControlRect(options), target);
}
public static int Toolbar(int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options)
{
int value = Toolbar(selectedIndex, displayedOptions, GUI.ToolbarButtonSize.Fixed, options);
Space(5);
return value;
}
public static int Toolbar(int selectedIndex, string[] displayedOptions, GUI.ToolbarButtonSize toolbarButtonSize, params GUILayoutOption[] options)
{
Rect position = EditorGUILayout.GetControlRect(options);
int value = LucidEditorGUI.Toolbar(position, selectedIndex, displayedOptions, toolbarButtonSize);
Space(5);
return value;
}
public static void Space() => EditorGUILayout.Space();
public static void Space(float width) => EditorGUILayout.Space(width);
public static void Space(float width, bool expand) => EditorGUILayout.Space(width, expand);
public static Rect BeginVertical()
{
return EditorGUILayout.BeginVertical();
}
public static Rect BeginVertical(params GUILayoutOption[] options)
{
return EditorGUILayout.BeginVertical(options);
}
public static Rect BeginVertical(GUIStyle style, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginVertical(style, options);
}
public static void EndVertical()
{
EditorGUILayout.EndVertical();
}
public static Rect BeginHorizontal()
{
return EditorGUILayout.BeginHorizontal();
}
public static Rect BeginHorizontal(params GUILayoutOption[] options)
{
return EditorGUILayout.BeginHorizontal(options);
}
public static Rect BeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginHorizontal(style, options);
}
public static void EndHorizontal()
{
EditorGUILayout.EndHorizontal();
}
public static Vector2 BeginScrollView(Vector2 scrollPosition, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginScrollView(scrollPosition, options);
}
public static Vector2 BeginScrollView(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginScrollView(scrollPosition, alwaysShowHorizontal, alwaysShowVertical, options);
}
public static Vector2 BeginScrollView(Vector2 scrollPosition, GUIStyle style, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginScrollView(scrollPosition, style, options);
}
public static Vector2 BeginScrollView(Vector2 scrollPosition, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginScrollView(scrollPosition, horizontalScrollbar, verticalScrollbar, options);
}
public static Vector2 BeginScrollView(Vector2 scrollPosition, bool alwaysShowHorizontal, bool alwaysShowVertical, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar, GUIStyle background, params GUILayoutOption[] options)
{
return EditorGUILayout.BeginScrollView(scrollPosition, alwaysShowHorizontal, alwaysShowVertical, horizontalScrollbar, verticalScrollbar, background, options);
}
public static void EndScrollView()
{
EditorGUILayout.EndScrollView();
}
public static bool BeginFadeGroup(float value)
{
return EditorGUILayout.BeginFadeGroup(value);
}
public static void EndFadeGroup()
{
EditorGUILayout.EndFadeGroup();
}
public static BuildTargetGroup BeginBuildTargetSelectionGrouping()
{
return EditorGUILayout.BeginBuildTargetSelectionGrouping();
}
public static void EndBuildTargetSelectionGrouping()
{
EditorGUILayout.EndBuildTargetSelectionGrouping();
}
public static void BeginLayoutIndent(int indentLevel)
{
GUILayout.BeginHorizontal();
GUILayout.Space(LucidEditorUtility.singleIndentWidth * indentLevel);
LucidEditorUtility.PushIndentLevel(0);
GUILayout.BeginVertical();
}
public static void EndLayoutIndent()
{
GUILayout.EndVertical();
LucidEditorUtility.PopIndentLevel();
GUILayout.EndHorizontal();
}
public static void BeginBoxGroup(string content, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
Rect headerRect = EditorGUILayout.GetControlRect(false, 20f, options);
headerRect.yMin -= 4f;
headerRect.xMin -= 4f;
headerRect.xMax += 4f;
EditorGUI.LabelField(headerRect, GUIContent.none, GUI.skin.button);
headerRect.xMin += 4f;
EditorGUI.LabelField(headerRect, content);
}
public static void EndBoxGroup()
{
EditorGUILayout.EndVertical();
}
public static bool BeginFoldoutGroup(bool foldout, string content, params GUILayoutOption[] options)
{
bool expanded = foldout;
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
Rect position = EditorGUILayout.GetControlRect(options);
Rect headerRect = position;
headerRect.yMin -= 3f;
headerRect.yMax += 3f;
headerRect.xMin -= 4f;
headerRect.xMax += 4f;
EditorGUI.LabelField(headerRect, GUIContent.none, GUI.skin.button);
position.x += 15f;
position.y -= 1f;
expanded = LucidEditorGUI.FoldoutToggle(position, foldout);
position.x += 2f;
position.y += 1f;
LucidEditorGUI.Header(position, content);
LucidGUIEvent.MouseDownEvent(position, () => expanded = !expanded);
if (expanded) EditorGUILayout.Space(2);
return expanded;
}
public static void EndFoldoutGroup()
{
EditorGUILayout.EndVertical();
}
public static int BeginTabGroup(int selected, string[] items, params GUILayoutOption[] options)
{
return BeginTabGroup(selected, EditorStyles.helpBox, items);
}
public static int BeginTabGroup(int selected, GUIStyle style, string[] items, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(style);
Rect position = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight + 2f, options.Append(GUILayout.MinWidth(0f)).ToArray());
position.xMin -= 4.2f;
position.xMax += 4.2f;
position.y -= 4.2f;
int value = LucidEditorGUI.Toolbar(position, selected, items);
return value;
}
public static void EndTabGroup()
{
EditorGUILayout.EndVertical();
}
public static bool BeginToggleGroup(string label, bool toggle, params GUILayoutOption[] options)
{
return BeginToggleGroup(label, toggle, EditorStyles.helpBox, options);
}
public static bool BeginToggleGroup(GUIContent label, bool toggle, params GUILayoutOption[] options)
{
return BeginToggleGroup(label, toggle, EditorStyles.helpBox, options);
}
public static bool BeginToggleGroup(string label, bool toggle, GUIStyle style, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(style, options);
bool enabled = ToggleLeft(label, toggle);
EditorGUI.BeginDisabledGroup(!enabled);
return enabled;
}
public static bool BeginToggleGroup(GUIContent label, bool toggle, GUIStyle style, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(style, options);
bool enabled = ToggleLeft(label, toggle);
EditorGUI.BeginDisabledGroup(!enabled);
return enabled;
}
public static void EndToggleGroup()
{
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndVertical();
}
public static bool BeginToggleFoldoutGroup(GUIContent label, bool foldout, ref bool toggle, params GUILayoutOption[] options)
{
return BeginToggleFoldoutGroup(label, foldout, ref toggle, options);
}
public static bool BeginToggleFoldoutGroup(string label, bool foldout, ref bool toggle, params GUILayoutOption[] options)
{
return BeginToggleFoldoutGroup(label, foldout, ref toggle, EditorStyles.helpBox, options);
}
public static bool BeginToggleFoldoutGroup(GUIContent label, bool foldout, ref bool toggle, GUIStyle style, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(style, options);
Rect position = EditorGUILayout.GetControlRect();
foldout = ToggleFoldoutGroupHeader(position, foldout);
position.x += 17f;
toggle = LucidEditorGUI.ToggleLeft(position, label, toggle);
EditorGUI.BeginDisabledGroup(!toggle);
return foldout;
}
public static bool BeginToggleFoldoutGroup(string label, bool foldout, ref bool toggle, GUIStyle style, params GUILayoutOption[] options)
{
EditorGUILayout.BeginVertical(style, options);
Rect position = EditorGUILayout.GetControlRect();
foldout = ToggleFoldoutGroupHeader(position, foldout);
position.x += 17f;
toggle = LucidEditorGUI.ToggleLeft(position, label, toggle);
EditorGUI.BeginDisabledGroup(!toggle);
return foldout;
}
public static void EndToggleFoldoutGroup()
{
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndVertical();
}
private static bool ToggleFoldoutGroupHeader(Rect position, bool foldout)
{
position.xMin += 15f;
foldout = LucidEditorGUI.FoldoutToggle(position, foldout);
position.xMin += 17f;
LucidGUIEvent.MouseDownEvent(position, () => foldout = !foldout);
return foldout;
}
public class BoxGroupScope : GUI.Scope
{
public BoxGroupScope(string content)
{
BeginBoxGroup(content);
}
protected override void CloseScope()
{
EndBoxGroup();
}
}
public class FoldoutGroupScope : GUI.Scope
{
public bool expanded { get; private set; }
public FoldoutGroupScope(bool foldout, string content)
{
expanded = BeginFoldoutGroup(foldout, content);
}
protected override void CloseScope()
{
EndFoldoutGroup();
}
}
public class TabGroupScope : GUI.Scope
{
public int selected { get; private set; }
public TabGroupScope(int selected, params string[] items)
{
this.selected = BeginTabGroup(selected, items);
}
public TabGroupScope(int selected, GUIStyle style, params string[] items)
{
this.selected = BeginTabGroup(selected, style, items);
}
protected override void CloseScope()
{
EndTabGroup();
}
}
public class ToggleFoldoutGroupScope : GUI.Scope
{
public bool expanded { get; private set; }
public bool enabled { get; private set; }
public ToggleFoldoutGroupScope(string label, bool foldout, bool toggle, GUIStyle style)
{
expanded = BeginToggleFoldoutGroup(label, foldout, ref toggle, style);
enabled = toggle;
}
public ToggleFoldoutGroupScope(GUIContent label, bool foldout, bool toggle, GUIStyle style)
{
expanded = BeginToggleFoldoutGroup(label, foldout, ref toggle, style);
enabled = toggle;
}
public ToggleFoldoutGroupScope(string label, bool foldout, bool toggle)
{
expanded = BeginToggleFoldoutGroup(label, foldout, ref toggle);
enabled = toggle;
}
public ToggleFoldoutGroupScope(GUIContent label, bool foldout, bool toggle)
{
expanded = BeginToggleFoldoutGroup(label, foldout, ref toggle);
enabled = toggle;
}
protected override void CloseScope()
{
EndToggleFoldoutGroup();
}
}
public class ToggleGroupScope : GUI.Scope
{
public bool enabled { get; private set; }
public ToggleGroupScope(string label, bool toggle, GUIStyle style)
{
BeginToggleGroup(label, toggle, style);
}
public ToggleGroupScope(GUIContent label, bool toggle, GUIStyle style)
{
BeginToggleGroup(label, toggle, style);
}
public ToggleGroupScope(string label, bool toggle)
{
BeginToggleGroup(label, toggle);
}
public ToggleGroupScope(GUIContent label, bool toggle)
{
BeginToggleGroup(label, toggle);
}
protected override void CloseScope()
{
EndToggleGroup();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0dcb07f0fee5c40559cc8236d5e6e3c7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,187 @@
using System.Collections.Generic;
using UnityEditor;
namespace Cainos.LucidEditor
{
public static class LucidEditorPrefs
{
public static bool HasKey<T>(string key)
{
return EditorPrefs.HasKey(key);
}
public static void DeleteKey(string key)
{
EditorPrefs.DeleteKey(key);
}
public static T Get<T>(string key)
{
T defaultValue = default(T);
string data = EditorPrefs.GetString(key);
if (string.IsNullOrEmpty(data)) return defaultValue;
switch (defaultValue)
{
case long longValue:
return GenericTypeConverter<T>.Convert<long>(long.Parse(data));
case int intValue:
return GenericTypeConverter<T>.Convert<int>(int.Parse(data));
case float floatValue:
return GenericTypeConverter<T>.Convert<float>(float.Parse(data));
case double doubleValue:
return GenericTypeConverter<T>.Convert<double>(double.Parse(data));
case bool boolValue:
return GenericTypeConverter<T>.Convert<bool>(bool.Parse(data));
case string stringValue:
return GenericTypeConverter<T>.Convert<string>(data);
default:
object obj = defaultValue;
EditorJsonUtility.FromJsonOverwrite(data, obj);
return (T)obj;
}
}
public static void Set<T>(string key, T value)
{
string data = null;
switch (value)
{
case long longValue:
case int intValue:
case double doubleValue:
case float floatValue:
case bool boolValue:
case string stringValue:
data = value.ToString();
break;
default:
data = EditorJsonUtility.ToJson(value);
break;
}
EditorPrefs.SetString(key, data);
}
public static bool HasConfigValueKey(string key)
{
return EditorUserSettings.GetConfigValue(key) != null;
}
public static T GetConfigValue<T>(string key)
{
T defaultValue = default(T);
string data = EditorUserSettings.GetConfigValue(key);
if (string.IsNullOrEmpty(data)) return defaultValue;
switch (defaultValue)
{
case long longValue:
return GenericTypeConverter<T>.Convert<long>(long.Parse(data));
case int intValue:
return GenericTypeConverter<T>.Convert<int>(int.Parse(data));
case float floatValue:
return GenericTypeConverter<T>.Convert<float>(float.Parse(data));
case double doubleValue:
return GenericTypeConverter<T>.Convert<double>(double.Parse(data));
case bool boolValue:
return GenericTypeConverter<T>.Convert<bool>(bool.Parse(data));
case string stringValue:
return GenericTypeConverter<T>.Convert<string>(data);
default:
object obj = defaultValue;
EditorJsonUtility.FromJsonOverwrite(data, obj);
return (T)obj;
}
}
public static void SetConfigValue<T>(string key, T value)
{
string data = null;
switch (value)
{
case long longValue:
case int intValue:
case double doubleValue:
case float floatValue:
case bool boolValue:
case string stringValue:
data = value.ToString();
break;
default:
data = EditorJsonUtility.ToJson(value);
break;
}
EditorUserSettings.SetConfigValue(key, data);
}
public static LocalPersistentData<T> CreateLocalPersistentData<T>(string key)
{
return new LocalPersistentData<T>(key);
}
public static GlobalPersistentData<T> CreateGlobalPersistentData<T>(string key)
{
return new GlobalPersistentData<T>(key);
}
}
public sealed class GlobalPersistentData<T>
{
internal GlobalPersistentData(string key)
{
this.key = key;
value = LucidEditorPrefs.Get<T>(key);
}
private string key;
private EqualityComparer<T> comparer = EqualityComparer<T>.Default;
private T value;
public T Value
{
get
{
return value;
}
set
{
if (!comparer.Equals(this.value, value))
{
LucidEditorPrefs.Set<T>(key, value);
}
this.value = value;
}
}
}
public sealed class LocalPersistentData<T>
{
internal LocalPersistentData(string key)
{
this.key = key;
value = LucidEditorPrefs.Get<T>(key);
}
private string key;
private EqualityComparer<T> comparer = EqualityComparer<T>.Default;
private T value;
public T Value
{
get
{
return value;
}
set
{
if (!comparer.Equals(this.value, value))
{
LucidEditorPrefs.Set<T>(key, value);
}
this.value = value;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 440549d8b0a5a4e4ca2a56d26b539708
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace Cainos.LucidEditor
{
public static class LucidEditorUtility
{
private static Stack<int> indentStack = new Stack<int>();
private static Stack<Color> guiColorStack = new Stack<Color>();
internal static int horizontalGroupCount;
public static float singleIndentWidth { get; set; } = 15f;
public static float currentIndentWidth
{
get
{
return EditorGUI.indentLevel * singleIndentWidth;
}
}
public static void PushIndentLevel(int indentLevel)
{
indentStack.Push(EditorGUI.indentLevel);
EditorGUI.indentLevel = indentLevel;
}
public static void PopIndentLevel()
{
EditorGUI.indentLevel = indentStack.Pop();
}
public static void PushGUIColor(Color color)
{
guiColorStack.Push(GUI.color);
GUI.color = color;
}
public static void PopGUIColor()
{
GUI.color = guiColorStack.Pop();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8befbc51965de48b687f7c67888ba902
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,107 @@
using System;
using UnityEngine;
namespace Cainos.LucidEditor
{
public static class LucidGUIEvent
{
public static bool isRepaint
{
get
{
return Event.current.type == EventType.Repaint;
}
}
public static bool isLayout
{
get
{
return Event.current.type == EventType.Layout;
}
}
public static bool isUsed
{
get
{
return Event.current.type == EventType.Used;
}
}
public static Vector2 mousePosition
{
get
{
return Event.current.mousePosition;
}
}
public static Vector2 mouseDelta
{
get
{
return Event.current.delta;
}
}
public static bool GetKeyDown(KeyCode keyCode, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.KeyDown && e.keyCode == keyCode, use);
}
public static bool GetKeyUp(KeyCode keyCode, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.KeyUp && e.keyCode == keyCode, use);
}
public static bool GetMouseButtonDown(int button, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseDown && e.button == button, use);
}
public static bool GetMouseButtonDown(int button, Rect rect, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseDown && e.button == button && rect.Contains(e.mousePosition), use);
}
public static bool GetMouseButtonUp(int button, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseUp && e.button == button, use);
}
public static bool GetMouseButtonUp(int button, Rect rect, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseUp && e.button == button && rect.Contains(e.mousePosition), use);
}
public static bool GetMouseButtonMultiClick(int button, int count, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseUp && e.button == button && e.clickCount == count, use);
}
public static bool GetMouseButtonMultiClick(int button, int count, Rect rect, bool use = false)
{
return GetGUIEvent(e => e.type == EventType.MouseUp && e.button == button && e.clickCount == count && rect.Contains(e.mousePosition), use);
}
private static bool GetGUIEvent(Func<Event, bool> func, bool use)
{
if (func == null) return false;
var e = Event.current;
bool result = func.Invoke(e);
if (result && use) e.Use();
return result;
}
internal static void MouseDownEvent(Rect rect, Action action)
{
var e = Event.current;
if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition) && e.button == 0)
{
action?.Invoke();
e.Use();
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More