Platformer example started
This commit is contained in:
1 parent
efcfaae647
commit
9f026b76d6
325 files changed
+23540
-270
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Code.Infrastructure.UI;
|
||||
using DG.Tweening;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.Example.Race.UI
|
||||
{
|
||||
public class PlayerScores : UIPanel
|
||||
{
|
||||
[SerializeField] private Image image;
|
||||
[SerializeField] private TMP_Text scoreText;
|
||||
[SerializeField] private Color shownColor;
|
||||
[SerializeField] private Color hiddenColor;
|
||||
|
||||
public void SetText(List<RaceData> scores)
|
||||
{
|
||||
scoreText.text = "";
|
||||
foreach (var score in scores)
|
||||
{
|
||||
var t = TimeSpan.FromSeconds(score.raceTimeSeconds);
|
||||
scoreText.text += $@"{score.place} место за {t:mm\:ss\:fff}\n";
|
||||
}
|
||||
}
|
||||
public override void Open(Action callback = null)
|
||||
{
|
||||
image.DOColor(shownColor, 1f);
|
||||
scoreText.DOColor(shownColor, 1f).onComplete = () => callback?.Invoke();
|
||||
}
|
||||
|
||||
public override void Close(Action callback = null)
|
||||
{
|
||||
image.DOColor(hiddenColor, 1f);
|
||||
scoreText.DOColor(hiddenColor, 1f).onComplete = () => callback?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user