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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,11 @@
namespace DCFApixels.DragonECS 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 public sealed class EcsWhereExecutor<TAspect> : EcsQueryExecutor where TAspect : EcsAspect
{ {
private TAspect _aspect; private TAspect _aspect;

View File

@ -2,6 +2,11 @@
namespace DCFApixels.DragonECS 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 public sealed class EcsWhereToGroupExecutor<TAspect> : EcsQueryExecutor where TAspect : EcsAspect
{ {
private TAspect _aspect; private TAspect _aspect;

View File

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

View File

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

View File

@ -8,6 +8,11 @@ using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS.Internal 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 class SparseArray<TValue>
{ {
public const int MIN_CAPACITY_BITS_OFFSET = 4; public const int MIN_CAPACITY_BITS_OFFSET = 4;

View File

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

View File

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

View File

@ -6,6 +6,10 @@ using System.Runtime.CompilerServices;
namespace DCFApixels.DragonECS 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 public sealed class EcsTagPool<T> : IEcsPoolImplementation<T>, IEcsStructPool<T>, IEnumerable<T> //IEnumerable<T> - IntelliSense hack
where T : struct, IEcsTagComponent where T : struct, IEcsTagComponent
{ {