BITFALL/Assets/Artists/Scripts/Editor/ItemEditor.cs

52 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using BITKit;
using BITKit.GameEditor;
using BITKit.UX;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace BITFALL.GameEditor
{
public class ItemEditor : ScriptableObjectGroupEditor<AssetableItem>
{
protected override string AssetsPath => "Assets/Artists/Configs/Items/";
[MenuItem("Tools/ScriptableObjectEditor/ItemEditor")]
public static void Open()
{
var window = GetWindow<ItemEditor>();
window.titleContent = new GUIContent("Item Editor");
window.Show();
}
protected override VisualElement MakeItem()
{
var container = new VisualElement();
var icon = container.Create<VisualElement>(UXConstant.Icon);
var label = container.Create<Label>(UXConstant.ContextLabel);
container.style.flexDirection = FlexDirection.Row;
container.style.alignContent = Align.Center;
container.style.alignItems = Align.Center;
icon.style.width = 24;
icon.style.height = 24;
return container;
}
protected override void BindItem(VisualElement arg1, int arg2)
{
var item = List[arg2];
var container = new UXContainer(arg1);
container.contextLabel.text = item.Name;
container.icon.style.backgroundImage = item.SquareIcon;
}
}
}