添加插件
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Obvious.Soap.Example.Editor",
|
||||
"references": [
|
||||
"GUID:7bfe539b077dc974898ee3ed5a4be674",
|
||||
"GUID:ee6baafdecd94804a8714654c4bd097f",
|
||||
"GUID:d077ff18d774b9d479c2ce4c35deb3a1"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63a94bf298e26084badd91eb5fe3c960
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Obvious.Soap.Example.Editor
|
||||
{
|
||||
[CustomEditor(typeof(ScriptableSaveExample))]
|
||||
public class ScriptableSaveExampleEditor : UnityEditor.Editor
|
||||
{
|
||||
private string newItemName = "NewItem";
|
||||
private int levelValue = 0;
|
||||
|
||||
private float Spacing => EditorGUIUtility.singleLineHeight * 0.5f;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
ScriptableSaveExample scriptableSave = (ScriptableSaveExample)target;
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Useful Methods", EditorStyles.boldLabel);
|
||||
GUILayout.Space(Spacing);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
levelValue = EditorGUILayout.IntField("Level", levelValue);
|
||||
if (GUILayout.Button("Set Level"))
|
||||
{
|
||||
scriptableSave.SetLevel(levelValue);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(Spacing);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
newItemName = EditorGUILayout.TextField("Item Name", newItemName);
|
||||
if (GUILayout.Button("Add Item"))
|
||||
{
|
||||
scriptableSave.AddItem(new Item(newItemName));
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (GUILayout.Button("Clear Items"))
|
||||
{
|
||||
scriptableSave.ClearItems();
|
||||
}
|
||||
|
||||
GUILayout.Space(EditorGUIUtility.singleLineHeight);
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button("Save", GUILayout.Height(30f)))
|
||||
{
|
||||
scriptableSave.Save();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Load", GUILayout.Height(30f)))
|
||||
{
|
||||
scriptableSave.Load();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Print", GUILayout.Height(30f)))
|
||||
{
|
||||
scriptableSave.PrintToConsole();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button("Delete", GUILayout.Height(30f)))
|
||||
{
|
||||
scriptableSave.Delete();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Open Save Location", GUILayout.Height(30f)))
|
||||
{
|
||||
scriptableSave.OpenSaveLocation();
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 911286e00f665dc4aa3915bd1fbfb766
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user