simple UI added

This commit is contained in:
Mausham
2025-12-11 18:20:42 -08:00
parent 60e58082ac
commit 2118bb7c36
576 changed files with 126744 additions and 13 deletions

View File

@@ -0,0 +1,39 @@
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using VContainer;
public class DeathScreenController
{
private DeathScreenView _view;
[Inject] private StartScreenController startScreenController;
public DeathScreenController(DeathScreenView view)
{
_view = view;
_view.backButton.onClick.AddListener(OnBackBtnClicked);
_view.rePlayButton.onClick.AddListener(OnReplayBtnClicked);
}
public void HideDeathScreen()
{
_view.Hide();
}
private void OnReplayBtnClicked()
{
HideDeathScreen();
SceneManager.LoadScene(0);
Debug.Log("Game Replayed");
}
private void OnBackBtnClicked()
{
HideDeathScreen();
SceneManager.LoadScene(0);
}
public void ShowDeathScreen(int score, int highscore)
{
_view.Show(score,highscore);
}
}

View File

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

View File

@@ -0,0 +1,28 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class DeathScreenView : MonoBehaviour
{
public GameObject deathScreen;
public Button rePlayButton;
public Button backButton;
public TextMeshProUGUI highScoreText;
public TextMeshProUGUI currentScoreText;
private void Start()
{
deathScreen.SetActive(false);
}
public void Show(int score, int highscore)
{
highScoreText.text = highscore.ToString();
currentScoreText.text = score.ToString();
deathScreen.SetActive(true);
}
public void Hide()
{
deathScreen.SetActive(false);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 89974c575158e4d4fb7be55470dc5150

View File

@@ -0,0 +1,37 @@
using UnityEngine;
using VContainer;
public class StartScreenController
{
private StartScreenView _view;
public bool hasGameStarted = false;
public StartScreenController(StartScreenView view)
{
_view = view;
_view.playBtn.onClick.AddListener(OnPlayBtnClicked);
Debug.Log("Instance");
}
public void OnPlayBtnClicked()
{
_view.Hide();
hasGameStarted = true;
}
public void ShowStartScreen()
{
_view.Show();
hasGameStarted = false;
}
public void HideStartScreen()
{
_view.Hide();
hasGameStarted = true;
}
}

View File

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

View File

@@ -0,0 +1,19 @@
using UnityEngine;
using UnityEngine.UI;
using VContainer;
public class StartScreenView : MonoBehaviour
{
public GameObject startScreen;
public Button playBtn;
public void Hide()
{
startScreen.SetActive(false);
}
public void Show()
{
startScreen.SetActive(true);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7614619c0714a4e47804c3234d3398dc