completed intro video and mainmenu scene

This commit is contained in:
Mausham
2026-05-28 15:37:33 +05:45
parent 86bf52ced4
commit 3f14d0b346
6 changed files with 74 additions and 122 deletions

View File

@@ -1,4 +1,5 @@
using System;
using Darkmatter.Core.Data.Signals.Features.AppBoot;
using Darkmatter.Libs.Observer;
using UnityEngine;
using VContainer.Unity;
@@ -7,16 +8,12 @@ namespace Darkmatter.Features.Mainmenu
{
public class MainMenuPresenter : IStartable, IDisposable
{
<<<<<<<< HEAD:Assets/Darkmatter/Code/Features/MainMenu/UI/MainmenuPresenter.cs
private readonly MainmenuView _view;
private readonly IEventBus _eventBus;
public MainmenuPresenter(MainmenuView view, IEventBus eventBus)
========
private readonly MainMenuView _view;
public MainMenuPresenter(MainMenuView view)
>>>>>>>> origin/main:Assets/Darkmatter/Code/Features/MainMenu/UI/MainMenuPresenter.cs
public MainMenuPresenter(MainMenuView view, IEventBus eventBus)
{
_view = view;
_eventBus = eventBus;
@@ -25,6 +22,12 @@ namespace Darkmatter.Features.Mainmenu
public void Start()
{
_view.OnPlayBtnClickedEvent += OnPlayBtnClicked;
_eventBus.Subscribe<IntroCompletedSignal>(OnIntroComplete);
}
private void OnIntroComplete(IntroCompletedSignal signal)
{
_view.PlayMascotIntro();
}
private void OnPlayBtnClicked()

View File

@@ -10,10 +10,8 @@ namespace Darkmatter.Features.Mainmenu
public class MainMenuView : MonoBehaviour
{
[Header("UI Elements")]
[SerializeField] private Button playBtn;
[SerializeField] private ParticleSystem playBtnParticle;
[SerializeField] private Animator playBtnAnimator;
//[SerializeField] private Button playBtn;
[SerializeField] private PlayButtonView playBtn;
[SerializeField] private SkeletonGraphic mascotSkeletonGraphic;
[Header("Mascot Animations")]
@@ -28,8 +26,7 @@ namespace Darkmatter.Features.Mainmenu
private void Start()
{
playBtn.onClick.AddListener(OnPlayBtnClicked);
PlayMascotIntro();
playBtn.OnPlayBtnClickedEvent += () => OnPlayBtnClickedEvent?.Invoke();
}
private void OnDisable()
@@ -39,7 +36,7 @@ namespace Darkmatter.Features.Mainmenu
helloCts = null;
}
private void PlayMascotIntro()
public void PlayMascotIntro()
{
var state = mascotSkeletonGraphic.AnimationState;
state.SetAnimation(0, jumpAnimation, false);
@@ -59,19 +56,5 @@ namespace Darkmatter.Features.Mainmenu
state.AddAnimation(0, idleAnimation, true, 0f);
}
}
private void OnPlayBtnClicked()
{
playBtn.interactable = false;
playBtnAnimator.enabled = false;
PlayBtnSequenceAsync(this.GetCancellationTokenOnDestroy()).Forget();
}
private async UniTaskVoid PlayBtnSequenceAsync(CancellationToken token)
{
playBtnParticle.Play();
await UniTask.WaitUntil(() => !playBtnParticle.IsAlive(true), cancellationToken: token);
OnPlayBtnClickedEvent?.Invoke();
}
}
}

View File

@@ -1,9 +0,0 @@
using UnityEngine;
namespace Darkmatter.Features.Mainmenu
{
public class PlayBtnEffector : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Threading;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
namespace Darkmatter.Features.Mainmenu
{
public class PlayButtonView : MonoBehaviour
{
private Button playBtn;
private Animator playBtnAnimator;
[SerializeField] private ParticleSystem playBtnParticle;
public event Action OnPlayBtnClickedEvent;
private void Awake()
{
playBtnAnimator = GetComponent<Animator>();
playBtn = GetComponent<Button>();
}
private void Start()
{
playBtn.onClick.AddListener(OnPlayBtnClicked);
}
private void OnPlayBtnClicked()
{
playBtn.interactable = false;
playBtnAnimator.enabled = false;
PlayBtnSequenceAsync(this.GetCancellationTokenOnDestroy()).Forget();
}
private async UniTaskVoid PlayBtnSequenceAsync(CancellationToken token)
{
playBtnParticle.Play();
await UniTask.WaitUntil(() => !playBtnParticle.IsAlive(true), cancellationToken: token);
OnPlayBtnClickedEvent?.Invoke();
}
}
}