Add seeding screen

This commit is contained in:
Dean Herbert
2020-03-03 18:12:42 +09:00
parent 372060bc2b
commit 093f2affdf
13 changed files with 955 additions and 44 deletions

View File

@ -0,0 +1,23 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
namespace osu.Game.Tournament.Models
{
public class SeedingBeatmap
{
public int ID;
public BeatmapInfo BeatmapInfo;
public long Score;
public Bindable<int> Seed = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Bindables;
namespace osu.Game.Tournament.Models
{
public class SeedingResult
{
public List<SeedingBeatmap> Beatmaps = new List<SeedingBeatmap>();
public Bindable<string> Mod = new Bindable<string>();
public Bindable<int> Seed = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Bindables;
using osu.Game.Users;
@ -29,6 +30,32 @@ namespace osu.Game.Tournament.Models
/// </summary>
public Bindable<string> Acronym = new Bindable<string>(string.Empty);
public BindableList<SeedingResult> SeedingResults = new BindableList<SeedingResult>();
public double AverageRank
{
get
{
var ranks = Players.Select(p => p.Statistics?.Ranks.Global)
.Where(i => i.HasValue)
.Select(i => i.Value)
.ToArray();
if (ranks.Length == 0)
return 0;
return ranks.Average();
}
}
public Bindable<string> Seed = new Bindable<string>(string.Empty);
public Bindable<int> LastYearPlacing = new BindableInt
{
MinValue = 1,
MaxValue = 64
};
[JsonProperty]
public BindableList<User> Players { get; set; } = new BindableList<User>();