2016-09-02 19:30:27 +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-11-19 18:07:57 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2016-09-02 19:30:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2016-11-19 18:07:57 +08:00
|
|
|
|
using osu.Game.Modes.Objects.Drawables;
|
|
|
|
|
using OpenTK;
|
2016-09-02 19:30:27 +08:00
|
|
|
|
|
2016-11-14 17:54:24 +08:00
|
|
|
|
namespace osu.Game.Modes.UI
|
2016-09-02 19:30:27 +08:00
|
|
|
|
{
|
2016-11-19 18:07:57 +08:00
|
|
|
|
public abstract class Playfield : Container
|
2016-09-02 19:30:27 +08:00
|
|
|
|
{
|
2016-11-19 18:07:57 +08:00
|
|
|
|
public HitObjectContainer HitObjects;
|
2016-12-06 20:14:38 +08:00
|
|
|
|
private Container<Drawable> content;
|
2016-11-19 18:07:57 +08:00
|
|
|
|
|
|
|
|
|
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
|
|
|
|
|
|
2016-11-24 17:58:06 +08:00
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2016-11-19 18:07:57 +08:00
|
|
|
|
public Playfield()
|
|
|
|
|
{
|
2016-12-06 20:14:38 +08:00
|
|
|
|
AddInternal(content = new ScaledContainer()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Add(HitObjects = new HitObjectContainer
|
2016-11-19 18:07:57 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
public class ScaledContainer : Container
|
2016-11-19 18:07:57 +08:00
|
|
|
|
{
|
|
|
|
|
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
|
2016-12-11 17:09:58 +08:00
|
|
|
|
|
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
2016-12-06 20:14:38 +08:00
|
|
|
|
}
|
2016-11-24 17:58:06 +08:00
|
|
|
|
|
2016-12-06 20:14:38 +08:00
|
|
|
|
public class HitObjectContainer : Container<DrawableHitObject>
|
|
|
|
|
{
|
2016-11-24 17:58:06 +08:00
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
2016-11-19 18:07:57 +08:00
|
|
|
|
}
|
2016-09-02 19:30:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|