mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 16:32:54 +08:00
Add current time labels
This commit is contained in:
parent
32226f90db
commit
6679575c13
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
@ -22,8 +23,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
private SpeedAdjustmentCollection adjustmentCollection;
|
private SpeedAdjustmentCollection adjustmentCollection;
|
||||||
|
|
||||||
private BindableDouble timeRangeBindable;
|
private BindableDouble timeRangeBindable;
|
||||||
private SpriteText timeRangeText;
|
private OsuSpriteText timeRangeText;
|
||||||
private SpriteText bottomLabel;
|
private OsuSpriteText bottomLabel;
|
||||||
|
private SpriteText topTime, bottomTime;
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
@ -43,7 +45,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
KeyboardStep = 100
|
KeyboardStep = 100
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(timeRangeText = new SpriteText
|
Add(timeRangeText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
X = 210,
|
X = 210,
|
||||||
TextSize = 16,
|
TextSize = 16,
|
||||||
@ -70,21 +72,38 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
adjustmentCollection = new SpeedAdjustmentCollection
|
adjustmentCollection = new SpeedAdjustmentCollection
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
VisibleTimeRange = timeRangeBindable
|
VisibleTimeRange = timeRangeBindable,
|
||||||
|
Masking = true,
|
||||||
},
|
},
|
||||||
new SpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "t minus 0",
|
Text = "t minus 0",
|
||||||
|
Margin = new MarginPadding(2),
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
},
|
},
|
||||||
bottomLabel = new SpriteText
|
bottomLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "t minus x",
|
Text = "t minus x",
|
||||||
|
Margin = new MarginPadding(2),
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
},
|
},
|
||||||
|
topTime = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding(2),
|
||||||
|
TextSize = 14,
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
},
|
||||||
|
bottomTime = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding(2),
|
||||||
|
TextSize = 14,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -96,6 +115,13 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
AddStep("Add hit object", () => adjustmentCollection.Add(new TestDrawableHitObject(new HitObject { StartTime = Time.Current + 2000 })));
|
AddStep("Add hit object", () => adjustmentCollection.Add(new TestDrawableHitObject(new HitObject { StartTime = Time.Current + 2000 })));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
topTime.Text = Time.Current.ToString("#,#");
|
||||||
|
bottomTime.Text = (Time.Current + timeRangeBindable.Value).ToString("#,#");
|
||||||
|
}
|
||||||
|
|
||||||
private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer
|
private class TestSpeedAdjustmentContainer : SpeedAdjustmentContainer
|
||||||
{
|
{
|
||||||
public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint)
|
public TestSpeedAdjustmentContainer(MultiplierControlPoint controlPoint)
|
||||||
@ -126,6 +152,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private class TestDrawableHitObject : DrawableHitObject
|
private class TestDrawableHitObject : DrawableHitObject
|
||||||
{
|
{
|
||||||
|
private const float height = 14;
|
||||||
|
|
||||||
public TestDrawableHitObject(HitObject hitObject)
|
public TestDrawableHitObject(HitObject hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
@ -135,11 +163,29 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
Y = (float)hitObject.StartTime;
|
Y = (float)hitObject.StartTime;
|
||||||
|
|
||||||
Add(new Box
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
new Box
|
||||||
Height = 10,
|
{
|
||||||
});
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = height,
|
||||||
|
},
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Colour = Color4.Cyan,
|
||||||
|
Height = 1,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
TextSize = height,
|
||||||
|
Font = @"Exo2.0-BoldItalic",
|
||||||
|
Text = $"{hitObject.StartTime:#,#}"
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user