增加A2WToolBox工具集,增加Launch场景核LaunchPanel

This commit is contained in:
Wurui
2025-11-08 11:06:48 +08:00
parent 3e92e5684a
commit 3b43829e85
726 changed files with 87807 additions and 215 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ff59c477e0a3ce4d91ae1ae98be3c80
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
{
"name": "EventBetter"
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 72b24636a1274304cacde1d74b47e29b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,656 @@
// EventBetter
// Copyright (c) 2018, Piotr Gwiazdowski <gwiazdorrr+github at gmail.com>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
/// <summary>
/// Intentionally made partial, in case you want to extend it easily.
/// </summary>
public static partial class EventBetter
{
/// <summary>
/// Register a message handler.
///
/// The <paramref name="handler"/> will be invoked every time a message of type <typeparamref name="MessageType"/> is raised,
/// unless <paramref name="listener"/> gets destroyed or one of Unlisten/Clear methods is called.
/// </summary>
/// <typeparam name="ListenerType"></typeparam>
/// <typeparam name="MessageType"></typeparam>
/// <param name="listener"></param>
/// <param name="handler"></param>
/// <param name="once">After the <paramref name="handler"/> is invoked - unlisten automatically.</param>
/// <param name="excludeInactive">If <paramref name="listener"/> is a Behaviour or GameObject, will only invoke <paramref name="handler"/>
/// if <paramref name="listener"/> is active and enabled.</param>
/// <exception cref="System.InvalidOperationException">Thrown if the internal worker has been disabled somehow.</exception>
public static void Listen<ListenerType, MessageType>(ListenerType listener, System.Action<MessageType> handler,
bool once = false,
bool excludeInactive = false,
bool persistent = false)
where ListenerType : UnityEngine.Object
{
HandlerFlags flags = HandlerFlags.IsUnityObject;
if (once)
flags |= HandlerFlags.Once;
if (excludeInactive)
flags |= HandlerFlags.OnlyIfActiveAndEnabled;
if (persistent)
flags |= HandlerFlags.Persistent;
RegisterInternal(listener, handler, flags);
}
/// <summary>
/// Register a message handler. No listener, you unregister by calling <see cref="IDisposable.Dispose">Dispose</see> on returned object.
/// Handler is not limited in what it is allowed to capture.
/// </summary>
/// <typeparam name="MessageType"></typeparam>
/// <param name="handler"></param>
/// <returns></returns>
public static IDisposable ListenManual<MessageType>(System.Action<MessageType> handler)
{
// use the dict as a listener here, it will ensure the handler is going to live forever
var actualHandler = RegisterInternal<object, MessageType>(s_entries, (msg) => handler(msg), HandlerFlags.None);
return new ManualHandlerDisposable()
{
Handler = actualHandler,
MessageType = typeof(MessageType)
};
}
/// <summary>
/// Invoke all registered handlers for this message type immediately.
/// </summary>
/// <typeparam name="MessageType"></typeparam>
/// <param name="message"></param>
/// <returns>True if there are any handlers for this message type, false otherwise.</returns>
public static bool Raise<MessageType>(MessageType message)
{
return RaiseInternal(message);
}
/// <summary>
/// Unregisters all <typeparamref name="MessageType"/> handlers for a given listener.
/// </summary>
/// <typeparam name="MessageType"></typeparam>
/// <param name="listener"></param>
/// <returns>True if there were any handlers, false otherwise.</returns>
public static bool Unlisten<MessageType>(UnityEngine.Object listener)
{
if (listener == null)
throw new ArgumentNullException("listener");
return UnregisterInternal(typeof(MessageType), listener, (eventEntry, index, referenceListener) => object.ReferenceEquals(eventEntry.listeners[index], referenceListener));
}
/// <summary>
/// Unregisters all message types for a given listener.
/// </summary>
/// <param name="listener"></param>
/// <returns>True if there were any handlers, false otherwise.</returns>
public static bool UnlistenAll(UnityEngine.Object listener)
{
if (listener == null)
throw new ArgumentNullException("listener");
bool anyListeners = false;
foreach (var entry in s_entriesList)
{
anyListeners |= UnregisterInternal(entry, listener, (eventEntry, index, referenceListener) => object.ReferenceEquals(eventEntry.listeners[index], referenceListener));
}
return anyListeners;
}
/// <summary>
/// Unregisters everything.
/// </summary>
public static void Clear(bool clearPersistent = true)
{
if (clearPersistent)
{
s_entries.Clear();
s_entriesList.Clear();
}
else
{
foreach (var entry in s_entriesList)
{
RemoveNonPersistentHandlers(entry);
}
}
}
/// <summary>
/// Removes handlers that will now longer be called because their listeners have been destroyed. Normally
/// there's no reason to call that, since EventBetter does it behind the scenes in every LateUpdate.
/// </summary>
public static void RemoveUnusedHandlers()
{
foreach (var entry in s_entriesList)
{
RemoveUnusedHandlers(entry);
}
}
#region Coroutine Support
/// <summary>
/// Use this in coroutines. Yield will return when at least one event of type <typeparamref name="MessageType"/>
/// has been raised. To get the messages use <see cref="YieldListener{MessageType}.First"/> or
/// <see cref="YieldListener{MessageType}.Messages"/>
/// </summary>
/// <typeparam name="MessageType"></typeparam>
/// <returns></returns>
public static YieldListener<MessageType> ListenWait<MessageType>()
where MessageType : class
{
return new YieldListener<MessageType>();
}
public class YieldListener<MessageType> : System.Collections.IEnumerator, IDisposable
where MessageType : class
{
private Delegate handler;
public List<MessageType> Messages { get; private set; }
public MessageType First
{
get
{
if (Messages == null || Messages.Count == 0)
return null;
return Messages[0];
}
}
internal YieldListener()
{
handler = EventBetter.RegisterInternal<YieldListener<MessageType>, MessageType>(
this, (msg) => OnMessage(msg), HandlerFlags.DontInvokeIfAddedInAHandler);
}
public void Dispose()
{
if (handler != null)
{
EventBetter.UnlistenHandler(typeof(MessageType), handler);
handler = null;
}
}
private void OnMessage(MessageType msg)
{
if (Messages == null)
{
Messages = new List<MessageType>();
}
Messages.Add(msg);
}
bool System.Collections.IEnumerator.MoveNext()
{
if (Messages != null)
{
Dispose();
return false;
}
return true;
}
object System.Collections.IEnumerator.Current
{
get { return null; }
}
void System.Collections.IEnumerator.Reset()
{
}
}
#endregion
#region Async Support
public static async Task<MessageType> ListenAsync<MessageType>()
{
var tcs = new TaskCompletionSource<MessageType>();
var handler = RegisterInternal<object, MessageType>(s_entries,
(msg) => tcs.SetResult(msg), HandlerFlags.DontInvokeIfAddedInAHandler);
try
{
return await tcs.Task;
}
finally
{
EventBetter.UnlistenHandler(typeof(MessageType), handler);
}
}
#endregion
#region Private
private class ManualHandlerDisposable : IDisposable
{
public Type MessageType { get; set; }
public Delegate Handler { get; set; }
public void Dispose()
{
if (Handler == null)
return;
try
{
UnlistenHandler(MessageType, Handler);
}
finally
{
MessageType = null;
Handler = null;
}
}
}
[Flags]
private enum HandlerFlags
{
None = 0,
OnlyIfActiveAndEnabled = 1 << 0,
Once = 1 << 1,
DontInvokeIfAddedInAHandler = 1 << 2,
IsUnityObject = 1 << 3,
Persistent = 1 << 4,
}
private class EventEntry
{
public uint invocationCount = 0;
public bool needsCleanup = false;
public readonly List<object> listeners = new List<object>();
public readonly List<Delegate> handlers = new List<Delegate>();
public readonly List<HandlerFlags> flags = new List<HandlerFlags>();
public int Count
{
get { return listeners.Count; }
}
public bool HasFlag(int i, HandlerFlags flag)
{
return (flags[i] & flag) == flag;
}
public void SetFlag(int i, HandlerFlags flag, bool value)
{
if (value)
{
flags[i] |= flag;
}
else
{
flags[i] &= ~flag;
}
}
public void Add(object listener, Delegate handler, HandlerFlags flag)
{
UnityEngine.Debug.Assert(listeners.Count == handlers.Count);
// if not in a handler, don't set this flag as it would ignore first
// nested handler
if (invocationCount == 0)
flag &= ~HandlerFlags.DontInvokeIfAddedInAHandler;
listeners.Add(listener);
handlers.Add(handler);
flags.Add(flag);
}
public void NullifyAt(int i)
{
UnityEngine.Debug.Assert(listeners.Count == handlers.Count);
listeners[i] = null;
handlers[i] = null;
flags[i] = HandlerFlags.None;
}
public void RemoveAt(int i)
{
UnityEngine.Debug.Assert(listeners.Count == handlers.Count);
listeners.RemoveAt(i);
handlers.RemoveAt(i);
flags.RemoveAt(i);
}
}
/// <summary>
/// For lookups.
/// </summary>
private static Dictionary<Type, EventEntry> s_entries = new Dictionary<Type, EventEntry>();
/// <summary>
/// For faster iteration.
/// </summary>
private static List<EventEntry> s_entriesList = new List<EventEntry>();
private static bool RaiseInternal<T>(T message)
{
EventEntry entry;
if (!s_entries.TryGetValue(typeof(T), out entry))
return false;
bool hadActiveHandlers = false;
var invocationCount = ++entry.invocationCount;
try
{
int initialCount = entry.Count;
for (int i = 0; i < entry.Count; ++i)
{
var listener = GetAliveTarget(entry.listeners[i]);
bool removeHandler = true;
if (listener != null)
{
if (entry.HasFlag(i, HandlerFlags.OnlyIfActiveAndEnabled))
{
var behaviour = listener as UnityEngine.Behaviour;
if (!ReferenceEquals(behaviour, null))
{
if (!behaviour.isActiveAndEnabled)
continue;
}
var go = listener as GameObject;
if (!ReferenceEquals(go, null))
{
if (!go.activeInHierarchy)
continue;
}
}
if (i >= initialCount)
{
// this is a new handler; if it has a protection flag, don't call it
if (entry.HasFlag(i, HandlerFlags.DontInvokeIfAddedInAHandler))
{
entry.SetFlag(i, HandlerFlags.DontInvokeIfAddedInAHandler, false);
continue;
}
}
if (!entry.HasFlag(i, HandlerFlags.Once))
{
removeHandler = false;
}
((Action<T>)entry.handlers[i])(message);
hadActiveHandlers = true;
}
if (removeHandler)
{
if (invocationCount == 1)
{
// it's OK to compact now
entry.RemoveAt(i);
--i;
--initialCount;
}
else
{
// need to wait
entry.needsCleanup = true;
entry.NullifyAt(i);
}
}
}
}
finally
{
UnityEngine.Debug.Assert(invocationCount == entry.invocationCount);
--entry.invocationCount;
if (invocationCount == 1 && entry.needsCleanup)
{
entry.needsCleanup = false;
RemoveUnusedHandlers(entry);
}
}
return hadActiveHandlers;
}
private static Delegate RegisterInternal<ListenerType, MessageType>(ListenerType listener, System.Action<MessageType> handler, HandlerFlags flags)
{
return RegisterInternal<MessageType>(listener, handler, flags);
}
private static Delegate RegisterInternal<T>(object listener, Action<T> handler, HandlerFlags flags)
{
if (listener == null)
throw new ArgumentNullException("listener");
if (handler == null)
throw new ArgumentNullException("handler");
if ((flags & HandlerFlags.IsUnityObject) == HandlerFlags.IsUnityObject)
{
Debug.Assert(listener is UnityEngine.Object);
}
EventEntry entry;
if (!s_entries.TryGetValue(typeof(T), out entry))
{
entry = new EventEntry();
s_entries.Add(typeof(T), entry);
s_entriesList.Add(entry);
}
entry.Add(listener, handler, flags);
return handler;
}
private static bool UnlistenHandler(Type messageType, Delegate handler)
{
return EventBetter.UnregisterInternal(messageType, handler, (eventEntry, index, _handler) => eventEntry.handlers[index] == _handler);
}
private static bool UnregisterInternal<ParamType>(Type messageType, ParamType param, Func<EventEntry, int, ParamType, bool> predicate)
{
EventEntry entry;
if (!s_entries.TryGetValue(messageType, out entry))
{
return false;
}
return UnregisterInternal(entry, param, predicate);
}
private static bool UnregisterInternal<ParamType>(EventEntry entry, ParamType param, Func<EventEntry, int, ParamType, bool> predicate)
{
bool found = false;
for (int i = 0; i < entry.Count; ++i)
{
if (entry.listeners[i] == null)
continue;
if (predicate != null && !predicate(entry, i, param))
continue;
found = true;
if (entry.invocationCount == 0)
{
// it's ok to compact now
entry.RemoveAt(i);
--i;
}
else
{
// need to wait
entry.needsCleanup = true;
entry.NullifyAt(i);
}
}
return found;
}
private static object GetAliveTarget(object target)
{
if (target == null)
return null;
var targetAsUnityObject = target as UnityEngine.Object;
if (object.ReferenceEquals(targetAsUnityObject, null))
return target;
if (targetAsUnityObject)
return target;
return null;
}
private static void RemoveUnusedHandlers(EventEntry entry)
{
for (int i = 0; i < entry.Count; ++i)
{
var listener = entry.listeners[i];
if (entry.HasFlag(i, HandlerFlags.IsUnityObject))
{
if ((UnityEngine.Object)listener != null)
continue;
}
else
{
if (listener != null)
continue;
}
if (entry.invocationCount == 0)
entry.RemoveAt(i--);
else
entry.NullifyAt(i);
}
}
private static void RemoveNonPersistentHandlers(EventEntry entry)
{
for (int i = 0; i < entry.Count; ++i)
{
if (entry.HasFlag(i, HandlerFlags.Persistent))
{
continue;
}
Debug.Assert(entry.invocationCount == 0);
entry.RemoveAt(i--);
}
}
#endregion
#region Player Loop System Registration
struct EventBetterCleanupSystem
{
}
static EventBetter()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.playModeStateChanged += (change) =>
{
if (change == UnityEditor.PlayModeStateChange.ExitingPlayMode || change == UnityEditor.PlayModeStateChange.ExitingEditMode)
{
Clear(clearPersistent: false);
}
};
#endif
var rootPlayerLoopSystem = PlayerLoop.GetCurrentPlayerLoop();
var playerLoopSystemTypes = GetPlayerLoopSystemHierarchy(typeof(PreLateUpdate.ScriptRunBehaviourLateUpdate));
RegisterPlayerLoopSystem(ref rootPlayerLoopSystem, playerLoopSystemTypes);
PlayerLoop.SetPlayerLoop(rootPlayerLoopSystem);
Type[] GetPlayerLoopSystemHierarchy(Type systemType)
{
List<Type> result = new();
for (var t = systemType; t != null; t = t.DeclaringType)
{
result.Insert(0, t);
}
return result.ToArray();
}
void RegisterPlayerLoopSystem(ref PlayerLoopSystem parentSystem, Span<Type> subSystemTypes)
{
Debug.Assert(subSystemTypes.Length >= 1);
ref PlayerLoopSystem[] list = ref parentSystem.subSystemList;
if (list != null)
{
for (int i = 0; i < list.Length; ++i)
{
if (list[i].type != subSystemTypes[0])
{
continue;
}
if (subSystemTypes.Length == 1)
{
// insert after
var newSystem = new PlayerLoopSystem()
{
type = typeof(EventBetterCleanupSystem),
updateDelegate = EventBetter.RemoveUnusedHandlers
};
List<PlayerLoopSystem> tmpList = list.ToList();
tmpList.Insert(i+1, newSystem);
list = tmpList.ToArray();
}
else
{
RegisterPlayerLoopSystem(ref list[i], subSystemTypes.Slice(1));
}
return;
}
}
throw new InvalidOperationException($"SubSystem {subSystemTypes[0]} is not found in {parentSystem.type}");
}
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 29b3b48fff4cd3c428bf37cd35cc6151
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2fbf7c62a2cdb32488597d6ae682221b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f1c5c604e6d27cc4d86e81f45c704e11
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 66686847ee1fa044bb15dfe473666178
folderAsset: yes
timeCreated: 1507995546
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1f67e408a6d0adf4ab29d095ccd8b116
folderAsset: yes
timeCreated: 1507998942
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c76425e719cd4424d868674bcfb233f2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class AllowNestingAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95b49d3abe880c044adbe7faf6b7b4ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using System;
using UnityEngine;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class AnimatorParamAttribute : DrawerAttribute
{
public string AnimatorName { get; private set; }
public AnimatorControllerParameterType? AnimatorParamType { get; private set; }
public AnimatorParamAttribute(string animatorName)
{
AnimatorName = animatorName;
AnimatorParamType = null;
}
public AnimatorParamAttribute(string animatorName, AnimatorControllerParameterType animatorParamType)
{
AnimatorName = animatorName;
AnimatorParamType = animatorParamType;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7373332cb77b42744a415d6b4add445d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using System;
using UnityEngine;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class CurveRangeAttribute : DrawerAttribute
{
public Vector2 Min { get; private set; }
public Vector2 Max { get; private set; }
public EColor Color { get; private set; }
public CurveRangeAttribute(Vector2 min, Vector2 max, EColor color = EColor.Clear)
{
Min = min;
Max = max;
Color = color;
}
public CurveRangeAttribute(EColor color)
: this(Vector2.zero, Vector2.one, color)
{
}
public CurveRangeAttribute(float minX, float minY, float maxX, float maxY, EColor color = EColor.Clear)
: this(new Vector2(minX, minY), new Vector2(maxX, maxY), color)
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bbdf3fb8882c7514c9a01108122cda7e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
using UnityEngine;
namespace NaughtyAttributes
{
/// <summary>
/// Base class for all drawer attributes
/// </summary>
public class DrawerAttribute : PropertyAttribute, INaughtyAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9df37fdebccf65c4da5b0a14f6dad5f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
using System.Collections;
using System;
using System.Collections.Generic;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class DropdownAttribute : DrawerAttribute
{
public string ValuesName { get; private set; }
public DropdownAttribute(string valuesName)
{
ValuesName = valuesName;
}
}
public interface IDropdownList : IEnumerable<KeyValuePair<string, object>>
{
}
public class DropdownList<T> : IDropdownList
{
private List<KeyValuePair<string, object>> _values;
public DropdownList()
{
_values = new List<KeyValuePair<string, object>>();
}
public void Add(string displayName, T value)
{
_values.Add(new KeyValuePair<string, object>(displayName, value));
}
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
return _values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public static explicit operator DropdownList<object>(DropdownList<T> target)
{
DropdownList<object> result = new DropdownList<object>();
foreach (var kvp in target)
{
result.Add(kvp.Key, kvp.Value);
}
return result;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2cb864a1092cec04f8a4dbb556e8ed31
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class EnumFlagsAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e8b31eb6d7299e54d89dcabc4cad0e6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ExpandableAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60926d6ca7f9ced469e9248ff1192da6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class HorizontalLineAttribute : DrawerAttribute
{
public const float DefaultHeight = 2.0f;
public const EColor DefaultColor = EColor.Gray;
public float Height { get; private set; }
public EColor Color { get; private set; }
public HorizontalLineAttribute(float height = DefaultHeight, EColor color = DefaultColor)
{
Height = height;
Color = color;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2fdd6f99acca2fd42a4f3162d585ce95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using System;
namespace NaughtyAttributes
{
public enum EInfoBoxType
{
Normal,
Warning,
Error
}
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class InfoBoxAttribute : DrawerAttribute
{
public string Text { get; private set; }
public EInfoBoxType Type { get; private set; }
public InfoBoxAttribute(string text, EInfoBoxType type = EInfoBoxType.Normal)
{
Text = text;
Type = type;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: afd1d6323740c734893fa8397c53113b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class InputAxisAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85033978c18810f46af271bbe94cf4aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class LayerAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 668d19ebe071176448d1af816a9a0ce0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class MinMaxSliderAttribute : DrawerAttribute
{
public float MinValue { get; private set; }
public float MaxValue { get; private set; }
public MinMaxSliderAttribute(float minValue, float maxValue)
{
MinValue = minValue;
MaxValue = maxValue;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4aaa73f574deaa54187cb54aae571b24
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ProgressBarAttribute : DrawerAttribute
{
public string Name { get; private set; }
public float MaxValue { get; set; }
public string MaxValueName { get; private set; }
public EColor Color { get; private set; }
public ProgressBarAttribute(string name, float maxValue, EColor color = EColor.Blue)
{
Name = name;
MaxValue = maxValue;
Color = color;
}
public ProgressBarAttribute(string name, string maxValueName, EColor color = EColor.Blue)
{
Name = name;
MaxValueName = maxValueName;
Color = color;
}
public ProgressBarAttribute(float maxValue, EColor color = EColor.Blue)
: this("", maxValue, color)
{
}
public ProgressBarAttribute(string maxValueName, EColor color = EColor.Blue)
: this("", maxValueName, color)
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e19e4db6f4d08f849aa8ea8155cd2760
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ResizableTextAreaAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56d9a4b795ef4a94d86b94e55fb81240
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class SceneAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e054de18423364f4688b72a0f2a472b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ShowAssetPreviewAttribute : DrawerAttribute
{
public const int DefaultWidth = 64;
public const int DefaultHeight = 64;
public int Width { get; private set; }
public int Height { get; private set; }
public ShowAssetPreviewAttribute(int width = DefaultWidth, int height = DefaultHeight)
{
Width = width;
Height = height;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4b7dd9b44abc0054cb5cd68d74be2c1a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class SortingLayerAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b7564ee02deb3974a85d8617eea098fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class TagAttribute : DrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8903399bbd7c9d745a7b9188ab6c8320
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5cf879ed72221e740a7aa02ef9c366a7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System;
namespace NaughtyAttributes
{
public enum EButtonEnableMode
{
/// <summary>
/// Button should be active always
/// </summary>
Always,
/// <summary>
/// Button should be active only in editor
/// </summary>
Editor,
/// <summary>
/// Button should be active only in playmode
/// </summary>
Playmode
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ButtonAttribute : SpecialCaseDrawerAttribute
{
public string Text { get; private set; }
public EButtonEnableMode SelectedEnableMode { get; private set; }
public ButtonAttribute(string text = null, EButtonEnableMode enabledMode = EButtonEnableMode.Always)
{
this.Text = text;
this.SelectedEnableMode = enabledMode;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e8fe363a25ec5e24a9dd510bb0b4a0d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ReorderableListAttribute : SpecialCaseDrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6189b48f4055e6c47aa132632d898fa6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public class ShowNativePropertyAttribute : SpecialCaseDrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8e9b7b71c94a1f459336a24cfe04b1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ShowNonSerializedFieldAttribute : SpecialCaseDrawerAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ea09f60df536734184a8920ff8bda6f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
using System;
namespace NaughtyAttributes
{
public class SpecialCaseDrawerAttribute : Attribute, INaughtyAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95a59093f8ed1af48a8be75fa3050a3c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
using System;
namespace NaughtyAttributes
{
public interface INaughtyAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: edda855906d15e541b46efd812fd70f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 64c95d02a2004854585e8d923d6680d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class BoxGroupAttribute : MetaAttribute, IGroupAttribute
{
public string Name { get; private set; }
public BoxGroupAttribute(string name = "")
{
Name = name;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07da8af1e3be52c4789678bf4138ae11
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class DisableIfAttribute : EnableIfAttributeBase
{
public DisableIfAttribute(string condition)
: base(condition)
{
Inverted = true;
}
public DisableIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
: base(conditionOperator, conditions)
{
Inverted = true;
}
public DisableIfAttribute(string enumName, object enumValue)
: base(enumName, enumValue as Enum)
{
Inverted = true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52a0d5c249ac8fd42a4fb4d61bc2f797
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class EnableIfAttribute : EnableIfAttributeBase
{
public EnableIfAttribute(string condition)
: base(condition)
{
Inverted = false;
}
public EnableIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
: base(conditionOperator, conditions)
{
Inverted = false;
}
public EnableIfAttribute(string enumName, object enumValue)
: base(enumName, enumValue as Enum)
{
Inverted = false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a616ae826c8ebae45a89d6a8cb68a843
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
using System;
namespace NaughtyAttributes
{
public abstract class EnableIfAttributeBase : MetaAttribute
{
public string[] Conditions { get; private set; }
public EConditionOperator ConditionOperator { get; private set; }
public bool Inverted { get; protected set; }
/// <summary>
/// If this not null, <see cref="Conditions"/>[0] is name of an enum variable.
/// </summary>
public Enum EnumValue { get; private set; }
public EnableIfAttributeBase(string condition)
{
ConditionOperator = EConditionOperator.And;
Conditions = new string[1] { condition };
}
public EnableIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions)
{
ConditionOperator = conditionOperator;
Conditions = conditions;
}
public EnableIfAttributeBase(string enumName, Enum enumValue)
: this(enumName)
{
if (enumValue == null)
{
throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value.");
}
EnumValue = enumValue;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ba6385cd022e164b89ead1937173ddc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class FoldoutAttribute : MetaAttribute, IGroupAttribute
{
public string Name { get; private set; }
public FoldoutAttribute(string name)
{
Name = name;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95f184555d5079243b2d25b35a641a74
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class HideIfAttribute : ShowIfAttributeBase
{
public HideIfAttribute(string condition)
: base(condition)
{
Inverted = true;
}
public HideIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
: base(conditionOperator, conditions)
{
Inverted = true;
}
public HideIfAttribute(string enumName, object enumValue)
: base(enumName, enumValue as Enum)
{
Inverted = true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9ab2d0fcfb13a214ea6ef7629c96a761
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
using UnityEngine;
namespace NaughtyAttributes
{
public interface IGroupAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7c437b9ac50575347a7b12520f37f9a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class LabelAttribute : MetaAttribute
{
public string Label { get; private set; }
public LabelAttribute(string label)
{
Label = label;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 79e0e0c0a7c25ea4fbe8eecaa4d559a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
using System;
namespace NaughtyAttributes
{
public class MetaAttribute : Attribute, INaughtyAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a482b4e0fbf0f4547a5d522182a68d24
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
public class OnValueChangedAttribute : MetaAttribute
{
public string CallbackName { get; private set; }
public OnValueChangedAttribute(string callbackName)
{
CallbackName = callbackName;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e16a27c5576022b4bbe997c7db9051f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ReadOnlyAttribute : MetaAttribute
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e57264747ba93b94fbff12733de29499
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ShowIfAttribute : ShowIfAttributeBase
{
public ShowIfAttribute(string condition)
: base(condition)
{
Inverted = false;
}
public ShowIfAttribute(EConditionOperator conditionOperator, params string[] conditions)
: base(conditionOperator, conditions)
{
Inverted = false;
}
public ShowIfAttribute(string enumName, object enumValue)
: base(enumName, enumValue as Enum)
{
Inverted = false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ada427cfd2c9b04989d6d18dea27985
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
using System;
namespace NaughtyAttributes
{
public class ShowIfAttributeBase : MetaAttribute
{
public string[] Conditions { get; private set; }
public EConditionOperator ConditionOperator { get; private set; }
public bool Inverted { get; protected set; }
/// <summary>
/// If this not null, <see cref="Conditions"/>[0] is name of an enum variable.
/// </summary>
public Enum EnumValue { get; private set; }
public ShowIfAttributeBase(string condition)
{
ConditionOperator = EConditionOperator.And;
Conditions = new string[1] { condition };
}
public ShowIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions)
{
ConditionOperator = conditionOperator;
Conditions = conditions;
}
public ShowIfAttributeBase(string enumName, Enum enumValue)
: this(enumName)
{
if (enumValue == null)
{
throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value.");
}
EnumValue = enumValue;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0532b1c4d8a9ccf4b9f98f0bbe4a6747
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
{
"name": "NaughtyAttributes.Core",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 776d03a35f1b52c4a9aed9f56d7b4229
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6d61a3a977073c740ae13a3683ed22a1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
using UnityEngine;
namespace NaughtyAttributes
{
public enum EColor
{
Clear,
White,
Black,
Gray,
Red,
Pink,
Orange,
Yellow,
Green,
Blue,
Indigo,
Violet
}
public static class EColorExtensions
{
public static Color GetColor(this EColor color)
{
switch (color)
{
case EColor.Clear:
return new Color32(0, 0, 0, 0);
case EColor.White:
return new Color32(255, 255, 255, 255);
case EColor.Black:
return new Color32(0, 0, 0, 255);
case EColor.Gray:
return new Color32(128, 128, 128, 255);
case EColor.Red:
return new Color32(255, 0, 63, 255);
case EColor.Pink:
return new Color32(255, 152, 203, 255);
case EColor.Orange:
return new Color32(255, 128, 0, 255);
case EColor.Yellow:
return new Color32(255, 211, 0, 255);
case EColor.Green:
return new Color32(98, 200, 79, 255);
case EColor.Blue:
return new Color32(0, 135, 189, 255);
case EColor.Indigo:
return new Color32(75, 0, 130, 255);
case EColor.Violet:
return new Color32(128, 0, 255, 255);
default:
return new Color32(0, 0, 0, 255);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 059f8674a8065924ea9c678298b5cd63
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
using System;
namespace NaughtyAttributes
{
public enum EConditionOperator
{
And,
Or
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c227b6c19fc67b46ad294d95818f85a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bf91d63e37bed3e4cbf75d576fc03a21
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class MaxValueAttribute : ValidatorAttribute
{
public float MaxValue { get; private set; }
public MaxValueAttribute(float maxValue)
{
MaxValue = maxValue;
}
public MaxValueAttribute(int maxValue)
{
MaxValue = maxValue;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a748250af5ccfd7499cfb444aafb8a03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class MinValueAttribute : ValidatorAttribute
{
public float MinValue { get; private set; }
public MinValueAttribute(float minValue)
{
MinValue = minValue;
}
public MinValueAttribute(int minValue)
{
MinValue = minValue;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40133bac7c8d42b4d837138430a503e0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class RequiredAttribute : ValidatorAttribute
{
public string Message { get; private set; }
public RequiredAttribute(string message = null)
{
Message = message;
}
}
}

Some files were not shown because too many files have changed in this diff Show More