2019-05-13 16:14:52 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Overlays.Changelog.Header;
|
2018-07-18 07:35:06 +08:00
|
|
|
|
using System;
|
2019-05-12 23:46:22 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2019-05-12 23:36:05 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Changelog
|
|
|
|
|
{
|
|
|
|
|
public class ChangelogHeader : Container
|
|
|
|
|
{
|
2019-05-14 17:03:54 +08:00
|
|
|
|
private OsuSpriteText titleStream;
|
|
|
|
|
private TextBadgePairListing listing;
|
|
|
|
|
private SpriteIcon chevron;
|
|
|
|
|
private TextBadgePairRelease releaseStream;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
2018-07-24 02:36:24 +08:00
|
|
|
|
public delegate void ListingSelectedEventHandler();
|
|
|
|
|
|
|
|
|
|
public event ListingSelectedEventHandler ListingSelected;
|
2018-07-20 01:07:24 +08:00
|
|
|
|
|
2019-05-13 16:32:49 +08:00
|
|
|
|
private const float cover_height = 150;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
private const float title_height = 50;
|
|
|
|
|
private const float icon_size = 50;
|
|
|
|
|
private const float icon_margin = 20;
|
|
|
|
|
private const float version_height = 40;
|
|
|
|
|
|
2019-05-14 17:03:54 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours, TextureStore textures)
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Height = cover_height;
|
2019-05-13 16:32:49 +08:00
|
|
|
|
|
2018-07-17 05:50:22 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-13 16:32:49 +08:00
|
|
|
|
new Container
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2019-05-13 16:32:49 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = cover_height,
|
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-14 17:03:54 +08:00
|
|
|
|
new Sprite
|
2019-05-13 16:32:49 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-05-14 17:03:54 +08:00
|
|
|
|
Texture = textures.Get(@"https://osu.ppy.sh/images/headers/changelog.jpg"),
|
2019-05-13 16:32:49 +08:00
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-07-18 07:35:06 +08:00
|
|
|
|
},
|
2018-07-20 21:48:20 +08:00
|
|
|
|
new Container
|
2018-07-18 07:35:06 +08:00
|
|
|
|
{
|
|
|
|
|
Height = title_height,
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Y = -version_height,
|
2018-07-17 05:50:22 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-07-20 21:48:20 +08:00
|
|
|
|
new CircularContainer
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
X = icon_margin,
|
|
|
|
|
Masking = true,
|
2019-05-14 17:03:54 +08:00
|
|
|
|
BorderColour = colours.Violet,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
BorderThickness = 3,
|
|
|
|
|
MaskingSmoothness = 1,
|
2018-07-19 01:32:15 +08:00
|
|
|
|
Size = new Vector2(50),
|
2018-07-18 00:32:11 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-14 17:03:54 +08:00
|
|
|
|
new Sprite
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-05-14 17:03:54 +08:00
|
|
|
|
// todo: https://osu.ppy.sh/images/icons/changelog.svg
|
|
|
|
|
Texture = textures.Get(@"https://i.imgur.com/HQM3Vhp.png"),
|
2018-07-19 01:32:15 +08:00
|
|
|
|
Size = new Vector2(0.8f),
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2018-07-17 05:50:22 +08:00
|
|
|
|
},
|
2018-07-18 07:35:06 +08:00
|
|
|
|
|
|
|
|
|
// this box has 2 functions:
|
|
|
|
|
// - ensures the circle doesn't disappear on the X and Y edges
|
2018-07-20 03:49:13 +08:00
|
|
|
|
// - gets rid of the white "contamination" on the circle (due to smoothing)
|
|
|
|
|
// (https://i.imgur.com/SMuvWBZ.png)
|
2018-07-18 07:35:06 +08:00
|
|
|
|
new Box
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
AlwaysPresent = true,
|
2019-05-14 17:03:54 +08:00
|
|
|
|
Colour = colours.Violet,
|
2018-07-18 00:32:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-07-19 01:32:15 +08:00
|
|
|
|
new FillFlowContainer
|
2018-07-18 00:32:11 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2018-07-18 00:32:11 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
X = icon_size + icon_margin * 2,
|
2018-07-18 00:32:11 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-07-19 01:32:15 +08:00
|
|
|
|
new OsuSpriteText
|
2018-07-18 00:32:11 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Text = "Changelog ",
|
2019-05-12 23:46:22 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30,
|
2018-07-17 05:50:22 +08:00
|
|
|
|
},
|
2018-07-18 07:35:06 +08:00
|
|
|
|
titleStream = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Listing",
|
2019-05-12 23:46:22 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30,
|
2019-05-14 17:03:54 +08:00
|
|
|
|
Colour = colours.Violet,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-07-19 01:32:15 +08:00
|
|
|
|
new FillFlowContainer // Listing > Lazer 2018.713.1
|
2018-07-18 07:35:06 +08:00
|
|
|
|
{
|
2018-07-25 01:01:24 +08:00
|
|
|
|
X = 2 * icon_margin + icon_size,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Height = version_height,
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-14 17:03:54 +08:00
|
|
|
|
listing = new TextBadgePairListing(colours.Violet),
|
2018-07-19 01:32:15 +08:00
|
|
|
|
new Container // without a container, moving the chevron wont work
|
2018-07-18 00:32:11 +08:00
|
|
|
|
{
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Anchor = Anchor.CentreLeft,
|
2018-07-18 00:32:11 +08:00
|
|
|
|
Origin = Anchor.CentreLeft,
|
2018-07-19 01:32:15 +08:00
|
|
|
|
Margin = new MarginPadding
|
2018-07-18 07:35:06 +08:00
|
|
|
|
{
|
|
|
|
|
Top = 10,
|
2018-07-24 02:36:24 +08:00
|
|
|
|
Left = 15,
|
2018-07-18 21:17:20 +08:00
|
|
|
|
Right = 18,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Bottom = 15,
|
|
|
|
|
},
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
chevron = new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(7),
|
2019-05-14 17:03:54 +08:00
|
|
|
|
Colour = colours.Violet,
|
2019-05-12 23:36:05 +08:00
|
|
|
|
Icon = FontAwesome.Solid.ChevronRight,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Alpha = 0,
|
|
|
|
|
X = -200,
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-07-18 00:32:11 +08:00
|
|
|
|
},
|
2019-05-14 17:03:54 +08:00
|
|
|
|
releaseStream = new TextBadgePairRelease(colours.Violet, "Lazer")
|
2018-07-18 07:35:06 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2018-07-20 21:48:20 +08:00
|
|
|
|
new Box
|
2018-07-18 07:35:06 +08:00
|
|
|
|
{
|
2019-05-14 17:03:54 +08:00
|
|
|
|
Colour = colours.Violet,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2018-07-22 05:10:42 +08:00
|
|
|
|
Height = 2,
|
2018-07-18 07:35:06 +08:00
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
},
|
2018-07-17 05:50:22 +08:00
|
|
|
|
};
|
2019-05-14 17:03:54 +08:00
|
|
|
|
|
2018-07-24 02:36:24 +08:00
|
|
|
|
listing.Activated += OnListingSelected;
|
2018-07-24 05:15:14 +08:00
|
|
|
|
releaseStream.Activated += OnReleaseSelected;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-23 04:13:14 +08:00
|
|
|
|
public void ShowBuild(string displayName, string displayVersion)
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2018-07-23 00:44:45 +08:00
|
|
|
|
listing.Deactivate();
|
2018-07-23 04:13:14 +08:00
|
|
|
|
releaseStream.Activate($"{displayName} {displayVersion}");
|
|
|
|
|
titleStream.Text = displayName;
|
2018-07-23 00:44:45 +08:00
|
|
|
|
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
|
2018-07-23 04:31:24 +08:00
|
|
|
|
chevron.MoveToX(0, 100).FadeIn(100);
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-23 00:44:45 +08:00
|
|
|
|
public void ShowListing()
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2018-07-23 00:44:45 +08:00
|
|
|
|
releaseStream.Deactivate();
|
|
|
|
|
listing.Activate();
|
2018-07-24 05:15:14 +08:00
|
|
|
|
titleStream.Text = "Listing";
|
|
|
|
|
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
|
2018-07-23 04:31:24 +08:00
|
|
|
|
chevron.MoveToX(-20, 100).FadeOut(100);
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-24 02:36:24 +08:00
|
|
|
|
protected virtual void OnListingSelected(object source, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ListingSelected?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-24 05:15:14 +08:00
|
|
|
|
protected virtual void OnReleaseSelected(object source, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
|
|
|
|
|
}
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|