mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Basic layout.
This commit is contained in:
parent
c2b16dae10
commit
1d3139d3c3
126
osu.Desktop.Tests/Visual/TestCaseOnlineBeatmapSetOverlay.cs
Normal file
126
osu.Desktop.Tests/Visual/TestCaseOnlineBeatmapSetOverlay.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseOnlineBeatmapSetOverlay : TestCase
|
||||
{
|
||||
public override string Description => @"view online beatmap sets";
|
||||
|
||||
private readonly OnlineBeatmapSetOverlay overlay;
|
||||
|
||||
public TestCaseOnlineBeatmapSetOverlay()
|
||||
{
|
||||
Add(overlay = new OnlineBeatmapSetOverlay());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
{
|
||||
var r = rulesets.GetRuleset(3);
|
||||
|
||||
AddStep(@"show lachryma", () =>
|
||||
{
|
||||
overlay.ShowBeatmapSet(new BeatmapSetInfo
|
||||
{
|
||||
OnlineBeatmapSetID = 415886,
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Lachryma <Re:Queen’M>",
|
||||
Artist = @"Kaneko Chiharu",
|
||||
Author = @"Fresh Chicken",
|
||||
Source = @"SOUND VOLTEX III GRAVITY WARS",
|
||||
Tags = @"sdvx grace the 5th kac original song contest konami bemani",
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Preview = @"https://b.ppy.sh/preview/415886.mp3",
|
||||
PlayCount = 681380,
|
||||
FavouriteCount = 356,
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
||||
},
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 901048,
|
||||
StarDifficulty = 1.36,
|
||||
Version = @"BASIC",
|
||||
Ruleset = r,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
DrainRate = 6.5f,
|
||||
OverallDifficulty = 6.5f,
|
||||
ApproachRate = 5,
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 901051,
|
||||
StarDifficulty = 2.22,
|
||||
Version = @"NOVICE",
|
||||
Ruleset = r,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
DrainRate = 7,
|
||||
OverallDifficulty = 7,
|
||||
ApproachRate = 5,
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 901047,
|
||||
StarDifficulty = 3.49,
|
||||
Version = @"ADVANCED",
|
||||
Ruleset = r,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
DrainRate = 7.5f,
|
||||
OverallDifficulty = 7.5f,
|
||||
ApproachRate = 5,
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 901049,
|
||||
StarDifficulty = 4.24,
|
||||
Version = @"EXHAUST",
|
||||
Ruleset = r,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
DrainRate = 8,
|
||||
OverallDifficulty = 8,
|
||||
ApproachRate = 5,
|
||||
},
|
||||
},
|
||||
new BeatmapInfo
|
||||
{
|
||||
OnlineBeatmapID = 901050,
|
||||
StarDifficulty = 901050,
|
||||
Version = @"GRAVITY",
|
||||
Ruleset = r,
|
||||
Difficulty = new BeatmapDifficulty
|
||||
{
|
||||
CircleSize = 4,
|
||||
DrainRate = 8.5f,
|
||||
OverallDifficulty = 8.5f,
|
||||
ApproachRate = 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -112,6 +112,7 @@
|
||||
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
||||
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
||||
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
||||
<Compile Include="Visual\TestCaseOnlineBeatmapSetOverlay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj">
|
||||
|
139
osu.Game/Overlays/OnlineBeatmapSet/Header.cs
Normal file
139
osu.Game/Overlays/OnlineBeatmapSet/Header.cs
Normal file
@ -0,0 +1,139 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
|
||||
namespace osu.Game.Overlays.OnlineBeatmapSet
|
||||
{
|
||||
public class Header : Container
|
||||
{
|
||||
public Header(BeatmapSetInfo set)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 400;
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 3,
|
||||
Offset = new Vector2(0f, 1f),
|
||||
};
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
new DelayedLoadWrapper(new BeatmapSetCover(set)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d =>
|
||||
{
|
||||
d.FadeInFromZero(400, Easing.Out);
|
||||
},
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TimeBeforeLoad = 300
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)),
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Width = OnlineBeatmapSetOverlay.RIGHT_WIDTH,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Right = OnlineBeatmapSetOverlay.X_PADDING },
|
||||
Spacing = new Vector2(1f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DetailBox
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 42,
|
||||
},
|
||||
},
|
||||
new DetailBox
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 35,
|
||||
},
|
||||
},
|
||||
new DetailBox
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 110,
|
||||
},
|
||||
},
|
||||
new DetailBox
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 115,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private class DetailBox : Container
|
||||
{
|
||||
private Container content;
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public DetailBox()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Horizontal = 15 },
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
155
osu.Game/Overlays/OnlineBeatmapSet/Info.cs
Normal file
155
osu.Game/Overlays/OnlineBeatmapSet/Info.cs
Normal file
@ -0,0 +1,155 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.OnlineBeatmapSet
|
||||
{
|
||||
public class Info : Container
|
||||
{
|
||||
private const float metadata_width = 225;
|
||||
private const float spacing = 20;
|
||||
|
||||
private readonly BeatmapSetInfo set;
|
||||
|
||||
private readonly Box successRateBackground;
|
||||
private readonly FillFlowContainer metadataFlow;
|
||||
private readonly ScrollContainer descriptionScroll;
|
||||
|
||||
public Info(BeatmapSetInfo set)
|
||||
{
|
||||
this.set = set;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 220;
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 3,
|
||||
Offset = new Vector2(0f, 1f),
|
||||
};
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = 15, Horizontal = OnlineBeatmapSetOverlay.X_PADDING },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = metadata_width + OnlineBeatmapSetOverlay.RIGHT_WIDTH + spacing * 2 },
|
||||
Child = descriptionScroll = new ScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
},
|
||||
},
|
||||
new ScrollContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = metadata_width,
|
||||
ScrollbarVisible = false,
|
||||
Padding = new MarginPadding { Horizontal = 10 },
|
||||
Margin = new MarginPadding { Right = OnlineBeatmapSetOverlay.RIGHT_WIDTH + spacing },
|
||||
Child = metadataFlow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = OnlineBeatmapSetOverlay.RIGHT_WIDTH,
|
||||
Children = new[]
|
||||
{
|
||||
successRateBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
successRateBackground.Colour = colours.GrayE;
|
||||
descriptionScroll.Child = new MetadataSection("Description", "", colours.Gray5);
|
||||
metadataFlow.Children = new[]
|
||||
{
|
||||
new MetadataSection("Source", set.Metadata.Source, colours.Gray5),
|
||||
new MetadataSection("Tags", set.Metadata.Tags, colours.BlueDark),
|
||||
};
|
||||
}
|
||||
|
||||
private class MetadataSection : FillFlowContainer
|
||||
{
|
||||
private readonly OsuSpriteText header;
|
||||
|
||||
public MetadataSection(string title, string body, Color4 textColour)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FillDirection.Vertical;
|
||||
Spacing = new Vector2(5f);
|
||||
|
||||
TextFlowContainer content;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
header = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
TextSize = 14,
|
||||
Text = title,
|
||||
Margin = new MarginPadding { Top = 20 },
|
||||
},
|
||||
content = new TextFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
},
|
||||
};
|
||||
|
||||
content.AddText(body, t =>
|
||||
{
|
||||
t.TextSize = 14;
|
||||
t.Colour = textColour;
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
header.Colour = colours.Gray5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
80
osu.Game/Overlays/OnlineBeatmapSetOverlay.cs
Normal file
80
osu.Game/Overlays/OnlineBeatmapSetOverlay.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.OnlineBeatmapSet;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class OnlineBeatmapSetOverlay : WaveOverlayContainer
|
||||
{
|
||||
public const float X_PADDING = 40;
|
||||
public const float RIGHT_WIDTH = 275;
|
||||
|
||||
private readonly ReverseChildIDFillFlowContainer<Drawable> scrollContent;
|
||||
|
||||
public OnlineBeatmapSetOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.TopCentre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Width = 0.85f;
|
||||
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 3,
|
||||
Offset = new Vector2(0f, 1f),
|
||||
};
|
||||
|
||||
Child = new ScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
Child = scrollContent = new ReverseChildIDFillFlowContainer<Drawable>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
FadeEdgeEffectTo(0.25f, APPEAR_DURATION, Easing.In);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
FadeEdgeEffectTo(0, DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
public void ShowBeatmapSet(BeatmapSetInfo set)
|
||||
{
|
||||
scrollContent.Children = new Drawable[]
|
||||
{
|
||||
new Header(set),
|
||||
new Info(set),
|
||||
};
|
||||
|
||||
Show();
|
||||
}
|
||||
}
|
||||
}
|
@ -538,6 +538,9 @@
|
||||
<Compile Include="Screens\Multiplayer\ParticipantInfo.cs" />
|
||||
<Compile Include="Screens\Multiplayer\ModeTypeInfo.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
||||
<Compile Include="Overlays\OnlineBeatmapSetOverlay.cs" />
|
||||
<Compile Include="Overlays\OnlineBeatmapSet\Info.cs" />
|
||||
<Compile Include="Overlays\OnlineBeatmapSet\Header.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
Loading…
Reference in New Issue
Block a user