Update comments; Improve neighboring builds handling;

Apply fixes to things pointed out by AppVeyor
This commit is contained in:
HoutarouOreki 2018-07-20 15:48:20 +02:00
parent 227394925a
commit 02a8fb2154
9 changed files with 37 additions and 49 deletions

View File

@ -5,16 +5,13 @@ 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
{ {
@ -40,12 +37,6 @@ 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

@ -7,14 +7,14 @@ namespace osu.Game.Online.API.Requests
{ {
public class GetChangelogBuildRequest : APIRequest<APIChangelog> public class GetChangelogBuildRequest : APIRequest<APIChangelog>
{ {
private readonly string name; //private readonly string name;
private readonly string version; //private readonly string version;
public GetChangelogBuildRequest(string streamName, string buildVersion) //public GetChangelogBuildRequest(string streamName, string buildVersion)
{ //{
name = streamName; // name = streamName;
version = buildVersion; // version = buildVersion;
} //}
//protected override string Target => $@"changelog/{name}/{version}"; //protected override string Target => $@"changelog/{name}/{version}";
protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing protected override string Uri => @"https://api.myjson.com/bins/ya5q2"; // for testing

View File

@ -6,12 +6,9 @@ using System.Collections.Generic;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
/// <summary>
/// Obviously a placeholder
/// </summary>
public class GetChangelogLatestBuildsRequest : APIRequest<List<APIChangelog>> public class GetChangelogLatestBuildsRequest : APIRequest<List<APIChangelog>>
{ {
protected override string Uri => Target; //protected override string Target => @"changelog";
protected override string Target => @"https://api.myjson.com/bins/16waui"; protected override string Uri => @"https://api.myjson.com/bins/16waui"; // for testing
} }
} }

View File

@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests
{ {
public class GetChangelogRequest : APIRequest<APIChangelog[]> public class GetChangelogRequest : APIRequest<APIChangelog[]>
{ {
protected override string Uri => Target; //protected override string Target => @"changelog";
protected override string Target => "https://api.myjson.com/bins/6zv2i"; protected override string Uri => @"https://api.myjson.com/bins/6zv2i"; // for testing
} }
} }

View File

@ -29,8 +29,11 @@ namespace osu.Game.Overlays.Changelog
public override void Add(ChangelogContentGroup changelogContentGroup) public override void Add(ChangelogContentGroup changelogContentGroup)
{ {
changelogContentGroup.PreviousRequested = ShowPrevious; if (changelogContentGroup != null)
changelogContentGroup.NextRequested = ShowNext; {
changelogContentGroup.PreviousRequested = showPrevious;
changelogContentGroup.NextRequested = showNext;
}
base.Add(changelogContentGroup); base.Add(changelogContentGroup);
} }
@ -38,26 +41,29 @@ namespace osu.Game.Overlays.Changelog
{ {
Clear(); Clear();
Add(new ChangelogContentGroup(changelog)); Add(new ChangelogContentGroup(changelog));
FetchChangelogBuild(changelog); //fetchChangelogBuild(changelog);
fetchChangelogBuild();
} }
private void ShowNext() private void showNext()
{ {
if (currentBuild.Versions.Next != null) if (currentBuild.Versions.Next != null)
{ {
Clear(); Clear();
Add(new ChangelogContentGroup(currentBuild.Versions.Next)); Add(new ChangelogContentGroup(currentBuild.Versions.Next));
FetchChangelogBuild(currentBuild.Versions.Next); //fetchChangelogBuild(currentBuild.Versions.Next);
fetchChangelogBuild();
} }
} }
private void ShowPrevious() private void showPrevious()
{ {
if (currentBuild.Versions.Previous != null) if (currentBuild.Versions.Previous != null)
{ {
Clear(); Clear();
Add(new ChangelogContentGroup(currentBuild.Versions.Previous)); Add(new ChangelogContentGroup(currentBuild.Versions.Previous));
FetchChangelogBuild(currentBuild.Versions.Previous); //fetchChangelogBuild(currentBuild.Versions.Previous);
fetchChangelogBuild();
} }
} }
@ -67,9 +73,11 @@ namespace osu.Game.Overlays.Changelog
this.api = api; this.api = api;
} }
private void FetchChangelogBuild(APIChangelog build) //private void fetchChangelogBuild(APIChangelog build)
private void fetchChangelogBuild()
{ {
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); //var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
var req = new GetChangelogBuildRequest();
req.Success += res => currentBuild = res; req.Success += res => currentBuild = res;
api.Queue(req); api.Queue(req);
} }

View File

@ -15,8 +15,6 @@ namespace osu.Game.Overlays.Changelog
public class ChangelogContentGroup : FillFlowContainer public class ChangelogContentGroup : FillFlowContainer
{ {
public Action NextRequested, PreviousRequested; public Action NextRequested, PreviousRequested;
// 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)
public ChangelogContentGroup(APIChangelog build) public ChangelogContentGroup(APIChangelog build)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -47,7 +45,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_left, Icon = FontAwesome.fa_chevron_left,
Size = new Vector2(24), Size = new Vector2(24),
TooltipText = "Previous", TooltipText = "Previous",
OnPressed = () => PreviousRequested(), Action = () => PreviousRequested(),
}, },
new FillFlowContainer<SpriteText> new FillFlowContainer<SpriteText>
{ {
@ -65,7 +63,7 @@ namespace osu.Game.Overlays.Changelog
TextSize = 28, // web: 24, TextSize = 28, // web: 24,
Font = @"Exo2.0-Medium", Font = @"Exo2.0-Medium",
}, },
new SpriteText // a space... new SpriteText
{ {
Text = " ", Text = " ",
TextSize = 28, TextSize = 28,
@ -84,7 +82,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(), Action = () => NextRequested(),
}, },
} }
}, },
@ -105,6 +103,6 @@ namespace osu.Game.Overlays.Changelog
}, },
}; };
} }
//public ChangelogContentGroup(DateTimeOffset date) { } //public ChangelogContentGroup() { } // for listing
} }
} }

View File

@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Changelog
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
}, },
new Container // this is the line badge-Changelog-Stream new Container
{ {
Height = title_height, Height = title_height,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Changelog
Y = -version_height, Y = -version_height,
Children = new Drawable[] Children = new Drawable[]
{ {
new CircularContainer // a purple circle new CircularContainer
{ {
X = icon_margin, X = icon_margin,
Masking = true, Masking = true,
@ -131,8 +131,6 @@ namespace osu.Game.Overlays.Changelog
{ {
Top = 10, Top = 10,
Left = 7, Left = 7,
// + chevron size, and account for gained space on left by
// listing's font draw width being smaller
Right = 18, Right = 18,
Bottom = 15, Bottom = 15,
}, },
@ -153,7 +151,7 @@ namespace osu.Game.Overlays.Changelog
releaseStream = new TextBadgePairRelease(Purple, "Lazer") releaseStream = new TextBadgePairRelease(Purple, "Lazer")
}, },
}, },
new Box // purple line new Box
{ {
Colour = Purple, Colour = Purple,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -26,8 +26,6 @@ namespace osu.Game.Overlays.Changelog
public ChangelogStreams() public ChangelogStreams()
{ {
// this should actually be resizeable (https://streamable.com/yw2ug)
// if not, with small width:height ratio it cuts off right-most content
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]
@ -70,7 +68,6 @@ namespace osu.Game.Overlays.Changelog
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
// is this nullreference-safe for badgesContainer?
foreach (StreamBadge streamBadge in BadgesContainer.Children) foreach (StreamBadge streamBadge in BadgesContainer.Children)
{ {
if (SelectedRelease != null) if (SelectedRelease != null)

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays
Width = 0.85f; Width = 0.85f;
Masking = true; Masking = true;
ChangelogContent content; // told by appveyor to conver to local variable.. ChangelogContent content; // told by appveyor to convert to local variable..
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
@ -73,13 +73,12 @@ namespace osu.Game.Overlays
header = new ChangelogHeader(), header = new ChangelogHeader(),
Streams = new ChangelogStreams(), Streams = new ChangelogStreams(),
new ChangelogChart(), new ChangelogChart(),
// will need to default to day-sorted content
content = new ChangelogContent(), content = new ChangelogContent(),
}, },
}, },
}, },
}; };
OnLoadComplete += d => FetchChangelog(); // is i OnLoadComplete += d => FetchChangelog();
Streams.OnSelection = () => Streams.OnSelection = () =>
{ {
if (Streams.SelectedRelease != null) if (Streams.SelectedRelease != null)