mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 05:32:54 +08:00
Add setting to ladder info and simplify changes
This commit is contained in:
parent
6543c720ef
commit
90a5c75474
@ -42,5 +42,7 @@ namespace osu.Game.Tournament.Models
|
|||||||
};
|
};
|
||||||
|
|
||||||
public Bindable<bool> AutoProgressScreens = new BindableBool(true);
|
public Bindable<bool> AutoProgressScreens = new BindableBool(true);
|
||||||
|
|
||||||
|
public Bindable<bool> SplitMapPoolByMods = new BindableBool(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Settings;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.IPC;
|
using osu.Game.Tournament.IPC;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
@ -25,8 +24,7 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
{
|
{
|
||||||
public partial class MapPoolScreen : TournamentMatchScreen
|
public partial class MapPoolScreen : TournamentMatchScreen
|
||||||
{
|
{
|
||||||
private readonly FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows;
|
private FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows;
|
||||||
private TournamentMatch currentMatch;
|
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private TournamentSceneManager sceneManager { get; set; }
|
private TournamentSceneManager sceneManager { get; set; }
|
||||||
@ -34,14 +32,13 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
private TeamColour pickColour;
|
private TeamColour pickColour;
|
||||||
private ChoiceType pickType;
|
private ChoiceType pickType;
|
||||||
|
|
||||||
private readonly OsuButton buttonRedBan;
|
private OsuButton buttonRedBan;
|
||||||
private readonly OsuButton buttonBlueBan;
|
private OsuButton buttonBlueBan;
|
||||||
private readonly OsuButton buttonRedPick;
|
private OsuButton buttonRedPick;
|
||||||
private readonly OsuButton buttonBluePick;
|
private OsuButton buttonBluePick;
|
||||||
|
|
||||||
private readonly SettingsCheckbox chkBoxLineBreak;
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(MatchIPCInfo ipc)
|
||||||
public MapPoolScreen()
|
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -102,26 +99,26 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
Action = reset
|
Action = reset
|
||||||
},
|
},
|
||||||
new ControlPanel.Spacer(),
|
new ControlPanel.Spacer(),
|
||||||
new TournamentSpriteText
|
new OsuCheckbox
|
||||||
{
|
{
|
||||||
Text = "Each modpool takes"
|
LabelText = "Split display by mods",
|
||||||
|
Current = LadderInfo.SplitMapPoolByMods,
|
||||||
},
|
},
|
||||||
new TournamentSpriteText
|
|
||||||
{
|
|
||||||
Text = "different row"
|
|
||||||
},
|
|
||||||
chkBoxLineBreak = new SettingsCheckbox()
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ipc.Beatmap.BindValueChanged(beatmapChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private Bindable<bool> splitMapPoolByMods;
|
||||||
private void load(MatchIPCInfo ipc)
|
|
||||||
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
ipc.Beatmap.BindValueChanged(beatmapChanged);
|
base.LoadComplete();
|
||||||
chkBoxLineBreak.Current.Value = true;
|
|
||||||
chkBoxLineBreak.Current.BindValueChanged(_ => rearrangeMappool());
|
splitMapPoolByMods = LadderInfo.SplitMapPoolByMods.GetBoundCopy();
|
||||||
|
splitMapPoolByMods.BindValueChanged(_ => updateDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap> beatmap)
|
private void beatmapChanged(ValueChangedEvent<TournamentBeatmap> beatmap)
|
||||||
@ -228,42 +225,40 @@ namespace osu.Game.Tournament.Screens.MapPool
|
|||||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||||
{
|
{
|
||||||
base.CurrentMatchChanged(match);
|
base.CurrentMatchChanged(match);
|
||||||
currentMatch = match.NewValue;
|
updateDisplay();
|
||||||
rearrangeMappool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rearrangeMappool()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
mapFlows.Clear();
|
mapFlows.Clear();
|
||||||
|
|
||||||
if (currentMatch == null)
|
if (CurrentMatch.Value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int totalRows = 0;
|
int totalRows = 0;
|
||||||
|
|
||||||
if (currentMatch.Round.Value != null)
|
if (CurrentMatch.Value.Round.Value != null)
|
||||||
{
|
{
|
||||||
FillFlowContainer<TournamentBeatmapPanel> currentFlow = null;
|
FillFlowContainer<TournamentBeatmapPanel> currentFlow = null;
|
||||||
string currentMod = null;
|
string currentMods = null;
|
||||||
int flowCount = 0;
|
int flowCount = 0;
|
||||||
|
|
||||||
foreach (var b in currentMatch.Round.Value.Beatmaps)
|
foreach (var b in CurrentMatch.Value.Round.Value.Beatmaps)
|
||||||
{
|
{
|
||||||
if (currentFlow == null || currentMod != b.Mods)
|
if (currentFlow == null || (LadderInfo.SplitMapPoolByMods.Value && currentMods != b.Mods))
|
||||||
{
|
{
|
||||||
if (chkBoxLineBreak.Current.Value || currentFlow == null)
|
mapFlows.Add(currentFlow = new FillFlowContainer<TournamentBeatmapPanel>
|
||||||
{
|
{
|
||||||
mapFlows.Add(currentFlow = new FillFlowContainer<TournamentBeatmapPanel>
|
Spacing = new Vector2(10, 5),
|
||||||
{
|
Direction = FillDirection.Full,
|
||||||
Spacing = new Vector2(10, 5),
|
RelativeSizeAxes = Axes.X,
|
||||||
Direction = FillDirection.Full,
|
AutoSizeAxes = Axes.Y
|
||||||
RelativeSizeAxes = Axes.X,
|
});
|
||||||
AutoSizeAxes = Axes.Y
|
|
||||||
});
|
|
||||||
|
|
||||||
totalRows++;
|
currentMods = b.Mods;
|
||||||
flowCount = 0;
|
|
||||||
}
|
totalRows++;
|
||||||
currentMod = b.Mods;
|
flowCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++flowCount > 2)
|
if (++flowCount > 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user