fixes for support unity 2020.1.x

This commit is contained in:
Mikhail 2024-01-08 13:39:38 +08:00
parent 94fdcab168
commit b2414ec765
8 changed files with 66 additions and 8 deletions

View File

@ -28,7 +28,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _values.Length;
}
public readonly int this[int index]
public int this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _values[index];

View File

@ -75,7 +75,7 @@ namespace DCFApixels.DragonECS
internal sealed class ComponentResetHandler<T> : IEcsComponentReset<T>
where T : IEcsComponentReset<T>
{
private T _fakeInstnace;
private T _fakeInstnace = default;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Reset(ref T component) => _fakeInstnace.Reset(ref component);
}

11
src/EcsMask.cs.meta Normal file
View File

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

View File

@ -138,12 +138,12 @@ namespace DCFApixels.DragonECS
throw new Exception();
}
Type GetRunnerBaseType(Type type)
Type GetRunnerBaseType(Type inType)
{
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(EcsRunner<>))
return type;
if (type.BaseType != null)
return GetRunnerBaseType(type.BaseType);
if (inType.IsGenericType && inType.GetGenericTypeDefinition() == typeof(EcsRunner<>))
return inType;
if (inType.BaseType != null)
return GetRunnerBaseType(inType.BaseType);
return null;
}
Type baseType = GetRunnerBaseType(type);
@ -291,7 +291,7 @@ namespace DCFApixels.DragonECS
name = Regex.Replace(name, @"\bEcs|Process\b", "");
if (Regex.IsMatch(name, "`\\w{1,}$"))
{
var s = name.Split("`");
var s = name.Split('`');
name = s[0] + $"<{s[1]}>";
}
_processes.Add(type, new ProcessInterface(type, name));

View File

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

View File

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

View File

@ -68,12 +68,14 @@ namespace DCFApixels.DragonECS
#endregion
#region Object
#pragma warning disable CS0809 // Óñòàðåâøèé ÷ëåí ïåðåîïðåäåëÿåò íåóñòàðåâøèé ÷ëåí
[Obsolete("Equals() on ReadOnlySpan will always throw an exception. Use the equality operator instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => throw new NotSupportedException();
[Obsolete("GetHashCode() on ReadOnlySpan will always throw an exception.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => throw new NotSupportedException();
#pragma warning restore CS0809 // Óñòàðåâøèé ÷ëåí ïåðåîïðåäåëÿåò íåóñòàðåâøèé ÷ëåí
public override string ToString()
{
//if (typeof(T) == typeof(char))
@ -154,6 +156,18 @@ namespace DCFApixels.DragonECS
// }
// return retVal;
//}
public void CopyTo(T[] array)
{
if (_length > array.Length)
{
throw new ArgumentOutOfRangeException();
}
for (int i = 0; i < _length; i++)
{
array[i] = _array[i];
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ReadOnlySpan<T> Slice(int start)

View File

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