Config: Most synced options have something in common
This commit is contained in:
parent
3e751c0d8d
commit
b8824dbbfb
|
@ -1183,12 +1183,7 @@ namespace MuzikaGromche
|
|||
50,
|
||||
new ConfigDescription(description, chanceRange, track));
|
||||
|
||||
var slider = new IntSliderConfigItem(track.Weight.Entry, new IntSliderOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyWeightsNow,
|
||||
});
|
||||
LethalConfigManager.AddConfigItem(slider);
|
||||
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight.Entry, Default(new IntSliderOptions())));
|
||||
CSyncHackAddSyncedEntry(track.Weight);
|
||||
}
|
||||
|
||||
|
@ -1241,11 +1236,7 @@ namespace MuzikaGromche
|
|||
{
|
||||
var syncedEntry = configFile.BindSyncedEntry("General", "Skip Winding Phase", false,
|
||||
new ConfigDescription("Skip most of the wind-up/intro/start music.\n\nUse this option to test your Loop audio segment."));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(syncedEntry.Entry, new BoolCheckBoxOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
}));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(syncedEntry.Entry, Default(new BoolCheckBoxOptions())));
|
||||
CSyncHackAddSyncedEntry(syncedEntry);
|
||||
syncedEntry.Changed += (sender, args) => apply();
|
||||
syncedEntry.SyncHostToLocal();
|
||||
|
@ -1273,11 +1264,7 @@ namespace MuzikaGromche
|
|||
customPaletteSizeSyncedEntry = configFile.BindSyncedEntry(section, "Palette Size", 0, new ConfigDescription(
|
||||
"Number of colors in the custom palette.\n\nIf set to non-zero, custom palette overrides track's own built-in palette.",
|
||||
new AcceptableValueRange<int>(0, maxCustomPaletteSize)));
|
||||
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeSyncedEntry.Entry, new IntSliderOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
}));
|
||||
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeSyncedEntry.Entry, Default(new IntSliderOptions())));
|
||||
CSyncHackAddSyncedEntry(customPaletteSizeSyncedEntry);
|
||||
customPaletteSizeSyncedEntry.Changed += (sender, args) => apply();
|
||||
customPaletteSizeSyncedEntry.SyncHostToLocal();
|
||||
|
@ -1287,11 +1274,7 @@ namespace MuzikaGromche
|
|||
string entryName = $"Custom Color {i + 1}";
|
||||
var customColorSyncedEntry = configFile.BindSyncedEntry(section, entryName, "#FFFFFF", "Choose color for the custom palette");
|
||||
customPaletteSyncedEntries[i] = customColorSyncedEntry;
|
||||
LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorSyncedEntry.Entry, new HexColorInputFieldOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
}));
|
||||
LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorSyncedEntry.Entry, Default(new HexColorInputFieldOptions())));
|
||||
CSyncHackAddSyncedEntry(customColorSyncedEntry);
|
||||
customColorSyncedEntry.Changed += (sender, args) => apply();
|
||||
customColorSyncedEntry.SyncHostToLocal();
|
||||
|
@ -1348,11 +1331,7 @@ namespace MuzikaGromche
|
|||
|
||||
overrideTimingsSyncedEntry = configFile.BindSyncedEntry(section, "Override Timings", false,
|
||||
new ConfigDescription("If checked, custom timings override track's own built-in timings."));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsSyncedEntry.Entry, new BoolCheckBoxOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
}));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsSyncedEntry.Entry, Default(new BoolCheckBoxOptions())));
|
||||
CSyncHackAddSyncedEntry(overrideTimingsSyncedEntry);
|
||||
overrideTimingsSyncedEntry.Changed += (sender, args) => apply();
|
||||
overrideTimingsSyncedEntry.SyncHostToLocal();
|
||||
|
@ -1366,24 +1345,16 @@ namespace MuzikaGromche
|
|||
colorTransitionEasingSyncedEntry = configFile.BindSyncedEntry(section, "Color Transition Easing", Easing.Linear.Name,
|
||||
new ConfigDescription("Interpolation/easing method to use for color transitions", new AcceptableValueList<string>(Easing.AllNames)));
|
||||
|
||||
var floatSliderOptions = new FloatSliderOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
};
|
||||
var floatSliderOptions = Default(new FloatSliderOptions());
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(beatsOffsetSyncedEntry.Entry, floatSliderOptions));
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionInSyncedEntry.Entry, floatSliderOptions));
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionOutSyncedEntry.Entry, floatSliderOptions));
|
||||
LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingSyncedEntry.Entry, new TextDropDownOptions
|
||||
{
|
||||
RequiresRestart = false,
|
||||
CanModifyCallback = CanModifyIfHost,
|
||||
}));
|
||||
LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingSyncedEntry.Entry, Default(new TextDropDownOptions())));
|
||||
|
||||
registerStruct(beatsOffsetSyncedEntry, t => t._BeatsOffset, x => BeatsOffsetOverride = x);
|
||||
registerStruct(colorTransitionInSyncedEntry, t => t._ColorTransitionIn, x => ColorTransitionInOverride = x);
|
||||
registerStruct(colorTransitionOutSyncedEntry, t => t._ColorTransitionOut, x => ColorTransitionOutOverride = x);
|
||||
registerClass(colorTransitionEasingSyncedEntry, t => t._ColorTransitionEasing.Name, x => ColorTransitionEasingOverride = x);
|
||||
registerStruct(beatsOffsetSyncedEntry, t => t._BeatsOffset, x => BeatsOffsetOverride = x);
|
||||
registerStruct(colorTransitionInSyncedEntry, t => t._ColorTransitionIn, x => ColorTransitionInOverride = x);
|
||||
registerStruct(colorTransitionOutSyncedEntry, t => t._ColorTransitionOut, x => ColorTransitionOutOverride = x);
|
||||
registerClass(colorTransitionEasingSyncedEntry, t => t._ColorTransitionEasing.Name, x => ColorTransitionEasingOverride = x);
|
||||
|
||||
void register<T>(SyncedEntry<T> syncedEntry, Func<Track, T> getter, Action applier)
|
||||
{
|
||||
|
@ -1398,9 +1369,9 @@ namespace MuzikaGromche
|
|||
entries.Add((loader, applier));
|
||||
}
|
||||
|
||||
void registerStruct<T>(SyncedEntry<T> syncedEntry, Func<Track, T> getter, Action<T?> setter) where T: struct =>
|
||||
void registerStruct<T>(SyncedEntry<T> syncedEntry, Func<Track, T> getter, Action<T?> setter) where T : struct =>
|
||||
register(syncedEntry, getter, () => setter.Invoke(overrideTimingsSyncedEntry.Value ? syncedEntry.Value : null));
|
||||
void registerClass<T>(SyncedEntry<T> syncedEntry, Func<Track, T> getter, Action<T> setter) where T: class =>
|
||||
void registerClass<T>(SyncedEntry<T> syncedEntry, Func<Track, T> getter, Action<T> setter) where T : class =>
|
||||
register(syncedEntry, getter, () => setter.Invoke(overrideTimingsSyncedEntry.Value ? syncedEntry.Value : null));
|
||||
|
||||
void load()
|
||||
|
@ -1420,6 +1391,13 @@ namespace MuzikaGromche
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private T Default<T>(T options) where T: BaseOptions
|
||||
{
|
||||
options.RequiresRestart = false;
|
||||
options.CanModifyCallback = CanModifyIfHost;
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
// farAudio is during windup, Start overrides popGoesTheWeaselTheme
|
||||
|
|
Loading…
Reference in New Issue