1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 15:27:24 +08:00

Merge branch 'master' into taiko-drumroll-party

This commit is contained in:
Dean Herbert 2020-04-27 13:27:10 +09:00 committed by GitHub
commit 1cd4fd2ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 155 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,111 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{
[TestFixture]
public class TestSceneDrawableBarLine : TaikoSkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => base.RequiredTypes.Concat(new[]
{
typeof(DrawableBarLine),
typeof(LegacyBarLine),
typeof(BarLine),
}).ToList();
[Cached(typeof(IScrollingInfo))]
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
{
Direction = { Value = ScrollingDirection.Left },
TimeRange = { Value = 5000 },
};
[BackgroundDependencyLoader]
private void load()
{
AddStep("Bar line", () => SetContents(() =>
{
ScrollingHitObjectContainer hoc;
var cont = new Container
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
};
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
}));
AddStep("Bar line (major)", () => SetContents(() =>
{
ScrollingHitObjectContainer hoc;
var cont = new Container
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
};
hoc.Add(new DrawableBarLineMajor(createBarLineAtCurrentTime(true))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
}));
}
private BarLine createBarLineAtCurrentTime(bool major = false)
{
var barline = new BarLine
{
Major = major,
StartTime = Time.Current + 2000,
};
var cpi = new ControlPointInfo();
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
barline.ApplyDefaults(cpi, new BeatmapDifficulty());
return barline;
}
}
}

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osuTK; using osuTK;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
@ -27,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// <summary> /// <summary>
/// The visual line tracker. /// The visual line tracker.
/// </summary> /// </summary>
protected Box Tracker; protected SkinnableDrawable Line;
/// <summary> /// <summary>
/// The bar line. /// The bar line.
@ -45,13 +46,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = tracker_width; Width = tracker_width;
AddInternal(Tracker = new Box AddInternal(Line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box
{
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(0.5f, 0),
})
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both, Alpha = 0.75f,
EdgeSmoothness = new Vector2(0.5f, 0),
Alpha = 0.75f
}); });
} }

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
}); });
Tracker.Alpha = 1f; Line.Alpha = 1f;
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -0,0 +1,27 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Taiko.Skinning
{
public class LegacyBarLine : Sprite
{
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{
Texture = skin.GetTexture("taiko-barline");
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(1, 0.88f);
FillMode = FillMode.Fill;
}
}
}

View File

@ -75,6 +75,12 @@ namespace osu.Game.Rulesets.Taiko.Skinning
return Drawable.Empty(); return Drawable.Empty();
return null; return null;
case TaikoSkinComponents.BarLine:
if (GetTexture("taiko-barline") != null)
return new LegacyBarLine();
return null;
} }
return source.GetDrawableComponent(component); return source.GetDrawableComponent(component);

View File

@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Taiko
Swell, Swell,
HitTarget, HitTarget,
PlayfieldBackgroundLeft, PlayfieldBackgroundLeft,
PlayfieldBackgroundRight PlayfieldBackgroundRight,
BarLine
} }
} }