diff --git a/Assets/Script/Gameplay/HUD/PlayerNameDisplay.cs b/Assets/Script/Gameplay/HUD/PlayerNameDisplay.cs index 1b64eaa45..ae63f2027 100644 --- a/Assets/Script/Gameplay/HUD/PlayerNameDisplay.cs +++ b/Assets/Script/Gameplay/HUD/PlayerNameDisplay.cs @@ -10,10 +10,11 @@ using YARG.Gameplay.Player; using YARG.Helpers.Extensions; using YARG.Player; +using YARG.Settings; namespace YARG.Gameplay.HUD { - public class PlayerNameDisplay : MonoBehaviour + public class PlayerNameDisplay : GameplayBehaviour { [SerializeField] private TextMeshProUGUI _playerName; @@ -27,13 +28,19 @@ public class PlayerNameDisplay : MonoBehaviour public float DisplayTime = 3.0f; public float FadeDuration = 0.5f; - void Awake() + protected override void GameplayAwake() { _canvasGroup = GetComponent(); + _canvasGroup.alpha = 0f; } public void ShowPlayer(YargPlayer player) { + if (!ShouldShowPlayer()) + { + return; + } + var profile = player.Profile; _playerName.text = profile.Name; @@ -45,24 +52,34 @@ public void ShowPlayer(YargPlayer player) StartCoroutine(FadeoutCoroutine()); } - private string GetSpriteName(Instrument currentInstrument, byte harmonyIndex) + public void ShowPlayer(YargPlayer player, int needleId) { - if (currentInstrument == Instrument.Harmony) + if (!ShouldShowPlayer()) { - return $"HarmonyVocalsIcons[{harmonyIndex + 1}]"; + return; } - return $"InstrumentIcons[{currentInstrument.ToResourceName()}]"; - } - - public void ShowPlayer(YargPlayer player, int needleId) - { var textureNeedle = $"VocalNeedleTexture/{needleId}"; _needleIcon.texture = Addressables.LoadAssetAsync(textureNeedle).WaitForCompletion(); _instrumentIcon.color = GetHarmonyColor(player); ShowPlayer(player); } + private bool ShouldShowPlayer() + { + return !GameManager.IsPractice && SettingsManager.Settings.ShowPlayerNameWhenStartingSong.Value; + } + + private string GetSpriteName(Instrument currentInstrument, byte harmonyIndex) + { + if (currentInstrument == Instrument.Harmony) + { + return $"HarmonyVocalsIcons[{harmonyIndex + 1}]"; + } + + return $"InstrumentIcons[{currentInstrument.ToResourceName()}]"; + } + private Color GetHarmonyColor(YargPlayer player) { if (player.Profile.CurrentInstrument != Instrument.Harmony) diff --git a/Assets/Script/Settings/SettingsManager.Settings.cs b/Assets/Script/Settings/SettingsManager.Settings.cs index c74099c17..cf89cfed5 100644 --- a/Assets/Script/Settings/SettingsManager.Settings.cs +++ b/Assets/Script/Settings/SettingsManager.Settings.cs @@ -265,6 +265,8 @@ public void OpenVenueFolder() CountdownDisplayMode.Disabled }; + public ToggleSetting ShowPlayerNameWhenStartingSong { get; } = new(true); + #endregion #region File Management diff --git a/Assets/Script/Settings/SettingsManager.cs b/Assets/Script/Settings/SettingsManager.cs index b8405b0af..791188f9d 100644 --- a/Assets/Script/Settings/SettingsManager.cs +++ b/Assets/Script/Settings/SettingsManager.cs @@ -135,7 +135,8 @@ public static partial class SettingsManager nameof(Settings.SongTimeOnScoreBox), nameof(Settings.GraphicalProgressOnScoreBox), nameof(Settings.KeepSongInfoVisible), - nameof(Settings.CountdownDisplay) + nameof(Settings.CountdownDisplay), + nameof(Settings.ShowPlayerNameWhenStartingSong) }, new PresetsTab("Presets", icon: "Customization"), new AllSettingsTab(), diff --git a/Assets/StreamingAssets/lang/en-US.json b/Assets/StreamingAssets/lang/en-US.json index 107ab5365..ef7de1446 100644 --- a/Assets/StreamingAssets/lang/en-US.json +++ b/Assets/StreamingAssets/lang/en-US.json @@ -955,6 +955,10 @@ "ReduceNoteSpeedByDifficulty": { "Name": "Reduce Note Speed by Difficulty", "Description": "Reduces the note speed if playing on a lower difficulty than Expert. The specified note speed is applied to Expert, and lower difficulties receive a reduction in speed. This setting does not affect vocal tracks." + }, + "ShowPlayerNameWhenStartingSong": { + "Name": "Show Player Name When Starting Song", + "Description": "If enabled, the player name and instrument icon will appear when the song starts." } }, "PresetType": {