mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
More closely match osu-web styling
This commit is contained in:
@ -14,34 +14,45 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||||
{
|
{
|
||||||
public class DrawableMostPlayedBeatmap : OsuHoverContainer
|
public class DrawableMostPlayedBeatmap : OsuHoverContainer
|
||||||
{
|
{
|
||||||
private readonly Box background;
|
|
||||||
private const int cover_width = 100;
|
private const int cover_width = 100;
|
||||||
private const int corner_radius = 10;
|
private const int corner_radius = 10;
|
||||||
private readonly SpriteIcon icon;
|
|
||||||
private readonly OsuSpriteText playCountText;
|
private readonly BeatmapInfo beatmap;
|
||||||
private readonly LinkFlowContainer mapper;
|
private readonly int playCount;
|
||||||
|
|
||||||
|
private Box background;
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
||||||
|
|
||||||
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
this.playCount = playCount;
|
||||||
Enabled.Value = true; //manually enabled, because we have no action
|
Enabled.Value = true; //manually enabled, because we have no action
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 60;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = corner_radius;
|
CornerRadius = corner_radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
IdleColour = colours.GreySeafoam;
|
||||||
|
HoverColour = colours.GreySeafoamLight;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new UpdateableBeatmapSetCover
|
new UpdateableBeatmapSetCover
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = cover_width,
|
Width = cover_width,
|
||||||
BeatmapSet = beatmap.BeatmapSet,
|
BeatmapSet = beatmap.BeatmapSet,
|
||||||
@ -49,69 +60,53 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Left = cover_width - corner_radius },
|
Padding = new MarginPadding { Left = cover_width - corner_radius },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box { RelativeSizeAxes = Axes.Both },
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
Padding = new MarginPadding { Left = 15, Right = 20 },
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new MostPlayedBeatmapMetadataContainer(beatmap)
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Margin = new MarginPadding { Bottom = 2 },
|
AutoSizeAxes = Axes.Both,
|
||||||
},
|
Direction = FillDirection.Vertical,
|
||||||
mapper = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Regular))
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new MostPlayedBeatmapMetadataContainer(beatmap),
|
||||||
|
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.TopLeft,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Margin = new MarginPadding { Top = 2 },
|
Colour = colours.GreySeafoamLighter
|
||||||
}.With(d =>
|
}.With(d =>
|
||||||
{
|
{
|
||||||
d.AddText("mapped by ");
|
d.AddText("mapped by ");
|
||||||
d.AddUserLink(beatmap.Metadata.Author);
|
d.AddUserLink(beatmap.Metadata.Author);
|
||||||
}),
|
}),
|
||||||
new FillFlowContainer
|
}
|
||||||
|
},
|
||||||
|
new PlayCountText(playCount)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
icon = new SpriteIcon
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.CaretRight,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Size = new Vector2(20),
|
|
||||||
},
|
},
|
||||||
playCountText = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Text = playCount.ToString(),
|
|
||||||
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Regular, fixedWidth: true),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -121,15 +116,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colors)
|
|
||||||
{
|
|
||||||
IdleColour = colors.GreySeafoam;
|
|
||||||
HoverColour = colors.GreySeafoamLight;
|
|
||||||
mapper.Colour = colors.GreySeafoamLighter;
|
|
||||||
icon.Colour = playCountText.Colour = colors.Yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
{
|
{
|
||||||
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||||
@ -144,14 +130,55 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
Text = new LocalisedString((
|
Text = new LocalisedString((
|
||||||
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
||||||
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold)
|
Font = OsuFont.GetFont(weight: FontWeight.Bold)
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
||||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular)
|
Font = OsuFont.GetFont(weight: FontWeight.Regular)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class PlayCountText : CompositeDrawable, IHasTooltip
|
||||||
|
{
|
||||||
|
public string TooltipText => "times played";
|
||||||
|
|
||||||
|
public PlayCountText(int playCount)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Spacing = new Vector2(5, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SpriteIcon
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Size = new Vector2(12),
|
||||||
|
Icon = FontAwesome.Solid.Play,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Text = playCount.ToString(),
|
||||||
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = colours.Yellow;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user