add il2cpp options

This commit is contained in:
Mikhail 2024-04-28 19:43:10 +08:00
parent bd7bb03f64
commit 4bc60072ed
13 changed files with 103 additions and 1 deletions

View File

@ -32,6 +32,11 @@ namespace DCFApixels.DragonECS
namespace DCFApixels.DragonECS.Internal
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.Orange)]
internal sealed class EcsPreInitRunner : EcsRunner<IEcsPreInit>, IEcsPreInit
{
@ -83,6 +88,10 @@ namespace DCFApixels.DragonECS.Internal
#endif
}
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.Orange)]
internal sealed class EcsInitRunner : EcsRunner<IEcsInit>, IEcsInit
{
@ -131,6 +140,10 @@ namespace DCFApixels.DragonECS.Internal
#endif
}
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.Orange)]
internal sealed class EcsRunRunner : EcsRunner<IEcsRun>, IEcsRun
{
@ -179,6 +192,10 @@ namespace DCFApixels.DragonECS.Internal
#endif
}
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[MetaColor(MetaColor.Orange)]
internal sealed class EcsDestroyRunner : EcsRunner<IEcsDestroy>, IEcsDestroy
{

View File

@ -10,6 +10,11 @@ using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
//_dense заполняется с индекса 1
//в операциях изменяющих состояние группы нельзя итерироваться по this, либо осторожно учитывать этот момент
[StructLayout(LayoutKind.Sequential, Pack = 0, Size = 8)]
@ -140,6 +145,10 @@ namespace DCFApixels.DragonECS
#endregion
}
#if ENABLE_IL2CPP
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public class EcsGroup : IDisposable, IEnumerable<int>, IEntityStorage
{

View File

@ -6,6 +6,11 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public readonly ref struct EcsSpan
{
@ -37,6 +42,9 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return new EcsLongsSpan(this); }
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.ArrayBoundsChecks, true)]
#endif
public int this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -137,6 +145,10 @@ namespace DCFApixels.DragonECS
#endregion
}
#if ENABLE_IL2CPP
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(EcsSpan.DebuggerProxy))]
public readonly ref struct EcsLongsSpan
{
@ -162,6 +174,9 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _source.Count; }
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.ArrayBoundsChecks, true)]
#endif
public entlong this[int index]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@ -7,6 +7,11 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public sealed class EcsMask : IEquatable<EcsMask>
{

View File

@ -7,6 +7,9 @@ using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
#endif
public class EcsWorldConfig
{
public static readonly EcsWorldConfig Default = new EcsWorldConfig();
@ -24,6 +27,10 @@ namespace DCFApixels.DragonECS
PoolRecycledComponentsCapacity = poolRecycledComponentsCapacity;
}
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public partial class EcsWorld : IEntityStorage
{

View File

@ -2,6 +2,11 @@
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
public sealed class EcsWhereExecutor<TAspect> : EcsQueryExecutor where TAspect : EcsAspect
{
private TAspect _aspect;

View File

@ -2,6 +2,11 @@
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
public sealed class EcsWhereToGroupExecutor<TAspect> : EcsQueryExecutor where TAspect : EcsAspect
{
private TAspect _aspect;

View File

@ -7,6 +7,11 @@ namespace DCFApixels.DragonECS.Internal
{
//TODO разработать возможность ручного устанавливания ID типам.
//это нужно для упрощения разработки сетевух
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
internal static class EcsTypeCode
{
private static readonly Dictionary<Type, int> _codes = new Dictionary<Type, int>();
@ -31,10 +36,18 @@ namespace DCFApixels.DragonECS.Internal
public static bool Has<T>() { return _codes.ContainsKey(typeof(T)); }
public static IEnumerable<TypeCodeInfo> GetDeclaredTypes() { return _codes.Select(o => new TypeCodeInfo(o.Key, o.Value)); }
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
internal static class EcsTypeCodeCache<T>
{
public static readonly int code = EcsTypeCode.Get(typeof(T));
}
#if ENABLE_IL2CPP
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
internal struct TypeCodeInfo
{
public Type type;

View File

@ -6,9 +6,14 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS.Internal
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[Serializable]
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public class IdDispenser : IEnumerable<int>, IReadOnlyCollection<int>
internal class IdDispenser : IEnumerable<int>, IReadOnlyCollection<int>
{
private const int MIN_SIZE = 4;
@ -24,14 +29,17 @@ namespace DCFApixels.DragonECS.Internal
/// <summary> Used Count </summary>
public int Count
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _usedCount; }
}
public int Size
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _size; }
}
public int NullID
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _nullID; }
}
#endregion

View File

@ -8,6 +8,11 @@ using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS.Internal
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
public class SparseArray<TValue>
{
public const int MIN_CAPACITY_BITS_OFFSET = 4;

View File

@ -7,6 +7,11 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS.Internal
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[DebuggerTypeProxy(typeof(UnsafeArray<>.DebuggerProxy))]
internal unsafe struct UnsafeArray<T> : IDisposable, IEnumerable<T>
where T : unmanaged

View File

@ -6,6 +6,10 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
#endif
/// <summary>Pool for IEcsComponent components</summary>
public sealed class EcsPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsComponent

View File

@ -6,6 +6,10 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS
{
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption (Option.NullChecks, false)]
#endif
public sealed class EcsTagPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsTagComponent
{