mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Merge branch 'master' into custom-meter
This commit is contained in:
commit
d7db6fa918
@ -46,6 +46,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
|
||||
editorBeatmap.BeatmapInfo.Metadata.Title = "title";
|
||||
});
|
||||
AddStep("Set author", () => editorBeatmap.BeatmapInfo.Metadata.Author.Username = "author");
|
||||
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName = "difficulty");
|
||||
|
||||
AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));
|
||||
@ -64,6 +65,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("Save", () => InputManager.Keys(PlatformAction.Save));
|
||||
|
||||
checkMutations();
|
||||
AddAssert("Beatmap has correct .osu file path", () => editorBeatmap.BeatmapInfo.Path == "artist - title (author) [difficulty].osu");
|
||||
|
||||
AddStep("Exit", () => InputManager.Key(Key.Escape));
|
||||
|
||||
@ -88,6 +90,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1);
|
||||
AddAssert("Beatmap has correct overall difficulty", () => editorBeatmap.Difficulty.OverallDifficulty == 7);
|
||||
AddAssert("Beatmap has correct metadata", () => editorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && editorBeatmap.BeatmapInfo.Metadata.Title == "title");
|
||||
AddAssert("Beatmap has correct author", () => editorBeatmap.BeatmapInfo.Metadata.Author.Username == "author");
|
||||
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.DifficultyName == "difficulty");
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays.Login;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
@ -15,6 +17,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
public class TestSceneLoginPanel : OsuManualInputManagerTestScene
|
||||
{
|
||||
private LoginPanel loginPanel;
|
||||
private int hideCount;
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
@ -26,6 +29,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Width = 0.5f,
|
||||
RequestHide = () => hideCount++,
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -51,5 +55,22 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
AddStep("enter password", () => loginPanel.ChildrenOfType<OsuPasswordTextBox>().First().Text = "password");
|
||||
AddStep("submit", () => loginPanel.ChildrenOfType<OsuButton>().First(b => b.Text.ToString() == "Sign in").TriggerClick());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickingOnFlagClosesPanel()
|
||||
{
|
||||
AddStep("reset hide count", () => hideCount = 0);
|
||||
|
||||
AddStep("logout", () => API.Logout());
|
||||
AddStep("enter password", () => loginPanel.ChildrenOfType<OsuPasswordTextBox>().First().Text = "password");
|
||||
AddStep("submit", () => loginPanel.ChildrenOfType<OsuButton>().First(b => b.Text.ToString() == "Sign in").TriggerClick());
|
||||
|
||||
AddStep("click on flag", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(loginPanel.ChildrenOfType<UpdateableFlag>().First());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddAssert("hide requested", () => hideCount == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Beatmaps
|
||||
private static string getFilename(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
var metadata = beatmapInfo.Metadata;
|
||||
return $"{metadata.Artist} - {metadata.Title} ({metadata.Author}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename();
|
||||
return $"{metadata.Artist} - {metadata.Title} ({metadata.Author.Username}) [{beatmapInfo.DifficultyName}].osu".GetValidArchiveContentFilename();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -21,6 +21,7 @@ using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using Realms;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -93,28 +94,27 @@ namespace osu.Game.Screens.Menu
|
||||
MenuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||
seeya = audio.Samples.Get(SeeyaSampleName);
|
||||
|
||||
ILive<BeatmapSetInfo> setInfo = null;
|
||||
|
||||
// if the user has requested not to play theme music, we should attempt to find a random beatmap from their collection.
|
||||
if (!MenuMusic.Value)
|
||||
{
|
||||
var sets = beatmaps.GetAllUsableBeatmapSets();
|
||||
|
||||
if (sets.Count > 0)
|
||||
realmContextFactory.Run(realm =>
|
||||
{
|
||||
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
|
||||
setInfo?.PerformRead(s =>
|
||||
{
|
||||
if (s.Beatmaps.Count == 0)
|
||||
return;
|
||||
var usableBeatmapSets = realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected).AsRealmCollection();
|
||||
|
||||
initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0]);
|
||||
});
|
||||
}
|
||||
int setCount = usableBeatmapSets.Count;
|
||||
|
||||
if (setCount > 0)
|
||||
{
|
||||
var found = usableBeatmapSets[RNG.Next(0, setCount - 1)].Beatmaps.FirstOrDefault();
|
||||
|
||||
if (found != null)
|
||||
initialBeatmap = beatmaps.GetWorkingBeatmap(found);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
|
||||
if (setInfo == null)
|
||||
if (initialBeatmap == null)
|
||||
{
|
||||
if (!loadThemedIntro())
|
||||
{
|
||||
@ -130,7 +130,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
bool loadThemedIntro()
|
||||
{
|
||||
setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
|
||||
var setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
|
||||
|
||||
if (setInfo == null)
|
||||
return false;
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -23,6 +24,12 @@ namespace osu.Game.Users.Drawables
|
||||
/// </summary>
|
||||
public bool ShowPlaceholderOnNull = true;
|
||||
|
||||
/// <summary>
|
||||
/// Perform an action in addition to showing the country ranking.
|
||||
/// This should be used to perform auxiliary tasks and not as a primary action for clicking a flag (to maintain a consistent UX).
|
||||
/// </summary>
|
||||
public Action Action;
|
||||
|
||||
public UpdateableFlag(Country country = null)
|
||||
{
|
||||
Country = country;
|
||||
@ -52,6 +59,7 @@ namespace osu.Game.Users.Drawables
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Action?.Invoke();
|
||||
rankingsOverlay?.ShowCountry(Country);
|
||||
return true;
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ namespace osu.Game.Users
|
||||
|
||||
protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.Country)
|
||||
{
|
||||
Size = new Vector2(39, 26)
|
||||
Size = new Vector2(39, 26),
|
||||
Action = Action,
|
||||
};
|
||||
|
||||
protected SpriteIcon CreateStatusIcon() => statusIcon = new SpriteIcon
|
||||
|
Loading…
Reference in New Issue
Block a user