添加插件

This commit is contained in:
2025-11-10 00:08:26 +08:00
parent 4059c207c0
commit 76f80db694
2814 changed files with 436400 additions and 178 deletions

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 33dc52977f400d3419d2774a68a798c1
folderAsset: yes
timeCreated: 1602707605
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
using UnityEditor;
using UnityEngine;
namespace FIMSpace.FEditor
{
[CustomPropertyDrawer(typeof(FPropDrawers_DrawScriptableAttribute))]
public class FPropDrawers_DrawScriptableDrawer : PropertyDrawer
{
bool showProperty = false;
float DrawerHeight = 0;
string button = "►";
// Draw the property inside the given rect
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var e = Editor.CreateEditor(property.objectReferenceValue);
var indent = EditorGUI.indentLevel;
Rect temp = new Rect(position.x, position.y, 20, 16);
if (GUI.Button(temp, button))
if (showProperty)
{
showProperty = false;
button = "►";
}
else
{
showProperty = true;
button = "▼";
}
DrawerHeight = 0;
position.height = 16;
position.x += 20;
position.width -= 20;
EditorGUI.PropertyField(position, property);
position.width += 20;
position.x -= 20;
position.y += 20;
if (!showProperty) return;
if (e != null)
{
position.x += 20;
position.width -= 40;
var so = e.serializedObject;
so.Update();
var prop = so.GetIterator();
prop.NextVisible(true);
int depthChilden = 0;
bool showChilden = false;
while (prop.NextVisible(true))
{
if (prop.depth == 0) { showChilden = false; depthChilden = 0; }
if (showChilden && prop.depth > depthChilden)
{
continue;
}
position.height = 16;
EditorGUI.indentLevel = indent + prop.depth;
if (EditorGUI.PropertyField(position, prop))
{
showChilden = false;
}
else
{
showChilden = true;
depthChilden = prop.depth;
}
position.y += 20;
SetDrawerHeight(20);
}
if (GUI.changed)
{
so.ApplyModifiedProperties();
}
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
float height = base.GetPropertyHeight(property, label);
height += DrawerHeight;
return height;
}
void SetDrawerHeight(float height)
{
DrawerHeight += height;
}
}
public class FPropDrawers_DrawScriptableAttribute : PropertyAttribute
{
}
}

View File

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

View File

@@ -0,0 +1,107 @@
using UnityEditor;
using UnityEngine;
namespace FIMSpace.FEditor
{
[CustomPropertyDrawer(typeof(FPD_OverridableFloatAttribute))]
public class FPD_OverridableFloat : PropertyDrawer
{
FPD_OverridableFloatAttribute Attribute { get { return ((FPD_OverridableFloatAttribute)base.attribute); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var boolProp = property.serializedObject.FindProperty(Attribute.BoolVarName);
var valProp = property.serializedObject.FindProperty(Attribute.TargetVarName);
Color disabled = new Color(0.8f, 0.8f, 0.8f, 0.6f);
Color preCol = GUI.color;
if (!boolProp.boolValue) GUI.color = disabled; else GUI.color = preCol;
EditorGUI.BeginProperty(position, label, property);
var boolRect = new Rect(position.x, position.y, Attribute.LabelWidth + 15f, position.height);
EditorGUIUtility.labelWidth = Attribute.LabelWidth;
EditorGUI.PrefixLabel(position, label);
EditorGUI.PropertyField(boolRect, boolProp);
EditorGUIUtility.labelWidth = 14;
var valRect = new Rect(position.x + Attribute.LabelWidth + 15, position.y, position.width - (Attribute.LabelWidth + 15), position.height);
EditorGUI.PropertyField(valRect, valProp, new GUIContent(" "));
EditorGUIUtility.labelWidth = 0;
GUI.color = preCol;
EditorGUI.EndProperty();
}
}
// -------------------------- Next F Property Drawer -------------------------- \\
[CustomPropertyDrawer(typeof(BackgroundColorAttribute))]
public class BackgroundColorDecorator : DecoratorDrawer
{
BackgroundColorAttribute Attribute { get { return ((BackgroundColorAttribute)base.attribute); } }
public override float GetHeight() { return 0; }
public override void OnGUI(Rect position)
{
GUI.backgroundColor = Attribute.Color;
}
}
// -------------------------- Next F Property Drawer -------------------------- \\
[CustomPropertyDrawer(typeof(FPD_WidthAttribute))]
public class FPD_Width : PropertyDrawer
{
FPD_WidthAttribute Attribute { get { return ((FPD_WidthAttribute)base.attribute); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUIUtility.labelWidth = Attribute.LabelWidth;
EditorGUI.PrefixLabel(position, label);
EditorGUI.PropertyField(position, property);
EditorGUIUtility.labelWidth = 0;
}
}
// -------------------------- Next F Property Drawer -------------------------- \\
[CustomPropertyDrawer(typeof(FPD_IndentAttribute))]
public class FPD_Indent : PropertyDrawer
{
FPD_IndentAttribute Attribute { get { return ((FPD_IndentAttribute)base.attribute); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUIUtility.labelWidth = Attribute.LabelsWidth;
for (int i = 0; i < Attribute.IndentCount; i++) EditorGUI.indentLevel++;
EditorGUI.PrefixLabel(position, label);
EditorGUI.PropertyField(position, property);
for (int i = 0; i < Attribute.IndentCount; i++) EditorGUI.indentLevel--;
EditorGUIUtility.labelWidth = 0;
GUILayout.Space(Attribute.SpaceAfter);
}
}
// -------------------------- Next F Property Drawer -------------------------- \\
[CustomPropertyDrawer(typeof(FPD_HorizontalLineAttribute))]
public class FPD_HorizontalLine : PropertyDrawer
{
FPD_HorizontalLineAttribute Attribute { get { return ((FPD_HorizontalLineAttribute)base.attribute); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
FGUI_Inspector.DrawUILine(Attribute.color);
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: b65c850de06f12c4aa781383b5a038cd
timeCreated: 1543091521
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: