Что я сдал
This commit is contained in:
1 parent
24b1157026
commit
a5665f0101
2838 files changed
+129953
-1304
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using Code.GameplayServices;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class PlayerNameSetter : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TMP_InputField playerNameInput;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerNameInput.onSubmit.AddListener(PlayerScoreService.Instance.SetPlayerName);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
playerNameInput.onSubmit.RemoveListener(PlayerScoreService.Instance.SetPlayerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f4db2b26d88412b866130c8c56de6a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 500
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using Code.GameplayServices;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -9,16 +8,22 @@ namespace Code.UI
|
||||
public class RestartPanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button restartButton;
|
||||
[SerializeField] private Button showScoresPanel;
|
||||
[SerializeField] private ScoreTable scoreTable;
|
||||
[SerializeField] private TMP_Text scoreText;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
restartButton.onClick.AddListener(RestartGame);
|
||||
showScoresPanel.onClick.AddListener(PlayerScoreService.Instance.ShowScoreTable);
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
restartButton.onClick.RemoveListener(RestartGame);
|
||||
showScoresPanel.onClick.RemoveListener(PlayerScoreService.Instance.ShowScoreTable);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -31,6 +36,10 @@ namespace Code.UI
|
||||
scoreText.text = PlayerScoreService.Instance.Score.ToString();
|
||||
}
|
||||
|
||||
private void RestartGame() => GameplayManager.Instance.RestartGame();
|
||||
private void RestartGame()
|
||||
{
|
||||
GameplayManager.Instance.RestartGame();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Code.GameplayServices;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class ScoreDataView : MonoBehaviour
|
||||
{
|
||||
private ScoreData _scoreData;
|
||||
[SerializeField] private TMP_Text playerName;
|
||||
[SerializeField] private TMP_Text score;
|
||||
|
||||
public void SetScoreData(ScoreData scoreData)
|
||||
{
|
||||
_scoreData = scoreData;
|
||||
score.text = _scoreData.score.ToString();
|
||||
playerName.text = _scoreData.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4062cee3c2574cf5a585fe6a1ad09955
|
||||
timeCreated: 1777911875
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Code.GameplayServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class ScoreTable : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform scoreDataBox;
|
||||
[SerializeField] private ScoreDataView scoreDataPrefab;
|
||||
[SerializeField] private Button exitButton;
|
||||
private List<ScoreDataView> _scoreDataViews = new();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
exitButton.onClick.AddListener(HideTable);
|
||||
HideTable();
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
exitButton.onClick.RemoveListener(HideTable);
|
||||
}
|
||||
|
||||
private void HideTable() => gameObject.SetActive(false);
|
||||
private void OnEnable()
|
||||
{
|
||||
foreach (var score in PlayerScoreService.Instance.Scores)
|
||||
{
|
||||
var scoreData = Instantiate(scoreDataPrefab, scoreDataBox);
|
||||
scoreData.SetScoreData(score);
|
||||
_scoreDataViews.Add(scoreData);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
foreach (var scoreDataView in _scoreDataViews)
|
||||
{
|
||||
Destroy(scoreDataView.gameObject);
|
||||
}
|
||||
_scoreDataViews.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 070b229c264246378695676272843220
|
||||
timeCreated: 1777911495
|
||||
@@ -0,0 +1,27 @@
|
||||
using Code.GameplayServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class StartGamePanel : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button startGameButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
startGameButton.onClick.AddListener(RestartGame);
|
||||
}
|
||||
|
||||
private void RestartGame()
|
||||
{
|
||||
GameplayManager.Instance.RestartGame();
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
startGameButton.onClick.RemoveListener(RestartGame);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28b1b2220c4e4b2bbd9066886e8c0765
|
||||
timeCreated: 1777891400
|
||||
Reference in new issue
Block a user