mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-19 02:24:37 +08:00
fixes for support Unity 2020.1.x
This commit is contained in:
parent
e3839609a5
commit
8b5cdd84f4
@ -25,7 +25,7 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get => _values.Length;
|
get => _values.Length;
|
||||||
}
|
}
|
||||||
public readonly int this[int index]
|
public int this[int index]
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get => _values[index];
|
get => _values[index];
|
||||||
|
@ -142,16 +142,28 @@ namespace DCFApixels.DragonECS
|
|||||||
foreach (var id in maskInc)
|
foreach (var id in maskInc)
|
||||||
{
|
{
|
||||||
var bit = EcsMaskBit.FromID(id);
|
var bit = EcsMaskBit.FromID(id);
|
||||||
if (!r.TryAdd(bit.chankIndex, bit.mask))
|
if (r.ContainsKey(bit.chankIndex))
|
||||||
|
{
|
||||||
r[bit.chankIndex] = r[bit.chankIndex] | bit.mask;
|
r[bit.chankIndex] = r[bit.chankIndex] | bit.mask;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r[bit.chankIndex] = bit.mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EcsMaskBit[] incMasks = r.Select(o => new EcsMaskBit(o.Key, o.Value)).ToArray();
|
EcsMaskBit[] incMasks = r.Select(o => new EcsMaskBit(o.Key, o.Value)).ToArray();
|
||||||
r.Clear();
|
r.Clear();
|
||||||
foreach (var id in maskExc)
|
foreach (var id in maskExc)
|
||||||
{
|
{
|
||||||
var bit = EcsMaskBit.FromID(id);
|
var bit = EcsMaskBit.FromID(id);
|
||||||
if (!r.TryAdd(bit.chankIndex, bit.mask))
|
if (r.ContainsKey(bit.chankIndex))
|
||||||
|
{
|
||||||
r[bit.chankIndex] = r[bit.chankIndex] | bit.mask;
|
r[bit.chankIndex] = r[bit.chankIndex] | bit.mask;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r[bit.chankIndex] = bit.mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EcsMaskBit[] excMasks = r.Select(o => new EcsMaskBit(o.Key, o.Value)).ToArray();
|
EcsMaskBit[] excMasks = r.Select(o => new EcsMaskBit(o.Key, o.Value)).ToArray();
|
||||||
|
|
||||||
@ -230,7 +242,6 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
public static EcsMaskBit FromID(int id)
|
public static EcsMaskBit FromID(int id)
|
||||||
{
|
{
|
||||||
short x = 10;
|
|
||||||
return new EcsMaskBit(id >> DIV_SHIFT, 1 << (id & MOD_MASK)); //аналогично new EcsMaskBit(id / BITS, 1 << (id % BITS)) но быстрее
|
return new EcsMaskBit(id >> DIV_SHIFT, 1 << (id & MOD_MASK)); //аналогично new EcsMaskBit(id / BITS, 1 << (id % BITS)) но быстрее
|
||||||
}
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -138,12 +138,12 @@ namespace DCFApixels.DragonECS
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
Type GetRunnerBaseType(Type type)
|
Type GetRunnerBaseType(Type typeX)
|
||||||
{
|
{
|
||||||
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(EcsRunner<>))
|
if (typeX.IsGenericType && typeX.GetGenericTypeDefinition() == typeof(EcsRunner<>))
|
||||||
return type;
|
return typeX;
|
||||||
if (type.BaseType != null)
|
if (typeX.BaseType != null)
|
||||||
return GetRunnerBaseType(type.BaseType);
|
return GetRunnerBaseType(typeX.BaseType);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Type baseType = GetRunnerBaseType(type);
|
Type baseType = GetRunnerBaseType(type);
|
||||||
@ -291,7 +291,7 @@ namespace DCFApixels.DragonECS
|
|||||||
name = Regex.Replace(name, @"\bEcs|Process\b", "");
|
name = Regex.Replace(name, @"\bEcs|Process\b", "");
|
||||||
if (Regex.IsMatch(name, "`\\w{1,}$"))
|
if (Regex.IsMatch(name, "`\\w{1,}$"))
|
||||||
{
|
{
|
||||||
var s = name.Split("`");
|
var s = name.Split("`".ToCharArray());
|
||||||
name = s[0] + $"<{s[1]}>";
|
name = s[0] + $"<{s[1]}>";
|
||||||
}
|
}
|
||||||
_processes.Add(type, new ProcessInterface(type, name));
|
_processes.Add(type, new ProcessInterface(type, name));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#if ENABLE_DUMMY_SPAN
|
#if ENABLE_DUMMY_SPAN
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute;
|
using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute;
|
||||||
@ -68,12 +69,14 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Object
|
#region Object
|
||||||
|
#pragma warning disable CS0809 // Óñòàðåâøèé ÷ëåí ïåðåîïðåäåëÿåò íåóñòàðåâøèé ÷ëåí
|
||||||
[Obsolete("Equals() on ReadOnlySpan will always throw an exception. Use the equality operator instead.")]
|
[Obsolete("Equals() on ReadOnlySpan will always throw an exception. Use the equality operator instead.")]
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
public override bool Equals(object obj) => throw new NotSupportedException();
|
public override bool Equals(object obj) => throw new NotSupportedException();
|
||||||
[Obsolete("GetHashCode() on ReadOnlySpan will always throw an exception.")]
|
[Obsolete("GetHashCode() on ReadOnlySpan will always throw an exception.")]
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
public override int GetHashCode() => throw new NotSupportedException();
|
public override int GetHashCode() => throw new NotSupportedException();
|
||||||
|
#pragma warning restore CS0809 // Óñòàðåâøèé ÷ëåí ïåðåîïðåäåëÿåò íåóñòàðåâøèé ÷ëåí
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
//if (typeof(T) == typeof(char))
|
//if (typeof(T) == typeof(char))
|
||||||
@ -155,6 +158,19 @@ namespace DCFApixels.DragonECS
|
|||||||
// return retVal;
|
// 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)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ReadOnlySpan<T> Slice(int start)
|
public ReadOnlySpan<T> Slice(int start)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user