2016-09-02 18:25:13 +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
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
|
|
|
|
using osu.Game.Beatmaps.Objects;
|
|
|
|
|
using osu.Game.Beatmaps.Objects.Osu;
|
2016-09-11 01:27:42 +08:00
|
|
|
|
using OpenTK;
|
2016-10-10 16:17:26 +08:00
|
|
|
|
using System.Diagnostics;
|
2016-09-02 18:25:13 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.GameModes.Play.Osu
|
|
|
|
|
{
|
|
|
|
|
public class OsuHitRenderer : HitRenderer
|
|
|
|
|
{
|
|
|
|
|
List<OsuBaseHit> objects;
|
|
|
|
|
private OsuPlayfield playfield;
|
|
|
|
|
|
2016-09-26 14:07:29 +08:00
|
|
|
|
public override List<HitObject> Objects
|
2016-09-02 18:25:13 +08:00
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-10-10 16:17:26 +08:00
|
|
|
|
Debug.Assert(objects == null);
|
|
|
|
|
|
2016-09-02 18:25:13 +08:00
|
|
|
|
//osu! mode requires all objects to be of OsuBaseHit type.
|
|
|
|
|
objects = value.ConvertAll(o => (OsuBaseHit)o);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 16:17:26 +08:00
|
|
|
|
public override void Load(Framework.BaseGame game)
|
2016-09-02 18:25:13 +08:00
|
|
|
|
{
|
2016-10-10 16:17:26 +08:00
|
|
|
|
base.Load(game);
|
2016-09-02 18:25:13 +08:00
|
|
|
|
|
|
|
|
|
if (playfield == null)
|
|
|
|
|
Add(playfield = new OsuPlayfield());
|
|
|
|
|
else
|
|
|
|
|
playfield.Clear();
|
|
|
|
|
|
|
|
|
|
if (objects == null) return;
|
|
|
|
|
|
|
|
|
|
foreach (OsuBaseHit h in objects)
|
|
|
|
|
{
|
|
|
|
|
//render stuff!
|
2016-09-21 12:12:05 +08:00
|
|
|
|
Sprite s = new Sprite
|
2016-09-02 18:25:13 +08:00
|
|
|
|
{
|
2016-10-10 16:17:26 +08:00
|
|
|
|
Texture = game.Textures.Get(@"Menu/logo"),
|
2016-09-02 18:25:13 +08:00
|
|
|
|
Origin = Anchor.Centre,
|
2016-09-11 01:27:42 +08:00
|
|
|
|
Scale = new Vector2(0.1f),
|
2016-09-02 18:25:13 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
Position = h.Position
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-03 15:17:15 +08:00
|
|
|
|
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 0, EndValue = 1 });
|
|
|
|
|
s.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
2016-09-21 12:12:15 +08:00
|
|
|
|
s.Expire(true);
|
2016-09-02 18:25:13 +08:00
|
|
|
|
|
|
|
|
|
playfield.Add(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|