Demote legacy runtime cache names
This commit is contained in:
parent
6b435b8f13
commit
e7d33e5e43
29 changed files with 62 additions and 53 deletions
|
|
@ -1,146 +0,0 @@
|
|||
using System;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class GlobalSettingsAttribute : Attribute { }
|
||||
|
||||
// [AttributeUsage(AttributeTargets.Class)]
|
||||
// public class ExternalEntryAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.All, Inherited = false)]
|
||||
public class InspectableAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public abstract class PreferredInspectorAttribute : InspectableAttribute { }
|
||||
|
||||
public class InspectableTextAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectablePrefabAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableTextureAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableTextAssetAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableTemperatureAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableAnimationCurveAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableColorAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableSoundBankAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableAudioParameterAttribute : PreferredInspectorAttribute { }
|
||||
public class InspectableSchematicShapeAttribute : PreferredInspectorAttribute { }
|
||||
|
||||
public class InspectableEnumValuesAttribute : PreferredInspectorAttribute
|
||||
{
|
||||
public Type EnumType;
|
||||
|
||||
public InspectableEnumValuesAttribute(Type enumType)
|
||||
{
|
||||
EnumType = enumType;
|
||||
}
|
||||
}
|
||||
|
||||
public class InspectableDatabaseLinkAttribute : PreferredInspectorAttribute
|
||||
{
|
||||
public readonly Type EntryType;
|
||||
|
||||
public InspectableDatabaseLinkAttribute(Type entryType)
|
||||
{
|
||||
EntryType = entryType;
|
||||
}
|
||||
}
|
||||
|
||||
public class InspectableRangedFloatAttribute : PreferredInspectorAttribute
|
||||
{
|
||||
public readonly float Min, Max;
|
||||
|
||||
public InspectableRangedFloatAttribute(float min, float max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
}
|
||||
|
||||
public class InspectableRangedIntAttribute : PreferredInspectorAttribute
|
||||
{
|
||||
public readonly int Min, Max;
|
||||
|
||||
public InspectableRangedIntAttribute(int min, int max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
}
|
||||
|
||||
public class InspectableTypeAttribute : PreferredInspectorAttribute
|
||||
{
|
||||
public readonly Type Type;
|
||||
|
||||
public InspectableTypeAttribute(Type type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class RangedFloatAttribute : Attribute
|
||||
{
|
||||
public readonly float Min, Max;
|
||||
|
||||
public RangedFloatAttribute(float min, float max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>Specify a tooltip for a field in the Inspector window.</para>
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
|
||||
public class TooltipAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>The tooltip text.</para>
|
||||
/// </summary>
|
||||
public readonly string tooltip;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Specify a tooltip for a field.</para>
|
||||
/// </summary>
|
||||
/// <param name="tooltip">The tooltip text.</param>
|
||||
public TooltipAttribute(string tooltip) => this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class LegacyCatalogGroupAttribute : Attribute
|
||||
{
|
||||
public string TableName;
|
||||
|
||||
public LegacyCatalogGroupAttribute(string tableName)
|
||||
{
|
||||
TableName = tableName;
|
||||
}
|
||||
}
|
||||
|
||||
public class NameAttribute : Attribute
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public NameAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public class OrderAttribute : Attribute
|
||||
{
|
||||
public int Order;
|
||||
|
||||
public OrderAttribute(int order)
|
||||
{
|
||||
Order = order;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)]
|
||||
public class InspectorHeaderAttribute : Attribute
|
||||
{
|
||||
public readonly string header;
|
||||
|
||||
public InspectorHeaderAttribute(string header) => this.header = header;
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d078a6b39f8c440fabe8d43881207c5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class CollectionExtensions
|
||||
{
|
||||
// https://stackoverflow.com/a/3188835
|
||||
public static T MaxBy<T, U>(this IEnumerable<T> items, Func<T, U> selector)
|
||||
{
|
||||
if (!items.Any())
|
||||
{
|
||||
throw new InvalidOperationException("Empty input sequence");
|
||||
}
|
||||
|
||||
var comparer = Comparer<U>.Default;
|
||||
T maxItem = items.First();
|
||||
U maxValue = selector(maxItem);
|
||||
|
||||
foreach (T item in items.Skip(1))
|
||||
{
|
||||
// Get the value of the item and compare it to the current max.
|
||||
U value = selector(item);
|
||||
if (comparer.Compare(value, maxValue) > 0)
|
||||
{
|
||||
maxValue = value;
|
||||
maxItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
return maxItem;
|
||||
}
|
||||
|
||||
public static T MinBy<T, U>(this IEnumerable<T> items, Func<T, U> selector)
|
||||
{
|
||||
if (!items.Any())
|
||||
{
|
||||
throw new InvalidOperationException("Empty input sequence");
|
||||
}
|
||||
|
||||
var comparer = Comparer<U>.Default;
|
||||
T maxItem = items.First();
|
||||
U maxValue = selector(maxItem);
|
||||
|
||||
foreach (T item in items.Skip(1))
|
||||
{
|
||||
// Get the value of the item and compare it to the current max.
|
||||
U value = selector(item);
|
||||
if (comparer.Compare(value, maxValue) < 0)
|
||||
{
|
||||
maxValue = value;
|
||||
maxItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
return maxItem;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AsyncAwaitExtensions
|
||||
{
|
||||
public static async void WrapAwait(this Task task)
|
||||
{
|
||||
await task;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eed05df00a9a6b84292c81be1662a66e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using Unity.Mathematics;
|
||||
|
||||
public interface INamedEntry
|
||||
{
|
||||
string EntryName { get; set; }
|
||||
}
|
||||
|
||||
public abstract class DatabaseEntry
|
||||
{
|
||||
public Guid ID = Guid.NewGuid();
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ID.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is DatabaseEntry entry) return entry.ID == ID;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class DatabaseLink<T> : DatabaseLinkBase where T : ItemData
|
||||
{
|
||||
public T Value => ResolveRuntimeItemCatalog<T>(LinkID);
|
||||
}
|
||||
|
||||
public class DatabaseLinkBase
|
||||
{
|
||||
public Guid LinkID;
|
||||
|
||||
private static IRuntimeItemCatalogReader Catalog { get; set; }
|
||||
|
||||
protected static T ResolveRuntimeItemCatalog<T>(Guid linkId) where T : ItemData
|
||||
{
|
||||
if (Catalog == null)
|
||||
throw new InvalidOperationException("Runtime item catalog resolution is not bound. Open typed Aetheria runtime state before reading item object graphs.");
|
||||
|
||||
return Catalog.Get<T>(linkId);
|
||||
}
|
||||
|
||||
public static void BindRuntimeItemCatalog(IRuntimeItemCatalogReader catalog)
|
||||
{
|
||||
if (catalog == null) throw new ArgumentNullException(nameof(catalog));
|
||||
|
||||
Catalog = catalog;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITintInspector
|
||||
{
|
||||
float3 TintColor { get; }
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3bb4780bed7bb544dbf6ea2223dd8f06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public static class ReflectionExtensions
|
||||
{
|
||||
private static Dictionary<Type,Type[]> InterfaceClasses = new Dictionary<Type, Type[]>();
|
||||
public static Type[] GetAllInterfaceClasses(this Type type)
|
||||
{
|
||||
if (InterfaceClasses.ContainsKey(type))
|
||||
return InterfaceClasses[type];
|
||||
return InterfaceClasses[type] = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(ass => ass.GetTypes()).Where(t => t.IsClass && t.GetInterfaces().Contains(type)).ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<Type,Type[]> ParentTypes = new Dictionary<Type, Type[]>();
|
||||
|
||||
public static Type[] GetParentTypes(this Type type)
|
||||
{
|
||||
if (ParentTypes.ContainsKey(type))
|
||||
return ParentTypes[type];
|
||||
return ParentTypes[type] = type.GetParents().ToArray();
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetParents(this Type type)
|
||||
{
|
||||
// is there any base type?
|
||||
if (type == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return type;
|
||||
|
||||
// return all implemented or inherited interfaces
|
||||
foreach (var i in type.GetInterfaces())
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
|
||||
// return all inherited types
|
||||
var currentBaseType = type.BaseType;
|
||||
while (currentBaseType != null)
|
||||
{
|
||||
yield return currentBaseType;
|
||||
currentBaseType= currentBaseType.BaseType;
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<Type,Type[]> ChildClasses = new Dictionary<Type, Type[]>();
|
||||
public static Type[] GetAllChildClasses(this Type type)
|
||||
{
|
||||
if (ChildClasses.ContainsKey(type))
|
||||
return ChildClasses[type];
|
||||
return ChildClasses[type] = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(ass => ass.GetTypes()).Where(type.IsAssignableFrom).ToArray();
|
||||
}
|
||||
|
||||
private static Dictionary<Type,Type[]> GenericChildClasses = new Dictionary<Type, Type[]>();
|
||||
public static Type[] GetAllGenericChildClasses(this Type genericType)
|
||||
{
|
||||
if (GenericChildClasses.ContainsKey(genericType))
|
||||
return ChildClasses[genericType];
|
||||
return ChildClasses[genericType] = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(ass => ass.GetTypes()).Where(type=>type.IsAssignableToGenericType(genericType)).ToArray();
|
||||
}
|
||||
|
||||
public static bool IsAssignableToGenericType(this Type givenType, Type genericType)
|
||||
{
|
||||
var interfaceTypes = givenType.GetInterfaces();
|
||||
|
||||
foreach (var it in interfaceTypes)
|
||||
{
|
||||
if (it.IsGenericType && it.GetGenericTypeDefinition() == genericType)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (givenType.IsGenericType && givenType.GetGenericTypeDefinition() == genericType)
|
||||
return true;
|
||||
|
||||
Type baseType = givenType.BaseType;
|
||||
if (baseType == null) return false;
|
||||
|
||||
return IsAssignableToGenericType(baseType, genericType);
|
||||
}
|
||||
|
||||
public static string SplitCamelCase( this string str )
|
||||
{
|
||||
return Regex.Replace(
|
||||
Regex.Replace(
|
||||
str,
|
||||
@"(\P{Ll})(\P{Ll}\p{Ll})",
|
||||
"$1 $2"
|
||||
),
|
||||
@"(\p{Ll})(\P{Ll})",
|
||||
"$1 $2"
|
||||
);
|
||||
}
|
||||
|
||||
public static string FormatTypeName(this string typeName)
|
||||
{
|
||||
return (typeName.EndsWith("Data", StringComparison.InvariantCultureIgnoreCase)
|
||||
? typeName.Substring(0, typeName.Length - 4)
|
||||
: typeName).SplitCamelCase();
|
||||
}
|
||||
|
||||
public static string GetFullName(this Type t)
|
||||
{
|
||||
if (!t.IsGenericType)
|
||||
return t.Name.FormatTypeName();
|
||||
|
||||
var name = t.Name.FormatTypeName();
|
||||
return
|
||||
$"{name.Substring(0, name.LastIndexOf("`"))}{t.GetGenericArguments().Aggregate("<", (aggregate, type) => $"{aggregate}{(aggregate == "<" ? "" : ",")}{GetFullName(type)}")}>";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fd5642f26b80465fb57f3d2610633140
|
||||
timeCreated: 1617055075
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8035c545a12367f419eb4a2fe1c917b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue