diff --git a/Assets/Script/UI/PlayResultScreen/PlayResultScreen.cs b/Assets/Script/UI/PlayResultScreen/PlayResultScreen.cs index a38ffab00..be92edecd 100644 --- a/Assets/Script/UI/PlayResultScreen/PlayResultScreen.cs +++ b/Assets/Script/UI/PlayResultScreen/PlayResultScreen.cs @@ -1,22 +1,18 @@ using System; using System.Collections; using System.Collections.Generic; +using DG.Tweening; using TMPro; using UnityEngine; using UnityEngine.UI; - -using DG.Tweening; - using YARG.Data; using YARG.Input; using YARG.PlayMode; namespace YARG.UI.PlayResultScreen { - public class PlayResultScreen : MonoBehaviour { + public class PlayResultScreen : MonoBehaviour { private readonly Color PASS = new(.18f, .85f, 1f); private readonly Color FAIL = new(.95f, .17f, .22f); - private readonly Color PASS_TRANSLUCENT = new(.18f, .85f, 1f, .2f); - private readonly Color FAIL_TRANSLUCENT = new(.95f, .17f, .22f, .2f); [SerializeField] private GameObject playerCardPrefab; @@ -36,7 +32,7 @@ public class PlayResultScreen : MonoBehaviour { private CanvasGroup songInfoCG; [SerializeField] private TextMeshProUGUI songTitle; - [SerializeField] + [SerializeField] private TextMeshProUGUI songArtist; [SerializeField] private CanvasGroup starScoreCG; @@ -76,7 +72,7 @@ void OnEnable() { // change graphics depending on clear/fail backgroundBorderFail.gameObject.SetActive(hasFailed); - backgroundBorderPass.gameObject.SetActive(!hasFailed); + backgroundBorderPass.gameObject.SetActive(!hasFailed); headerBackgroundPassed.gameObject.SetActive(!hasFailed); songArtist.color = hasFailed ? FAIL : PASS; @@ -139,7 +135,7 @@ private void ProcessScores() { if (oldScore == null || oldScore.highestScore == null || !oldScore.highestScore.TryGetValue(player.chosenInstrument, out var oldHighestSc) || lastScore.score > oldHighestSc) { - + songScore.highestPercent[player.chosenInstrument] = lastScore.percentage; songScore.highestScore[player.chosenInstrument] = lastScore.score; highScores.Add(player); @@ -164,7 +160,7 @@ private void CreatePlayerCards() { if (player.chosenInstrument == null) continue; var pc = Instantiate(playerCardPrefab, playerCardsContainer.transform).GetComponent(); - + ClearStatus clr; if (bot.Contains(player)) { clr = ClearStatus.Bot; @@ -228,7 +224,7 @@ IEnumerator EnableAnimation() { OnEnableAnimationFinish(); - + // slide in helpbar helpBarRT .DOAnchorMin(new Vector2(helpBarRT.anchorMin.x, hbYMinTgt), .75f) @@ -281,7 +277,7 @@ private void OnDisable() { foreach (var p in PlayerManager.players) { p.inputStrategy.GenericNavigationEvent -= OnGenericNavigation; } - } catch {} + } catch { } } - } + } } diff --git a/Assets/Script/UI/PlayResultScreen/PlayerCard.cs b/Assets/Script/UI/PlayResultScreen/PlayerCard.cs index 63e91634e..1f9d715d1 100644 --- a/Assets/Script/UI/PlayResultScreen/PlayerCard.cs +++ b/Assets/Script/UI/PlayResultScreen/PlayerCard.cs @@ -1,29 +1,27 @@ using System; using System.Collections.Generic; +using DG.Tweening; using TMPro; +using Unity.Mathematics; using UnityEngine; using UnityEngine.UI; -using Unity.Mathematics; - -using DG.Tweening; - using YARG.Data; using YARG.Input; namespace YARG.UI.PlayResultScreen { // TODO: move into more appropriate spot? - public enum ClearStatus { - Disqualified, Cleared, FullCombo, Brutal, Bot - } + public enum ClearStatus { + Disqualified, Cleared, FullCombo, Brutal, Bot + } - public class PlayerCard : MonoBehaviour { + public class PlayerCard : MonoBehaviour { public static readonly Dictionary statusColor = new() { - {ClearStatus.Disqualified, new Color(.322f, .345f, .377f)}, - {ClearStatus.Bot, new Color(.322f, .345f, .377f)}, - {ClearStatus.Cleared, new Color(.18f, .85f, 1f)}, - {ClearStatus.FullCombo, new Color(1f, .76f, .16f)}, - {ClearStatus.Brutal, new Color(.82f, 0f, .8f)}, + {ClearStatus.Disqualified, new Color(.322f, .345f, .377f)}, + {ClearStatus.Bot, new Color(.322f, .345f, .377f)}, + {ClearStatus.Cleared, new Color(.18f, .85f, 1f)}, + {ClearStatus.FullCombo, new Color(1f, .76f, .16f)}, + {ClearStatus.Brutal, new Color(.82f, 0f, .8f)}, }; private PlayerManager.Player player; @@ -51,12 +49,12 @@ public class PlayerCard : MonoBehaviour { private ScrollRect scrollContainer; [Space] - [Header("Main Page")] - [SerializeField] + [Header("Main Page")] + [SerializeField] private TextMeshProUGUI playerName; - [SerializeField] + [SerializeField] private TextMeshProUGUI percentage; - [SerializeField] + [SerializeField] private TextMeshProUGUI difficulty; [SerializeField] private TextMeshProUGUI score; @@ -73,9 +71,9 @@ public class PlayerCard : MonoBehaviour { [Header("Color Elements")] [SerializeField] private RawImage separator0; - [SerializeField] + [SerializeField] private RawImage separator1; - [SerializeField] + [SerializeField] private RawImage bottomBanner; public void Setup(PlayerManager.Player player, ClearStatus cs, bool isHighScore) { @@ -84,16 +82,16 @@ public void Setup(PlayerManager.Player player, ClearStatus cs, bool isHighScore) // set window frame containerImg.sprite = cs switch { - ClearStatus.Bot or ClearStatus.Disqualified => + ClearStatus.Bot or ClearStatus.Disqualified => backgroundDisqualified, - ClearStatus.FullCombo => backgroundFullCombo, - _ => backgroundCleared + ClearStatus.FullCombo => backgroundFullCombo, + _ => backgroundCleared }; - /* Set Content */ + /* Set Content */ fcSymbol.gameObject.SetActive(cs == ClearStatus.FullCombo); playerName.text = player.DisplayName; - difficulty.text = player.chosenDifficulty switch { + difficulty.text = player.chosenDifficulty switch { Difficulty.EXPERT_PLUS => "EXPERT+", _ => player.chosenDifficulty.ToString() }; @@ -106,7 +104,7 @@ public void Setup(PlayerManager.Player player, ClearStatus cs, bool isHighScore) var scr = player.lastScore.Value; percentage.text = $"{Mathf.FloorToInt(scr.percentage.percent * 100f)}%"; score.text = $"{scr.score.score:N0}"; - starDisplay.SetStars ( + starDisplay.SetStars( scr.score.stars, scr.score.stars <= 5 ? StarType.Standard : StarType.Gold ); @@ -125,11 +123,11 @@ public void Setup(PlayerManager.Player player, ClearStatus cs, bool isHighScore) } else if (isHighScore) { bottomBannerText.text = "HIGH SCORE"; } else { - bottomBannerText.text = String.Empty; + bottomBannerText.text = string.Empty; } - + // only compress banner if nothing or to prep for animation (high score) - if (bottomBannerText.text == String.Empty || bottomBannerText.text == "HIGH SCORE") { + if (bottomBannerText.text == string.Empty || bottomBannerText.text == "HIGH SCORE") { bottomBanner.gameObject.GetComponent().flexibleHeight = 0f; } @@ -203,5 +201,5 @@ private void OnDisable() { player.inputStrategy.GenericNavigationEvent -= OnGenericNavigation; } } - } + } }