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,24 +1,45 @@
using System;
using UnityEngine;
using VContainer;
using VContainer.Unity;
public class StartScreenController
public class StartScreenController:IStartable
{
private StartScreenView startScreenView;
public event Action OnStartPressed;
public StartScreenController(StartScreenView _startScreenView)
[Inject] IGameScreenController gameScreenController;
[Inject] IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
public StartScreenController(StartScreenView _startScreenView, IGameScreenController _gameScreenController)
{
Debug.Log("StartScreenController Constructor Called");
startScreenView = _startScreenView;
startScreenView.tapToStartButton.onClick.AddListener(() => OnStartPressed?.Invoke());
gameScreenController = _gameScreenController;
startScreenView.tapToStartButton.onClick.AddListener(OnTapToStartButtonClicked);
}
public void Start()
{
if(IgameSession.showStartScreen)
{
startScreenView.Show();
IinputReader.LockInput();
IgameSession.showStartScreen = false;
IgameSession.hasGameStarted = false;
}
else
{
gameScreenController.ShowGameScreen();
IgameSession.hasGameStarted = true;
}
}
private void OnTapToStartButtonClicked()
{
IaudioController.PlayBtnPressedSound();
startScreenView.Hide();
}
public void ShowStartScreen()
{
startScreenView.Show();
IinputReader.UnlockInput();
gameScreenController.ShowGameScreen();
IgameSession.hasGameStarted = true;
}
}