51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace BITKit.IO
|
|
{
|
|
public class UnityApplicationFile : MonoBehaviour
|
|
{
|
|
[SerializeReference,SubclassSelector] internal IApplicationFile service;
|
|
}
|
|
#if UNITY_EDITOR
|
|
[CustomEditor(typeof(UnityApplicationFile))]
|
|
public sealed class UnityApplicationFileInspector:BITInspector<UnityApplicationFile>
|
|
{
|
|
public override VisualElement CreateInspectorGUI()
|
|
{
|
|
FillDefaultInspector();
|
|
|
|
CreateSubTitle("Editor");
|
|
|
|
if (agent.service is null)
|
|
{
|
|
root.Create<Label>().text = "Service is null";
|
|
return root;
|
|
}
|
|
var current = agent.service.Current;
|
|
|
|
var saveButton = root.Create<Button>();
|
|
saveButton.text = "Save";
|
|
saveButton.clicked += agent.service.Save;
|
|
|
|
var loadButton = root.Create<Button>();
|
|
loadButton.text = "Load";
|
|
loadButton.clicked += ()=>agent.service.Load();
|
|
|
|
var currentPathLabel = root.Create<Label>();
|
|
currentPathLabel.text = current?.GetPath() ?? "No File";
|
|
|
|
var reloadButton = root.Create<Button>();
|
|
reloadButton.text = "Reload";
|
|
reloadButton.clicked += agent.service.Reload;
|
|
|
|
return root;
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
|