Skip to content

Commit

Permalink
Prevent users from playing a song with everyone sitting out
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Jan 18, 2024
1 parent 58005ff commit bbfc69e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Assets/Script/Menu/DifficultySelect/DifficultySelectMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
Expand All @@ -13,6 +14,7 @@
using YARG.Helpers;
using YARG.Helpers.Extensions;
using YARG.Menu.Navigation;
using YARG.Menu.Persistent;
using YARG.Player;

namespace YARG.Menu.DifficultySelect
Expand Down Expand Up @@ -312,6 +314,17 @@ private void ChangePlayer(int add)
// When the user(s) have selected all of their difficulties, move on
if (_playerIndex >= PlayerContainer.Players.Count)
{
// If everyone is sitting out, show a warning and boot back to music library
if (PlayerContainer.Players.All(i => i.SittingOut))
{
MenuManager.Instance.PopMenu();

DialogManager.Instance.ShowMessage("Nobody's Playing!",
"You tried to play a song with every player sitting out.");

return;
}

// This will always work (as it's set up in the input field)
// The max speed that the game can keep up with is 4995%
float speed = float.Parse(_speedInput.text.TrimEnd('%')) / 100f;
Expand Down

0 comments on commit bbfc69e

Please sign in to comment.