mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:47:25 +08:00
94 lines
2.7 KiB
C#
94 lines
2.7 KiB
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using System;
|
|
using System.ComponentModel;
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
using osu.Game.Rulesets.Osu.Judgements;
|
|
using osu.Framework.Graphics;
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|
{
|
|
public class DrawableOsuHitObject : DrawableHitObject<OsuHitObject, OsuJudgement>
|
|
{
|
|
public const float TIME_PREEMPT = 600;
|
|
public const float TIME_FADEIN = 400;
|
|
public const float TIME_FADEOUT = 500;
|
|
|
|
protected DrawableOsuHitObject(OsuHitObject hitObject)
|
|
: base(hitObject)
|
|
{
|
|
AccentColour = HitObject.ComboColour;
|
|
Alpha = 0;
|
|
}
|
|
|
|
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 };
|
|
|
|
protected sealed override void UpdateState(ArmedState state)
|
|
{
|
|
FinishTransforms();
|
|
|
|
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
|
|
{
|
|
UpdateInitialState();
|
|
|
|
UpdatePreemptState();
|
|
|
|
using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true))
|
|
UpdateCurrentState(state);
|
|
}
|
|
}
|
|
|
|
protected virtual void UpdateInitialState()
|
|
{
|
|
Hide();
|
|
}
|
|
|
|
protected virtual void UpdatePreemptState()
|
|
{
|
|
this.FadeIn(TIME_FADEIN);
|
|
}
|
|
|
|
protected virtual void UpdateCurrentState(ArmedState state)
|
|
{
|
|
}
|
|
|
|
private WeakReference<OsuInputManager> osuActionInputManager = new WeakReference<OsuInputManager>(null);
|
|
internal OsuInputManager OsuActionInputManager
|
|
{
|
|
get
|
|
{
|
|
OsuInputManager target = null;
|
|
if (osuActionInputManager.TryGetTarget(out target)) return target;
|
|
target = GetContainingInputManager() as OsuInputManager;
|
|
osuActionInputManager.SetTarget(target);
|
|
return target;
|
|
}
|
|
}
|
|
}
|
|
|
|
public enum ComboResult
|
|
{
|
|
[Description(@"")]
|
|
None,
|
|
[Description(@"Good")]
|
|
Good,
|
|
[Description(@"Amazing")]
|
|
Perfect
|
|
}
|
|
|
|
public enum OsuScoreResult
|
|
{
|
|
[Description(@"Miss")]
|
|
Miss,
|
|
[Description(@"50")]
|
|
Hit50,
|
|
[Description(@"100")]
|
|
Hit100,
|
|
[Description(@"300")]
|
|
Hit300,
|
|
[Description(@"10")]
|
|
SliderTick
|
|
}
|
|
}
|