1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 11:43:01 +08:00

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.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics.Containers;
using System;
namespace osu.Game.Graphics.UserInterface
{
public class TooltipIconButton : OsuClickableContainer, IHasTooltip
{
private readonly SpriteIcon icon;
public Action OnPressed;
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; }
}
}

View File

@ -7,14 +7,14 @@ namespace osu.Game.Online.API.Requests
{
public class GetChangelogBuildRequest : APIRequest<APIChangelog>
{
private readonly string name;
private readonly string version;
//private readonly string name;
//private readonly string version;
public GetChangelogBuildRequest(string streamName, string buildVersion)
{
name = streamName;
version = buildVersion;
}
//public GetChangelogBuildRequest(string streamName, string buildVersion)
//{
// name = streamName;
// version = buildVersion;
//}
//protected override string Target => $@"changelog/{name}/{version}";
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
{
/// <summary>
/// Obviously a placeholder
/// </summary>
public class GetChangelogLatestBuildsRequest : APIRequest<List<APIChangelog>>
{
protected override string Uri => Target;
protected override string Target => @"https://api.myjson.com/bins/16waui";
//protected override string Target => @"changelog";
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[]>
{
protected override string Uri => Target;
protected override string Target => "https://api.myjson.com/bins/6zv2i";
//protected override string Target => @"changelog";
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)
{
changelogContentGroup.PreviousRequested = ShowPrevious;
changelogContentGroup.NextRequested = ShowNext;
if (changelogContentGroup != null)
{
changelogContentGroup.PreviousRequested = showPrevious;
changelogContentGroup.NextRequested = showNext;
}
base.Add(changelogContentGroup);
}
@ -38,26 +41,29 @@ namespace osu.Game.Overlays.Changelog
{
Clear();
Add(new ChangelogContentGroup(changelog));
FetchChangelogBuild(changelog);
//fetchChangelogBuild(changelog);
fetchChangelogBuild();
}
private void ShowNext()
private void showNext()
{
if (currentBuild.Versions.Next != null)
{
Clear();
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)
{
Clear();
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;
}
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;
api.Queue(req);
}

View File

@ -15,8 +15,6 @@ namespace osu.Game.Overlays.Changelog
public class ChangelogContentGroup : FillFlowContainer
{
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)
{
RelativeSizeAxes = Axes.X;
@ -47,7 +45,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_left,
Size = new Vector2(24),
TooltipText = "Previous",
OnPressed = () => PreviousRequested(),
Action = () => PreviousRequested(),
},
new FillFlowContainer<SpriteText>
{
@ -65,7 +63,7 @@ namespace osu.Game.Overlays.Changelog
TextSize = 28, // web: 24,
Font = @"Exo2.0-Medium",
},
new SpriteText // a space...
new SpriteText
{
Text = " ",
TextSize = 28,
@ -84,7 +82,7 @@ namespace osu.Game.Overlays.Changelog
Icon = FontAwesome.fa_chevron_right,
Size = new Vector2(24),
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,
FillMode = FillMode.Fill,
},
new Container // this is the line badge-Changelog-Stream
new Container
{
Height = title_height,
Anchor = Anchor.BottomLeft,
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Changelog
Y = -version_height,
Children = new Drawable[]
{
new CircularContainer // a purple circle
new CircularContainer
{
X = icon_margin,
Masking = true,
@ -131,8 +131,6 @@ namespace osu.Game.Overlays.Changelog
{
Top = 10,
Left = 7,
// + chevron size, and account for gained space on left by
// listing's font draw width being smaller
Right = 18,
Bottom = 15,
},
@ -153,7 +151,7 @@ namespace osu.Game.Overlays.Changelog
releaseStream = new TextBadgePairRelease(Purple, "Lazer")
},
},
new Box // purple line
new Box
{
Colour = Purple,
RelativeSizeAxes = Axes.X,

View File

@ -26,8 +26,6 @@ namespace osu.Game.Overlays.Changelog
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;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
@ -70,7 +68,6 @@ namespace osu.Game.Overlays.Changelog
protected override bool OnHover(InputState state)
{
// is this nullreference-safe for badgesContainer?
foreach (StreamBadge streamBadge in BadgesContainer.Children)
{
if (SelectedRelease != null)

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays
Width = 0.85f;
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
{
@ -73,13 +73,12 @@ namespace osu.Game.Overlays
header = new ChangelogHeader(),
Streams = new ChangelogStreams(),
new ChangelogChart(),
// will need to default to day-sorted content
content = new ChangelogContent(),
},
},
},
};
OnLoadComplete += d => FetchChangelog(); // is i
OnLoadComplete += d => FetchChangelog();
Streams.OnSelection = () =>
{
if (Streams.SelectedRelease != null)