Add build-scoped requests;

Add OnClick to TooltipIconButton; Actions on pressing previous/next in builds
This commit is contained in:
HoutarouOreki
2018-07-20 12:22:31 +02:00
parent 1857c91647
commit c7669b2128
3 changed files with 33 additions and 4 deletions

View File

@ -5,13 +5,16 @@ using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using System;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class TooltipIconButton : OsuClickableContainer, IHasTooltip public class TooltipIconButton : OsuClickableContainer, IHasTooltip
{ {
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
public Action OnPressed;
public FontAwesome Icon public FontAwesome Icon
{ {
@ -37,6 +40,12 @@ namespace osu.Game.Graphics.UserInterface
}; };
} }
protected override bool OnClick(InputState state)
{
OnPressed?.Invoke();
return base.OnClick(state);
}
public string TooltipText { get; set; } public string TooltipText { get; set; }
} }
} }

View File

@ -0,0 +1,20 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
public class GetChangelogBuildRequest : APIRequest<APIChangelog>
{
private string url;
/// <param name="url">This will need to be changed to "long Id"
/// Placeholder for testing</param>
GetChangelogBuildRequest(string url)
{
this.url = url;
}
protected override string Uri => @"";
protected override string Target => url;
}
}

View File

@ -8,12 +8,13 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using System;
namespace osu.Game.Overlays.Changelog namespace osu.Game.Overlays.Changelog
{ {
public class ChangelogContentGroup : FillFlowContainer public class ChangelogContentGroup : FillFlowContainer
{ {
// will porobably depend in some way on #1692 (https://github.com/ppy/osu-framework/pull/1692) public Action NextRequested, PreviousRequested;
// need to keep in mind it looks different on Listing (one contains all builds from a date) // need to keep in mind it looks different on Listing (one contains all builds from a date)
// and when a stream is selected (looks like now) // and when a stream is selected (looks like now)
public ChangelogContentGroup(APIChangelog build) public ChangelogContentGroup(APIChangelog build)
@ -45,10 +46,8 @@ namespace osu.Game.Overlays.Changelog
{ {
Icon = FontAwesome.fa_chevron_left, Icon = FontAwesome.fa_chevron_left,
Size = new Vector2(24), Size = new Vector2(24),
// how do we link to previous/next builds?
// I'm thinking some linked list, but how do we make that
// from the available API data
TooltipText = "Previous", TooltipText = "Previous",
OnPressed = PreviousRequested,
}, },
new FillFlowContainer<SpriteText> new FillFlowContainer<SpriteText>
{ {
@ -85,6 +84,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_right, Icon = FontAwesome.fa_chevron_right,
Size = new Vector2(24), Size = new Vector2(24),
TooltipText = "Next", TooltipText = "Next",
OnPressed = NextRequested,
}, },
} }
}, },