add project files
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using OHM.UnityToolkit;
|
||||
using OHM.UnityToolkit.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class UIVictory : UIMenu
|
||||
{
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("scoreCounter")]
|
||||
private UIIncrementableCounter _scoreCounter;
|
||||
|
||||
[SerializeField]
|
||||
private UIIncrementableCounter levelCounter;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("best")]
|
||||
private GameObject _best;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("continueCoins")]
|
||||
private GameObject _continueCoins;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("continueNoCoins")]
|
||||
private GameObject _continueNoCoins;
|
||||
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("collectDuration")]
|
||||
private float _collectDuration = 0.8f;
|
||||
|
||||
[SerializeField]
|
||||
private SFX sfx;
|
||||
|
||||
private bool _canGetMoney;
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
_canGetMoney = true;
|
||||
if (_scoreCounter != null)
|
||||
{
|
||||
_scoreCounter.Init(0L);
|
||||
_scoreCounter.SetTargetValue(appController.coreGame.scoreController.Score);
|
||||
}
|
||||
_continueCoins.SetActive(value: false);
|
||||
_continueNoCoins.SetActive(value: false);
|
||||
if (levelCounter != null)
|
||||
{
|
||||
levelCounter.Init(appController.GetPlayerLevel());
|
||||
}
|
||||
if (_best != null)
|
||||
{
|
||||
_best.SetActive(appController.coreGame.scoreController.Score >= appController.GetBestScore());
|
||||
}
|
||||
ShowContinuesButton();
|
||||
}
|
||||
|
||||
private void ShowContinuesButton()
|
||||
{
|
||||
_continueCoins.SetActive(value: true);
|
||||
_continueNoCoins.SetActive(value: false);
|
||||
sfx.Play(base.transform);
|
||||
}
|
||||
|
||||
public void CollectAndContinue()
|
||||
{
|
||||
if (_canGetMoney)
|
||||
{
|
||||
appController.coreGame.WinCurrencies();
|
||||
_canGetMoney = false;
|
||||
}
|
||||
|
||||
Invoke(nameof(Quit), _collectDuration);
|
||||
}
|
||||
|
||||
private void Quit()
|
||||
{
|
||||
appController.Quit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user