mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Perform mappings earlier in execution
This commit is contained in:
parent
968d39c0e6
commit
53ec01d51f
@ -24,7 +24,7 @@ namespace osu.Game.Tournament.Tests
|
||||
pairing.Grouping.Value = Ladder.Groupings.FirstOrDefault(g => g.Name == "Finals");
|
||||
currentMatch.Value = pairing;
|
||||
|
||||
Add(new TeamIntroScreen()
|
||||
Add(new TeamIntroScreen
|
||||
{
|
||||
FillMode = FillMode.Fit,
|
||||
FillAspectRatio = 16 / 9f
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -67,37 +66,9 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
}
|
||||
};
|
||||
|
||||
// assign teams
|
||||
foreach (var pairing in info.Pairings)
|
||||
{
|
||||
pairing.Team1.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym);
|
||||
pairing.Team2.Value = info.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym);
|
||||
}
|
||||
|
||||
// assign progressions
|
||||
foreach (var pair in info.Progressions)
|
||||
{
|
||||
var src = info.Pairings.FirstOrDefault(p => p.ID == pair.Item1);
|
||||
var dest = info.Pairings.FirstOrDefault(p => p.ID == pair.Item2);
|
||||
|
||||
if (src == null) throw new InvalidOperationException();
|
||||
|
||||
if (dest != null)
|
||||
{
|
||||
if (pair.Losers)
|
||||
src.LosersProgression.Value = dest;
|
||||
else
|
||||
src.Progression.Value = dest;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var pairing in info.Pairings)
|
||||
addPairing(pairing);
|
||||
|
||||
foreach (var group in info.Groupings)
|
||||
foreach (var id in group.Pairings)
|
||||
info.Pairings.Single(p => p.ID == id).Grouping.Value = group;
|
||||
|
||||
// todo: fix this
|
||||
Scheduler.AddDelayed(() => layout.Invalidate(), 100, true);
|
||||
}
|
||||
|
@ -1,6 +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 System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -56,13 +57,38 @@ namespace osu.Game.Tournament
|
||||
|
||||
Ladder = content != null ? JsonConvert.DeserializeObject<LadderInfo>(content) : new LadderInfo();
|
||||
|
||||
//todo: temp
|
||||
currentMatch.Value = Ladder.Pairings.FirstOrDefault();
|
||||
|
||||
dependencies.Cache(Ladder);
|
||||
|
||||
bool addedInfo = false;
|
||||
|
||||
// assign teams
|
||||
foreach (var pairing in Ladder.Pairings)
|
||||
{
|
||||
pairing.Team1.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team1Acronym);
|
||||
pairing.Team2.Value = Ladder.Teams.FirstOrDefault(t => t.Acronym == pairing.Team2Acronym);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (src == null) throw new InvalidOperationException();
|
||||
|
||||
if (dest != null)
|
||||
{
|
||||
if (pair.Losers)
|
||||
src.LosersProgression.Value = dest;
|
||||
else
|
||||
src.Progression.Value = dest;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var group in Ladder.Groupings)
|
||||
foreach (var id in group.Pairings)
|
||||
Ladder.Pairings.Single(p => p.ID == id).Grouping.Value = group;
|
||||
|
||||
foreach (var g in Ladder.Groupings)
|
||||
foreach (var b in g.Beatmaps)
|
||||
if (b.BeatmapInfo == null)
|
||||
@ -74,6 +100,9 @@ namespace osu.Game.Tournament
|
||||
addedInfo = true;
|
||||
}
|
||||
|
||||
//todo: temp
|
||||
currentMatch.Value = Ladder.Pairings.FirstOrDefault();
|
||||
|
||||
if (addedInfo)
|
||||
SaveChanges();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user