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

Fix beatmap skin properties not copying

This commit is contained in:
Bartłomiej Dach 2022-02-06 18:50:11 +01:00
parent 1292722a00
commit a144d6f8d6
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
3 changed files with 39 additions and 13 deletions

View File

@ -144,7 +144,7 @@ namespace osu.Game.Beatmaps
targetBeatmapSet.Beatmaps.Add(newBeatmapInfo); targetBeatmapSet.Beatmaps.Add(newBeatmapInfo);
newBeatmapInfo.BeatmapSet = targetBeatmapSet; newBeatmapInfo.BeatmapSet = targetBeatmapSet;
beatmapModelManager.Save(newBeatmapInfo, newBeatmap); beatmapModelManager.Save(newBeatmapInfo, newBeatmap, creationParameters.ReferenceBeatmapSkin);
workingBeatmapCache.Invalidate(targetBeatmapSet); workingBeatmapCache.Invalidate(targetBeatmapSet);
return GetWorkingBeatmap(newBeatmap.BeatmapInfo); return GetWorkingBeatmap(newBeatmap.BeatmapInfo);

View File

@ -9,6 +9,7 @@ using JetBrains.Annotations;
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -853,13 +854,14 @@ namespace osu.Game.Screens.Edit
private void switchToNewDifficulty(RulesetInfo rulesetInfo, bool clearAllObjects) private void switchToNewDifficulty(RulesetInfo rulesetInfo, bool clearAllObjects)
=> loader?.ScheduleSwitchToNewDifficulty(new NewDifficultyCreationParameters => loader?.ScheduleSwitchToNewDifficulty(new NewDifficultyCreationParameters
{ (
BeatmapSet = editorBeatmap.BeatmapInfo.BeatmapSet, editorBeatmap.BeatmapInfo.BeatmapSet.AsNonNull(),
Ruleset = rulesetInfo, rulesetInfo,
ReferenceBeatmap = playableBeatmap, playableBeatmap,
ClearAllObjects = clearAllObjects, editorBeatmap.BeatmapSkin,
EditorState = GetState() clearAllObjects,
}); GetState()
));
private EditorMenuItem createDifficultySwitchMenu() private EditorMenuItem createDifficultySwitchMenu()
{ {

View File

@ -1,8 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable enable
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Skinning;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
{ {
@ -11,26 +14,47 @@ namespace osu.Game.Screens.Edit
/// <summary> /// <summary>
/// The <see cref="BeatmapSetInfo"/> that should contain the newly-created difficulty. /// The <see cref="BeatmapSetInfo"/> that should contain the newly-created difficulty.
/// </summary> /// </summary>
public BeatmapSetInfo BeatmapSet { get; set; } public BeatmapSetInfo BeatmapSet { get; }
/// <summary> /// <summary>
/// The <see cref="RulesetInfo"/> that the new difficulty should be playable for. /// The <see cref="RulesetInfo"/> that the new difficulty should be playable for.
/// </summary> /// </summary>
public RulesetInfo Ruleset { get; set; } public RulesetInfo Ruleset { get; }
/// <summary> /// <summary>
/// A reference <see cref="IBeatmap"/> upon which the new difficulty should be based. /// A reference <see cref="IBeatmap"/> upon which the new difficulty should be based.
/// </summary> /// </summary>
public IBeatmap ReferenceBeatmap { get; set; } public IBeatmap ReferenceBeatmap { get; }
/// <summary>
/// A reference <see cref="ISkin"/> that the new difficulty should base its own skin upon.
/// </summary>
public ISkin? ReferenceBeatmapSkin { get; }
/// <summary> /// <summary>
/// Whether all objects should be cleared from the new difficulty. /// Whether all objects should be cleared from the new difficulty.
/// </summary> /// </summary>
public bool ClearAllObjects { get; set; } public bool ClearAllObjects { get; }
/// <summary> /// <summary>
/// The saved state of the previous <see cref="Editor"/> which should be restored upon opening the newly-created difficulty. /// The saved state of the previous <see cref="Editor"/> which should be restored upon opening the newly-created difficulty.
/// </summary> /// </summary>
public EditorState EditorState { get; set; } public EditorState EditorState { get; }
public NewDifficultyCreationParameters(
BeatmapSetInfo beatmapSet,
RulesetInfo ruleset,
IBeatmap referenceBeatmap,
ISkin? referenceBeatmapSkin,
bool clearAllObjects,
EditorState editorState)
{
BeatmapSet = beatmapSet;
Ruleset = ruleset;
ReferenceBeatmap = referenceBeatmap;
ReferenceBeatmapSkin = referenceBeatmapSkin;
ClearAllObjects = clearAllObjects;
EditorState = editorState;
}
} }
} }