1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 22:06:08 +08:00

fixes + updates to DetailsBar and a button for the TestCaseDetails

This commit is contained in:
Jorolf 2017-03-29 14:48:43 +02:00
parent 199c70ff95
commit 7bd13d76a8
3 changed files with 19 additions and 6 deletions

View File

@ -16,12 +16,12 @@ namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseDetails : TestCase class TestCaseDetails : TestCase
{ {
private Details details;
public override void Reset() public override void Reset()
{ {
base.Reset(); base.Reset();
Details details;
Add(details = new Details Add(details = new Details
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests
details.Ratings = Enumerable.Range(1, 10); details.Ratings = Enumerable.Range(1, 10);
details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100));
details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100));
AddButton("new retry/fail values", newRetryAndFailValues);
}
private int lastRange = 1;
private void newRetryAndFailValues()
{
lastRange += 100;
details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100));
details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100));
} }
} }
} }

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select
beatmap = value; beatmap = value;
description.Text = beatmap.Version; description.Text = beatmap.Version;
source.Text = beatmap.Metadata.Source; source.Text = beatmap.Metadata.Source;
tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new SpriteText
{ {
Text = text, Text = text,
TextSize = 14, TextSize = 14,

View File

@ -6,7 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using System; using osu.Framework.Graphics.Transforms;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -17,6 +17,8 @@ namespace osu.Game.Screens.Select
private const int resize_duration = 250; private const int resize_duration = 250;
private const EasingTypes easing = EasingTypes.InOutCubic;
private float length; private float length;
public float Length public float Length
{ {
@ -26,7 +28,7 @@ namespace osu.Game.Screens.Select
} }
set set
{ {
length = value; length = MathHelper.Clamp(value,0,1);
updateBarLength(); updateBarLength();
} }
} }
@ -90,11 +92,11 @@ namespace osu.Game.Screens.Select
{ {
case BarDirection.LeftToRight: case BarDirection.LeftToRight:
case BarDirection.RightToLeft: case BarDirection.RightToLeft:
bar.ResizeTo(new Vector2(length, 1), resize_duration); bar.ResizeTo(new Vector2(length, 1), resize_duration, easing);
break; break;
case BarDirection.TopToBottom: case BarDirection.TopToBottom:
case BarDirection.BottomToTop: case BarDirection.BottomToTop:
bar.ResizeTo(new Vector2(1, length), resize_duration); bar.ResizeTo(new Vector2(1, length), resize_duration, easing);
break; break;
} }