case4
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace IngameDebugConsole
|
||||
{
|
||||
public abstract class ConsoleAttribute : Attribute
|
||||
{
|
||||
public MethodInfo Method { get; private set; }
|
||||
public abstract int Order { get; }
|
||||
|
||||
public void SetMethod(MethodInfo method)
|
||||
{
|
||||
if (Method != null)
|
||||
throw new Exception("Method was already initialized.");
|
||||
|
||||
Method = method;
|
||||
}
|
||||
|
||||
public abstract void Load();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efc4511f2eea8034ca3a0a29cac8f554
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace IngameDebugConsole
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
|
||||
public class ConsoleCustomTypeParserAttribute : ConsoleAttribute
|
||||
{
|
||||
public readonly Type type;
|
||||
public readonly string readableName;
|
||||
|
||||
public override int Order { get { return 0; } }
|
||||
|
||||
public ConsoleCustomTypeParserAttribute(Type type, string readableName = null)
|
||||
{
|
||||
this.type = type;
|
||||
this.readableName = readableName;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
DebugLogConsole.AddCustomParameterType(type, (DebugLogConsole.ParseFunction)Delegate.CreateDelegate(typeof(DebugLogConsole.ParseFunction), Method), readableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b014aa072d9631848babd5dafb325d3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace IngameDebugConsole
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Method, Inherited = false, AllowMultiple = true )]
|
||||
public class ConsoleMethodAttribute : ConsoleAttribute
|
||||
{
|
||||
private string m_command;
|
||||
private string m_description;
|
||||
private string[] m_parameterNames;
|
||||
|
||||
public string Command { get { return m_command; } }
|
||||
public string Description { get { return m_description; } }
|
||||
public string[] ParameterNames { get { return m_parameterNames; } }
|
||||
|
||||
public override int Order { get { return 1; } }
|
||||
|
||||
public ConsoleMethodAttribute( string command, string description, params string[] parameterNames )
|
||||
{
|
||||
m_command = command;
|
||||
m_description = description;
|
||||
m_parameterNames = parameterNames;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
DebugLogConsole.AddCommand(Command, Description, Method, null, ParameterNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 324bb39c0bff0f74fa42f83e91f07e3a
|
||||
timeCreated: 1520710946
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user