2017-03-24 22:02:24 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-03-25 22:33:03 +00:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-03-25 22:33:03 +00:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
using osu.Framework.Graphics.Primitives;
|
2017-03-25 22:33:03 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Database;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2017-03-25 22:33:03 +00:00
|
|
|
|
using System.Linq;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select
|
|
|
|
|
{
|
|
|
|
|
public class Details : Container
|
|
|
|
|
{
|
|
|
|
|
private SpriteText description;
|
|
|
|
|
private SpriteText source;
|
|
|
|
|
private FillFlowContainer<SpriteText> tags;
|
2017-03-25 22:33:03 +00:00
|
|
|
|
|
|
|
|
|
private DifficultyRow circleSize;
|
|
|
|
|
private DifficultyRow drainRate;
|
|
|
|
|
private DifficultyRow approachRate;
|
|
|
|
|
private DifficultyRow overallDifficulty;
|
|
|
|
|
private DifficultyRow stars;
|
|
|
|
|
|
|
|
|
|
private BeatmapInfo beatmap;
|
|
|
|
|
public BeatmapInfo Beatmap
|
2017-03-24 22:02:24 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-03-25 22:33:03 +00:00
|
|
|
|
return beatmap;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-03-25 22:33:03 +00:00
|
|
|
|
if (beatmap == value) return;
|
|
|
|
|
beatmap = value;
|
|
|
|
|
description.Text = beatmap.Version;
|
|
|
|
|
source.Text = beatmap.Metadata.Source;
|
|
|
|
|
tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = text,
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = "Exo2.0-Medium",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
circleSize.Value = beatmap.Difficulty.CircleSize;
|
|
|
|
|
drainRate.Value = beatmap.Difficulty.DrainRate;
|
|
|
|
|
approachRate.Value = beatmap.Difficulty.ApproachRate;
|
|
|
|
|
overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty;
|
|
|
|
|
stars.Value = (float) beatmap.StarDifficulty;
|
2017-03-24 22:02:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Details()
|
|
|
|
|
{
|
2017-03-25 22:33:03 +00:00
|
|
|
|
Children = new Drawable[]
|
2017-03-24 22:02:24 +00:00
|
|
|
|
{
|
2017-03-25 22:33:03 +00:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer()
|
2017-03-24 22:02:24 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Width = 0.4f,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-03-25 22:33:03 +00:00
|
|
|
|
Padding = new MarginPadding(5),
|
2017-03-24 22:02:24 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Description",
|
2017-03-25 22:33:03 +00:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
|
|
|
|
},
|
|
|
|
|
description = new SpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
Direction = FillDirection.Full,
|
2017-03-24 22:02:24 +00:00
|
|
|
|
},
|
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Source",
|
2017-03-25 22:33:03 +00:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
2017-03-24 22:02:24 +00:00
|
|
|
|
Margin = new MarginPadding { Top = 20 },
|
|
|
|
|
},
|
2017-03-25 22:33:03 +00:00
|
|
|
|
source = new SpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
Direction = FillDirection.Full,
|
|
|
|
|
},
|
2017-03-24 22:02:24 +00:00
|
|
|
|
new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Tags",
|
2017-03-25 22:33:03 +00:00
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Bold",
|
2017-03-24 22:02:24 +00:00
|
|
|
|
Margin = new MarginPadding { Top = 20 },
|
|
|
|
|
},
|
|
|
|
|
tags = new FillFlowContainer<SpriteText>
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Spacing = new Vector2(3,0),
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-03-25 22:33:03 +00:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Width = 0.6f,
|
|
|
|
|
Padding = new MarginPadding(5) { Top = 0 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0,10),
|
|
|
|
|
Padding = new MarginPadding(7),
|
|
|
|
|
Children = new []
|
|
|
|
|
{
|
|
|
|
|
circleSize = new DifficultyRow
|
|
|
|
|
{
|
|
|
|
|
DifficultyName = "Circle Size",
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
MaxValue = 7,
|
|
|
|
|
},
|
|
|
|
|
drainRate = new DifficultyRow
|
|
|
|
|
{
|
|
|
|
|
DifficultyName = "HP Drain",
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
approachRate = new DifficultyRow
|
|
|
|
|
{
|
|
|
|
|
DifficultyName = "Accuracy",
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
overallDifficulty = new DifficultyRow
|
|
|
|
|
{
|
|
|
|
|
DifficultyName = "Limit Break",
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
stars = new DifficultyRow
|
|
|
|
|
{
|
|
|
|
|
DifficultyName = "Star Difficulty",
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-03-24 22:02:24 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colour)
|
|
|
|
|
{
|
|
|
|
|
description.Colour = colour.GrayB;
|
|
|
|
|
source.Colour = colour.GrayB;
|
2017-03-25 22:33:03 +00:00
|
|
|
|
tags.Colour = colour.YellowLight;
|
|
|
|
|
stars.BarColour = colour.YellowLight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class DifficultyRow : Container
|
|
|
|
|
{
|
|
|
|
|
private SpriteText name;
|
|
|
|
|
private DetailsBar bar;
|
|
|
|
|
private SpriteText valueText;
|
|
|
|
|
|
|
|
|
|
private float difficultyValue;
|
|
|
|
|
public float Value
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return difficultyValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
difficultyValue = value;
|
|
|
|
|
bar.Value = value/maxValue;
|
|
|
|
|
valueText.Text = value.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float maxValue = 10;
|
|
|
|
|
public float MaxValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return maxValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
maxValue = value;
|
|
|
|
|
bar.Value = Value/value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string DifficultyName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return name.Text;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
name.Text = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SRGBColour BarColour
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return bar.BarColour;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
bar.BarColour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DifficultyRow()
|
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
name = new SpriteText
|
|
|
|
|
{
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
},
|
|
|
|
|
bar = new DetailsBar
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Size = new Vector2(1, 0.35f),
|
|
|
|
|
Padding = new MarginPadding { Left = 100, Right = 25 },
|
|
|
|
|
},
|
|
|
|
|
valueText = new SpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
TextSize = 14,
|
|
|
|
|
Font = @"Exo2.0-Medium",
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colour)
|
|
|
|
|
{
|
|
|
|
|
name.Colour = colour.GrayB;
|
|
|
|
|
bar.BackgroundColour = colour.Gray7;
|
|
|
|
|
valueText.Colour = colour.GrayB;
|
|
|
|
|
}
|
2017-03-24 22:02:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|