Files
Vocaluxe/PartyModes/PartyModeRuleRoulette/CPartyScreenRuleRouletteConfig.cs
T
McSchneidarandFlorian Ostertag d61f90e6fc Add rule roulette party mode (#916)
A new party mode for 2 to 12 players that only needs 2 microphones. Players sing duels against each other, and before every duel a wheel decides the rule for this round. Every player sings equally often, and the player with the most points wins.

- 20 rules: from short songs, medleys, double packs, duets and free song choice to rules that change what counts (golden notes, line bonus, target score, fewer points win, teamwork) or how many points there are (double points, all or nothing, point steal, lead counts, underdog bonus, jokers)
- The rules on the wheel are drawn randomly for each game, or chosen manually: every rule can be set to always, random or never
- Every rule on the wheel comes up once before any rule comes up again; rules already used are dimmed
- Rules that need special songs are only used if the song selection has enough of them
- The wheel spins with a running light that slows down, and the winner is celebrated at the end

Co-authored-by: Florian Ostertag <flokuep@users.noreply.github.com>
2026-10-18 08:30:04 +02:00

166 lines
6.0 KiB
C#

#region license
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion
using System.Windows.Forms;
namespace VocaluxeLib.PartyModes.RuleRoulette
{
public class CPartyScreenRuleRouletteConfig : CPartyScreenRuleRoulette
{
protected override int _ScreenVersion
{
get { return 1; }
}
private const string _SelectSlideNumPlayers = "SelectSlideNumPlayers";
private const string _SelectSlideSongsPerPlayer = "SelectSlideSongsPerPlayer";
private const string _SelectSlideNumJokers = "SelectSlideNumJokers";
private const string _SelectSlideRuleSelection = "SelectSlideRuleSelection";
private const string _SelectSlideNumRules = "SelectSlideNumRules";
private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack";
public override void Init()
{
base.Init();
_ThemeSelectSlides = new string[] { _SelectSlideNumPlayers, _SelectSlideSongsPerPlayer, _SelectSlideNumJokers, _SelectSlideRuleSelection, _SelectSlideNumRules };
_ThemeButtons = new string[] { _ButtonNext, _ButtonBack };
}
public override bool HandleInput(SKeyEvent keyEvent)
{
base.HandleInput(keyEvent);
if (!keyEvent.KeyPressed)
{
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
_PartyMode.Back();
break;
case Keys.Enter:
_UpdateSlides();
if (_Buttons[_ButtonBack].Selected)
{
_PartyMode.Back();
}
if (_Buttons[_ButtonNext].Selected)
{
_PartyMode.Next();
}
break;
case Keys.Left:
case Keys.Right:
_UpdateSlides();
break;
}
}
return true;
}
public override bool HandleMouse(SMouseEvent mouseEvent)
{
base.HandleMouse(mouseEvent);
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
{
_UpdateSlides();
if (_Buttons[_ButtonBack].Selected)
{
_PartyMode.Back();
}
if (_Buttons[_ButtonNext].Selected)
{
_PartyMode.Next();
}
}
if (mouseEvent.RB)
{
_PartyMode.Back();
}
return true;
}
public override void OnShow()
{
base.OnShow();
_SelectSlides[_SelectSlideNumPlayers].Clear();
for (var i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
{
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
}
_SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString();
_SelectSlides[_SelectSlideSongsPerPlayer].Clear();
for (var i = 1; i <= CPartyModeRuleRoulette.MaxSongsPerPlayer; i++)
{
_SelectSlides[_SelectSlideSongsPerPlayer].AddValue(i.ToString());
}
_SelectSlides[_SelectSlideSongsPerPlayer].SelectedValue = _PartyMode.GameData.SongsPerPlayer.ToString();
_SelectSlides[_SelectSlideRuleSelection].Clear();
_SelectSlides[_SelectSlideRuleSelection].AddValue(CBase.Language.Translate("TR_SCREENCONFIG_RULES_RANDOM", PartyModeId));
_SelectSlides[_SelectSlideRuleSelection].AddValue(CBase.Language.Translate("TR_SCREENCONFIG_RULES_MANUAL", PartyModeId));
_SelectSlides[_SelectSlideRuleSelection].Selection = _PartyMode.GameData.ManualRules ? 1 : 0;
_SelectSlides[_SelectSlideNumRules].Clear();
for (var i = CPartyModeRuleRoulette.MinRulesOnWheel; i <= CPartyModeRuleRoulette.MaxRulesOnWheel; i++)
{
_SelectSlides[_SelectSlideNumRules].AddValue(i.ToString());
}
_SelectSlides[_SelectSlideNumRules].SelectedValue = _PartyMode.GameData.NumRulesOnWheel.ToString();
_SelectSlides[_SelectSlideNumJokers].Clear();
for (var i = 0; i <= CPartyModeRuleRoulette.MaxJokers; i++)
{
_SelectSlides[_SelectSlideNumJokers].AddValue(i.ToString());
}
_SelectSlides[_SelectSlideNumJokers].SelectedValue = _PartyMode.GameData.NumJokers.ToString();
}
public override bool UpdateGame()
{
return true;
}
private void _UpdateSlides()
{
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumJokers = _SelectSlides[_SelectSlideNumJokers].Selection;
_PartyMode.GameData.SongsPerPlayer = _SelectSlides[_SelectSlideSongsPerPlayer].Selection + 1;
_PartyMode.GameData.ManualRules = _SelectSlides[_SelectSlideRuleSelection].Selection == 1;
_PartyMode.GameData.NumRulesOnWheel = _SelectSlides[_SelectSlideNumRules].Selection + CPartyModeRuleRoulette.MinRulesOnWheel;
}
}
}