1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 08:53:20 +08:00

Fix bindable changes

This commit is contained in:
Dean Herbert 2019-03-02 13:40:43 +09:00
parent 796f6c3092
commit 389632d932
21 changed files with 96 additions and 94 deletions

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
@ -12,13 +12,12 @@ namespace osu.Game.Tournament.Components
{ {
public new Bindable<DateTimeOffset> Bindable public new Bindable<DateTimeOffset> Bindable
{ {
get { return bindable; } get => bindable;
set set
{ {
bindable = value; bindable = value;
bindable.BindValueChanged(dto => bindable.BindValueChanged(dto =>
base.Bindable.Value = dto.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true); base.Bindable.Value = dto.NewValue.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"), true);
} }
} }

View File

@ -3,7 +3,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
@ -25,12 +25,12 @@ namespace osu.Game.Tournament.Components
if (ipc != null) if (ipc != null)
{ {
chatChannel.BindTo(ipc.ChatChannel); chatChannel.BindTo(ipc.ChatChannel);
chatChannel.BindValueChanged(channelString => chatChannel.BindValueChanged(c =>
{ {
if (string.IsNullOrWhiteSpace(channelString)) if (string.IsNullOrWhiteSpace(c.NewValue))
return; return;
int id = int.Parse(channelString); int id = int.Parse(c.NewValue);
if (id <= 0) return; if (id <= 0) return;

View File

@ -6,7 +6,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -148,9 +148,9 @@ namespace osu.Game.Tournament.Components
}); });
} }
private void matchChanged(MatchPairing match) private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
{ {
match.PicksBans.CollectionChanged += picksBansOnCollectionChanged; pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
updateState(); updateState();
} }

View File

@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;

View File

@ -3,7 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Ladder.Components; using osu.Game.Tournament.Screens.Ladder.Components;

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Legacy;
@ -30,15 +31,15 @@ namespace osu.Game.Tournament.Screens
ipc.Mods.BindValueChanged(modsChanged, true); ipc.Mods.BindValueChanged(modsChanged, true);
} }
private void modsChanged(LegacyMods mods) private void modsChanged(ValueChangedEvent<LegacyMods> mods)
{ {
SongBar.Mods = mods; SongBar.Mods = mods.NewValue;
} }
private void beatmapChanged(BeatmapInfo beatmap) private void beatmapChanged(ValueChangedEvent<BeatmapInfo> beatmap)
{ {
SongBar.FadeInFromZero(300, Easing.OutQuint); SongBar.FadeInFromZero(300, Easing.OutQuint);
SongBar.Beatmap = beatmap; SongBar.Beatmap = beatmap.NewValue;
} }
} }
} }

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -73,13 +73,13 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(MatchPairing match) private void matchChanged(ValueChangedEvent<MatchPairing> match)
{ {
currentTeamScore.UnbindBindings(); currentTeamScore.UnbindBindings();
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.Team1Score : match.Team2Score); currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
currentTeam.UnbindBindings(); currentTeam.UnbindBindings();
currentTeam.BindTo(teamColour == TeamColour.Red ? match.Team1 : match.Team2); currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
// team may change to same team, which means score is not in a good state. // team may change to same team, which means score is not in a good state.
// thus we handle this manually. // thus we handle this manually.
@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentTeamScore.BindTo(score); currentTeamScore.BindTo(score);
} }
private void scoreChanged(int? score) => counter.CountStars = score ?? 0; private void scoreChanged(ValueChangedEvent<int?> score) => counter.CountStars = score.NewValue ?? 0;
} }
private class TeamDisplay : DrawableTournamentTeam private class TeamDisplay : DrawableTournamentTeam
@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(MatchPairing match) private void matchChanged(ValueChangedEvent<MatchPairing> match)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -218,7 +218,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = Color4.White, Colour = Color4.White,
Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping", Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping",
Font = "Aquatico-Regular", Font = "Aquatico-Regular",
TextSize = 18, TextSize = 18,
}, },

View File

@ -3,7 +3,7 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -120,10 +120,10 @@ namespace osu.Game.Tournament.Screens.Gameplay
State.BindTo(ipc.State); State.BindTo(ipc.State);
State.BindValueChanged(stateChanged, true); State.BindValueChanged(stateChanged, true);
currentMatch.BindValueChanged(m => warmup.Value = m.Team1Score + m.Team2Score == 0); currentMatch.BindValueChanged(m => warmup.Value = m.NewValue.Team1Score.Value + m.NewValue.Team2Score.Value == 0);
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true); warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true);
} }
private ScheduledDelegate scheduledOperation; private ScheduledDelegate scheduledOperation;
@ -132,15 +132,15 @@ namespace osu.Game.Tournament.Screens.Gameplay
private TourneyState lastState; private TourneyState lastState;
private void stateChanged(TourneyState state) private void stateChanged(ValueChangedEvent<TourneyState> state)
{ {
try try
{ {
if (state == TourneyState.Ranking) if (state.NewValue == TourneyState.Ranking)
{ {
if (warmup.Value) return; if (warmup.Value) return;
if (ipc.Score1 > ipc.Score2) if (ipc.Score1.Value > ipc.Score2.Value)
currentMatch.Value.Team1Score.Value++; currentMatch.Value.Team1Score.Value++;
else else
currentMatch.Value.Team2Score.Value++; currentMatch.Value.Team2Score.Value++;
@ -167,16 +167,16 @@ namespace osu.Game.Tournament.Screens.Gameplay
chat.Contract(); chat.Contract();
} }
switch (state) switch (state.NewValue)
{ {
case TourneyState.Idle: case TourneyState.Idle:
contract(); contract();
if (lastState == TourneyState.Ranking && !warmup.Value) if (lastState == TourneyState.Ranking && !warmup.Value)
{ {
if (currentMatch.Value?.Completed == true) if (currentMatch.Value?.Completed.Value == true)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000); scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, 4000);
else if (currentMatch.Value?.Completed == false) else if (currentMatch.Value?.Completed.Value == false)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000); scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000);
} }
@ -192,7 +192,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
} }
finally finally
{ {
lastState = state; lastState = state.NewValue;
} }
} }
} }

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -87,7 +87,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
pairing.Position.BindValueChanged(pos => pairing.Position.BindValueChanged(pos =>
{ {
if (IsDragged) return; if (IsDragged) return;
Position = new Vector2(pos.X, pos.Y);
Position = new Vector2(pos.NewValue.X, pos.NewValue.Y);
}, true); }, true);
updateTeams(); updateTeams();
@ -127,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateProgression() private void updateProgression()
{ {
if (!Pairing.Completed) if (!Pairing.Completed.Value)
{ {
// ensure we clear any of our teams from our progression. // ensure we clear any of our teams from our progression.
// this is not pretty logic but should suffice for now. // this is not pretty logic but should suffice for now.
@ -177,10 +178,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
if (Pairing.Grouping.Value == null) return; if (Pairing.Grouping.Value == null) return;
var instaWinAmount = Pairing.Grouping.Value.BestOf / 2; var instaWinAmount = Pairing.Grouping.Value.BestOf.Value / 2;
Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0 Pairing.Completed.Value = Pairing.Grouping.Value.BestOf.Value > 0
&& (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount); && (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Grouping.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount);
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -193,7 +194,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
globalSelection = editorInfo.Selected.GetBoundCopy(); globalSelection = editorInfo.Selected.GetBoundCopy();
globalSelection.BindValueChanged(s => globalSelection.BindValueChanged(s =>
{ {
if (s != Pairing) Selected = false; if (s.NewValue != Pairing) Selected = false;
}); });
} }
} }
@ -216,14 +217,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym); var team2Match = conditional.Acronyms.Contains(Pairing.Team2Acronym);
if (team1Match && team2Match) if (team1Match && team2Match)
Pairing.Date.Value = conditional.Date; Pairing.Date.Value = conditional.Date.Value;
} }
} }
Flow.Children = new[] Flow.Children = new[]
{ {
new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers), new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value),
new DrawableMatchTeam(Pairing.Team2, Pairing, Pairing.Losers) new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value)
}; };
SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression)); SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression));

View File

@ -3,7 +3,7 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
@ -52,7 +52,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private LadderEditorInfo editorInfo { get; set; } private LadderEditorInfo editorInfo { get; set; }
public DrawableMatchTeam(Bindable<TournamentTeam> team, MatchPairing pairing, bool losers) public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers)
: base(team) : base(team)
{ {
this.pairing = pairing; this.pairing = pairing;
@ -74,8 +74,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
isWinner = () => pairing.Winner == Team; isWinner = () => pairing.Winner == Team;
completed.BindTo(pairing.Completed); completed.BindTo(pairing.Completed);
if (team.Value != null) if (team != null)
score.BindTo(team.Value == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score); score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score);
} }
} }
@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
score.BindValueChanged(val => score.BindValueChanged(val =>
{ {
scoreText.Text = val?.ToString() ?? string.Empty; scoreText.Text = val.NewValue?.ToString() ?? string.Empty;
updateWinStyle(); updateWinStyle();
}, true); }, true);
} }
@ -155,7 +155,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
pairing.StartMatch(); pairing.StartMatch();
} }
else if (!pairing.Completed) else if (!pairing.Completed.Value)
score.Value++; score.Value++;
} }
else else
@ -164,7 +164,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
// don't allow changing scores if the match has a progression. can cause large data loss // don't allow changing scores if the match has a progression. can cause large data loss
return false; return false;
if (pairing.Completed && pairing.Winner != Team) if (pairing.Completed.Value && pairing.Winner != Team)
// don't allow changing scores from the non-winner // don't allow changing scores from the non-winner
return false; return false;
@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateWinStyle() private void updateWinStyle()
{ {
bool winner = completed && isWinner?.Invoke() == true; bool winner = completed.Value && isWinner?.Invoke() == true;
background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint);

View File

@ -1,7 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration; using osu.Framework.Bindables;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
@ -93,11 +93,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
editorInfo.Selected.ValueChanged += selection => editorInfo.Selected.ValueChanged += selection =>
{ {
textboxTeam1.Text = selection?.Team1.Value?.Acronym; textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym;
textboxTeam2.Text = selection?.Team2.Value?.Acronym; textboxTeam2.Text = selection.NewValue?.Team2.Value?.Acronym;
groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First(); groupingDropdown.Bindable.Value = selection.NewValue?.Grouping.Value ?? groupingOptions.First();
losersCheckbox.Current.Value = selection?.Losers.Value ?? false; losersCheckbox.Current.Value = selection.NewValue?.Losers.Value ?? false;
dateTimeBox.Bindable.Value = selection?.Date.Value ?? DateTimeOffset.UtcNow; dateTimeBox.Bindable.Value = selection.NewValue?.Date.Value ?? DateTimeOffset.UtcNow;
}; };
textboxTeam1.OnCommit = (val, newText) => textboxTeam1.OnCommit = (val, newText) =>
@ -116,10 +116,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
if (editorInfo.Selected.Value != null) if (editorInfo.Selected.Value != null)
{ {
editorInfo.Selected.Value.Grouping.Value = grouping; editorInfo.Selected.Value.Grouping.Value = grouping.NewValue;
if (editorInfo.Selected.Value.Date.Value < grouping.StartDate.Value) if (editorInfo.Selected.Value.Date.Value < grouping.NewValue.StartDate.Value)
{ {
editorInfo.Selected.Value.Date.Value = grouping.StartDate.Value; editorInfo.Selected.Value.Date.Value = grouping.NewValue.StartDate.Value;
editorInfo.Selected.TriggerChange(); editorInfo.Selected.TriggerChange();
} }
} }
@ -128,13 +128,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
losersCheckbox.Current.ValueChanged += losers => losersCheckbox.Current.ValueChanged += losers =>
{ {
if (editorInfo.Selected.Value != null) if (editorInfo.Selected.Value != null)
editorInfo.Selected.Value.Losers.Value = losers; editorInfo.Selected.Value.Losers.Value = losers.NewValue;
}; };
dateTimeBox.Bindable.ValueChanged += date => dateTimeBox.Bindable.ValueChanged += date =>
{ {
if (editorInfo.Selected.Value != null) if (editorInfo.Selected.Value != null)
editorInfo.Selected.Value.Date.Value = date; editorInfo.Selected.Value.Date.Value = date.NewValue;
}; };
} }

View File

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using SixLabors.Primitives; using SixLabors.Primitives;
@ -71,8 +71,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
public MatchPairing() public MatchPairing()
{ {
Team1.BindValueChanged(t => Team1Acronym = t?.Acronym, true); Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym, true);
Team2.BindValueChanged(t => Team2Acronym = t?.Acronym, true); Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym, true);
} }
public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null) public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null)
@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
[JsonIgnore] [JsonIgnore]
public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value;
public int PointsToWin => Grouping.Value == null ? 0 : Grouping.Value.BestOf / 2 + 1; public int PointsToWin => Grouping.Value?.BestOf.Value / 2 + 1 ?? 0;
/// <summary> /// <summary>
/// Remove scores from the match, in case of a false click or false start. /// Remove scores from the match, in case of a false click or false start.

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Configuration; using osu.Framework.Bindables;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {

View File

@ -98,13 +98,13 @@ namespace osu.Game.Tournament.Screens.Ladder
// clean up outdated progressions. // clean up outdated progressions.
pairing.Pairing.Progression.Value = null; pairing.Pairing.Progression.Value = null;
else else
paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers ? losersPathColour : normalPathColour }); paths.Add(new ProgressionPath(pairing, dest) { Colour = pairing.Pairing.Losers.Value ? losersPathColour : normalPathColour });
} }
} }
foreach (var group in LadderInfo.Groupings) foreach (var group in LadderInfo.Groupings)
{ {
var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); var topPairing = PairingsContainer.Where(p => !p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault();
if (topPairing == null) continue; if (topPairing == null) continue;
@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Ladder
foreach (var group in LadderInfo.Groupings) foreach (var group in LadderInfo.Groupings)
{ {
var topPairing = PairingsContainer.Where(p => p.Pairing.Losers && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault(); var topPairing = PairingsContainer.Where(p => p.Pairing.Losers.Value && p.Pairing.Grouping.Value == group).OrderBy(p => p.Y).FirstOrDefault();
if (topPairing == null) continue; if (topPairing == null) continue;

View File

@ -3,7 +3,7 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
@ -102,13 +102,13 @@ namespace osu.Game.Tournament.Screens.MapPool
ipc.Beatmap.BindValueChanged(beatmapChanged); ipc.Beatmap.BindValueChanged(beatmapChanged);
} }
private void beatmapChanged(BeatmapInfo beatmap) private void beatmapChanged(ValueChangedEvent<BeatmapInfo> beatmap)
{ {
if (currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2) if (currentMatch.Value.PicksBans.Count(p => p.Type == ChoiceType.Ban) < 2)
return; return;
if (beatmap.OnlineBeatmapID != null) if (beatmap.NewValue.OnlineBeatmapID != null)
addForBeatmap(beatmap.OnlineBeatmapID.Value); addForBeatmap(beatmap.NewValue.OnlineBeatmapID.Value);
} }
private void setMode(TeamColour colour, ChoiceType choiceType) private void setMode(TeamColour colour, ChoiceType choiceType)
@ -201,16 +201,16 @@ namespace osu.Game.Tournament.Screens.MapPool
} }
} }
private void matchChanged(MatchPairing match) private void matchChanged(ValueChangedEvent<MatchPairing> match)
{ {
mapFlows.Clear(); mapFlows.Clear();
if (match.Grouping.Value != null) if (match.NewValue.Grouping.Value != null)
{ {
FillFlowContainer<TournamentBeatmapPanel> currentFlow = null; FillFlowContainer<TournamentBeatmapPanel> currentFlow = null;
string currentMod = null; string currentMod = null;
foreach (var b in match.Grouping.Value.Beatmaps) foreach (var b in match.NewValue.Grouping.Value.Beatmaps)
{ {
if (currentFlow == null || currentMod != b.Mods) if (currentFlow == null || currentMod != b.Mods)
{ {

View File

@ -4,7 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -48,9 +48,9 @@ namespace osu.Game.Tournament.Screens.Schedule
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(MatchPairing pairing) private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
{ {
if (pairing == null) if (pairing.NewValue == null)
{ {
mainContainer.Clear(); mainContainer.Clear();
return; return;
@ -113,10 +113,10 @@ namespace osu.Game.Tournament.Screens.Schedule
Colour = Color4.Black, Colour = Color4.Black,
TextSize = 20 TextSize = 20
}, },
new SchedulePairing(currentMatch, false), new SchedulePairing(currentMatch.Value, false),
new OsuSpriteText new OsuSpriteText
{ {
Text = "Start Time " + pairing.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Text = "Start Time " + pairing.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"),
Colour = Color4.Black, Colour = Color4.Black,
TextSize = 20 TextSize = 20
}, },

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Video; using osu.Framework.Graphics.Video;
@ -46,9 +46,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
} }
private void matchChanged(MatchPairing pairing) private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
{ {
if (pairing == null) if (pairing.NewValue == null)
{ {
mainContainer.Clear(); mainContainer.Clear();
return; return;
@ -56,7 +56,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamWithPlayers(pairing.Team1, true) new TeamWithPlayers(pairing.NewValue.Team1.Value, true)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
@ -64,7 +64,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.CentreRight Origin = Anchor.CentreRight
}, },
new TeamWithPlayers(pairing.Team2) new TeamWithPlayers(pairing.NewValue.Team2.Value)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft Origin = Anchor.CentreLeft
}, },
new RoundDisplay(pairing) new RoundDisplay(pairing.NewValue)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,

View File

@ -2,7 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Video; using osu.Framework.Graphics.Video;
@ -62,10 +62,10 @@ namespace osu.Game.Tournament.Screens.TeamWin
currentCompleted.BindValueChanged(_ => update()); currentCompleted.BindValueChanged(_ => update());
} }
private void matchChanged(MatchPairing pairing) private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
{ {
currentCompleted.UnbindBindings(); currentCompleted.UnbindBindings();
currentCompleted.BindTo(pairing.Completed); currentCompleted.BindTo(pairing.NewValue.Completed);
update(); update();
} }

View File

@ -8,6 +8,7 @@ using System.IO;
using System.Linq; using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;