mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Merge branch 'master' into restore-scores-after-bearmap-reinstallation
This commit is contained in:
commit
87308abec2
@ -133,6 +133,32 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("objects reverted to original position", () => addedObjects[0].Position == new Vector2(0));
|
AddAssert("objects reverted to original position", () => addedObjects[0].Position == new Vector2(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGlobalFlipHotkeys()
|
||||||
|
{
|
||||||
|
HitCircle addedObject = null;
|
||||||
|
|
||||||
|
AddStep("add hitobjects", () => EditorBeatmap.Add(addedObject = new HitCircle { StartTime = 100 }));
|
||||||
|
|
||||||
|
AddStep("select objects", () => EditorBeatmap.SelectedHitObjects.Add(addedObject));
|
||||||
|
|
||||||
|
AddStep("flip horizontally across playfield", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.H);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("objects flipped horizontally", () => addedObject.Position == new Vector2(OsuPlayfield.BASE_SIZE.X, 0));
|
||||||
|
|
||||||
|
AddStep("flip vertically across playfield", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.ControlLeft);
|
||||||
|
InputManager.Key(Key.J);
|
||||||
|
InputManager.ReleaseKey(Key.ControlLeft);
|
||||||
|
});
|
||||||
|
AddAssert("objects flipped vertically", () => addedObject.Position == OsuPlayfield.BASE_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestBasicSelect()
|
public void TestBasicSelect()
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using AutoMapper.Internal;
|
using AutoMapper.Internal;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Models;
|
using osu.Game.Models;
|
||||||
@ -52,10 +54,23 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
foreach (var beatmap in s.Beatmaps)
|
foreach (var beatmap in s.Beatmaps)
|
||||||
{
|
{
|
||||||
var existing = d.Beatmaps.FirstOrDefault(b => b.ID == beatmap.ID);
|
// Importantly, search all of realm for the beatmap (not just the set's beatmaps).
|
||||||
|
// It may have gotten detached, and if that's the case let's use this opportunity to fix
|
||||||
|
// things up.
|
||||||
|
var existingBeatmap = d.Realm.Find<BeatmapInfo>(beatmap.ID);
|
||||||
|
|
||||||
if (existing != null)
|
if (existingBeatmap != null)
|
||||||
copyChangesToRealm(beatmap, existing);
|
{
|
||||||
|
// As above, reattach if it happens to not be in the set's beatmaps.
|
||||||
|
if (!d.Beatmaps.Contains(existingBeatmap))
|
||||||
|
{
|
||||||
|
Debug.Fail("Beatmaps should never become detached under normal circumstances. If this ever triggers, it should be investigated further.");
|
||||||
|
Logger.Log("WARNING: One of the difficulties in a beatmap was detached from its set. Please save a copy of logs and report this to devs.", LoggingTarget.Database, LogLevel.Important);
|
||||||
|
d.Beatmaps.Add(existingBeatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
copyChangesToRealm(beatmap, existingBeatmap);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var newBeatmap = new BeatmapInfo
|
var newBeatmap = new BeatmapInfo
|
||||||
@ -64,6 +79,7 @@ namespace osu.Game.Database
|
|||||||
BeatmapSet = d,
|
BeatmapSet = d,
|
||||||
Ruleset = d.Realm.Find<RulesetInfo>(beatmap.Ruleset.ShortName)
|
Ruleset = d.Realm.Find<RulesetInfo>(beatmap.Ruleset.ShortName)
|
||||||
};
|
};
|
||||||
|
|
||||||
d.Beatmaps.Add(newBeatmap);
|
d.Beatmaps.Add(newBeatmap);
|
||||||
copyChangesToRealm(beatmap, newBeatmap);
|
copyChangesToRealm(beatmap, newBeatmap);
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,16 @@ Please try changing your audio device to a working setting.");
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString LinkTypeNotSupported => new TranslatableString(getKey(@"unsupported_link_type"), @"This link type is not yet supported!");
|
public static LocalisableString LinkTypeNotSupported => new TranslatableString(getKey(@"unsupported_link_type"), @"This link type is not yet supported!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "You received a private message from '{0}'. Click to read it!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString PrivateMessageReceived(string username) => new TranslatableString(getKey(@"private_message_received"), @"You received a private message from '{0}'. Click to read it!", username);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Your name was mentioned in chat by '{0}'. Click to find out why!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString YourNameWasMentioned(string username) => new TranslatableString(getKey(@"your_name_was_mentioned"), @"Your name was mentioned in chat by '{0}'. Click to find out why!", username);
|
||||||
|
|
||||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -154,7 +155,7 @@ namespace osu.Game.Online.Chat
|
|||||||
: base(message, channel)
|
: base(message, channel)
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.Envelope;
|
Icon = FontAwesome.Solid.Envelope;
|
||||||
Text = $"You received a private message from '{message.Sender.Username}'. Click to read it!";
|
Text = NotificationsStrings.PrivateMessageReceived(message.Sender.Username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ namespace osu.Game.Online.Chat
|
|||||||
: base(message, channel)
|
: base(message, channel)
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.At;
|
Icon = FontAwesome.Solid.At;
|
||||||
Text = $"Your name was mentioned in chat by '{message.Sender.Username}'. Click to find out why!";
|
Text = NotificationsStrings.YourNameWasMentioned(message.Sender.Username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,13 +160,23 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (e.Repeat)
|
if (e.Repeat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool handled;
|
||||||
|
|
||||||
switch (e.Action)
|
switch (e.Action)
|
||||||
{
|
{
|
||||||
case GlobalAction.EditorFlipHorizontally:
|
case GlobalAction.EditorFlipHorizontally:
|
||||||
return HandleFlip(Direction.Horizontal, true);
|
ChangeHandler?.BeginChange();
|
||||||
|
handled = HandleFlip(Direction.Horizontal, true);
|
||||||
|
ChangeHandler?.EndChange();
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
|
||||||
case GlobalAction.EditorFlipVertically:
|
case GlobalAction.EditorFlipVertically:
|
||||||
return HandleFlip(Direction.Vertical, true);
|
ChangeHandler?.BeginChange();
|
||||||
|
handled = HandleFlip(Direction.Vertical, true);
|
||||||
|
ChangeHandler?.EndChange();
|
||||||
|
|
||||||
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user