This commit is contained in:
CortexCore
2024-03-29 00:58:24 +08:00
parent 967ad8eacf
commit 05315ef4a8
232 changed files with 53368 additions and 8539 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using AYellowpaper.SerializedCollections;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UIElements;
@@ -11,40 +12,9 @@ namespace BITKit.GameEditor
{
public class AssetCacheScriptableObject : ScriptableObject
{
[SerializeField] private bool isEditable;
[SerializeField] private Object[] _assets;
public bool IsEditable => isEditable;
[SerializeField] private SerializedDictionary<string, Object[]> folders;
public Object[] Assets => _assets;
public Dictionary<string, Object[]> Folders=>folders;
}
#if UNITY_EDITOR
[CustomEditor(typeof(AssetCacheScriptableObject))]
public class AssetCacheScriptableObjectEditor : BITInspector<AssetCacheScriptableObject>
{
public override VisualElement CreateInspectorGUI()
{
root.root.Clear();
if (agent.IsEditable)
{
return base.CreateInspectorGUI();
}
var toggle = root.Create<Toggle>();
toggle.bindingPath = "isEditable";
toggle.label = "Edit";
toggle.RegisterValueChangedCallback(x => CreateInspectorGUI());
foreach (var x in agent.Assets)
{
var field = root.Create<ObjectField>();
//field.label = x.name;
field.style.opacity = 1;
field.value = x;
field.SetEnabled(false);
}
return root;
}
}
#endif
}