mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Improve logic around map pool mode changes
This commit is contained in:
parent
c3ddf773b7
commit
2dd12a6725
@ -136,34 +136,34 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
pickColour = colour;
|
pickColour = colour;
|
||||||
pickType = choiceType;
|
pickType = choiceType;
|
||||||
|
|
||||||
static Color4 setColour(bool active) => active ? Color4.White : Color4.Gray;
|
|
||||||
|
|
||||||
buttonRedBan.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Ban);
|
buttonRedBan.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Ban);
|
||||||
buttonBlueBan.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Ban);
|
buttonBlueBan.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Ban);
|
||||||
buttonRedPick.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Pick);
|
buttonRedPick.Colour = setColour(pickColour == TeamColour.Red && pickType == ChoiceType.Pick);
|
||||||
buttonBluePick.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Pick);
|
buttonBluePick.Colour = setColour(pickColour == TeamColour.Blue && pickType == ChoiceType.Pick);
|
||||||
|
|
||||||
|
static Color4 setColour(bool active) => active ? Color4.White : Color4.Gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextMode()
|
private void setNextMode()
|
||||||
{
|
{
|
||||||
int banCount = 2;
|
if (CurrentMatch.Value?.Round.Value == null)
|
||||||
|
|
||||||
if (CurrentMatch.Value == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CurrentMatch.Value.Round.Value != null)
|
int totalBansRequired = CurrentMatch.Value.Round.Value.BanCount.Value * 2;
|
||||||
{
|
|
||||||
banCount = CurrentMatch.Value.Round.Value.BanCount.Value * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TeamColour roll_winner = TeamColour.Red; //todo: draw from match
|
const TeamColour roll_winner = TeamColour.Red; //todo: draw from match
|
||||||
|
|
||||||
var nextColour = (CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red;
|
var nextColour = (CurrentMatch.Value.PicksBans.LastOrDefault()?.Team ?? roll_winner) == TeamColour.Red ? TeamColour.Blue : TeamColour.Red;
|
||||||
|
|
||||||
if (pickType == ChoiceType.Ban && CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= banCount)
|
bool hasAllBans = CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= totalBansRequired;
|
||||||
setMode(pickColour, ChoiceType.Pick);
|
|
||||||
else
|
if (hasAllBans && pickType == ChoiceType.Ban)
|
||||||
setMode(nextColour, CurrentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) >= banCount ? ChoiceType.Pick : ChoiceType.Ban);
|
{
|
||||||
|
// When switching from bans to picks, we don't rotate the team colour.
|
||||||
|
nextColour = pickColour;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMode(nextColour, hasAllBans ? ChoiceType.Pick : ChoiceType.Ban);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(MouseDownEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user