2017-02-07 04:59:30 +00: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 06:41:48 +00:00
|
|
|
|
|
2017-03-15 05:06:05 +00:00
|
|
|
|
using System;
|
2017-03-31 06:59:53 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-15 05:06:05 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2017-03-04 10:02:36 +00:00
|
|
|
|
using osu.Game.Database;
|
2017-03-14 13:11:38 +00:00
|
|
|
|
using osu.Game.Modes.Mods;
|
2017-03-24 00:51:52 +00:00
|
|
|
|
using osu.Game.Users;
|
2017-03-24 05:03:46 +00:00
|
|
|
|
using System.IO;
|
2017-03-31 03:43:42 +00:00
|
|
|
|
using osu.Game.Modes.Replays;
|
2017-03-05 02:29:52 +00:00
|
|
|
|
|
2017-03-24 00:51:52 +00:00
|
|
|
|
namespace osu.Game.Modes.Scoring
|
2016-11-29 06:41:48 +00:00
|
|
|
|
{
|
|
|
|
|
public class Score
|
|
|
|
|
{
|
2017-03-15 05:06:05 +00:00
|
|
|
|
[JsonProperty(@"rank")]
|
2017-03-13 21:34:43 +00:00
|
|
|
|
public ScoreRank Rank { get; set; }
|
2017-03-15 05:06:05 +00:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"score")]
|
2016-11-29 14:59:56 +00:00
|
|
|
|
public double TotalScore { get; set; }
|
|
|
|
|
public double Accuracy { get; set; }
|
2017-01-10 08:01:53 +00:00
|
|
|
|
public double Health { get; set; }
|
2017-03-15 05:06:05 +00:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"maxcombo")]
|
2017-03-10 07:05:05 +00:00
|
|
|
|
public int MaxCombo { get; set; }
|
|
|
|
|
public int Combo { get; set; }
|
2017-03-13 21:34:43 +00:00
|
|
|
|
public Mod[] Mods { get; set; }
|
2017-03-04 06:29:15 +00:00
|
|
|
|
|
2017-03-13 21:34:43 +00:00
|
|
|
|
public User User { get; set; }
|
2017-03-15 05:06:05 +00:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"replay_data")]
|
2017-03-04 06:29:15 +00:00
|
|
|
|
public Replay Replay;
|
2017-03-15 05:06:05 +00:00
|
|
|
|
|
2017-03-04 10:02:36 +00:00
|
|
|
|
public BeatmapInfo Beatmap;
|
2017-03-15 05:06:05 +00:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"score_id")]
|
|
|
|
|
public long OnlineScoreID;
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"username")]
|
|
|
|
|
public string Username;
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"user_id")]
|
|
|
|
|
public long UserID;
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"date")]
|
|
|
|
|
public DateTime Date;
|
|
|
|
|
|
2017-03-24 05:03:46 +00:00
|
|
|
|
/// <summary>
|
2017-03-31 06:59:53 +00:00
|
|
|
|
/// Creates a replay which is read from a stream.
|
2017-03-24 05:03:46 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="reader">The stream reader.</param>
|
|
|
|
|
/// <returns>The replay.</returns>
|
2017-03-31 06:59:53 +00:00
|
|
|
|
public virtual Replay CreateReplay(StreamReader reader)
|
|
|
|
|
{
|
|
|
|
|
var frames = new List<ReplayFrame>();
|
|
|
|
|
|
|
|
|
|
float lastTime = 0;
|
|
|
|
|
|
|
|
|
|
foreach (var l in reader.ReadToEnd().Split(','))
|
|
|
|
|
{
|
|
|
|
|
var split = l.Split('|');
|
|
|
|
|
|
|
|
|
|
if (split.Length < 4 || float.Parse(split[0]) < 0) continue;
|
|
|
|
|
|
|
|
|
|
lastTime += float.Parse(split[0]);
|
|
|
|
|
|
|
|
|
|
frames.Add(new ReplayFrame(
|
|
|
|
|
lastTime,
|
|
|
|
|
float.Parse(split[1]),
|
|
|
|
|
384 - float.Parse(split[2]),
|
|
|
|
|
(ReplayButtonState)int.Parse(split[3])
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Replay { Frames = frames };
|
|
|
|
|
}
|
2017-03-24 05:03:46 +00:00
|
|
|
|
|
2017-03-15 05:06:05 +00:00
|
|
|
|
// [JsonProperty(@"count50")] 0,
|
|
|
|
|
//[JsonProperty(@"count100")] 0,
|
|
|
|
|
//[JsonProperty(@"count300")] 100,
|
|
|
|
|
//[JsonProperty(@"countmiss")] 0,
|
|
|
|
|
//[JsonProperty(@"countkatu")] 0,
|
|
|
|
|
//[JsonProperty(@"countgeki")] 31,
|
|
|
|
|
//[JsonProperty(@"perfect")] true,
|
|
|
|
|
//[JsonProperty(@"enabled_mods")] [
|
|
|
|
|
// "DT",
|
|
|
|
|
// "FL",
|
|
|
|
|
// "HD",
|
|
|
|
|
// "HR"
|
|
|
|
|
//],
|
|
|
|
|
//[JsonProperty(@"rank")] "XH",
|
|
|
|
|
//[JsonProperty(@"pp")] 26.1816,
|
|
|
|
|
//[JsonProperty(@"replay")] true
|
2016-11-29 06:41:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|