mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Mapper -> Author, use BeatmapSetInfo for metadata
This commit is contained in:
@ -8,6 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
@ -19,20 +20,20 @@ namespace osu.Game.Overlays.Direct
|
|||||||
private readonly float vertical_padding = 5;
|
private readonly float vertical_padding = 5;
|
||||||
|
|
||||||
private readonly Sprite background;
|
private readonly Sprite background;
|
||||||
private readonly OsuSpriteText title, artist, mapperPrefix, mapper, source;
|
private readonly OsuSpriteText title, artist, authorPrefix, author, source;
|
||||||
private readonly Statistic playCount, favouriteCount;
|
private readonly Statistic playCount, favouriteCount;
|
||||||
private readonly FillFlowContainer difficultyIcons;
|
private readonly FillFlowContainer difficultyIcons;
|
||||||
|
|
||||||
protected override Sprite Background => background;
|
protected override Sprite Background => background;
|
||||||
protected override OsuSpriteText Title => title;
|
protected override OsuSpriteText Title => title;
|
||||||
protected override OsuSpriteText Artist => artist;
|
protected override OsuSpriteText Artist => artist;
|
||||||
protected override OsuSpriteText Mapper => mapper;
|
protected override OsuSpriteText Author => author;
|
||||||
protected override OsuSpriteText Source => source;
|
protected override OsuSpriteText Source => source;
|
||||||
protected override Statistic PlayCount => playCount;
|
protected override Statistic PlayCount => playCount;
|
||||||
protected override Statistic FavouriteCount => favouriteCount;
|
protected override Statistic FavouriteCount => favouriteCount;
|
||||||
protected override FillFlowContainer DifficultyIcons => difficultyIcons;
|
protected override FillFlowContainer DifficultyIcons => difficultyIcons;
|
||||||
|
|
||||||
public DirectGridPanel()
|
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||||
{
|
{
|
||||||
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
||||||
CornerRadius = 4;
|
CornerRadius = 4;
|
||||||
@ -113,13 +114,13 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
mapperPrefix = new OsuSpriteText
|
authorPrefix = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"mapped by ",
|
Text = @"mapped by ",
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Shadow = false,
|
Shadow = false,
|
||||||
},
|
},
|
||||||
mapper = new OsuSpriteText
|
author = new OsuSpriteText
|
||||||
{
|
{
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
@ -165,8 +166,8 @@ namespace osu.Game.Overlays.Direct
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
mapperPrefix.Colour = colours.Gray5;
|
authorPrefix.Colour = colours.Gray5;
|
||||||
Mapper.Colour = colours.BlueDark;
|
Author.Colour = colours.BlueDark;
|
||||||
Source.Colour = colours.Gray5;
|
Source.Colour = colours.Gray5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,30 +11,31 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Direct
|
namespace osu.Game.Overlays.Direct
|
||||||
{
|
{
|
||||||
public class DirectListPanel : DirectPanel
|
public class DirectListPanel : DirectPanel
|
||||||
{
|
{
|
||||||
private readonly float horizontal_padding = 10;
|
private readonly float horizontal_padding = 10;
|
||||||
private readonly float vertical_padding = 5;
|
private readonly float vertical_padding = 5;
|
||||||
private readonly float height = 70;
|
private readonly float height = 70;
|
||||||
|
|
||||||
private readonly Sprite background;
|
private readonly Sprite background;
|
||||||
private readonly OsuSpriteText title, artist, mapper, source;
|
private readonly OsuSpriteText title, artist, author, source;
|
||||||
private readonly Statistic playCount, favouriteCount;
|
private readonly Statistic playCount, favouriteCount;
|
||||||
private readonly FillFlowContainer difficultyIcons;
|
private readonly FillFlowContainer difficultyIcons;
|
||||||
|
|
||||||
protected override Sprite Background => background;
|
protected override Sprite Background => background;
|
||||||
protected override OsuSpriteText Title => title;
|
protected override OsuSpriteText Title => title;
|
||||||
protected override OsuSpriteText Artist => artist;
|
protected override OsuSpriteText Artist => artist;
|
||||||
protected override OsuSpriteText Mapper => mapper;
|
protected override OsuSpriteText Author => author;
|
||||||
protected override OsuSpriteText Source => source;
|
protected override OsuSpriteText Source => source;
|
||||||
protected override Statistic PlayCount => playCount;
|
protected override Statistic PlayCount => playCount;
|
||||||
protected override Statistic FavouriteCount => favouriteCount;
|
protected override Statistic FavouriteCount => favouriteCount;
|
||||||
protected override FillFlowContainer DifficultyIcons => difficultyIcons;
|
protected override FillFlowContainer DifficultyIcons => difficultyIcons;
|
||||||
|
|
||||||
public DirectListPanel()
|
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = height;
|
||||||
@ -101,11 +102,11 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Margin = new MarginPadding { Right = (height - vertical_padding * 2) + vertical_padding },
|
Margin = new MarginPadding { Right = (height - vertical_padding * 2) + vertical_padding },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
playCount = new Statistic(FontAwesome.fa_play_circle, 4579492)
|
playCount = new Statistic(FontAwesome.fa_play_circle)
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Right = 1 },
|
Margin = new MarginPadding { Right = 1 },
|
||||||
},
|
},
|
||||||
favouriteCount = new Statistic(FontAwesome.fa_heart, 2659),
|
favouriteCount = new Statistic(FontAwesome.fa_heart),
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -119,7 +120,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Text = @"mapped by ",
|
Text = @"mapped by ",
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
},
|
},
|
||||||
mapper = new OsuSpriteText
|
author = new OsuSpriteText
|
||||||
{
|
{
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-SemiBoldItalic",
|
Font = @"Exo2.0-SemiBoldItalic",
|
||||||
|
@ -6,7 +6,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -19,28 +19,29 @@ namespace osu.Game.Overlays.Direct
|
|||||||
protected virtual Sprite Background { get; }
|
protected virtual Sprite Background { get; }
|
||||||
protected virtual OsuSpriteText Title { get; }
|
protected virtual OsuSpriteText Title { get; }
|
||||||
protected virtual OsuSpriteText Artist { get; }
|
protected virtual OsuSpriteText Artist { get; }
|
||||||
protected virtual OsuSpriteText Mapper { get; }
|
protected virtual OsuSpriteText Author { get; }
|
||||||
protected virtual OsuSpriteText Source { get; }
|
protected virtual OsuSpriteText Source { get; }
|
||||||
protected virtual Statistic PlayCount { get; }
|
protected virtual Statistic PlayCount { get; }
|
||||||
protected virtual Statistic FavouriteCount { get; }
|
protected virtual Statistic FavouriteCount { get; }
|
||||||
protected virtual FillFlowContainer DifficultyIcons { get; }
|
protected virtual FillFlowContainer DifficultyIcons { get; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private BeatmapSetInfo setInfo;
|
||||||
private void load(TextureStore textures, RulesetDatabase rulesets)
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(LocalisationEngine localisation)
|
||||||
|
{
|
||||||
|
Title.Current = localisation.GetUnicodePreference(setInfo.Metadata.TitleUnicode, setInfo.Metadata.Title);
|
||||||
|
Artist.Current = localisation.GetUnicodePreference(setInfo.Metadata.ArtistUnicode, setInfo.Metadata.Artist);
|
||||||
|
Author.Text = setInfo.Metadata.Author;
|
||||||
|
Source.Text = @"from " + setInfo.Metadata.Source;
|
||||||
|
|
||||||
|
foreach (var b in setInfo.Beatmaps)
|
||||||
|
DifficultyIcons.Add(new DifficultyIcon(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DirectPanel(BeatmapSetInfo setInfo)
|
||||||
{
|
{
|
||||||
Background.Texture = textures.Get(@"Backgrounds/bg4");
|
this.setInfo = setInfo;
|
||||||
|
|
||||||
Title.Text = @"Platina";
|
|
||||||
Artist.Text = @"Maaya Sakamoto";
|
|
||||||
Mapper.Text = @"TicClick";
|
|
||||||
Source.Text = @"from Cardcaptor Sakura";
|
|
||||||
PlayCount.Value = 4579492;
|
|
||||||
FavouriteCount.Value = 2659;
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
DifficultyIcons.Add(new DifficultyIcon(new BeatmapInfo { Ruleset = rulesets.GetRuleset(i), StarDifficulty = i + 1 }));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Statistic : FillFlowContainer
|
public class Statistic : FillFlowContainer
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
@ -67,21 +69,49 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new DirectGridPanel
|
};
|
||||||
{
|
|
||||||
|
filter.Search.Exit = Hide;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(RulesetDatabase rulesets)
|
||||||
|
{
|
||||||
|
var setInfo = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Title = @"Platina",
|
||||||
|
Artist = @"Maaya Sakamoto",
|
||||||
|
Author = @"TicClick",
|
||||||
|
Source = @"Cardcaptor Sakura",
|
||||||
|
},
|
||||||
|
Beatmaps = new List<BeatmapInfo>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i< 4; i++)
|
||||||
|
{
|
||||||
|
setInfo.Beatmaps.Add(new BeatmapInfo {
|
||||||
|
Ruleset = rulesets.GetRuleset(i),
|
||||||
|
StarDifficulty = i + 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Add(new Drawable[]
|
||||||
|
{
|
||||||
|
new DirectGridPanel(setInfo)
|
||||||
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Width = 300,
|
Width = 300,
|
||||||
},
|
},
|
||||||
new DirectListPanel
|
new DirectListPanel(setInfo)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Width = 0.8f,
|
Width = 0.8f,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
filter.Search.Exit = Hide;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
Reference in New Issue
Block a user