Skip to content

Commit

Permalink
Merge pull request #13 from AnnulusGames/v0.1.8
Browse files Browse the repository at this point in the history
v0.1.8
  • Loading branch information
AnnulusGames committed Oct 24, 2023
2 parents e12641e + 1d3fe79 commit 45b0147
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 128 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Unity.Collections;
using Unity.Entities;

namespace MagicTween.Core
Expand All @@ -12,7 +13,7 @@ protected override void OnCreate()
if (TweenWorld.World != null && TweenWorld.World.IsCreated && TweenWorld.World != World) return;

TweenWorld.Initialize();
ArchetypeStore.Initialize();
//ArchetypeStore.Initialize();
TweenControllerContainer.Clear();
MagicTweenSettings.Initialize();
SharedRandom.InitState((uint)DateTime.Now.Ticks);
Expand All @@ -24,7 +25,9 @@ protected override void OnDestroy()
{
if (TweenWorld.World != World) return;

ArchetypeStore.Dispose();
//ArchetypeStore.Dispose();

if (TweenWorld.ArchetypeStorageRef.IsCreated) TweenWorld.ArchetypeStorageRef.Dispose();
}
}
}
30 changes: 15 additions & 15 deletions MagicTween/Assets/MagicTween/Runtime/Core/TweenFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static Tween<TValue, TOptions> CreateToTween<TValue, TOptions, TPlugin>(
where TOptions : unmanaged, ITweenOptions
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetLambdaTweenArchetype<TValue, TOptions>();
var archetype = TweenWorld.ArchetypeStorageRef.GetLambdaTweenArchetype<TValue, TOptions>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -33,7 +33,7 @@ public static Tween<TValue, TOptions> CreateFromToTween<TValue, TOptions, TPlugi
where TOptions : unmanaged, ITweenOptions
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetLambdaTweenArchetype<TValue, TOptions>();
var archetype = TweenWorld.ArchetypeStorageRef.GetLambdaTweenArchetype<TValue, TOptions>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -49,7 +49,7 @@ public static Tween<TValue, TOptions> CreateToTweenUnsafe<TObject, TValue, TOpti
where TOptions : unmanaged, ITweenOptions
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetUnsafeLambdaTweenArchetype<TValue, TOptions>();
var archetype = TweenWorld.ArchetypeStorageRef.GetUnsafeLambdaTweenArchetype<TValue, TOptions>();
var controllerId = TweenControllerContainer.GetId<UnsafeLambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -64,7 +64,7 @@ public static Tween<TValue, TOptions> CreateFromToTweenUnsafe<TObject, TValue, T
where TOptions : unmanaged, ITweenOptions
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetUnsafeLambdaTweenArchetype<TValue, TOptions>();
var archetype = TweenWorld.ArchetypeStorageRef.GetUnsafeLambdaTweenArchetype<TValue, TOptions>();
var controllerId = TweenControllerContainer.GetId<UnsafeLambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -78,7 +78,7 @@ public static Tween<TValue, PunchTweenOptions> CreatePunchTween<TValue, TPlugin>
where TValue : unmanaged
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetPunchLambdaTweenArchetype<TValue>();
var archetype = TweenWorld.ArchetypeStorageRef.GetPunchLambdaTweenArchetype<TValue>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -104,7 +104,7 @@ public static Tween<TValue, PunchTweenOptions> CreateUnsafePunchTween<TObject, T
where TValue : unmanaged
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetUnsafePunchLambdaTweenArchetype<TValue>();
var archetype = TweenWorld.ArchetypeStorageRef.GetUnsafePunchLambdaTweenArchetype<TValue>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand Down Expand Up @@ -133,7 +133,7 @@ public static Tween<TValue, ShakeTweenOptions> CreateShakeTween<TValue, TPlugin>
where TValue : unmanaged
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetShakeLambdaTweenArchetype<TValue>();
var archetype = TweenWorld.ArchetypeStorageRef.GetShakeLambdaTweenArchetype<TValue>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -160,7 +160,7 @@ public static Tween<TValue, ShakeTweenOptions> CreateUnsafeShakeTween<TObject, T
where TValue : unmanaged
where TPlugin : unmanaged, ITweenPlugin<TValue>
{
var archetype = ArchetypeStore.GetUnsafeShakeLambdaTweenArchetype<TValue>();
var archetype = TweenWorld.ArchetypeStorageRef.GetUnsafeShakeLambdaTweenArchetype<TValue>();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand Down Expand Up @@ -188,7 +188,7 @@ public static Tween<TValue, ShakeTweenOptions> CreateUnsafeShakeTween<TObject, T

public static Tween<UnsafeText, StringTweenOptions> CreateStringToTween(TweenGetter<string> getter, TweenSetter<string> setter, string endValue, float duration)
{
var archetype = ArchetypeStore.GetStringLambdaTweenArchetype();
var archetype = TweenWorld.ArchetypeStorageRef.GetStringLambdaTweenArchetype();
var controllerId = TweenControllerContainer.GetId<StringLambdaTweenController>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand Down Expand Up @@ -219,7 +219,7 @@ public static Tween<UnsafeText, StringTweenOptions> CreateStringToTween(TweenGet
}
public static Tween<UnsafeText, StringTweenOptions> CreateStringFromToTween(TweenSetter<string> setter, string startValue, string endValue, float duration)
{
var archetype = ArchetypeStore.GetStringLambdaTweenArchetype();
var archetype = TweenWorld.ArchetypeStorageRef.GetStringLambdaTweenArchetype();
var controllerId = TweenControllerContainer.GetId<StringLambdaTweenController>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand Down Expand Up @@ -253,7 +253,7 @@ public static Tween<UnsafeText, StringTweenOptions> CreateStringFromToTween(Twee

public unsafe static Tween<float3, PathTweenOptions> CreatePathTween(TweenGetter<float3> getter, TweenSetter<float3> setter, float3[] points, float duration)
{
var archetype = ArchetypeStore.GetPathLambdaTweenArchetype();
var archetype = TweenWorld.ArchetypeStorageRef.GetPathLambdaTweenArchetype();
var controllerId = TweenControllerContainer.GetId<LambdaTweenController<float3, PathTweenPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -277,7 +277,7 @@ public static Tween<TValue, TOptions> CreateEntityFromToTween<TValue, TOptions,
where TPlugin : unmanaged, ITweenPlugin<TValue>
where TTranslator : unmanaged, ITweenTranslatorBase<TValue>
{
var archetype = ArchetypeStore.GetEntityTweenArchetype<TValue, TOptions, TTranslator>();
var archetype = TweenWorld.ArchetypeStorageRef.GetEntityTweenArchetype<TValue, TOptions, TTranslator>();
var controllerId = TweenControllerContainer.GetId<EntityTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -294,7 +294,7 @@ public static Tween<TValue, TOptions> CreateEntityToTween<TValue, TOptions, TPlu
where TPlugin : unmanaged, ITweenPlugin<TValue>
where TTranslator : unmanaged, ITweenTranslatorBase<TValue>
{
var archetype = ArchetypeStore.GetEntityTweenArchetype<TValue, TOptions, TTranslator>();
var archetype = TweenWorld.ArchetypeStorageRef.GetEntityTweenArchetype<TValue, TOptions, TTranslator>();
var controllerId = TweenControllerContainer.GetId<EntityTweenController<TValue, TPlugin>>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -307,7 +307,7 @@ public static Tween<TValue, TOptions> CreateEntityToTween<TValue, TOptions, TPlu

public static Tween CreateUnitTween(float duration)
{
var archetype = ArchetypeStore.GetUnitTweenArchetype();
var archetype = TweenWorld.ArchetypeStorageRef.GetUnitTweenArchetype();
var controllerId = TweenControllerContainer.GetId<UnitTweenController>();

CreateTweenEntity(ref EntityManagerRef, archetype, duration, controllerId, out var entity);
Expand All @@ -316,7 +316,7 @@ public static Tween CreateUnitTween(float duration)

public static Sequence CreateSequence()
{
var archetype = ArchetypeStore.GetSequenceArchetype();
var archetype = TweenWorld.ArchetypeStorageRef.GetSequenceArchetype();
var controllerId = TweenControllerContainer.GetId<SequenceTweenController>();

CreateTweenEntity(ref EntityManagerRef, archetype, 0f, controllerId, out var entity);
Expand Down
4 changes: 4 additions & 0 deletions MagicTween/Assets/MagicTween/Runtime/Core/TweenWorld.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Unity.Entities;
using Unity.Collections;

namespace MagicTween.Core
{
Expand All @@ -9,15 +10,18 @@ public static void Initialize()
_world = World.DefaultGameObjectInjectionWorld;
_entityManager = _world.EntityManager;
_cleanupSystem = _world.GetExistingSystemManaged<TweenCleanupSystem>();
ArchetypeStorage.Create(Allocator.Persistent, out _archetypeStorage);
}

static World _world;
static EntityManager _entityManager;
static TweenCleanupSystem _cleanupSystem;
static ArchetypeStorage _archetypeStorage;

public static World World => _world;
public static EntityManager EntityManager => _entityManager;
public static ref EntityManager EntityManagerRef => ref _entityManager;
public static TweenCleanupSystem CleanupSystem => _cleanupSystem;
internal static ref ArchetypeStorage ArchetypeStorageRef => ref _archetypeStorage;
}
}
15 changes: 9 additions & 6 deletions MagicTween/Assets/MagicTween/Runtime/Sequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public Sequence AppendInterval(float interval)
public Sequence AppendCallback(Action callback)
{
var tween = Tween.Empty(0f);
tween.GetOrAddCallbackActions().onComplete = callback;
tween.GetOrAddCallbackActions().onRewind = callback;
var callbackComponent = tween.GetOrAddCallbackActions();
callbackComponent.onComplete = callback;
callbackComponent.onRewind = callback;
SequenceHelper.Append(this, tween, false);
return this;
}
Expand All @@ -68,8 +69,9 @@ public Sequence PrependInterval(float interval)
public Sequence PrependCallback(Action callback)
{
var tween = Tween.Empty(0f);
tween.GetOrAddCallbackActions().onComplete = callback;
tween.GetOrAddCallbackActions().onRewind = callback;
var callbackComponent = tween.GetOrAddCallbackActions();
callbackComponent.onComplete = callback;
callbackComponent.onRewind = callback;
SequenceHelper.Prepend(this, tween);
return this;
}
Expand All @@ -83,8 +85,9 @@ public Sequence Insert<T>(float position, T tween) where T : struct, ITweenHandl
public Sequence InsertCallback(float position, Action callback)
{
var tween = Tween.Empty(0f);
tween.GetOrAddCallbackActions().onComplete = callback;
tween.GetOrAddCallbackActions().onRewind = callback;
var callbackComponent = tween.GetOrAddCallbackActions();
callbackComponent.onComplete = callback;
callbackComponent.onRewind = callback;
SequenceHelper.Insert(this, tween, position);
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions MagicTween/Assets/MagicTween/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "com.annulusgames.magic-tween",
"version": "0.1.7",
"version": "0.1.8",
"displayName": "Magic Tween",
"description": "Extremely fast tween library implemented in Unity ECS",
"description": "Extremely fast tween library implemented with Unity ECS",
"unity": "2022.1",
"author": {
"name": "Annulus Games",
Expand Down
10 changes: 5 additions & 5 deletions MagicTween/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
"com.neuecc.unirx": "https://github.com/neuecc/UniRx.git?path=Assets/Plugins/UniRx/Scripts",
"com.unity.burst": "1.8.8",
"com.unity.collab-proxy": "2.0.4",
"com.unity.collab-proxy": "2.0.5",
"com.unity.entities": "1.0.14",
"com.unity.entities.graphics": "1.0.14",
"com.unity.feature.2d": "1.0.0",
"com.unity.ide.rider": "3.0.21",
"com.unity.feature.2d": "2.0.0",
"com.unity.ide.rider": "3.0.24",
"com.unity.ide.visualstudio": "2.0.20",
"com.unity.physics": "1.0.14",
"com.unity.postprocessing": "3.2.2",
"com.unity.render-pipelines.universal": "14.0.8",
"com.unity.splines": "2.2.1",
"com.unity.splines": "2.3.0",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.4",
"com.unity.timeline": "1.7.5",
"com.unity.toolchain.macos-arm64-linux-x86_64": "2.0.0",
"com.unity.ugui": "1.0.0",
"com.unity.visualeffectgraph": "14.0.8",
Expand Down
27 changes: 20 additions & 7 deletions MagicTween/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
},
"url": "https://packages.unity.com"
},
"com.unity.2d.aseprite": {
"version": "1.0.0",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.common": "6.0.6",
"com.unity.mathematics": "1.2.6",
"com.unity.modules.animation": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.2d.common": {
"version": "8.0.1",
"depth": 2,
Expand Down Expand Up @@ -85,7 +97,7 @@
}
},
"com.unity.2d.tilemap.extras": {
"version": "3.1.0",
"version": "3.1.1",
"depth": 1,
"source": "registry",
"dependencies": {
Expand All @@ -106,7 +118,7 @@
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "2.0.4",
"version": "2.0.5",
"depth": 0,
"source": "registry",
"dependencies": {},
Expand Down Expand Up @@ -161,7 +173,7 @@
"url": "https://packages.unity.com"
},
"com.unity.feature.2d": {
"version": "1.0.0",
"version": "2.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
Expand All @@ -171,11 +183,12 @@
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.spriteshape": "9.0.2",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.2d.tilemap.extras": "3.1.0"
"com.unity.2d.tilemap.extras": "3.1.1",
"com.unity.2d.aseprite": "1.0.0"
}
},
"com.unity.ide.rider": {
"version": "3.0.21",
"version": "3.0.24",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -299,7 +312,7 @@
}
},
"com.unity.splines": {
"version": "2.2.1",
"version": "2.3.0",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -356,7 +369,7 @@
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.7.4",
"version": "1.7.5",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down
9 changes: 7 additions & 2 deletions MagicTween/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ PlayerSettings:
vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0
bundleVersion: 0.1.7
bundleVersion: 0.1.8
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand All @@ -157,6 +157,7 @@ PlayerSettings:
Standalone: com.AnnulusGames.MagicTween
buildNumber:
Standalone: 0
VisionOS: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
Expand All @@ -181,6 +182,8 @@ PlayerSettings:
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 12.0
VisionOSSdkVersion: 0
VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
Expand Down Expand Up @@ -228,8 +231,10 @@ PlayerSettings:
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
VisionOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
VisionOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
Expand Down Expand Up @@ -753,6 +758,7 @@ PlayerSettings:
QNX: UNITY_POST_PROCESSING_STACK_V2
Stadia: UNITY_POST_PROCESSING_STACK_V2
Standalone: UNITY_POST_PROCESSING_STACK_V2
VisionOS: UNITY_POST_PROCESSING_STACK_V2
WebGL: UNITY_POST_PROCESSING_STACK_V2
Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2
XboxOne: UNITY_POST_PROCESSING_STACK_V2
Expand Down Expand Up @@ -781,7 +787,6 @@ PlayerSettings:
suppressCommonWarnings: 1
allowUnsafeCode: 1
useDeterministicCompilation: 1
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 1
Expand Down
Loading

0 comments on commit 45b0147

Please sign in to comment.