From e846c64d6f927879cb8a095e62d773a8d7b3c9f4 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 07:24:10 +0800 Subject: *ability system --- .../AdvancedInspector/Interface/ICopiable.cs | 18 +++++++++ .../AdvancedInspector/Interface/ICopiable.cs.meta | 8 ++++ .../Plugins/AdvancedInspector/Interface/ICopy.cs | 18 +++++++++ .../AdvancedInspector/Interface/ICopy.cs.meta | 8 ++++ .../AdvancedInspector/Interface/IDataChanged.cs | 24 ++++++++++++ .../Interface/IDataChanged.cs.meta | 8 ++++ .../Interface/IInspectorRunning.cs | 29 ++++++++++++++ .../Interface/IInspectorRunning.cs.meta | 8 ++++ .../AdvancedInspector/Interface/IListAttribute.cs | 12 ++++++ .../Interface/IListAttribute.cs.meta | 8 ++++ .../AdvancedInspector/Interface/IPreview.cs | 26 +++++++++++++ .../AdvancedInspector/Interface/IPreview.cs.meta | 8 ++++ .../Interface/IRuntimeAttribute.cs | 44 ++++++++++++++++++++++ .../Interface/IRuntimeAttribute.cs.meta | 8 ++++ 14 files changed, 227 insertions(+) create mode 100644 Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/ICopy.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/ICopy.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IPreview.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IPreview.cs.meta create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs create mode 100644 Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs.meta (limited to 'Assets/Plugins/AdvancedInspector/Interface') diff --git a/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs b/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs new file mode 100644 index 00000000..8498e056 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AdvancedInspector +{ + /// + /// Give an object the power to detect if it can be clone to the target location. + /// + public interface ICopiable + { + /// + /// Should return true if the object can be copied to replace the object destination. + /// + bool Copiable(object destination); + } +} diff --git a/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs.meta new file mode 100644 index 00000000..fe1413d4 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/ICopiable.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5be419eaa25267d4abffe1323b92fdba +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs b/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs new file mode 100644 index 00000000..d3584276 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AdvancedInspector +{ + /// + /// Give an object the power to handle it's own copying over an target destination. + /// + public interface ICopy + { + /// + /// Should return a copy of itself. The overriden destination object is passed in case important fields are not to be replaced. + /// + object Copy(object destination); + } +} diff --git a/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs.meta new file mode 100644 index 00000000..e96268ea --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/ICopy.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3c8bf575d7676a4bb245bda97724449 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs b/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs new file mode 100644 index 00000000..65e93a85 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using System; +using System.Collections; + +namespace AdvancedInspector +{ + /// + /// Define an interface called when the Inspector has performed changes. + /// The event works the other way around, as a way to notify the Inspector something changed and needs to be refreshed. + /// + public interface IDataChanged + { + /// + /// Fired when the Inspector changed. + /// + void DataChanged(); + + /// + /// Should be fired internal by the object when the fields structure changed. + /// Ex.: Added an object to a list. + /// + event GenericEventHandler OnDataChanged; + } +} \ No newline at end of file diff --git a/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs.meta new file mode 100644 index 00000000..957af94f --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IDataChanged.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d075315f0f1460743ac06aafae48b280 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs b/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs new file mode 100644 index 00000000..c2038537 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AdvancedInspector +{ + /// + /// When implementing this, gives the object ability to draw the header and footer of the Inspector's space. + /// + public interface IInspectorRunning + { + /// + /// Draw at the top of the inspector, in this order; + /// - This + /// - Class Helpbox + /// - Tabs + /// rest of the fields + /// + void OnHeaderGUI(); + + /// + /// Draw at the bottom of the inspector, in this order; + /// - Helpbox + /// - This + /// + void OnFooterGUI(); + } +} \ No newline at end of file diff --git a/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs.meta new file mode 100644 index 00000000..ad85b3be --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IInspectorRunning.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94767ceadd7c79e4da722e9aa451f87e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs b/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs new file mode 100644 index 00000000..2f020402 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace AdvancedInspector +{ + /// + /// Define an attribute that can be passed down to list/array elements. + /// + public interface IListAttribute { } +} diff --git a/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs.meta new file mode 100644 index 00000000..d180ca1e --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IListAttribute.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fec0fc7a00e58804ab5c94aa860790b7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs b/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs new file mode 100644 index 00000000..9dcf487c --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using UnityEngine; + +namespace AdvancedInspector +{ + /// + /// Implements the method required to display an inspector preview. + /// + public interface IPreview + { + /// + /// This should return instance(s) of the following type; + /// GameObject + /// Mesh + /// Material + /// Texture + /// Cubemap + /// If return null or empty array, preview is turned off. + /// + UnityEngine.Object[] Preview { get; } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs.meta new file mode 100644 index 00000000..841448df --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IPreview.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bea75a5ed3255024b904a3ebfddcb15b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs b/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs new file mode 100644 index 00000000..10710819 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; + +namespace AdvancedInspector +{ + /// + /// Define an attribute that stores a method name + /// Which should be turned into a delegate at runtime. + /// + public interface IRuntimeAttribute : IRuntimeAttribute + { + /// + /// Invoke the internal delegates and returns the requested values. + /// T should be the same type as the Delegate return type. + /// + T Invoke(int index, object instance, object value); + } + + public interface IRuntimeAttribute + { + /// + /// Name of the MethodInfo to retrieve at runtime. + /// + string MethodName { get; } + + /// + /// Prototype template of the delegate to create + /// + Type Template { get; } + + /// + /// Prototype template for static external delegate + /// + Type TemplateStatic { get; } + + /// + /// List of delegates to invoke. + /// + List Delegates { get; set; } + } +} \ No newline at end of file diff --git a/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs.meta b/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs.meta new file mode 100644 index 00000000..54a67e7e --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Interface/IRuntimeAttribute.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a59d020caab68e44bbc71d13e9f12fc1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: -- cgit v1.1-26-g67d0