1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 08:27:23 +08:00

Apply review changes

This commit is contained in:
Dean Herbert 2019-06-13 17:04:57 +09:00
parent ba475ef6c8
commit eb0f0aefba
10 changed files with 42 additions and 34 deletions

View File

@ -39,7 +39,6 @@ namespace osu.Game.Tournament.Components
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Control Panel",
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22)
},
@ -47,13 +46,10 @@ namespace osu.Game.Tournament.Components
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Width = 0.75f,
Position = new Vector2(0, 35f),
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f),
},

View File

@ -15,7 +15,7 @@ namespace osu.Game.Tournament.Components
get => bindable;
set
{
bindable = value;
bindable = value.GetBoundCopy();
bindable.BindValueChanged(dto =>
base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true);
}
@ -35,6 +35,7 @@ namespace osu.Game.Tournament.Components
}
catch
{
// reset textbox content to its last valid state on a parse failure.
bindable.TriggerChange();
}
};

View File

@ -15,8 +15,6 @@ namespace osu.Game.Tournament.Components
{
private readonly Bindable<string> chatChannel = new Bindable<string>();
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
private ChannelManager manager;
[BackgroundDependencyLoader(true)]
@ -55,6 +53,8 @@ namespace osu.Game.Tournament.Components
}
}
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
protected class MatchMessage : StandAloneMessage
{
public MatchMessage(Message message)

View File

@ -228,21 +228,22 @@ namespace osu.Game.Tournament.Components
s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15);
}
bool first = true;
foreach (var t in tuples)
for (var i = 0; i < tuples.Length; i++)
{
if (!first)
var tuple = tuples[i];
if (i > 0)
{
AddText(" / ", s =>
{
cp(s, OsuColour.Gray(0.33f));
s.Spacing = new Vector2(-2, 0);
});
}
AddText(new OsuSpriteText { Text = t.heading }, s => cp(s, OsuColour.Gray(0.33f)));
AddText(new OsuSpriteText { Text = tuple.heading }, s => cp(s, OsuColour.Gray(0.33f)));
AddText(" ", s => cp(s, OsuColour.Gray(0.33f)));
AddText(new OsuSpriteText { Text = t.content }, s => cp(s, OsuColour.Gray(0.5f)));
first = false;
AddText(new OsuSpriteText { Text = tuple.content }, s => cp(s, OsuColour.Gray(0.5f)));
}
}
}

View File

@ -11,9 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
@ -48,7 +46,7 @@ namespace osu.Game.Tournament.Components
}
[BackgroundDependencyLoader]
private void load(LadderInfo ladder, Storage storage)
private void load(LadderInfo ladder, TextureStore textures)
{
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(ladder.CurrentMatch);
@ -135,7 +133,7 @@ namespace osu.Game.Tournament.Components
if (!string.IsNullOrEmpty(mods))
AddInternal(new Sprite
{
Texture = new LargeTextureStore(new TextureLoaderStore(new StorageBackedResourceStore(storage))).Get($"mods/{mods}"),
Texture = textures.Get($"mods/{mods}"),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding(20),

View File

@ -138,7 +138,6 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
}, true);
}
//TODO: use OnClick instead once we have per-button clicks.
protected override bool OnClick(ClickEvent e)
{
if (Team == null || editorInfo != null) return false;
@ -196,8 +195,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
return new MenuItem[]
{
new OsuMenuItem("Set as current", MenuItemType.Standard, setCurrent),
new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, false)),
new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.RequestJoin(pairing, true)),
new OsuMenuItem("Join with", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, false)),
new OsuMenuItem("Join with (loser)", MenuItemType.Standard, () => ladderEditor.BeginJoin(pairing, true)),
new OsuMenuItem("Remove", MenuItemType.Destructive, () => ladderEditor.Remove(pairing)),
};
}

View File

@ -5,15 +5,26 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{
public class TournamentProgression
{
public int Item1;
public int Item2;
public int SourceID;
public int TargetID;
// migration
public int Item1
{
set => SourceID = value;
}
public int Item2
{
set => TargetID = value;
}
public bool Losers;
public TournamentProgression(int item1, int item2, bool losers = false)
public TournamentProgression(int sourceID, int targetID, bool losers = false)
{
Item1 = item1;
Item2 = item2;
SourceID = sourceID;
TargetID = targetID;
Losers = losers;
}
}

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Screens.Ladder
[BackgroundDependencyLoader]
private void load()
{
((Container)InternalChild).Add(new LadderEditorSettings
Content.Add(new LadderEditorSettings
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -58,9 +58,9 @@ namespace osu.Game.Tournament.Screens.Ladder
updateInfo();
}
public void RequestJoin(MatchPairing pairing, bool losers)
public void BeginJoin(MatchPairing pairing, bool losers)
{
ScrollContent.Add(new JoinRequestHandler(PairingsContainer, pairing, losers, updateInfo));
ScrollContent.Add(new JoinVisualiser(PairingsContainer, pairing, losers, updateInfo));
}
public MenuItem[] ContextMenuItems
@ -91,7 +91,7 @@ namespace osu.Game.Tournament.Screens.Ladder
PairingsContainer.FirstOrDefault(p => p.Pairing == pairing)?.Remove();
}
private class JoinRequestHandler : CompositeDrawable
private class JoinVisualiser : CompositeDrawable
{
private readonly Container<DrawableMatchPairing> pairingsContainer;
public readonly MatchPairing Source;
@ -100,7 +100,7 @@ namespace osu.Game.Tournament.Screens.Ladder
private ProgressionPath path;
public JoinRequestHandler(Container<DrawableMatchPairing> pairingsContainer, MatchPairing source, bool losers, Action complete)
public JoinVisualiser(Container<DrawableMatchPairing> pairingsContainer, MatchPairing source, bool losers, Action complete)
{
this.pairingsContainer = pairingsContainer;
RelativeSizeAxes = Axes.Both;

View File

@ -24,6 +24,8 @@ namespace osu.Game.Tournament.Screens.Ladder
protected LadderDragContainer ScrollContent;
protected Container Content;
[BackgroundDependencyLoader]
private void load(OsuColour colours, Storage storage)
{
@ -32,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both;
InternalChild = new Container
InternalChild = Content = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]

View File

@ -110,8 +110,8 @@ namespace osu.Game.Tournament
// assign progressions
foreach (var pair in ladder.Progressions)
{
var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item1);
var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.Item2);
var src = ladder.Pairings.FirstOrDefault(p => p.ID == pair.SourceID);
var dest = ladder.Pairings.FirstOrDefault(p => p.ID == pair.TargetID);
if (src == null) throw new InvalidOperationException();