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,16 +1,31 @@
using System;
using Unity.VisualScripting;
using UnityEngine;
using VContainer;
using VContainer.Unity;
public class GameScreenController
public class GameScreenController: IGameScreenController
{
GameScreenView gameScreenView;
public event Action OnPausePressed;
public GameScreenController(GameScreenView _gameScreenView)
[Inject] private IScoreService IscoreService;
[Inject] private IPauseScreenController IpauseScreenController;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
public GameScreenController(GameScreenView _gameScreenView,IScoreService _IscoreService,IPauseScreenController _IpauseScreenController)
{
this.gameScreenView = _gameScreenView;
gameScreenView.pauseBtn.onClick.AddListener(()=>OnPausePressed?.Invoke());
IscoreService = _IscoreService;
IpauseScreenController=_IpauseScreenController;
IscoreService.OnScoreChange += UpdateScore;
gameScreenView.pauseBtn.onClick.AddListener(OnPauseButtonClicked);
}
private void UpdateScore(int score)
{
Debug.Log("calling Score");
gameScreenView.UpdateScore(score);
}
public void ShowGameScreen()
@@ -20,6 +35,14 @@ public class GameScreenController
public void OnPauseButtonClicked()
{
Debug.Log("Paused Btn Clicked");
IaudioController.PlayBtnPressedSound();
Time.timeScale = 0f;
IinputReader.LockInput();
IpauseScreenController.ShowPauseScreen();
}
}
public interface IGameScreenController {
void ShowGameScreen();
}