2016-08-31 11:33:01 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2016-10-08 04:19:24 +08:00
|
|
|
|
using osu.Game.Beatmaps.Objects.Osu;
|
2016-08-31 11:33:01 +08:00
|
|
|
|
using osu.Game.Beatmaps.Samples;
|
2016-10-08 04:19:24 +08:00
|
|
|
|
using osu.Game.GameModes.Play;
|
2016-08-31 11:33:01 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Objects
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A hitobject describes a point in a beatmap
|
|
|
|
|
/// </summary>
|
2016-09-26 14:07:29 +08:00
|
|
|
|
public abstract class HitObject
|
2016-08-31 11:33:01 +08:00
|
|
|
|
{
|
|
|
|
|
public double StartTime;
|
2016-10-19 18:44:03 +08:00
|
|
|
|
public virtual double EndTime => StartTime;
|
2016-08-31 11:33:01 +08:00
|
|
|
|
|
2016-10-19 18:44:03 +08:00
|
|
|
|
public double Duration => EndTime - StartTime;
|
2016-09-02 17:31:32 +08:00
|
|
|
|
|
2016-08-31 12:51:00 +08:00
|
|
|
|
public HitSampleInfo Sample;
|
2016-10-08 04:19:24 +08:00
|
|
|
|
|
|
|
|
|
public static HitObject Parse(PlayMode mode, string val)
|
|
|
|
|
{
|
2016-10-13 10:41:11 +08:00
|
|
|
|
//TODO: move to modular HitObjectParser system rather than static parsing. (https://github.com/ppy/osu/pull/60/files#r83135780)
|
2016-10-08 04:19:24 +08:00
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case PlayMode.Osu:
|
|
|
|
|
return OsuBaseHit.Parse(val);
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-31 11:33:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|