add
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditorHelper
|
||||
{
|
||||
public class LayerAttribute : PropertyAttribute { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 971f5270110911b4fb502df4a3ad7eb5
|
||||
timeCreated: 1434825477
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditorHelper
|
||||
{
|
||||
public class LimitAttribute : PropertyAttribute
|
||||
{
|
||||
public enum Mode { LimitLower, LimitUpper, LimitBoth }
|
||||
|
||||
private readonly Mode _limitMode;
|
||||
|
||||
private readonly int _lowerLimit;
|
||||
private readonly int _upperLimit;
|
||||
|
||||
public LimitAttribute(int lowerLimit) : this(Mode.LimitLower, lowerLimit, int.MaxValue) { }
|
||||
|
||||
public LimitAttribute(int lowerLimit, int upperLimit) : this(Mode.LimitLower, lowerLimit, upperLimit) { }
|
||||
|
||||
private LimitAttribute(Mode mode, int lowerLimit, int upperLimit)
|
||||
{
|
||||
_limitMode = mode;
|
||||
_lowerLimit = lowerLimit;
|
||||
_upperLimit = upperLimit;
|
||||
}
|
||||
|
||||
public int Limit(int value)
|
||||
{
|
||||
switch (_limitMode)
|
||||
{
|
||||
case Mode.LimitLower:
|
||||
return Mathf.Clamp(value, _lowerLimit, int.MaxValue);
|
||||
case Mode.LimitUpper:
|
||||
return Mathf.Clamp(value, int.MinValue, _upperLimit);
|
||||
case Mode.LimitBoth:
|
||||
return Mathf.Clamp(value, _lowerLimit, _upperLimit);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31dce993b711b3d4ebe6de30a65f6f15
|
||||
timeCreated: 1434825476
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditorHelper
|
||||
{
|
||||
public class SortingLayerAttribute : PropertyAttribute { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cba79dad475a86645af6e8d148acbd8e
|
||||
timeCreated: 1434825477
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityEditorHelper
|
||||
{
|
||||
public class TagAttribute : PropertyAttribute { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30ebe4ad2affb194daaaf76da62e6bc0
|
||||
timeCreated: 1434825476
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user