mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Fix deprecated calls and code styling (partly)
This commit is contained in:
parent
34f54aa945
commit
31b72f168d
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
@ -20,7 +19,9 @@ namespace osu.Game.Tests.Visual
|
||||
Add(changelog = new ChangelogOverlay());
|
||||
AddStep(@"Show", changelog.Show);
|
||||
AddStep(@"Hide", changelog.Hide);
|
||||
AddWaitStep(3);
|
||||
|
||||
AddWaitStep("wait for hide", 3);
|
||||
|
||||
AddStep(@"Show with Lazer 2018.712.0", () =>
|
||||
{
|
||||
changelog.FetchAndShowBuild(new APIChangelogBuild
|
||||
@ -30,9 +31,11 @@ namespace osu.Game.Tests.Visual
|
||||
});
|
||||
changelog.Show();
|
||||
});
|
||||
AddWaitStep(3);
|
||||
|
||||
AddWaitStep("wait for show", 3);
|
||||
AddStep(@"Hide", changelog.Hide);
|
||||
AddWaitStep(3);
|
||||
AddWaitStep("wait for hide", 3);
|
||||
|
||||
AddStep(@"Show with listing", () =>
|
||||
{
|
||||
changelog.ShowListing();
|
||||
|
@ -42,7 +42,6 @@ namespace osu.Game.Tests.Visual
|
||||
AddStep(@"Hide text", () => textBadgePair.HideText(200));
|
||||
AddStep(@"Show text", () => textBadgePair.ShowText(200));
|
||||
AddStep(@"Different text", () => textBadgePair.ChangeText(200, "This one's a little bit wider"));
|
||||
AddWaitStep(1);
|
||||
AddStep(@"Different text", () => textBadgePair.ChangeText(200, "Ok?.."));
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ namespace osu.Game.Graphics
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
if (colours.TryGetValue(name, out ColourInfo colour))
|
||||
return colour;
|
||||
|
||||
return new Color4(0, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
@ -25,11 +24,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public bool IsHorizontal
|
||||
{
|
||||
get { return isHorizontal; }
|
||||
get => isHorizontal;
|
||||
set
|
||||
{
|
||||
if (value == isHorizontal)
|
||||
return;
|
||||
|
||||
if (IsLoaded)
|
||||
{
|
||||
FinishTransforms();
|
||||
@ -41,6 +41,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
else
|
||||
RelativeSizeAxes = value ? Axes.X : Axes.Y;
|
||||
|
||||
isHorizontal = value;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public bool IsEnabled
|
||||
{
|
||||
get { return isEnabled; }
|
||||
get => isEnabled;
|
||||
set
|
||||
{
|
||||
isEnabled = value;
|
||||
@ -77,6 +77,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
sampleClick?.Play();
|
||||
Action?.Invoke();
|
||||
}
|
||||
|
||||
return base.OnClick(e);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
@ -10,12 +9,19 @@ namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
private readonly string updateStream;
|
||||
|
||||
public GetChangelogChartRequest() => updateStream = null;
|
||||
public GetChangelogChartRequest()
|
||||
{
|
||||
updateStream = null;
|
||||
}
|
||||
|
||||
public GetChangelogChartRequest(string updateStreamName) => updateStream = updateStreamName;
|
||||
public GetChangelogChartRequest(string updateStreamName)
|
||||
{
|
||||
updateStream = updateStreamName;
|
||||
}
|
||||
|
||||
protected override string Target => $@"changelog/{(!string.IsNullOrEmpty(updateStream) ?
|
||||
updateStream + "/" : "")}chart-config";
|
||||
|
||||
protected override string Uri => $@"https://houtarouoreki.github.io/fake-api/{Target}"; // for testing
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using System;
|
||||
using osuTK.Graphics;
|
||||
@ -13,7 +12,6 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
public class ChangelogContent : FillFlowContainer
|
||||
{
|
||||
private APIAccess api;
|
||||
private ChangelogContentGroup changelogContentGroup;
|
||||
|
||||
public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args);
|
||||
|
@ -65,19 +65,17 @@ namespace osu.Game.Overlays.Changelog
|
||||
new SpriteText
|
||||
{
|
||||
Text = build.UpdateStream.DisplayName,
|
||||
TextSize = 28, // web: 24,
|
||||
Font = @"Exo2.0-Medium",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = " ",
|
||||
TextSize = 28,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28), // web: 24,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = build.DisplayVersion,
|
||||
TextSize = 28, // web: 24,
|
||||
Font = @"Exo2.0-Light",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24,
|
||||
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
|
||||
},
|
||||
}
|
||||
@ -100,9 +98,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
// do we need .ToUniversalTime() here?
|
||||
// also, this should be a temporary solution to weekdays in >localized< date strings
|
||||
Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""),
|
||||
TextSize = 17, // web: 14,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17), // web: 14,
|
||||
Colour = OsuColour.FromHex(@"FD5"),
|
||||
Font = @"Exo2.0-Medium",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
@ -130,9 +127,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
// do we need .ToUniversalTime() here?
|
||||
// also, this should be a temporary solution to weekdays in >localized< date strings
|
||||
Text = build.CreatedAt.Date.ToLongDateString().Replace(build.CreatedAt.ToString("dddd") + ", ", ""),
|
||||
TextSize = 28, // web: 24,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 28), // web: 24,
|
||||
Colour = OsuColour.FromHex(@"FD5"),
|
||||
Font = @"Exo2.0-Light",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 20 },
|
||||
@ -155,14 +151,12 @@ namespace osu.Game.Overlays.Changelog
|
||||
new SpriteText
|
||||
{
|
||||
Text = build.UpdateStream.DisplayName,
|
||||
TextSize = 20, // web: 18,
|
||||
Font = @"Exo2.0-Medium",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), // web: 19,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = build.DisplayVersion,
|
||||
TextSize = 20, // web: 18,
|
||||
Font = @"Exo2.0-Light",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 19,
|
||||
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
|
||||
},
|
||||
},
|
||||
@ -226,8 +220,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
ChangelogEntries.Add(new SpriteText
|
||||
{
|
||||
Text = category.Key,
|
||||
TextSize = 24, // web: 18,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24), // web: 24,
|
||||
Margin = new MarginPadding { Top = 35, Bottom = 15 },
|
||||
});
|
||||
|
||||
@ -240,40 +233,47 @@ namespace osu.Game.Overlays.Changelog
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Vertical = 5 },
|
||||
};
|
||||
|
||||
title.AddIcon(FontAwesome.Solid.Check, t =>
|
||||
{
|
||||
t.TextSize = 12;
|
||||
t.Font = OsuFont.GetFont(size: 12);
|
||||
t.Padding = new MarginPadding { Left = -17, Right = 5 };
|
||||
});
|
||||
title.AddText(entry.Title, t => { t.TextSize = 18; });
|
||||
|
||||
title.AddText(entry.Title, t => { t.Font = OsuFont.GetFont(size: 18); });
|
||||
|
||||
if (!string.IsNullOrEmpty(entry.Repository))
|
||||
{
|
||||
title.AddText(" (", t => t.TextSize = 18);
|
||||
title.AddText(" (", t => t.Font = OsuFont.GetFont(size: 18));
|
||||
title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}",
|
||||
entry.GithubUrl, Online.Chat.LinkAction.External, null,
|
||||
null, t => { t.TextSize = 18; });
|
||||
title.AddText(")", t => t.TextSize = 18);
|
||||
null, t => { t.Font = OsuFont.GetFont(size: 18); });
|
||||
title.AddText(")", t => t.Font = OsuFont.GetFont(size: 18));
|
||||
}
|
||||
|
||||
title.AddText(" by ", t => t.TextSize = 14);
|
||||
title.AddText(" by ", t => t.Font = OsuFont.GetFont(size: 14));
|
||||
|
||||
if (entry.GithubUser.GithubUrl != null)
|
||||
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl,
|
||||
Online.Chat.LinkAction.External, null, null,
|
||||
t => t.TextSize = 14);
|
||||
t => t.Font = OsuFont.GetFont(size: 14));
|
||||
else
|
||||
title.AddText(entry.GithubUser.DisplayName, t => t.TextSize = 14); //web: 12;
|
||||
title.AddText(entry.GithubUser.DisplayName, t => t.Font = OsuFont.GetFont(size: 14)); //web: 12;
|
||||
|
||||
ChangelogEntries.Add(title);
|
||||
|
||||
TextFlowContainer messageContainer = new TextFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
|
||||
messageContainer.AddText($"{entry.MessageHtml?.Replace("<p>", "").Replace("</p>", "")}\n", t =>
|
||||
{
|
||||
t.TextSize = 14; // web: 12,
|
||||
t.Font = OsuFont.GetFont(size: 14); // web: 12,
|
||||
t.Colour = new Color4(235, 184, 254, 255);
|
||||
});
|
||||
|
||||
ChangelogEntries.Add(messageContainer);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Changelog.Header;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -97,14 +98,12 @@ namespace osu.Game.Overlays.Changelog
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Changelog ",
|
||||
Font = @"Exo2.0-Light",
|
||||
TextSize = 38, // web: 30
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30,
|
||||
},
|
||||
titleStream = new OsuSpriteText
|
||||
{
|
||||
Text = "Listing",
|
||||
TextSize = 38, // web: 30
|
||||
Font = @"Exo2.0-Light",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 38), // web: 30,
|
||||
Colour = Purple,
|
||||
},
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -12,6 +11,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
Text = new SpriteText
|
||||
{
|
||||
TextSize = 21, // web: 16,
|
||||
Font = OsuFont.GetFont(size: 21), // web: 16,
|
||||
Text = displayText,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -56,6 +56,8 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
/// <param name="duration">
|
||||
/// The duration of popping in and popping out not combined.
|
||||
/// Full change takes double this time.</param>
|
||||
/// <param name="displayText"></param>
|
||||
/// <param name="easing"></param>
|
||||
public void ChangeText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
||||
{
|
||||
LineBadge.Collapse();
|
||||
|
@ -54,21 +54,18 @@ namespace osu.Game.Overlays.Changelog
|
||||
new SpriteText
|
||||
{
|
||||
Text = LatestBuild.UpdateStream.DisplayName,
|
||||
Font = @"Exo2.0-Bold",
|
||||
TextSize = 14, // web: 12,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), // web: 12,
|
||||
Margin = new MarginPadding { Top = 6 },
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = LatestBuild.DisplayVersion,
|
||||
Font = @"Exo2.0-Light",
|
||||
TextSize = 20, // web: 16,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 20), // web: 16,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = LatestBuild.Users > 0 ? $"{LatestBuild.Users:N0} users online" : null,
|
||||
TextSize = 12, // web: 10,
|
||||
Font = @"Exo2.0-Regular",
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 12), // web: 10,
|
||||
Colour = new Color4(203, 164, 218, 255),
|
||||
},
|
||||
}
|
||||
|
@ -161,8 +161,10 @@ namespace osu.Game.Overlays
|
||||
private void fetchListing()
|
||||
{
|
||||
header.ShowListing();
|
||||
|
||||
if (isAtListing)
|
||||
return;
|
||||
|
||||
isAtListing = true;
|
||||
var req = new GetChangelogRequest();
|
||||
badges.SelectNone();
|
||||
@ -173,8 +175,10 @@ namespace osu.Game.Overlays
|
||||
public void ShowListing()
|
||||
{
|
||||
header.ShowListing();
|
||||
|
||||
if (isAtListing)
|
||||
return;
|
||||
|
||||
isAtListing = true;
|
||||
content.Hide();
|
||||
listing.Show();
|
||||
@ -187,8 +191,8 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// Fetches and shows a specific build from a specific update stream.
|
||||
/// </summary>
|
||||
/// <param name="build">Must contain at least <see cref="APIChangelogBuild.UpdateStream.Name"/> and
|
||||
/// <see cref="APIChangelogBuild.Version"/>. If <see cref="APIChangelogBuild.UpdateStream.DisplayName"/> and
|
||||
/// <param name="build">Must contain at least <see cref="UpdateStream.Name"/> and
|
||||
/// <see cref="APIChangelogBuild.Version"/>. If <see cref="UpdateStream.DisplayName"/> and
|
||||
/// <see cref="APIChangelogBuild.DisplayVersion"/> are specified, the header will instantly display them.</param>
|
||||
/// <param name="updateBadges">Whether to update badges. Should be set to false in case
|
||||
/// the function is called by selecting a badge, to avoid an infinite loop.</param>
|
||||
|
Loading…
Reference in New Issue
Block a user