Added participant and other stuff
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b43e7f73d4ffc2545a17b938f63e6bc0
|
||||
folderAsset: yes
|
||||
timeCreated: 1468507225
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,77 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[CustomPropertyDrawer(typeof(InspectorNoteAttribute))]
|
||||
public class DrawerInspectorNote : DecoratorDrawer
|
||||
{
|
||||
public override void OnGUI( Rect position )
|
||||
{
|
||||
InspectorNoteAttribute note = attribute as InspectorNoteAttribute;
|
||||
|
||||
// our header is always present
|
||||
Rect posLabel = position;
|
||||
posLabel.y += 13;
|
||||
posLabel.x -= 2;
|
||||
posLabel.height += 13;
|
||||
EditorGUI.LabelField(posLabel, note.header, EditorStyles.whiteLargeLabel);
|
||||
|
||||
// do we have a message too?
|
||||
if (!string.IsNullOrEmpty(note.message))
|
||||
{
|
||||
Color color = GUI.color;
|
||||
Color faded = color;
|
||||
faded.a = 0.6f;
|
||||
|
||||
Rect posExplain = posLabel;
|
||||
posExplain.y += 15;
|
||||
GUI.color = faded;
|
||||
EditorGUI.LabelField(posExplain, note.message, EditorStyles.whiteMiniLabel);
|
||||
GUI.color = color;
|
||||
}
|
||||
|
||||
Rect posLine = position;
|
||||
posLine.y += string.IsNullOrEmpty(note.message) ? 30 : 42;
|
||||
posLine.height = 1f;
|
||||
GUI.Box(posLine, "");
|
||||
}
|
||||
|
||||
public override float GetHeight() {
|
||||
InspectorNoteAttribute note = attribute as InspectorNoteAttribute;
|
||||
return string.IsNullOrEmpty( note.message ) ? 38 : 50;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer( typeof( InspectorCommentAttribute ) )]
|
||||
public class DrawerInspectorComment : DecoratorDrawer {
|
||||
public override void OnGUI( Rect position ) {
|
||||
InspectorCommentAttribute comment = attribute as InspectorCommentAttribute;
|
||||
|
||||
// our header is always present
|
||||
Rect posLabel = position;
|
||||
//posLabel.y += 13;
|
||||
//posLabel.x -= 2;
|
||||
//posLabel.height += 13;
|
||||
//EditorGUI.LabelField( posLabel, comment.header, EditorStyles.whiteLargeLabel );
|
||||
|
||||
// do we have a message too?
|
||||
if ( !string.IsNullOrEmpty( comment.message ) ) {
|
||||
Color color = GUI.color;
|
||||
Color faded = color;
|
||||
faded.a = 0.6f;
|
||||
|
||||
Rect posExplain = posLabel;
|
||||
posExplain.y += 15;
|
||||
GUI.color = faded;
|
||||
EditorGUI.LabelField( posExplain, comment.message, EditorStyles.whiteMiniLabel );
|
||||
GUI.color = color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override float GetHeight() {
|
||||
InspectorNoteAttribute note = attribute as InspectorNoteAttribute;
|
||||
return string.IsNullOrEmpty( note.message ) ? 38 : 50;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f244e745a5bf8412d9d81d43dff35cf5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -1,283 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class FastList<T> {
|
||||
|
||||
/// <summary>
|
||||
/// Comparison function should return -1 if left is less than right, 1 if left is greater than right, and 0 if they match.
|
||||
/// </summary>
|
||||
public delegate int CompareFunc(T left, T right);
|
||||
|
||||
|
||||
public T[] array = null;
|
||||
public int size = 0;
|
||||
|
||||
public FastList () {
|
||||
}
|
||||
|
||||
public FastList(int size) {
|
||||
if (size > 0) {
|
||||
this.size = 0;
|
||||
array = new T[size];
|
||||
}
|
||||
else {
|
||||
this.size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get { return size;}
|
||||
set { }
|
||||
}
|
||||
|
||||
public T this[int i] {
|
||||
get { return array[i];}
|
||||
set { array[i] = value;}
|
||||
}
|
||||
|
||||
//Add item to end of list.
|
||||
public void Add(T item) {
|
||||
if (array == null || size == array.Length) {
|
||||
Allocate();
|
||||
}
|
||||
array[size] = item;
|
||||
size++;
|
||||
}
|
||||
|
||||
//Add item to end of list if it is unique.
|
||||
public void AddUnique( T item ) {
|
||||
if ( array == null || size == array.Length ) {
|
||||
Allocate();
|
||||
}
|
||||
if ( !Contains( item ) ) {
|
||||
array[size] = item;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
//Add items to the end of the list
|
||||
public void AddRange( IEnumerable<T> items ) {
|
||||
foreach ( T item in items ) {
|
||||
Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
//Insert item at specified index
|
||||
public void Insert(int index, T item) {
|
||||
if (array == null || size == array.Length) {
|
||||
Allocate();
|
||||
}
|
||||
if (index < size) {
|
||||
//move things back 1
|
||||
for (int i = size; i > index; i--) {
|
||||
array[i] = array[i-1];
|
||||
}
|
||||
array[index] = item;
|
||||
size++;
|
||||
}
|
||||
else Add(item);
|
||||
}
|
||||
|
||||
//Removes specified item and keeps everything else in order
|
||||
public bool Remove(T item) {
|
||||
if (array != null) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (item.Equals(array[i])) { //found it, push everything up
|
||||
size--;
|
||||
for (int j = i; j < size; j++) {
|
||||
array[j] = array[j+1];
|
||||
}
|
||||
array[size] = default(T);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Removes item at specified index while keeping everything else in order
|
||||
//O(n)
|
||||
public void RemoveAt(int index) {
|
||||
if (array != null && size > 0 && index < size) {
|
||||
size--;
|
||||
for (int i = index; i < size; i++) {
|
||||
array[i] = array[i+1];
|
||||
}
|
||||
array[size] = default(T);
|
||||
}
|
||||
}
|
||||
|
||||
//Removes the specified item from the list and replaces with last item. Return true if removed, false if not found.
|
||||
public bool RemoveFast(T item) {
|
||||
if (array != null) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if ( item.Equals( array[i] )) { //found
|
||||
//Move last item here
|
||||
if (i < (size - 1)) {
|
||||
T lastItem = array[size-1];
|
||||
array[size-1] = default(T);
|
||||
array[i] = lastItem;
|
||||
} else {
|
||||
array[i] = default(T);
|
||||
}
|
||||
size--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Removes item at specified index and replace with last item.
|
||||
public void RemoveAtFast(int index) {
|
||||
if (array != null && index < size && index >= 0) {
|
||||
//last element
|
||||
if (index == size - 1) {
|
||||
array[index] = default(T);
|
||||
}
|
||||
else {
|
||||
T lastItem = array[size - 1];
|
||||
array[index] = lastItem;
|
||||
array[size - 1] = default(T);
|
||||
}
|
||||
size--;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Return whether an item is contained within the list
|
||||
//O(n)
|
||||
public bool Contains(T item) {
|
||||
if (array == null || size <= 0 ) return false;
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (array[i].Equals(item)) { return true;}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Returns index of specified item, or -1 if not found.
|
||||
//O(n)
|
||||
public int IndexOf(T item) {
|
||||
if (size <= 0 || array == null) { return -1;}
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (item.Equals(array[i])) { return i;}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public T Pop() {
|
||||
if (array != null && size > 0) {
|
||||
T lastItem = array[size-1];
|
||||
array[size-1] = default(T);
|
||||
size--;
|
||||
return lastItem;
|
||||
}
|
||||
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public T[] ToArray() {
|
||||
Trim();
|
||||
return array;
|
||||
}
|
||||
|
||||
public void Sort (CompareFunc comparer) {
|
||||
int start = 0;
|
||||
int end = size - 1;
|
||||
bool changed = true;
|
||||
|
||||
while (changed) {
|
||||
changed = false;
|
||||
|
||||
for (int i = start; i < end; i++) {
|
||||
|
||||
if (comparer(array[i], array[i + 1]) > 0) {
|
||||
T temp = array[i];
|
||||
array[i] = array[i+1];
|
||||
array[i+1] = temp;
|
||||
changed = true;
|
||||
}
|
||||
else if (!changed) {
|
||||
start = (i==0) ? 0 : i-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void InsertionSort(CompareFunc comparer) {
|
||||
for (int i = 1; i < size; i++) {
|
||||
T curr = array[i];
|
||||
int j = i;
|
||||
while (j > 0 && comparer(array[j - 1], curr) > 0) {
|
||||
array[j] = array[j-1];
|
||||
j--;
|
||||
}
|
||||
array[j] = curr;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator() {
|
||||
if (array != null) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
yield return array[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T Find(Predicate<T> match) {
|
||||
if (match != null) {
|
||||
if (array != null) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (match(array[i])) { return array[i];}
|
||||
}
|
||||
}
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
//Allocate more space to internal array.
|
||||
void Allocate() {
|
||||
T[] newArray;
|
||||
if (array == null) {
|
||||
newArray = new T[32];
|
||||
}
|
||||
else {
|
||||
newArray = new T[Mathf.Max(array.Length << 1, 32)];
|
||||
}
|
||||
if (array != null && size > 0) {
|
||||
array.CopyTo(newArray, 0);
|
||||
}
|
||||
|
||||
array = newArray;
|
||||
}
|
||||
|
||||
|
||||
void Trim() {
|
||||
if (size > 0) {
|
||||
T[] newArray = new T[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
newArray[i] = array[i];
|
||||
}
|
||||
array = newArray;
|
||||
}
|
||||
else {
|
||||
array = null;
|
||||
}
|
||||
}
|
||||
|
||||
//Set size to 0, does not delete array from memory
|
||||
public void Clear() {
|
||||
size = 0;
|
||||
}
|
||||
|
||||
//Delete array from memory
|
||||
public void Release() {
|
||||
Clear();
|
||||
array = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ad95fb7eea735748bd34c963525ea21
|
||||
timeCreated: 1432749689
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
-----------------------
|
||||
|
||||
InspectorNoteAttribute()
|
||||
|
||||
-----------------------
|
||||
*/
|
||||
public class InspectorNoteAttribute : PropertyAttribute
|
||||
{
|
||||
public readonly string header;
|
||||
public readonly string message;
|
||||
|
||||
public InspectorNoteAttribute(string header, string message = "")
|
||||
{
|
||||
this.header = header;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
-----------------------
|
||||
|
||||
InspectorCommentAttribute()
|
||||
|
||||
-----------------------
|
||||
*/
|
||||
public class InspectorCommentAttribute : PropertyAttribute {
|
||||
public readonly string message;
|
||||
|
||||
public InspectorCommentAttribute( string message = "" ) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4616bbe65d311471f8d71174295f4986
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Reference in New Issue
Block a user