Hook up icons better.

This commit is contained in:
Dean Herbert
2017-01-30 13:35:40 +09:00
parent 0c2152f3d0
commit 2ed5cf7c91
10 changed files with 32 additions and 26 deletions

View File

@ -74,6 +74,8 @@ namespace osu.Game.Beatmaps.Drawables
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
RelativeSizeAxes = Axes.X,
}).ToList();
Header.AddDifficultyIcons(BeatmapPanels);
}
private void headerGainedSelection(BeatmapSetHeader panel)

View File

@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Input;
using osu.Game.Modes;
namespace osu.Game.Beatmaps.Drawables
{
@ -83,7 +84,7 @@ namespace osu.Game.Beatmaps.Drawables
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255))
new DifficultyIcon(beatmap)
{
Scale = new Vector2(1.8f),
Anchor = Anchor.CentreLeft,

View File

@ -2,6 +2,7 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -23,6 +24,7 @@ namespace osu.Game.Beatmaps.Drawables
private OsuConfigManager config;
private Bindable<bool> preferUnicode;
private WorkingBeatmap beatmap;
private FlowContainer difficultyIcons;
public BeatmapSetHeader(WorkingBeatmap beatmap)
{
@ -56,15 +58,10 @@ namespace osu.Game.Beatmaps.Drawables
TextSize = 17,
Shadow = true,
},
new FlowContainer
difficultyIcons = new FlowContainer
{
Margin = new MarginPadding { Top = 5 },
AutoSizeAxes = Axes.Both,
Children = new[]
{
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)),
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)),
}
}
}
}
@ -177,5 +174,11 @@ namespace osu.Game.Beatmaps.Drawables
});
}
}
public void AddDifficultyIcons(IEnumerable<BeatmapPanel> panels)
{
foreach (var p in panels)
difficultyIcons.Add(new DifficultyIcon(p.Beatmap));
}
}
}

View File

@ -3,7 +3,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Modes;
using OpenTK;
using OpenTK.Graphics;
@ -11,7 +13,7 @@ namespace osu.Game.Beatmaps.Drawables
{
class DifficultyIcon : Container
{
public DifficultyIcon(FontAwesome icon, Color4 color)
public DifficultyIcon(BeatmapInfo beatmap)
{
const float size = 20;
Size = new Vector2(size);
@ -21,8 +23,8 @@ namespace osu.Game.Beatmaps.Drawables
{
Anchor = Anchor.Centre,
TextSize = size,
Colour = color,
Icon = icon
Colour = new Color4(159, 198, 0, 255),
Icon = Ruleset.GetRuleset(beatmap.Mode).Icon
}
};
}