1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AYellowpaper.SerializedCollections;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
@@ -7,44 +8,13 @@ using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace BITKit
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user