mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Addressed change requests
This commit is contained in:
@ -403,8 +403,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
var taikoMod = getMod() as TaikoModDifficultyAdjust;
|
var taikoMod = getMod() as TaikoModDifficultyAdjust;
|
||||||
return
|
return
|
||||||
taikoMod?.ExtendedLimits.Value == true &&
|
taikoMod?.ExtendedLimits.Value == true &&
|
||||||
taikoMod?.DrainRate.Value == setting_change &&
|
taikoMod.DrainRate.Value == setting_change &&
|
||||||
taikoMod?.OverallDifficulty.Value == setting_change;
|
taikoMod.OverallDifficulty.Value == setting_change;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("non-shared settings at default", () =>
|
AddAssert("non-shared settings at default", () =>
|
||||||
|
@ -58,7 +58,6 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using File = System.IO.File;
|
|
||||||
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
using RuntimeInfo = osu.Framework.RuntimeInfo;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
@ -393,11 +392,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
Ruleset.BindValueChanged(onRulesetChanged);
|
Ruleset.BindValueChanged(onRulesetChanged);
|
||||||
Beatmap.BindValueChanged(onBeatmapChanged);
|
Beatmap.BindValueChanged(onBeatmapChanged);
|
||||||
SelectedMods.BindValueChanged(change => Logger.Log($"{modSetting(change.OldValue)} => {modSetting(change.NewValue)}"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private object modSetting(IReadOnlyList<Mod> mods) => mods.OfType<ModDoubleTime>().FirstOrDefault()?.GetSettingsSourceProperties().First().Item2.GetValue(mods.OfType<ModDoubleTime>().First())!;
|
|
||||||
|
|
||||||
private void addFilesWarning()
|
private void addFilesWarning()
|
||||||
{
|
{
|
||||||
var realmStore = new RealmFileStore(realm, Storage);
|
var realmStore = new RealmFileStore(realm, Storage);
|
||||||
@ -629,7 +625,7 @@ namespace osu.Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//for some reason emptying SelectedMods resets all SettingSources Bindables to default value
|
//DeepCloning collection, because emptying SelectedMods resets all SettingSources Bindables to their default value
|
||||||
var previouslySelectedMods = SelectedMods.Value.Select(mod => mod.DeepClone()).ToArray();
|
var previouslySelectedMods = SelectedMods.Value.Select(mod => mod.DeepClone()).ToArray();
|
||||||
|
|
||||||
if (!SelectedMods.Disabled)
|
if (!SelectedMods.Disabled)
|
||||||
@ -643,7 +639,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Mod newMod = instance.CreateModFromAcronym(oldMod.Acronym);
|
Mod newMod = instance.CreateModFromAcronym(oldMod.Acronym);
|
||||||
|
|
||||||
newMod?.CopyFromSimilar(oldMod);
|
newMod?.CopySharedSettings(oldMod);
|
||||||
|
|
||||||
return newMod;
|
return newMod;
|
||||||
}).Where(m => m != null).ToArray();
|
}).Where(m => m != null).ToArray();
|
||||||
|
@ -141,10 +141,28 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies all shared mod setting values from <paramref name="source"/> into this instance.
|
/// Copies mod setting values from <paramref name="source"/> into this instance, overwriting all existing settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source">The mod to copy properties from.</param>
|
/// <param name="source">The mod to copy properties from.</param>
|
||||||
public void CopyFromSimilar(Mod source)
|
public void CopyFrom(Mod source)
|
||||||
|
{
|
||||||
|
if (source.GetType() != GetType())
|
||||||
|
throw new ArgumentException($"Expected mod of type {GetType()}, got {source.GetType()}.", nameof(source));
|
||||||
|
|
||||||
|
foreach (var (_, property) in this.GetSettingsSourceProperties())
|
||||||
|
{
|
||||||
|
var targetBindable = (IBindable)property.GetValue(this)!;
|
||||||
|
var sourceBindable = (IBindable)property.GetValue(source)!;
|
||||||
|
|
||||||
|
CopyAdjustedSetting(targetBindable, sourceBindable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copies all mod setting values sharing same <see cref="MemberInfo.Name"/> from <paramref name="source"/> into this instance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The mod to copy properties from.</param>
|
||||||
|
internal void CopySharedSettings(Mod source)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> oldSettings = new Dictionary<string, object>();
|
Dictionary<string, object> oldSettings = new Dictionary<string, object>();
|
||||||
|
|
||||||
@ -164,24 +182,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies mod setting values from <paramref name="source"/> into this instance, overwriting all existing settings.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The mod to copy properties from.</param>
|
|
||||||
public void CopyFrom(Mod source)
|
|
||||||
{
|
|
||||||
if (source.GetType() != GetType())
|
|
||||||
throw new ArgumentException($"Expected mod of type {GetType()}, got {source.GetType()}.", nameof(source));
|
|
||||||
|
|
||||||
foreach (var (_, property) in this.GetSettingsSourceProperties())
|
|
||||||
{
|
|
||||||
var targetBindable = (IBindable)property.GetValue(this)!;
|
|
||||||
var sourceBindable = (IBindable)property.GetValue(source)!;
|
|
||||||
|
|
||||||
CopyAdjustedSetting(targetBindable, sourceBindable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When creating copies or clones of a Mod, this method will be called
|
/// When creating copies or clones of a Mod, this method will be called
|
||||||
/// to copy explicitly adjusted user settings from <paramref name="target"/>.
|
/// to copy explicitly adjusted user settings from <paramref name="target"/>.
|
||||||
|
Reference in New Issue
Block a user