mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 22:02:56 +08:00
Fix bindable changes
This commit is contained in:
parent
796f6c3092
commit
389632d932
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
@ -12,13 +12,12 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public new Bindable<DateTimeOffset> Bindable
|
||||
{
|
||||
get { return bindable; }
|
||||
|
||||
get => bindable;
|
||||
set
|
||||
{
|
||||
bindable = value;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.Chat;
|
||||
using osu.Game.Tournament.IPC;
|
||||
@ -25,12 +25,12 @@ namespace osu.Game.Tournament.Components
|
||||
if (ipc != null)
|
||||
{
|
||||
chatChannel.BindTo(ipc.ChatChannel);
|
||||
chatChannel.BindValueChanged(channelString =>
|
||||
chatChannel.BindValueChanged(c =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(channelString))
|
||||
if (string.IsNullOrWhiteSpace(c.NewValue))
|
||||
return;
|
||||
|
||||
int id = int.Parse(channelString);
|
||||
int id = int.Parse(c.NewValue);
|
||||
|
||||
if (id <= 0) return;
|
||||
|
||||
|
@ -6,7 +6,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Tournament.Components;
|
||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
@ -30,15 +31,15 @@ namespace osu.Game.Tournament.Screens
|
||||
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.Beatmap = beatmap;
|
||||
SongBar.Beatmap = beatmap.NewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -73,13 +73,13 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing match)
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> match)
|
||||
{
|
||||
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.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.
|
||||
// thus we handle this manually.
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
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
|
||||
@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing match)
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> match)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -218,7 +218,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = Color4.White,
|
||||
Text = match.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
||||
Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
||||
Font = "Aquatico-Regular",
|
||||
TextSize = 18,
|
||||
},
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -120,10 +120,10 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
State.BindTo(ipc.State);
|
||||
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);
|
||||
|
||||
warmup.BindValueChanged(w => warmupButton.Alpha = !w ? 0.5f : 1, true);
|
||||
warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true);
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledOperation;
|
||||
@ -132,15 +132,15 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
|
||||
private TourneyState lastState;
|
||||
|
||||
private void stateChanged(TourneyState state)
|
||||
private void stateChanged(ValueChangedEvent<TourneyState> state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (state == TourneyState.Ranking)
|
||||
if (state.NewValue == TourneyState.Ranking)
|
||||
{
|
||||
if (warmup.Value) return;
|
||||
|
||||
if (ipc.Score1 > ipc.Score2)
|
||||
if (ipc.Score1.Value > ipc.Score2.Value)
|
||||
currentMatch.Value.Team1Score.Value++;
|
||||
else
|
||||
currentMatch.Value.Team2Score.Value++;
|
||||
@ -167,16 +167,16 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
chat.Contract();
|
||||
}
|
||||
|
||||
switch (state)
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case TourneyState.Idle:
|
||||
contract();
|
||||
|
||||
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);
|
||||
else if (currentMatch.Value?.Completed == false)
|
||||
else if (currentMatch.Value?.Completed.Value == false)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, 4000);
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
}
|
||||
finally
|
||||
{
|
||||
lastState = state;
|
||||
lastState = state.NewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -87,7 +87,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
pairing.Position.BindValueChanged(pos =>
|
||||
{
|
||||
if (IsDragged) return;
|
||||
Position = new Vector2(pos.X, pos.Y);
|
||||
|
||||
Position = new Vector2(pos.NewValue.X, pos.NewValue.Y);
|
||||
}, true);
|
||||
|
||||
updateTeams();
|
||||
@ -127,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
private void updateProgression()
|
||||
{
|
||||
if (!Pairing.Completed)
|
||||
if (!Pairing.Completed.Value)
|
||||
{
|
||||
// ensure we clear any of our teams from our progression.
|
||||
// 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;
|
||||
|
||||
var instaWinAmount = Pairing.Grouping.Value.BestOf / 2;
|
||||
var instaWinAmount = Pairing.Grouping.Value.BestOf.Value / 2;
|
||||
|
||||
Pairing.Completed.Value = Pairing.Grouping.Value.BestOf > 0
|
||||
&& (Pairing.Team1Score + Pairing.Team2Score >= Pairing.Grouping.Value.BestOf || Pairing.Team1Score > instaWinAmount || Pairing.Team2Score > instaWinAmount);
|
||||
Pairing.Completed.Value = Pairing.Grouping.Value.BestOf.Value > 0
|
||||
&& (Pairing.Team1Score.Value + Pairing.Team2Score.Value >= Pairing.Grouping.Value.BestOf.Value || Pairing.Team1Score.Value > instaWinAmount || Pairing.Team2Score.Value > instaWinAmount);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -193,7 +194,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
globalSelection = editorInfo.Selected.GetBoundCopy();
|
||||
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);
|
||||
|
||||
if (team1Match && team2Match)
|
||||
Pairing.Date.Value = conditional.Date;
|
||||
Pairing.Date.Value = conditional.Date.Value;
|
||||
}
|
||||
}
|
||||
|
||||
Flow.Children = new[]
|
||||
{
|
||||
new DrawableMatchTeam(Pairing.Team1, Pairing, Pairing.Losers),
|
||||
new DrawableMatchTeam(Pairing.Team2, Pairing, Pairing.Losers)
|
||||
new DrawableMatchTeam(Pairing.Team1.Value, Pairing, Pairing.Losers.Value),
|
||||
new DrawableMatchTeam(Pairing.Team2.Value, Pairing, Pairing.Losers.Value)
|
||||
};
|
||||
|
||||
SchedulerAfterChildren.Add(() => Scheduler.Add(updateProgression));
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
[Resolved(CanBeNull = true)]
|
||||
private LadderEditorInfo editorInfo { get; set; }
|
||||
|
||||
public DrawableMatchTeam(Bindable<TournamentTeam> team, MatchPairing pairing, bool losers)
|
||||
public DrawableMatchTeam(TournamentTeam team, MatchPairing pairing, bool losers)
|
||||
: base(team)
|
||||
{
|
||||
this.pairing = pairing;
|
||||
@ -74,8 +74,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
isWinner = () => pairing.Winner == Team;
|
||||
|
||||
completed.BindTo(pairing.Completed);
|
||||
if (team.Value != null)
|
||||
score.BindTo(team.Value == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score);
|
||||
if (team != null)
|
||||
score.BindTo(team == pairing.Team1.Value ? pairing.Team1Score : pairing.Team2Score);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
score.BindValueChanged(val =>
|
||||
{
|
||||
scoreText.Text = val?.ToString() ?? string.Empty;
|
||||
scoreText.Text = val.NewValue?.ToString() ?? string.Empty;
|
||||
updateWinStyle();
|
||||
}, true);
|
||||
}
|
||||
@ -155,7 +155,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
pairing.StartMatch();
|
||||
}
|
||||
else if (!pairing.Completed)
|
||||
else if (!pairing.Completed.Value)
|
||||
score.Value++;
|
||||
}
|
||||
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
|
||||
return false;
|
||||
|
||||
if (pairing.Completed && pairing.Winner != Team)
|
||||
if (pairing.Completed.Value && pairing.Winner != Team)
|
||||
// don't allow changing scores from the non-winner
|
||||
return false;
|
||||
|
||||
@ -179,7 +179,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
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);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -93,11 +93,11 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
editorInfo.Selected.ValueChanged += selection =>
|
||||
{
|
||||
textboxTeam1.Text = selection?.Team1.Value?.Acronym;
|
||||
textboxTeam2.Text = selection?.Team2.Value?.Acronym;
|
||||
groupingDropdown.Bindable.Value = selection?.Grouping.Value ?? groupingOptions.First();
|
||||
losersCheckbox.Current.Value = selection?.Losers.Value ?? false;
|
||||
dateTimeBox.Bindable.Value = selection?.Date.Value ?? DateTimeOffset.UtcNow;
|
||||
textboxTeam1.Text = selection.NewValue?.Team1.Value?.Acronym;
|
||||
textboxTeam2.Text = selection.NewValue?.Team2.Value?.Acronym;
|
||||
groupingDropdown.Bindable.Value = selection.NewValue?.Grouping.Value ?? groupingOptions.First();
|
||||
losersCheckbox.Current.Value = selection.NewValue?.Losers.Value ?? false;
|
||||
dateTimeBox.Bindable.Value = selection.NewValue?.Date.Value ?? DateTimeOffset.UtcNow;
|
||||
};
|
||||
|
||||
textboxTeam1.OnCommit = (val, newText) =>
|
||||
@ -116,10 +116,10 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
if (editorInfo.Selected.Value != null)
|
||||
{
|
||||
editorInfo.Selected.Value.Grouping.Value = grouping;
|
||||
if (editorInfo.Selected.Value.Date.Value < grouping.StartDate.Value)
|
||||
editorInfo.Selected.Value.Grouping.Value = grouping.NewValue;
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -128,13 +128,13 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
losersCheckbox.Current.ValueChanged += losers =>
|
||||
{
|
||||
if (editorInfo.Selected.Value != null)
|
||||
editorInfo.Selected.Value.Losers.Value = losers;
|
||||
editorInfo.Selected.Value.Losers.Value = losers.NewValue;
|
||||
};
|
||||
|
||||
dateTimeBox.Bindable.ValueChanged += date =>
|
||||
{
|
||||
if (editorInfo.Selected.Value != null)
|
||||
editorInfo.Selected.Value.Date.Value = date;
|
||||
editorInfo.Selected.Value.Date.Value = date.NewValue;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Tournament.Components;
|
||||
using SixLabors.Primitives;
|
||||
|
||||
@ -71,8 +71,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
public MatchPairing()
|
||||
{
|
||||
Team1.BindValueChanged(t => Team1Acronym = t?.Acronym, true);
|
||||
Team2.BindValueChanged(t => Team2Acronym = t?.Acronym, true);
|
||||
Team1.BindValueChanged(t => Team1Acronym = t.NewValue?.Acronym, true);
|
||||
Team2.BindValueChanged(t => Team2Acronym = t.NewValue?.Acronym, true);
|
||||
}
|
||||
|
||||
public MatchPairing(TournamentTeam team1 = null, TournamentTeam team2 = null)
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
[JsonIgnore]
|
||||
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>
|
||||
/// Remove scores from the match, in case of a false click or false start.
|
||||
|
@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
|
@ -98,13 +98,13 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
// clean up outdated progressions.
|
||||
pairing.Pairing.Progression.Value = null;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -118,7 +118,7 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
|
||||
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;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -102,13 +102,13 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
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)
|
||||
return;
|
||||
|
||||
if (beatmap.OnlineBeatmapID != null)
|
||||
addForBeatmap(beatmap.OnlineBeatmapID.Value);
|
||||
if (beatmap.NewValue.OnlineBeatmapID != null)
|
||||
addForBeatmap(beatmap.NewValue.OnlineBeatmapID.Value);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if (match.Grouping.Value != null)
|
||||
if (match.NewValue.Grouping.Value != null)
|
||||
{
|
||||
FillFlowContainer<TournamentBeatmapPanel> currentFlow = 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)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -48,9 +48,9 @@ namespace osu.Game.Tournament.Screens.Schedule
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing pairing)
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
||||
{
|
||||
if (pairing == null)
|
||||
if (pairing.NewValue == null)
|
||||
{
|
||||
mainContainer.Clear();
|
||||
return;
|
||||
@ -113,10 +113,10 @@ namespace osu.Game.Tournament.Screens.Schedule
|
||||
Colour = Color4.Black,
|
||||
TextSize = 20
|
||||
},
|
||||
new SchedulePairing(currentMatch, false),
|
||||
new SchedulePairing(currentMatch.Value, false),
|
||||
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,
|
||||
TextSize = 20
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Video;
|
||||
@ -46,9 +46,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
currentMatch.BindTo(ladder.CurrentMatch);
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing pairing)
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
||||
{
|
||||
if (pairing == null)
|
||||
if (pairing.NewValue == null)
|
||||
{
|
||||
mainContainer.Clear();
|
||||
return;
|
||||
@ -56,7 +56,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
|
||||
mainContainer.Children = new Drawable[]
|
||||
{
|
||||
new TeamWithPlayers(pairing.Team1, true)
|
||||
new TeamWithPlayers(pairing.NewValue.Team1.Value, true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
@ -64,7 +64,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight
|
||||
},
|
||||
new TeamWithPlayers(pairing.Team2)
|
||||
new TeamWithPlayers(pairing.NewValue.Team2.Value)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
@ -72,7 +72,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
new RoundDisplay(pairing)
|
||||
new RoundDisplay(pairing.NewValue)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.25f,
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Video;
|
||||
@ -62,10 +62,10 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
||||
currentCompleted.BindValueChanged(_ => update());
|
||||
}
|
||||
|
||||
private void matchChanged(MatchPairing pairing)
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
||||
{
|
||||
currentCompleted.UnbindBindings();
|
||||
currentCompleted.BindTo(pairing.Completed);
|
||||
currentCompleted.BindTo(pairing.NewValue.Completed);
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
Loading…
Reference in New Issue
Block a user