Continuous level generation + custom voxel physics engine

This commit is contained in:
spatialfree 2020-09-21 07:19:43 -07:00
commit 57c47c815f
272 changed files with 10621 additions and 0 deletions

71
.gitignore vendored Normal file
View file

@ -0,0 +1,71 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

56
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,56 @@
{
"files.exclude":
{
"**/.DS_Store":true,
"**/.git":true,
"**/.gitignore":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.asset":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.prefab":true,
"**/*.unity":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"ProjectSettings/":true,
"temp/":true,
"Temp/":true
}
}

77
Assets/Enemy.mat Normal file
View file

@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Enemy
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0.25, b: 0.25, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

8
Assets/Enemy.mat.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d9312e72de6721d41975fc093421fc2f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e36719ce7215fe440af46dda6a9933b3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

52
Assets/Lighting.cs Normal file
View file

@ -0,0 +1,52 @@
using UnityEngine;
using UnityEditor;
public class Lighting
{
public static void CreateTexture3D()
{
// Configure the texture
int size = 32;
TextureFormat format = TextureFormat.RGBA32;
TextureWrapMode wrapMode = TextureWrapMode.Clamp;
// Create the texture and apply the configuration
Texture3D texture = new Texture3D(size, size, size, format, false);
texture.wrapMode = wrapMode;
// Create a 3-dimensional array to store color data
Color[] colors = new Color[size * size * size];
// Populate the array so that the x, y, and z values of the texture will map to red, blue, and green colors
float inverseResolution = 1.0f / (size - 1.0f);
for (int z = 0; z < size; z++)
{
int zOffset = z * size * size;
for (int y = 0; y < size; y++)
{
int yOffset = y * size;
for (int x = 0; x < size; x++)
{
colors[x + yOffset + zOffset] = new Color(x * inverseResolution,
y * inverseResolution, z * inverseResolution, 1.0f);
}
}
}
// 3d texture?? yup
// just use brush fire algorithm to light the cave
// that will make nicely for the base ambiance
// then you can handle light paths or other nice depth indicating things
// Copy the color values to the texture
texture.SetPixels(colors);
// Apply the changes to the texture and upload the updated texture to the GPU
texture.Apply();
#if UNITY_EDITOR
// Save the texture to your Unity Project
AssetDatabase.CreateAsset(texture, "Assets/Example3DTexture.asset");
#endif
}
}

11
Assets/Lighting.cs.meta Normal file
View file

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

466
Assets/Monolith.cs Normal file
View file

@ -0,0 +1,466 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using NaughtyAttributes;
using Random = UnityEngine.Random;
using ExtensionMethods;
using UnityEngine.XR;
[ExecuteInEditMode]
public class Monolith : MonoBehaviour
{
// Then monolith the pieces (exist
// = data render and spawn(manual mono -> auto sim)
// input class fed to sim and render
// , then move, then impact)
public Worm leftWorm, rightWorm;
public Piece piece;
public Piece enemy;
public Voxel[] voxels = new Voxel[48];
public int vIndex = 0;
public Simulate simulate = new Simulate();
public Render render;
[Header("References")]
public Camera cam;
void OnEnable()
{
render.Enable(this);
}
void OnDisable()
{
render.Disable();
}
[Button]
public void LightPass()
{
Lighting.CreateTexture3D();
}
[Button]
public void Reset()
{
voxels = new Voxel[voxels.Length];
voxels[0] = new Voxel(Vector3Int.zero);
leftWorm.pos = rightWorm.pos = Vector3Int.zero;
leftWorm.dirIndex = rightWorm.dirIndex = 0;
}
[Button]
public void Step()
{
simulate.Step(this);
}
InputDevice headset;
void Start()
{
headset = InputDevices.GetDeviceAtXRNode(XRNode.Head);
testPos = piece.pos + Vector3.forward * 0.4f;
testVel = Vector3.down;
}
Vector3Int Voxelcast(Vector3Int from, Vector3Int step)
{
Vector3Int vPos = from;
int i = 0;
while (i < 15)
{
vPos += step;
if (!InVoxel(vPos))
{
vPos -= step;
break;
}
i++;
}
return vPos;
}
Vector3 testPos;
Vector3Int voxelPos(Vector3 pos)
{
return new Vector3Int(Mathf.RoundToInt(pos.x), Mathf.RoundToInt(pos.y), Mathf.RoundToInt(pos.z));
}
public Vector3 testVel;
float Bound(Vector3 pos, int axis, int dir)
{
Vector3Int step = Vector3Int.zero;
step[axis] = dir;
float bound = Mathf.Infinity * dir;
float closest = Mathf.Infinity;
for (int i = 0; i < allDirs.Length; i++)
{
Vector3 d = (Vector3)allDirs[i] * 0.2f;
d[axis] = 0;
Vector3 vPos = Voxelcast(voxelPos(pos + d), step);
float dist = Mathf.Abs(vPos[axis] - pos[axis]);
if (dist < closest)
{
bound = vPos[axis];
closest = dist;
}
}
// when hit ?
return bound + (0.2f * dir);
}
bool InVoxel(Vector3Int pos)
{
for (int i = 0; i < voxels.Length; i++)
{
if (voxels[i].pos == pos)
{
return true;
}
}
return false;
}
bool jumpBtn = false;
Vector3 onTouchPos, oldTouchPos;
Vector2 camAngle = new Vector2(30, 45);
Vector2 camAngleVel, oldCamAngleVel;
float delay;
[ReadOnly]
public bool movePiece;
void Update()
{
Vector3 mousePos = Input.mousePosition;
Transform camForm = cam.transform;
// orbitcam
Quaternion headsetRot = Quaternion.identity;
headset.TryGetFeatureValue(CommonUsages.deviceRotation, out headsetRot);
if (headsetRot != null)
{
camForm.rotation = headsetRot;
}
camForm.position = camForm.rotation * Vector3.back * 10;
InputDevice mainCon = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
Vector2 wasd = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
Vector2 joystick = Vector2.zero;
mainCon.TryGetFeatureValue(CommonUsages.primary2DAxis, out joystick);
Vector2 input = wasd + joystick;
testVel.x += input.x * 6 * Time.deltaTime;
testVel.z += input.y * 6 * Time.deltaTime;
if (input.sqrMagnitude == 0)
{
testVel.x *= 1 - (60 * Time.deltaTime);
testVel.z *= 1 - (60 * Time.deltaTime);
}
mainCon.TryGetFeatureValue(CommonUsages.primaryButton, out jumpBtn);
if (Input.GetKeyDown(KeyCode.Space) || (jumpBtn && Mathf.Abs(testVel.y) < 0.1f))
{
testVel.y = 8;
}
// holding
float gravStr = 1;
if ((!Input.GetKey(KeyCode.Space) && !jumpBtn) || testVel.y < 0)
{
gravStr = 3;
}
testVel.y += -9.81f * gravStr * Time.deltaTime;
testVel = Vector3.ClampMagnitude(testVel, 60);
// Graphics.DrawMesh(render.meshPieceDebug,
// voxelPos(testPos), Quaternion.identity,
// render.matPieceDebug, 0
// );
// bounds/clamp
Vector3 toPos = testPos + testVel * Time.deltaTime;
int w = 0;
while (w < 3)
{
Vector3 clampPos = new Vector3(
Mathf.Clamp(toPos.x, Bound(testPos, 0, -1), Bound(testPos, 0, 1)),
Mathf.Clamp(toPos.y, Bound(testPos, 1, -1), Bound(testPos, 1, 1)),
Mathf.Clamp(toPos.z, Bound(testPos, 2, -1), Bound(testPos, 2, 1))
);
// find smallest clamp
// make only that clamp and clamp check again
// smallest?
// how'bout largest?
float largest = 0;
int largeIndex = -1;
for (int i = 0; i < 3; i++)
{
float dist = Mathf.Abs(toPos[i] - clampPos[i]);
if (dist > largest)
{
largeIndex = i;
largest = dist;
}
}
if (largeIndex > -1)
{
toPos[largeIndex] = clampPos[largeIndex];
testVel[largeIndex] *= -0.25f; // Bounce
// UnityEditor.EditorApplication.isPaused = true;
}
else
{
break;
}
w++;
}
testPos = toPos;
Graphics.DrawMesh(render.meshPieceDebug,
testPos, Quaternion.identity,
render.matPieceDebug, 0
);
// for (int i = 0; i < allDirs.Length; i++)
// {
// Graphics.DrawMesh(render.meshPieceDebug,
// testPos + allDirs[i], Quaternion.identity,
// render.matPieceDebug, 0
// );
// }
return;
// touchPos
// touchDown
// touching
// touchUp
if (Input.GetMouseButtonDown(0))
{
onTouchPos = mousePos;
Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, onTouchPos.z);
movePiece = Vector3.Distance(onTouchPos, screenCenter) < 32;
}
if (movePiece)
{
if (Input.GetMouseButtonUp(0) && Vector2.Distance(mousePos, cam.WorldToScreenPoint(piece.pos)) > 32)
{
Vector2 inputAngle = mousePos - cam.WorldToScreenPoint(piece.pos);
float closestAngle = 180;
int dirIndex = 0;
for (int i = 0; i < dirs.Length; i++)
{
float angle = Vector2.Angle(
inputAngle,
cam.WorldToScreenPoint(piece.pos + dirs[i]) - cam.WorldToScreenPoint(piece.pos)
);
// pick out of closest available
if (angle < closestAngle && !Outside(piece.pos + dirs[i]))
{
dirIndex = i;
closestAngle = angle;
}
}
if (closestAngle < 60)
{
while (!Outside(piece.pos))
{
piece.pos += dirs[dirIndex];
}
piece.pos -= dirs[dirIndex];
if (piece.pos == enemy.pos)
{
enemy.pos = voxels[Random.Range(0, voxels.Length)].pos;
}
}
movePiece = false;
}
camAngleVel = Vector2.zero;
}
else
{
if (Input.GetMouseButton(0))
{
Vector3 offset = (mousePos - oldTouchPos) / 3f;
camAngleVel = new Vector2(-offset.y, offset.x) / Time.deltaTime;
if (camAngleVel.sqrMagnitude > 0 || delay < Time.time)
{
oldCamAngleVel = camAngleVel;
delay = Time.time + 0.1f;
}
}
else
{
camAngleVel *= 1 - (6 * Time.deltaTime);
}
if (Input.GetMouseButtonUp(0))
{
camAngleVel = oldCamAngleVel;
}
}
camAngle += camAngleVel * Time.deltaTime;
camAngle.x = Mathf.Clamp(camAngle.x, -60f, 60f);
camForm.rotation = Quaternion.Euler(Vector3.up * camAngle.y) * Quaternion.Euler(Vector3.right * camAngle.x);
oldTouchPos = mousePos;
// vr chess? infinite dungeon crawler ZENCORE
// just 3d the movement patterns
// twist cursor game
// input is none
// simulate is monolithed entirely
// part of simulate is to generate the level
// pathing needs a refactor
// we learned quite a bit
// what paths are interesting in 3D?
// build for that, don't just translate chess movement patterns
// chess takeaways
// long shots from well placed pieces
// hook shots from knights
// consider gravities constraints
// fall | cling walls | cling ceiling
// jump | climb fly |
// what do I want to do?
camPivot = render.lerpPos;
camForm.position = camPivot + Quaternion.LookRotation(camForm.rotation * Vector3.forward) * Vector3.back * 24;
}
Vector3 camPivot;
[HideInInspector]
public Vector3Int[] dirs = new Vector3Int[] {
new Vector3Int(-1, 0, 0), new Vector3Int(0, -1, 0), new Vector3Int(0, 0, -1),
new Vector3Int(1, 0, 0), new Vector3Int(0, 1, 0), new Vector3Int(0, 0, 1)
};
[HideInInspector]
public Vector3Int[] allDirs = new Vector3Int[] {
new Vector3Int(-1, 0, 0),
new Vector3Int(0, -1, 0),
new Vector3Int(0, 0, -1),
new Vector3Int(-1, -1, 0),
new Vector3Int(0, -1, -1),
new Vector3Int(-1, 0, -1),
new Vector3Int(1, 0, 0),
new Vector3Int(0, 1, 0),
new Vector3Int(0, 0, 1),
new Vector3Int(1, 1, 0),
new Vector3Int(0, 1, 1),
new Vector3Int(1, 0, 1),
new Vector3Int(-1, 1, 0),
new Vector3Int(0, -1, 1),
new Vector3Int(1, 0, -1),
new Vector3Int(1, -1, 0),
new Vector3Int(0, 1, -1),
new Vector3Int(-1, 0, 1)
};
public bool Outside(Vector3Int pos)
{
for (int v = 0; v < voxels.Length; v++)
{
if (pos == voxels[v].pos) { return false; }
}
return true;
}
}
[Serializable]
public class Voxel
{
public Vector3Int pos;
public Voxel(Vector3Int pos)
{
this.pos = pos;
}
}
[Serializable]
public class Worm
{
public Vector3Int pos;
public int dirIndex;
public Worm(Vector3Int pos)
{
this.pos = pos;
this.dirIndex = 0;
}
}
[Serializable]
public class Piece
{
public Vector3Int pos;
public int[] pattern;
// a pattern is the change in dirIndex at x Step
// cant be a dir change at zero
public Piece(Vector3Int pos)
{
this.pos = pos;
}
}
namespace ExtensionMethods
{
public static class MyExtensions
{
public static int Rollover(this int index, int by, int length)
{
int rollover = index + by;
int delta = rollover - length;
if (delta >= 0)
{
rollover = delta;
}
return rollover;
}
}
}

11
Assets/Monolith.cs.meta Normal file
View file

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

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 771bc5d1e8c87a9428691ea0aac40477
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,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,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,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,28 @@
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 EColor Color { get; private set; }
public string MaxValueName { get; private set; }
public ProgressBarAttribute(string name = "", string maxValueName = "", int maxValue = 100, EColor color = EColor.Blue)
{
Name = name;
MaxValue = maxValue;
MaxValueName = maxValueName;
Color = color;
}
public ProgressBarAttribute(string name = "", int maxValue = 100, EColor color = EColor.Blue)
{
Name = name;
MaxValue = maxValue;
Color = 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,10 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ReadOnlyAttribute : DrawerAttribute
{
}
}

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,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,17 @@
using System;
namespace NaughtyAttributes
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ShowAssetPreviewAttribute : DrawerAttribute
{
public int Width { get; private set; }
public int Height { get; private set; }
public ShowAssetPreviewAttribute(int width = 64, int height = 64)
{
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 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
{
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,20 @@
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;
}
}
}

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,20 @@
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;
}
}
}

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,23 @@
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; }
public EnableIfAttributeBase(string condition)
{
ConditionOperator = EConditionOperator.And;
Conditions = new string[1] { condition };
}
public EnableIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions)
{
ConditionOperator = conditionOperator;
Conditions = conditions;
}
}
}

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,20 @@
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;
}
}
}

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,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,20 @@
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;
}
}
}

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,23 @@
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; }
public ShowIfAttributeBase(string condition)
{
ConditionOperator = EConditionOperator.And;
Conditions = new string[1] { condition };
}
public ShowIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions)
{
ConditionOperator = conditionOperator;
Conditions = conditions;
}
}
}

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;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b0cdf49d1687849458b1a8d4786553d4
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 ValidateInputAttribute : ValidatorAttribute
{
public string CallbackName { get; private set; }
public string Message { get; private set; }
public ValidateInputAttribute(string callbackName, string message = null)
{
CallbackName = callbackName;
Message = message;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c4171d68fb5bc0448d3ac298973e82c
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 ValidatorAttribute : Attribute, INaughtyAttribute
{
}
}

View file

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

View file

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

View file

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

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