files arranged using assembly defn

This commit is contained in:
Mausham
2025-12-16 18:12:45 -08:00
parent 4f1a6365fe
commit 04b1e3127c
144 changed files with 1207 additions and 1425 deletions

View File

@@ -0,0 +1,48 @@
using Darkmatter.Core;
using UnityEngine;
using UnityEngine.SceneManagement;
using VContainer;
namespace Darkmatter.Presentation
{
public class DeathScreenController : IDeathScreenController
{
private DeathScreenView deathScreenView;
[Inject] private IScoreService IscoreService;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
[Inject] private IGameScreenController IgameScreenController;
public DeathScreenController(DeathScreenView _deathScreenView)
{
deathScreenView = _deathScreenView;
deathScreenView.restartBtn.onClick.AddListener(OnRestartButtonClicked);
deathScreenView.exitBtn.onClick.AddListener(OnExitButtonClicked);
}
public void ShowDeathScreen()
{
IgameScreenController.HideGameScreen();
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();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 92c6fccb35ce2e64a820ecbc0fff7477

View File

@@ -0,0 +1,27 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Darkmatter.Presentation
{
public class DeathScreenView : MonoBehaviour
{
[SerializeField] private GameObject deathScreen;
public Button restartBtn;
public Button exitBtn;
public TextMeshProUGUI score;
public TextMeshProUGUI highScore;
public void Show(int _score, int _highScore)
{
this.score.text = _score.ToString();
this.highScore.text = _highScore.ToString();
deathScreen.SetActive(true);
}
public void Hide()
{
deathScreen.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4aab9e4cddc66e44e90193677b63e24e

View File

@@ -0,0 +1,50 @@
using Darkmatter.Core;
using UnityEngine;
using VContainer;
namespace Darkmatter.Presentation
{
public class GameScreenController : IGameScreenController
{
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;
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()
{
gameScreenView.Show();
}
public void HideGameScreen()
{
gameScreenView.Hide();
}
public void OnPauseButtonClicked()
{
IaudioController.PlayBtnPressedSound();
Time.timeScale = 0f;
IinputReader.LockInput();
IpauseScreenController.ShowPauseScreen();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0ab301d9fb59e24459e315204ffcc8d6

View File

@@ -0,0 +1,28 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace Darkmatter.Presentation
{
public class GameScreenView : MonoBehaviour
{
[SerializeField] private GameObject gameScreen;
public Button pauseBtn;
[SerializeField] private TextMeshProUGUI scoreText;
public void UpdateScore(int score)
{
scoreText.text = score.ToString();
}
public void Show()
{
gameScreen.SetActive(true);
}
public void Hide()
{
gameScreen.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2efefd316bbb28246bcee036477a00a5

View File

@@ -0,0 +1,46 @@
using Darkmatter.Core;
using UnityEngine;
using UnityEngine.SceneManagement;
using VContainer;
namespace Darkmatter.Presentation
{
public class PauseScreenController : IPauseScreenController
{
private PauseScreenView pauseScreenView;
[Inject] private IInputReader IinputReader;
[Inject] private IAudioController IaudioController;
[Inject] private IGameSession IgameSession;
public PauseScreenController(PauseScreenView _pauseScreenView)
{
pauseScreenView = _pauseScreenView;
pauseScreenView.resumeBtn.onClick.AddListener(OnResumeButtonClicked);
pauseScreenView.restartBtn.onClick.AddListener(OnRestartButtonClicked);
}
public void ShowPauseScreen()
{
pauseScreenView.Show();
}
private void OnRestartButtonClicked()
{
Time.timeScale = 1.0f;
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
IgameSession.showStartScreen = false;
SceneManager.LoadScene(0); //Restart This Scene
}
private void OnResumeButtonClicked()
{
Time.timeScale = 1.0f;
pauseScreenView.Hide();
IinputReader.UnlockInput();
IaudioController.PlayBtnPressedSound();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 682db5ec0dd207b4fb4122bc7798ffc4

View File

@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UI;
namespace Darkmatter.Presentation
{
public class PauseScreenView : MonoBehaviour
{
[SerializeField] public GameObject pauseScreen;
public Button resumeBtn;
public Button restartBtn;
public void Show()
{
pauseScreen.SetActive(true);
}
public void Hide()
{
pauseScreen.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e57e5514aa3e64c40a4d396db68170c4

View File

@@ -0,0 +1,49 @@
using Darkmatter.Core;
using UnityEngine;
using VContainer;
using VContainer.Unity;
namespace Darkmatter.Presentation
{
public class StartScreenController : IStartable
{
private 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;
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();
IinputReader.UnlockInput();
gameScreenController.ShowGameScreen();
IgameSession.hasGameStarted = true;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3f1b78c138759874ab695ee6697c16a4

View File

@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.UI;
namespace Darkmatter.Presentation
{
public class StartScreenView : MonoBehaviour
{
[SerializeField] private GameObject startScreen;
public Button tapToStartButton;
public void Show()
{
startScreen.SetActive(true);
}
public void Hide()
{
startScreen.SetActive(false);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3fccddd791b55e446a7a091823024f34