Intro done and bug fix
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
{
|
||||
"name": "Features.AppBoot"
|
||||
}
|
||||
"name": "Features.AppBoot",
|
||||
"rootNamespace": "Darkmatter.Features.AppBoot",
|
||||
"references": [
|
||||
"GUID:6a0a834eb41764f12ba55c3fb04a40cb",
|
||||
"GUID:c1c03c0e5b2f4412b9f2be1c20d6a9b1",
|
||||
"GUID:b0214a6008ed146ff8f122a6a9c2f6cc",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
8
Assets/Darkmatter/Code/Features/AppBoot/Flow.meta
Normal file
8
Assets/Darkmatter/Code/Features/AppBoot/Flow.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc7ecf57035f14a9897f40b12ad1b64f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Assets/Darkmatter/Code/Features/AppBoot/Flow/AppBootFlow.cs
Normal file
44
Assets/Darkmatter/Code/Features/AppBoot/Flow/AppBootFlow.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Darkmatter.Features.AppBoot.SceneRefs;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Darkmatter.Features.AppBoot.Flow
|
||||
{
|
||||
public class AppBootFlow : IAsyncStartable
|
||||
{
|
||||
private readonly AppBootSceneRefs _sceneRefs;
|
||||
|
||||
public AppBootFlow(AppBootSceneRefs sceneRefs)
|
||||
{
|
||||
_sceneRefs = sceneRefs;
|
||||
}
|
||||
|
||||
public async UniTask StartAsync(CancellationToken cancellation = default)
|
||||
{
|
||||
var tcs = new UniTaskCompletionSource();
|
||||
var player = _sceneRefs.IntroVideoPlayer;
|
||||
|
||||
void OnDone(VideoPlayer vp)
|
||||
{
|
||||
vp.loopPointReached -= OnDone;
|
||||
tcs.TrySetResult();
|
||||
}
|
||||
|
||||
player.loopPointReached += OnDone;
|
||||
player.Play();
|
||||
|
||||
await tcs.Task.AttachExternalCancellation(cancellation);
|
||||
|
||||
player.Stop();
|
||||
var rt = player.targetTexture;
|
||||
if (rt != null) rt.Release();
|
||||
|
||||
if (_sceneRefs.IntroCanvas != null)
|
||||
Object.Destroy(_sceneRefs.IntroCanvas.gameObject);
|
||||
Object.Destroy(player.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 892f636e24e0d41ce9423c7a989d717b
|
||||
8
Assets/Darkmatter/Code/Features/AppBoot/Installers.meta
Normal file
8
Assets/Darkmatter/Code/Features/AppBoot/Installers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfa843ca122db487f9a2defa353418a7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using Darkmatter.Features.AppBoot.Flow;
|
||||
using Darkmatter.Features.AppBoot.SceneRefs;
|
||||
using Darkmatter.Libs.Installers;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
|
||||
namespace Darkmatter.Features.AppBoot.Installers
|
||||
{
|
||||
public class AppBootFeatureModule : MonoBehaviour, IModule
|
||||
{
|
||||
[SerializeField] private AppBootSceneRefs sceneRefs;
|
||||
|
||||
public void Register(IContainerBuilder builder)
|
||||
{
|
||||
if (sceneRefs != null)
|
||||
builder.RegisterComponent(sceneRefs);
|
||||
builder.RegisterEntryPoint<AppBootFlow>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3a74c469f13e41a09665530aa744705
|
||||
3
Assets/Darkmatter/Code/Features/AppBoot/SceneRefs.meta
Normal file
3
Assets/Darkmatter/Code/Features/AppBoot/SceneRefs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 016a2252ff404eea98e7a84b80d0e4b1
|
||||
timeCreated: 1779955116
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
|
||||
namespace Darkmatter.Features.AppBoot.SceneRefs
|
||||
{
|
||||
public class AppBootSceneRefs : MonoBehaviour
|
||||
{
|
||||
[field: SerializeField] public VideoPlayer IntroVideoPlayer { get; private set; }
|
||||
[field: SerializeField] public GameObject IntroCanvas { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17fd08f85ba94bf694f285cdd48bee02
|
||||
timeCreated: 1779955127
|
||||
Reference in New Issue
Block a user