1
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
"GUID:15fc0a57446b3144c949da3e2b9737a9",
|
||||
"GUID:be17a8778dbfe454890ed8279279e153",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:9400d40641bab5b4a9702f65bf5c6eb5"
|
||||
"GUID:9400d40641bab5b4a9702f65bf5c6eb5",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
50
Src/Unity/Scripts/Utils/UnityApplicationFile.cs
Normal file
50
Src/Unity/Scripts/Utils/UnityApplicationFile.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
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
|
||||
}
|
||||
|
11
Src/Unity/Scripts/Utils/UnityApplicationFile.cs.meta
Normal file
11
Src/Unity/Scripts/Utils/UnityApplicationFile.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98a1c31e4cfd23347b2d2fdc6bbf1856
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user