mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:53:21 +08:00
Merge branch 'master' into remove-nullable-disable-in-the-mods-for-mania-ruleset
This commit is contained in:
commit
c74ffea236
@ -9,7 +9,6 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK;
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
|
@ -279,12 +279,16 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
var importer = new BeatmapImporter(storage, realm);
|
||||
using var rulesets = new RealmRulesetStore(realm, storage);
|
||||
string removedFilename = null!;
|
||||
|
||||
using var __ = getBeatmapArchive(out string pathOriginal);
|
||||
using var _ = getBeatmapArchiveWithModifications(out string pathMissingOneBeatmap, directory =>
|
||||
{
|
||||
// arbitrary beatmap removal
|
||||
directory.GetFiles("*.osu").First().Delete();
|
||||
var fileToRemove = directory.GetFiles("*.osu").First();
|
||||
|
||||
removedFilename = fileToRemove.Name;
|
||||
fileToRemove.Delete();
|
||||
});
|
||||
|
||||
var importBeforeUpdate = await importer.Import(new ImportTask(pathOriginal));
|
||||
@ -296,7 +300,9 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
importBeforeUpdate.PerformWrite(s =>
|
||||
{
|
||||
var beatmapInfo = s.Beatmaps.Last();
|
||||
// make sure not to add scores to the same beatmap that is removed in the update.
|
||||
var beatmapInfo = s.Beatmaps.First(b => b.File?.Filename != removedFilename);
|
||||
|
||||
scoreTargetBeatmapHash = beatmapInfo.Hash;
|
||||
s.Realm.Add(new ScoreInfo(beatmapInfo, s.Realm.All<RulesetInfo>().First(), new RealmUser()));
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
@ -12,9 +14,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public TestSceneExternalLinkButton()
|
||||
{
|
||||
Child = new ExternalLinkButton("https://osu.ppy.sh/home")
|
||||
Child = new OsuContextMenuContainer
|
||||
{
|
||||
Size = new Vector2(50)
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new ExternalLinkButton("https://osu.ppy.sh/home")
|
||||
{
|
||||
Size = new Vector2(50),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -12,7 +10,10 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.OSD;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -20,16 +21,19 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class ExternalLinkButton : CompositeDrawable, IHasTooltip, IHasContextMenu
|
||||
{
|
||||
public string Link { get; set; }
|
||||
public string? Link { get; set; }
|
||||
|
||||
private Color4 hoverColour;
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
private GameHost host { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private OnScreenDisplay? onScreenDisplay { get; set; }
|
||||
|
||||
private readonly SpriteIcon linkIcon;
|
||||
|
||||
public ExternalLinkButton(string link = null)
|
||||
public ExternalLinkButton(string? link = null)
|
||||
{
|
||||
Link = link;
|
||||
Size = new Vector2(12);
|
||||
@ -44,22 +48,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
};
|
||||
}
|
||||
|
||||
public MenuItem[] ContextMenuItems
|
||||
{
|
||||
get
|
||||
{
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (Link != null)
|
||||
{
|
||||
items.Add(new OsuMenuItem("Open", MenuItemType.Standard, () => host.OpenUrlExternally(Link)));
|
||||
items.Add(new OsuMenuItem("Copy URL", MenuItemType.Standard, () => host.GetClipboard()?.SetText(Link)));
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@ -86,5 +74,35 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
public LocalisableString TooltipText => "view in browser";
|
||||
|
||||
public MenuItem[] ContextMenuItems
|
||||
{
|
||||
get
|
||||
{
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (Link != null)
|
||||
{
|
||||
items.Add(new OsuMenuItem("Open", MenuItemType.Standard, () => host.OpenUrlExternally(Link)));
|
||||
items.Add(new OsuMenuItem("Copy URL", MenuItemType.Standard, copyUrl));
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private void copyUrl()
|
||||
{
|
||||
host.GetClipboard()?.SetText(Link);
|
||||
onScreenDisplay?.Display(new CopyUrlToast(ToastStrings.UrlCopied));
|
||||
}
|
||||
|
||||
private class CopyUrlToast : Toast
|
||||
{
|
||||
public CopyUrlToast(LocalisableString value)
|
||||
: base(UserInterfaceStrings.GeneralHeader, value, "")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString SkinSaved => new TranslatableString(getKey(@"skin_saved"), @"Skin saved");
|
||||
|
||||
/// <summary>
|
||||
/// "URL copied"
|
||||
/// </summary>
|
||||
public static LocalisableString UrlCopied => new TranslatableString(getKey(@"url_copied"), @"URL copied");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
/// <summary>
|
||||
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
Loading…
Reference in New Issue
Block a user