This commit is contained in:
Даниил Заикин
2026-06-17 20:44:53 +03:00
parent 9d153773c2
commit b133e7c656
1880 changed files with 244545 additions and 0 deletions
@@ -0,0 +1,49 @@
using System;
using System.Linq;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace QFSW.QC
{
/// <summary>
/// Marks the associated method as a command, allowing it to be loaded by the QuantumConsoleProcessor. This means it will be usable as a command from a Quantum Console.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
public sealed class CommandAttribute : Attribute
{
public readonly string Alias;
public readonly string Description;
public readonly Platform SupportedPlatforms;
public readonly MonoTargetType MonoTarget;
public readonly bool Valid = true;
private static readonly char[] _bannedAliasChars = new char[] { ' ', '(', ')', '{', '}', '[', ']', '<', '>' };
public CommandAttribute([CallerMemberName] string aliasOverride = "", Platform supportedPlatforms = Platform.AllPlatforms, MonoTargetType targetType = MonoTargetType.Single)
{
Alias = aliasOverride;
MonoTarget = targetType;
SupportedPlatforms = supportedPlatforms;
for (int i = 0; i < _bannedAliasChars.Length; i++)
{
if (Alias.Contains(_bannedAliasChars[i]))
{
string errorMessage = $"Development Processor Error: Command with alias '{Alias}' contains the char '{_bannedAliasChars[i]}' which is banned. Unexpected behaviour may occur.";
Debug.LogError(errorMessage);
Valid = false;
throw new ArgumentException(errorMessage, nameof(aliasOverride));
}
}
}
public CommandAttribute(string aliasOverride, MonoTargetType targetType, Platform supportedPlatforms = Platform.AllPlatforms) : this(aliasOverride, supportedPlatforms, targetType) { }
public CommandAttribute(string aliasOverride, string description, Platform supportedPlatforms = Platform.AllPlatforms, MonoTargetType targetType = MonoTargetType.Single) : this(aliasOverride, supportedPlatforms, targetType)
{
Description = description;
}
public CommandAttribute(string aliasOverride, string description, MonoTargetType targetType, Platform supportedPlatforms = Platform.AllPlatforms) : this(aliasOverride, description, supportedPlatforms, targetType) { }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8115824be443344f29ef0da5a1c05a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
using System;
namespace QFSW.QC
{
/// <summary>Provides a command with a description. If the [Command] attribute already provides a description, that will supersede this one. Useful for when you have several [Command]s on a single method.</summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class CommandDescriptionAttribute : Attribute
{
public readonly string Description;
public readonly bool Valid;
public CommandDescriptionAttribute(string description)
{
Description = description;
Valid = !string.IsNullOrWhiteSpace(description);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e52ff948b143dc54684640418a70f825
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
using System;
namespace QFSW.QC
{
/// <summary>Provides a command paremeter with a description.</summary>
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class CommandParameterDescriptionAttribute : Attribute
{
public readonly string Description;
public readonly bool Valid;
public CommandParameterDescriptionAttribute(string description)
{
Description = description;
Valid = !string.IsNullOrWhiteSpace(description);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c171fb328ed92146bd061b07d446a1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
using System;
namespace QFSW.QC
{
/// <summary>Determines which platforms the command is available on. Supersedes platform availability determined in the [Command].</summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public sealed class CommandPlatformAttribute : Attribute
{
public readonly Platform SupportedPlatforms;
public CommandPlatformAttribute(Platform supportedPlatforms)
{
SupportedPlatforms = supportedPlatforms;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d0cd481e1faecd4a8159c22114d7d9a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,35 @@
using System;
using System.Linq;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace QFSW.QC
{
/// <summary>
/// Creates a prefix that will be prepended to all commands made within this class. Works recursively with sub-classes.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class CommandPrefixAttribute : Attribute
{
public readonly string Prefix;
public readonly bool Valid = true;
private static readonly char[] _bannedAliasChars = { ' ', '(', ')', '{', '}', '[', ']', '<', '>' };
public CommandPrefixAttribute([CallerMemberName] string prefixName = "")
{
Prefix = prefixName;
foreach (var c in _bannedAliasChars)
{
if (Prefix.Contains(c))
{
string errorMessage = $"Development Processor Error: Command prefix '{Prefix}' contains the char '{c}' which is banned. Unexpected behaviour may occurr.";
Debug.LogError(errorMessage);
Valid = false;
throw new ArgumentException(errorMessage, nameof(prefixName));
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e8b3bb27784b8544785af220e6f8b39a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using System;
namespace QFSW.QC
{
/// <summary>
/// Instructs QC to ignore this entity when scanning the code base for commands.
/// This can be used to optimise QCs loading times in large codebases when there are large entities that do not have any commands present.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class QcIgnoreAttribute : Attribute { }
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9509f39d8a98d44784d6efc252ed5d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: