mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 12:22:57 +08:00
Rewrite mania selection blueprint test scene
This commit is contained in:
parent
ef96ceb4ab
commit
403aa433cf
@ -1,31 +1,53 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
|
[Cached(typeof(IPlayfieldProvider))]
|
||||||
|
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene, IPlayfieldProvider
|
||||||
{
|
{
|
||||||
[Cached(Type = typeof(IAdjustableClock))]
|
protected override Container<Drawable> Content => blueprints ?? base.Content;
|
||||||
private readonly IAdjustableClock clock = new StopwatchClock();
|
|
||||||
|
private readonly Container blueprints;
|
||||||
|
|
||||||
|
public Playfield Playfield { get; }
|
||||||
|
|
||||||
|
private readonly ScrollingTestContainer scrollingTestContainer;
|
||||||
|
|
||||||
|
protected ScrollingDirection Direction
|
||||||
|
{
|
||||||
|
set => scrollingTestContainer.Direction = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected ManiaSelectionBlueprintTestScene()
|
protected ManiaSelectionBlueprintTestScene()
|
||||||
{
|
{
|
||||||
Add(new Column(0)
|
var stageDefinitions = new List<StageDefinition> { new StageDefinition { Columns = 1 } };
|
||||||
|
base.Content.Child = scrollingTestContainer = new ScrollingTestContainer(ScrollingDirection.Down)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Children = new Drawable[]
|
||||||
AccentColour = Color4.OrangeRed,
|
{
|
||||||
Clock = new FramedClock(new StopwatchClock()), // No scroll
|
Playfield = new ManiaPlayfield(stageDefinitions)
|
||||||
});
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
blueprints = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManiaPlayfield Playfield => null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,56 +1,24 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public class TestSceneHoldNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
public class TestSceneHoldNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
||||||
{
|
{
|
||||||
private readonly DrawableHoldNote drawableObject;
|
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content ?? base.Content;
|
|
||||||
private readonly Container content;
|
|
||||||
|
|
||||||
public TestSceneHoldNoteSelectionBlueprint()
|
public TestSceneHoldNoteSelectionBlueprint()
|
||||||
{
|
{
|
||||||
var holdNote = new HoldNote { Column = 0, Duration = 1000 };
|
var holdNote = new HoldNote { Column = 0, Duration = 500 };
|
||||||
holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
holdNote.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
|
var drawableHitObject = new DrawableHoldNote(holdNote);
|
||||||
{
|
Playfield.Add(drawableHitObject);
|
||||||
Anchor = Anchor.Centre,
|
AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableHitObject);
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Width = 50,
|
|
||||||
Child = drawableObject = new DrawableHoldNote(holdNote)
|
|
||||||
{
|
|
||||||
Height = 300,
|
|
||||||
AccentColour = { Value = OsuColour.Gray(0.3f) }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AddBlueprint(new HoldNoteSelectionBlueprint(holdNote), drawableObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
foreach (var nested in drawableObject.NestedHitObjects)
|
|
||||||
{
|
|
||||||
double finalPosition = (nested.HitObject.StartTime - drawableObject.HitObject.StartTime) / drawableObject.HitObject.Duration;
|
|
||||||
nested.Y = (float)(-finalPosition * content.DrawHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,24 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
{
|
{
|
||||||
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
|
||||||
{
|
{
|
||||||
protected override Container<Drawable> Content => content ?? base.Content;
|
|
||||||
private readonly Container content;
|
|
||||||
|
|
||||||
public TestSceneNoteSelectionBlueprint()
|
public TestSceneNoteSelectionBlueprint()
|
||||||
{
|
{
|
||||||
var note = new Note { Column = 0 };
|
var note = new Note { Column = 0 };
|
||||||
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
DrawableNote drawableObject;
|
var drawableHitObject = new DrawableNote(note);
|
||||||
|
Playfield.Add(drawableHitObject);
|
||||||
base.Content.Child = content = new ScrollingTestContainer(ScrollingDirection.Down)
|
AddBlueprint(new NoteSelectionBlueprint(note), drawableHitObject);
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(50, 20),
|
|
||||||
Child = drawableObject = new DrawableNote(note)
|
|
||||||
};
|
|
||||||
|
|
||||||
AddBlueprint(new NoteSelectionBlueprint(note), drawableObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user