1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 23:22:55 +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
{
private Details details;
public override void Reset()
{
base.Reset();
Details details;
Add(details = new Details
{
RelativeSizeAxes = Axes.Both,
@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests
details.Ratings = Enumerable.Range(1, 10);
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));
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;
description.Text = beatmap.Version;
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,
TextSize = 14,

View File

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