-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
440 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Assets/MackySoft/MackySoft.Navigathena/Tests/Runtime/SceneManagement.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
...MackySoft/MackySoft.Navigathena/Tests/Runtime/SceneManagement/AnonymousSceneEntryPoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
using System.Threading; | ||
using Cysharp.Threading.Tasks; | ||
|
||
namespace MackySoft.Navigathena.SceneManagement.Tests | ||
{ | ||
|
||
[Flags] | ||
public enum SceneEntryPointCallbackFlags | ||
{ | ||
None = 0, | ||
All = OnInitialize | OnEnter | OnExit | OnFinalize, | ||
OnInitialize = 1 << 0, | ||
OnEnter = 1 << 1, | ||
OnExit = 1 << 2, | ||
OnFinalize = 1 << 3, | ||
} | ||
|
||
public sealed class SceneEntryPointCallbackFlagsStore | ||
{ | ||
public SceneEntryPointCallbackFlags Value { get; set; } | ||
} | ||
|
||
public sealed class AnonymousSceneEntryPoint : SceneEntryPointBase | ||
{ | ||
|
||
SceneEntryPointCallbackFlagsStore m_Flags = new(); | ||
|
||
Func<ISceneDataReader, IProgress<IProgressDataStore>, CancellationToken, UniTask> m_OnInitialize; | ||
Func<ISceneDataReader, CancellationToken, UniTask> m_OnEnter; | ||
Func<ISceneDataWriter, CancellationToken, UniTask> m_OnExit; | ||
Func<ISceneDataWriter, IProgress<IProgressDataStore>, CancellationToken, UniTask> m_OnFinalize; | ||
|
||
public void SetCallbacks ( | ||
Func<ISceneDataReader, IProgress<IProgressDataStore>, CancellationToken, UniTask> onInitialize = null, | ||
Func<ISceneDataReader, CancellationToken, UniTask> onEnter = null, | ||
Func<ISceneDataWriter, CancellationToken, UniTask> onExit = null, | ||
Func<ISceneDataWriter, IProgress<IProgressDataStore>, CancellationToken, UniTask> onFinalize = null | ||
) | ||
{ | ||
m_OnInitialize = onInitialize; | ||
m_OnEnter = onEnter; | ||
m_OnExit = onExit; | ||
m_OnFinalize = onFinalize; | ||
} | ||
|
||
public void RegisterFlags (SceneEntryPointCallbackFlagsStore store) | ||
{ | ||
m_Flags = store; | ||
} | ||
|
||
protected override UniTask OnInitialize (ISceneDataReader reader, IProgress<IProgressDataStore> progress, CancellationToken cancellationToken) | ||
{ | ||
m_Flags.Value |= SceneEntryPointCallbackFlags.OnInitialize; | ||
return m_OnInitialize?.Invoke(reader, progress, cancellationToken) ?? UniTask.CompletedTask; | ||
} | ||
|
||
protected override UniTask OnEnter (ISceneDataReader reader, CancellationToken cancellationToken) | ||
{ | ||
m_Flags.Value |= SceneEntryPointCallbackFlags.OnEnter; | ||
return m_OnEnter?.Invoke(reader, cancellationToken) ?? UniTask.CompletedTask; | ||
} | ||
|
||
protected override UniTask OnExit (ISceneDataWriter writer, CancellationToken cancellationToken) | ||
{ | ||
m_Flags.Value |= SceneEntryPointCallbackFlags.OnExit; | ||
return m_OnExit?.Invoke(writer, cancellationToken) ?? UniTask.CompletedTask; | ||
} | ||
|
||
protected override UniTask OnFinalize (ISceneDataWriter writer, IProgress<IProgressDataStore> progress, CancellationToken cancellationToken) | ||
{ | ||
m_Flags.Value |= SceneEntryPointCallbackFlags.OnFinalize; | ||
return m_OnFinalize?.Invoke(writer, progress, cancellationToken) ?? UniTask.CompletedTask; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...Soft/MackySoft.Navigathena/Tests/Runtime/SceneManagement/AnonymousSceneEntryPoint.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...igathena/Tests/Runtime/SceneManagement/MackySoft.Navigathena.SceneManagement.Tests.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "MackySoft.Navigathena.SceneManagement.Tests", | ||
"rootNamespace": "MackySoft.Navigathena.SceneManagement.Tests", | ||
"references": [ | ||
"UnityEngine.TestRunner", | ||
"MackySoft.Navigathena", | ||
"MackySoft.Navigathena.SceneManagement", | ||
"UniTask" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": true, | ||
"precompiledReferences": [ | ||
"nunit.framework.dll" | ||
], | ||
"autoReferenced": false, | ||
"defineConstraints": [ | ||
"UNITY_INCLUDE_TESTS" | ||
], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
...ena/Tests/Runtime/SceneManagement/MackySoft.Navigathena.SceneManagement.Tests.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.