initial commit

This commit is contained in:
Aggtaa
2026-01-20 10:02:31 +03:00
commit 17e2c3ab8b
125 changed files with 18236 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(Resource), true)]
public class ResourceDrawer : PropertyDrawer
{
private static Resource[] resources;
// public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
// {
// if (property.managedReferenceValue == null)
// return EditorGUIUtility.singleLineHeight;
// // Высота для выпадающего списка + внутренних полей
// return EditorGUI.GetPropertyHeight(property, true);
// }
private static void Initialize()
{
resources = ResourceStorage.RegisteredResources;
// if (resourceTypes == null)
// {
// resourceTypes = AppDomain
// .CurrentDomain.GetAssemblies()
// .SelectMany(a => a.GetTypes())
// .Where(t => t.IsSubclassOf(typeof(Resource)) && !t.IsAbstract)
// .ToArray();
// }
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
Initialize();
var currentValue = property.managedReferenceValue;
int newIndex = EditorGUILayout.Popup(
label.text,
Array.IndexOf(resources, currentValue),
resources.Select(t => t.Name).ToArray()
);
if (newIndex >= 0 && currentValue != resources[newIndex])
{
currentValue = resources[newIndex];
property.managedReferenceValue = currentValue;
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f5cfbba1554569443ae9fc69bcabd60f