simple UI added
This commit is contained in:
39
Assets/Scripts/UI/DeathScreenController.cs
Normal file
39
Assets/Scripts/UI/DeathScreenController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user