Game UI ready

This commit is contained in:
Mausham
2025-12-15 17:49:08 -08:00
parent 0ea929bd20
commit f4c55dec05
325 changed files with 28015 additions and 360 deletions

View File

@@ -1,34 +1,48 @@
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using VContainer;
using VContainer.Unity;
public class DeathScreenController
public class DeathScreenController:IDeathScreenController
{
private DeathScreenView deathScreenView;
public event Action OnRestartPressed;
public event Action OnExitPressed;
[Inject] private ScoreService scoreService;
[Inject] private IScoreService IscoreService;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
public DeathScreenController(DeathScreenView _deathScreenView)
{
deathScreenView = _deathScreenView;
deathScreenView.restartBtn.onClick.AddListener(() => OnRestartPressed?.Invoke());
deathScreenView.exitBtn.onClick.AddListener(()=>OnExitPressed?.Invoke());
deathScreenView.restartBtn.onClick.AddListener(OnRestartButtonClicked);
deathScreenView.exitBtn.onClick.AddListener(OnExitButtonClicked);
}
public void ShowDeathScreen()
{
deathScreenView.Show(scoreService.score,scoreService.highScore);
deathScreenView.Show(IscoreService.score,IscoreService.highScore);
}
private void OnExitButtonClicked()
{
Debug.Log("Exit Button Clicked");
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = true;
SceneManager.LoadScene(0);
}
private void OnRestartButtonClicked()
{
Debug.Log("Restart Button Clicked");
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
SceneManager.LoadScene(0);
}
}
public interface IDeathScreenController
{
void ShowDeathScreen();
}