2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-11-29 14:41:48 +08:00
|
|
|
|
|
2017-03-15 13:06:05 +08:00
|
|
|
|
using System;
|
2017-08-14 01:54:07 +08:00
|
|
|
|
using System.Linq;
|
2017-03-31 14:59:53 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-15 13:06:05 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2017-03-24 08:51:52 +08:00
|
|
|
|
using osu.Game.Users;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Replays;
|
2017-03-05 10:29:52 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Scoring
|
2016-11-29 14:41:48 +08:00
|
|
|
|
{
|
|
|
|
|
public class Score
|
|
|
|
|
{
|
2017-03-14 05:34:43 +08:00
|
|
|
|
public ScoreRank Rank { get; set; }
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"score")]
|
2016-11-29 22:59:56 +08:00
|
|
|
|
public double TotalScore { get; set; }
|
2017-04-19 15:02:18 +08:00
|
|
|
|
|
2016-11-29 22:59:56 +08:00
|
|
|
|
public double Accuracy { get; set; }
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
2017-04-19 15:02:18 +08:00
|
|
|
|
public double Health { get; set; } = 1;
|
|
|
|
|
|
2017-04-20 17:54:35 +08:00
|
|
|
|
[JsonProperty(@"max_combo")]
|
2017-03-10 15:05:05 +08:00
|
|
|
|
public int MaxCombo { get; set; }
|
2017-04-19 15:02:18 +08:00
|
|
|
|
|
2017-03-10 15:05:05 +08:00
|
|
|
|
public int Combo { get; set; }
|
2017-03-04 14:29:15 +08:00
|
|
|
|
|
2017-04-19 15:02:18 +08:00
|
|
|
|
[JsonProperty(@"mods")]
|
2017-08-15 21:30:53 +08:00
|
|
|
|
private string[] modStrings { get; set; }
|
2017-08-13 23:41:13 +08:00
|
|
|
|
|
|
|
|
|
private RulesetInfo ruleset;
|
|
|
|
|
public RulesetInfo Ruleset
|
|
|
|
|
{
|
|
|
|
|
get { return ruleset; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ruleset = value;
|
|
|
|
|
|
2017-08-14 19:30:54 +08:00
|
|
|
|
// Handle the mod strings if they are assigned
|
2017-08-15 21:30:53 +08:00
|
|
|
|
if (modStrings != null)
|
|
|
|
|
Mods = ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
2017-08-13 23:41:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-20 10:16:08 +08:00
|
|
|
|
|
2017-04-19 15:02:18 +08:00
|
|
|
|
public Mod[] Mods { get; set; }
|
2017-04-11 12:47:30 +08:00
|
|
|
|
|
2017-04-19 15:02:18 +08:00
|
|
|
|
[JsonProperty(@"user")]
|
|
|
|
|
public User User;
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"replay_data")]
|
2017-03-04 14:29:15 +08:00
|
|
|
|
public Replay Replay;
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
2017-03-04 18:02:36 +08:00
|
|
|
|
public BeatmapInfo Beatmap;
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"score_id")]
|
|
|
|
|
public long OnlineScoreID;
|
|
|
|
|
|
2017-04-19 15:02:18 +08:00
|
|
|
|
[JsonProperty(@"created_at")]
|
2017-05-16 21:14:50 +08:00
|
|
|
|
public DateTimeOffset Date;
|
2017-03-15 13:06:05 +08:00
|
|
|
|
|
2017-04-20 17:54:35 +08:00
|
|
|
|
[JsonProperty(@"statistics")]
|
|
|
|
|
private Dictionary<string, dynamic> jsonStats
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
foreach (var kvp in value)
|
|
|
|
|
{
|
|
|
|
|
string key = kvp.Key;
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case @"count_300":
|
|
|
|
|
key = @"300";
|
|
|
|
|
break;
|
|
|
|
|
case @"count_100":
|
|
|
|
|
key = @"100";
|
|
|
|
|
break;
|
|
|
|
|
case @"count_50":
|
|
|
|
|
key = @"50";
|
|
|
|
|
break;
|
|
|
|
|
case @"count_miss":
|
|
|
|
|
key = @"x";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Statistics.Add(key, kvp.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-20 10:02:56 +08:00
|
|
|
|
public Dictionary<string, dynamic> Statistics = new Dictionary<string, dynamic>();
|
2016-11-29 14:41:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|