forked from nikita/muzika-gromche
Remove remaining CSync code and references
There were issues with clients not being able to join, potentially caused by linked (even though actually unused) CSync library.
This commit is contained in:
parent
b3767cbbf0
commit
4516b853cd
|
@ -5,6 +5,7 @@
|
||||||
- Added a new track OnePartiyaUdar in Japanese language.
|
- Added a new track OnePartiyaUdar in Japanese language.
|
||||||
- Remastered recently added tracks at conventional 44100 Hz for better stitching.
|
- Remastered recently added tracks at conventional 44100 Hz for better stitching.
|
||||||
- Improved playback experience: use precise DSP time and up-front scheduing for seamless audio stitching, add custom Audio Sources to improve reliability.
|
- Improved playback experience: use precise DSP time and up-front scheduing for seamless audio stitching, add custom Audio Sources to improve reliability.
|
||||||
|
- Removed remaining CSync code and package references even from debug builds.
|
||||||
|
|
||||||
## MuzikaGromche 1337.420.9001 - Multiverse Edition
|
## MuzikaGromche 1337.420.9001 - Multiverse Edition
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,6 @@
|
||||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" PrivateAssets="all" Private="false" />
|
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" PrivateAssets="all" Private="false" />
|
||||||
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" PrivateAssets="all" Private="false" />
|
<PackageReference Include="UnityEngine.Modules" Version="2022.3.9" PrivateAssets="all" Private="false" />
|
||||||
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" Private="false" />
|
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" Private="false" />
|
||||||
<!--
|
|
||||||
Publicize internal methods, so we could generate config entries for tracks at runtime instead
|
|
||||||
of generating code at compile time. See https://github.com/lc-sigurd/CSync/issues/11
|
|
||||||
It is an optional dependency now, but there is no sane way to mark it as such.
|
|
||||||
-->
|
|
||||||
<PackageReference Include="Sigurd.BepInEx.CSync" Version="5.0.1" Publicize="true" PrivateAssets="all" Private="false" />
|
|
||||||
<PackageReference Include="AinaVT-LethalConfig" Version="1.4.6" PrivateAssets="all" Private="false" />
|
<PackageReference Include="AinaVT-LethalConfig" Version="1.4.6" PrivateAssets="all" Private="false" />
|
||||||
<PackageReference Include="TeamBMX.LobbyCompatibility" Version="1.*" PrivateAssets="all" Private="false" />
|
<PackageReference Include="TeamBMX.LobbyCompatibility" Version="1.*" PrivateAssets="all" Private="false" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -19,17 +19,9 @@ using Unity.Netcode;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
using CSync.Extensions;
|
|
||||||
using CSync.Lib;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace MuzikaGromche
|
namespace MuzikaGromche
|
||||||
{
|
{
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
#if DEBUG
|
|
||||||
[BepInDependency("com.sigurd.csync", "5.0.1")]
|
|
||||||
#endif
|
|
||||||
[BepInDependency("ainavt.lc.lethalconfig", "1.4.6")]
|
[BepInDependency("ainavt.lc.lethalconfig", "1.4.6")]
|
||||||
[BepInDependency("watergun.v72lightfix", BepInDependency.DependencyFlags.SoftDependency)]
|
[BepInDependency("watergun.v72lightfix", BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
[BepInDependency("BMX.LobbyCompatibility", BepInDependency.DependencyFlags.HardDependency)]
|
[BepInDependency("BMX.LobbyCompatibility", BepInDependency.DependencyFlags.HardDependency)]
|
||||||
|
@ -1794,25 +1786,7 @@ namespace MuzikaGromche
|
||||||
readonly public int TotalWeights { get; }
|
readonly public int TotalWeights { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
static class SyncedEntryExtensions
|
|
||||||
{
|
|
||||||
// Update local values on clients. Even though the clients couldn't
|
|
||||||
// edit them, they could at least see the new values.
|
|
||||||
public static void SyncHostToLocal<T>(this SyncedEntry<T> entry)
|
|
||||||
{
|
|
||||||
entry.Changed += (sender, args) =>
|
|
||||||
{
|
|
||||||
args.ChangedEntry.LocalValue = args.NewValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
#if DEBUG
|
|
||||||
: SyncedConfig2<Config>
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
public static ConfigEntry<bool> DisplayLyrics { get; private set; } = null!;
|
public static ConfigEntry<bool> DisplayLyrics { get; private set; } = null!;
|
||||||
|
|
||||||
|
@ -1866,9 +1840,6 @@ namespace MuzikaGromche
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
internal Config(ConfigFile configFile)
|
internal Config(ConfigFile configFile)
|
||||||
#if DEBUG
|
|
||||||
: base(PluginInfo.PLUGIN_GUID)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
DisplayLyrics = configFile.Bind("General", "Display Lyrics", true,
|
DisplayLyrics = configFile.Bind("General", "Display Lyrics", true,
|
||||||
new ConfigDescription("Display lyrics in the HUD tooltip when you hear the music."));
|
new ConfigDescription("Display lyrics in the HUD tooltip when you hear the music."));
|
||||||
|
@ -1936,10 +1907,6 @@ namespace MuzikaGromche
|
||||||
|
|
||||||
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight, Default(new IntSliderOptions())));
|
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(track.Weight, Default(new IntSliderOptions())));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
ConfigManager.Register(this);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IAudioTrack OverrideCurrentTrack(IAudioTrack track)
|
internal static IAudioTrack OverrideCurrentTrack(IAudioTrack track)
|
||||||
|
@ -1952,16 +1919,6 @@ namespace MuzikaGromche
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
// HACK because CSync doesn't provide an API to register a list of config entries
|
|
||||||
// See https://github.com/lc-sigurd/CSync/issues/11
|
|
||||||
private void CSyncHackAddSyncedEntry(SyncedEntryBase entryBase)
|
|
||||||
{
|
|
||||||
// This is basically what ConfigFile.PopulateEntryContainer does
|
|
||||||
EntryContainer.Add(entryBase.BoxedEntry.ToSyncedEntryIdentifier(), entryBase);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public static CanModifyResult CanModifyIfHost()
|
public static CanModifyResult CanModifyIfHost()
|
||||||
{
|
{
|
||||||
var startOfRound = StartOfRound.Instance;
|
var startOfRound = StartOfRound.Instance;
|
||||||
|
@ -1999,33 +1956,29 @@ namespace MuzikaGromche
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
private void SetupEntriesForExtrapolation(ConfigFile configFile)
|
private void SetupEntriesForExtrapolation(ConfigFile configFile)
|
||||||
{
|
{
|
||||||
var syncedEntry = configFile.BindSyncedEntry("General", "Extrapolate Audio Playback Time", true,
|
var entry = configFile.Bind("General", "Extrapolate Audio Playback Time", true,
|
||||||
new ConfigDescription("AudioSource only updates its playback position about 20 times per second.\n\nUse extrapolation technique to predict playback time between updates for smoother color animations."));
|
new ConfigDescription("AudioSource only updates its playback position about 20 times per second.\n\nUse extrapolation technique to predict playback time between updates for smoother color animations."));
|
||||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(syncedEntry.Entry, Default(new BoolCheckBoxOptions())));
|
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, Default(new BoolCheckBoxOptions())));
|
||||||
CSyncHackAddSyncedEntry(syncedEntry);
|
entry.SettingChanged += (sender, args) => apply();
|
||||||
syncedEntry.Changed += (sender, args) => apply();
|
|
||||||
syncedEntry.SyncHostToLocal();
|
|
||||||
apply();
|
apply();
|
||||||
|
|
||||||
void apply()
|
void apply()
|
||||||
{
|
{
|
||||||
ExtrapolateTime = syncedEntry.Value;
|
ExtrapolateTime = entry.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupEntriesToSkipWinding(ConfigFile configFile)
|
private void SetupEntriesToSkipWinding(ConfigFile configFile)
|
||||||
{
|
{
|
||||||
var syncedEntry = configFile.BindSyncedEntry("General", "Skip Winding Phase", false,
|
var entry = configFile.Bind("General", "Skip Winding Phase", false,
|
||||||
new ConfigDescription("Skip most of the wind-up/intro music.\n\nUse this option to test your Loop audio segment."));
|
new ConfigDescription("Skip most of the wind-up/intro music.\n\nUse this option to test your Loop audio segment."));
|
||||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(syncedEntry.Entry, Default(new BoolCheckBoxOptions())));
|
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(entry, Default(new BoolCheckBoxOptions())));
|
||||||
CSyncHackAddSyncedEntry(syncedEntry);
|
entry.SettingChanged += (sender, args) => apply();
|
||||||
syncedEntry.Changed += (sender, args) => apply();
|
|
||||||
syncedEntry.SyncHostToLocal();
|
|
||||||
apply();
|
apply();
|
||||||
|
|
||||||
void apply()
|
void apply()
|
||||||
{
|
{
|
||||||
ShouldSkipWindingPhase = syncedEntry.Value;
|
ShouldSkipWindingPhase = entry.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2034,31 +1987,27 @@ namespace MuzikaGromche
|
||||||
const string section = "Palette";
|
const string section = "Palette";
|
||||||
const int maxCustomPaletteSize = 8;
|
const int maxCustomPaletteSize = 8;
|
||||||
// Declare and initialize early to avoid "Use of unassigned local variable"
|
// Declare and initialize early to avoid "Use of unassigned local variable"
|
||||||
SyncedEntry<int> customPaletteSizeSyncedEntry = null!;
|
ConfigEntry<int> customPaletteSizeEntry = null!;
|
||||||
var customPaletteSyncedEntries = new SyncedEntry<string>[maxCustomPaletteSize];
|
var customPaletteEntries = new ConfigEntry<string>[maxCustomPaletteSize];
|
||||||
|
|
||||||
var loadButton = new GenericButtonConfigItem(section, "Load Palette from the Current Track",
|
var loadButton = new GenericButtonConfigItem(section, "Load Palette from the Current Track",
|
||||||
"Override custom palette with the built-in palette of the current track.", "Load", load);
|
"Override custom palette with the built-in palette of the current track.", "Load", load);
|
||||||
loadButton.ButtonOptions.CanModifyCallback = CanModifyIfHost;
|
loadButton.ButtonOptions.CanModifyCallback = CanModifyIfHost;
|
||||||
LethalConfigManager.AddConfigItem(loadButton);
|
LethalConfigManager.AddConfigItem(loadButton);
|
||||||
|
|
||||||
customPaletteSizeSyncedEntry = configFile.BindSyncedEntry(section, "Palette Size", 0, new ConfigDescription(
|
customPaletteSizeEntry = configFile.Bind(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.",
|
"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)));
|
new AcceptableValueRange<int>(0, maxCustomPaletteSize)));
|
||||||
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeSyncedEntry.Entry, Default(new IntSliderOptions())));
|
LethalConfigManager.AddConfigItem(new IntSliderConfigItem(customPaletteSizeEntry, Default(new IntSliderOptions())));
|
||||||
CSyncHackAddSyncedEntry(customPaletteSizeSyncedEntry);
|
customPaletteSizeEntry.SettingChanged += (sender, args) => apply();
|
||||||
customPaletteSizeSyncedEntry.Changed += (sender, args) => apply();
|
|
||||||
customPaletteSizeSyncedEntry.SyncHostToLocal();
|
|
||||||
|
|
||||||
for (int i = 0; i < maxCustomPaletteSize; i++)
|
for (int i = 0; i < maxCustomPaletteSize; i++)
|
||||||
{
|
{
|
||||||
string entryName = $"Custom Color {i + 1}";
|
string entryName = $"Custom Color {i + 1}";
|
||||||
var customColorSyncedEntry = configFile.BindSyncedEntry(section, entryName, "#FFFFFF", "Choose color for the custom palette");
|
var customColorEntry = configFile.Bind(section, entryName, "#FFFFFF", "Choose color for the custom palette");
|
||||||
customPaletteSyncedEntries[i] = customColorSyncedEntry;
|
customPaletteEntries[i] = customColorEntry;
|
||||||
LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorSyncedEntry.Entry, Default(new HexColorInputFieldOptions())));
|
LethalConfigManager.AddConfigItem(new HexColorInputFieldConfigItem(customColorEntry, Default(new HexColorInputFieldOptions())));
|
||||||
CSyncHackAddSyncedEntry(customColorSyncedEntry);
|
customColorEntry.SettingChanged += (sender, args) => apply();
|
||||||
customColorSyncedEntry.Changed += (sender, args) => apply();
|
|
||||||
customColorSyncedEntry.SyncHostToLocal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
|
@ -2069,25 +2018,25 @@ namespace MuzikaGromche
|
||||||
var colors = palette.Colors;
|
var colors = palette.Colors;
|
||||||
var count = Math.Min(colors.Count(), maxCustomPaletteSize);
|
var count = Math.Min(colors.Count(), maxCustomPaletteSize);
|
||||||
|
|
||||||
customPaletteSizeSyncedEntry.LocalValue = colors.Count();
|
customPaletteSizeEntry.Value = colors.Count();
|
||||||
for (int i = 0; i < maxCustomPaletteSize; i++)
|
for (int i = 0; i < maxCustomPaletteSize; i++)
|
||||||
{
|
{
|
||||||
var color = i < count ? colors[i] : Color.white;
|
var color = i < count ? colors[i] : Color.white;
|
||||||
string colorHex = $"#{ColorUtility.ToHtmlStringRGB(color)}";
|
string colorHex = $"#{ColorUtility.ToHtmlStringRGB(color)}";
|
||||||
customPaletteSyncedEntries[i].LocalValue = colorHex;
|
customPaletteEntries[i].Value = colorHex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply()
|
void apply()
|
||||||
{
|
{
|
||||||
int size = customPaletteSizeSyncedEntry.Value;
|
int size = customPaletteSizeEntry.Value;
|
||||||
if (size == 0 || size > maxCustomPaletteSize)
|
if (size == 0 || size > maxCustomPaletteSize)
|
||||||
{
|
{
|
||||||
PaletteOverride = null;
|
PaletteOverride = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var colors = customPaletteSyncedEntries.Select(entry => entry.Value).Take(size).ToArray();
|
var colors = customPaletteEntries.Select(entry => entry.Value).Take(size).ToArray();
|
||||||
PaletteOverride = Palette.Parse(colors);
|
PaletteOverride = Palette.Parse(colors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2099,93 +2048,89 @@ namespace MuzikaGromche
|
||||||
var colorTransitionRange = new AcceptableValueRange<float>(0f, 1f);
|
var colorTransitionRange = new AcceptableValueRange<float>(0f, 1f);
|
||||||
// Declare and initialize early to avoid "Use of unassigned local variable"
|
// Declare and initialize early to avoid "Use of unassigned local variable"
|
||||||
List<(Action<IAudioTrack?> Load, Action Apply)> entries = [];
|
List<(Action<IAudioTrack?> Load, Action Apply)> entries = [];
|
||||||
SyncedEntry<bool> overrideTimingsSyncedEntry = null!;
|
ConfigEntry<bool> overrideTimingsEntry = null!;
|
||||||
SyncedEntry<float> fadeOutBeatSyncedEntry = null!;
|
ConfigEntry<float> fadeOutBeatEntry = null!;
|
||||||
SyncedEntry<float> fadeOutDurationSyncedEntry = null!;
|
ConfigEntry<float> fadeOutDurationEntry = null!;
|
||||||
SyncedEntry<string> flickerLightsTimeSeriesSyncedEntry = null!;
|
ConfigEntry<string> flickerLightsTimeSeriesEntry = null!;
|
||||||
SyncedEntry<string> lyricsTimeSeriesSyncedEntry = null!;
|
ConfigEntry<string> lyricsTimeSeriesEntry = null!;
|
||||||
SyncedEntry<float> beatsOffsetSyncedEntry = null!;
|
ConfigEntry<float> beatsOffsetEntry = null!;
|
||||||
SyncedEntry<float> colorTransitionInSyncedEntry = null!;
|
ConfigEntry<float> colorTransitionInEntry = null!;
|
||||||
SyncedEntry<float> colorTransitionOutSyncedEntry = null!;
|
ConfigEntry<float> colorTransitionOutEntry = null!;
|
||||||
SyncedEntry<string> colorTransitionEasingSyncedEntry = null!;
|
ConfigEntry<string> colorTransitionEasingEntry = null!;
|
||||||
|
|
||||||
var loadButton = new GenericButtonConfigItem(section, "Load Timings from the Current Track",
|
var loadButton = new GenericButtonConfigItem(section, "Load Timings from the Current Track",
|
||||||
"Override custom timings with the built-in timings of the current track.", "Load", load);
|
"Override custom timings with the built-in timings of the current track.", "Load", load);
|
||||||
loadButton.ButtonOptions.CanModifyCallback = CanModifyIfHost;
|
loadButton.ButtonOptions.CanModifyCallback = CanModifyIfHost;
|
||||||
LethalConfigManager.AddConfigItem(loadButton);
|
LethalConfigManager.AddConfigItem(loadButton);
|
||||||
|
|
||||||
overrideTimingsSyncedEntry = configFile.BindSyncedEntry(section, "Override Timings", false,
|
overrideTimingsEntry = configFile.Bind(section, "Override Timings", false,
|
||||||
new ConfigDescription("If checked, custom timings override track's own built-in timings."));
|
new ConfigDescription("If checked, custom timings override track's own built-in timings."));
|
||||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsSyncedEntry.Entry, Default(new BoolCheckBoxOptions())));
|
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(overrideTimingsEntry, Default(new BoolCheckBoxOptions())));
|
||||||
CSyncHackAddSyncedEntry(overrideTimingsSyncedEntry);
|
overrideTimingsEntry.SettingChanged += (sender, args) => apply();
|
||||||
overrideTimingsSyncedEntry.Changed += (sender, args) => apply();
|
|
||||||
overrideTimingsSyncedEntry.SyncHostToLocal();
|
|
||||||
|
|
||||||
fadeOutBeatSyncedEntry = configFile.BindSyncedEntry(section, "Fade Out Beat", 0f,
|
fadeOutBeatEntry = configFile.Bind(section, "Fade Out Beat", 0f,
|
||||||
new ConfigDescription("The beat at which to start fading out", new AcceptableValueRange<float>(-1000f, 0)));
|
new ConfigDescription("The beat at which to start fading out", new AcceptableValueRange<float>(-1000f, 0)));
|
||||||
fadeOutDurationSyncedEntry = configFile.BindSyncedEntry(section, "Fade Out Duration", 0f,
|
fadeOutDurationEntry = configFile.Bind(section, "Fade Out Duration", 0f,
|
||||||
new ConfigDescription("Duration of fading out", new AcceptableValueRange<float>(0, 10)));
|
new ConfigDescription("Duration of fading out", new AcceptableValueRange<float>(0, 10)));
|
||||||
flickerLightsTimeSeriesSyncedEntry = configFile.BindSyncedEntry(section, "Flicker Lights Time Series", "",
|
flickerLightsTimeSeriesEntry = configFile.Bind(section, "Flicker Lights Time Series", "",
|
||||||
new ConfigDescription("Time series of beat offsets when to flicker the lights."));
|
new ConfigDescription("Time series of beat offsets when to flicker the lights."));
|
||||||
lyricsTimeSeriesSyncedEntry = configFile.BindSyncedEntry(section, "Lyrics Time Series", "",
|
lyricsTimeSeriesEntry = configFile.Bind(section, "Lyrics Time Series", "",
|
||||||
new ConfigDescription("Time series of beat offsets when to show lyrics lines."));
|
new ConfigDescription("Time series of beat offsets when to show lyrics lines."));
|
||||||
beatsOffsetSyncedEntry = configFile.BindSyncedEntry(section, "Beats Offset", 0f,
|
beatsOffsetEntry = configFile.Bind(section, "Beats Offset", 0f,
|
||||||
new ConfigDescription("How much to offset the whole beat. More is later", new AcceptableValueRange<float>(-0.5f, 0.5f)));
|
new ConfigDescription("How much to offset the whole beat. More is later", new AcceptableValueRange<float>(-0.5f, 0.5f)));
|
||||||
colorTransitionInSyncedEntry = configFile.BindSyncedEntry(section, "Color Transition In", 0.25f,
|
colorTransitionInEntry = configFile.Bind(section, "Color Transition In", 0.25f,
|
||||||
new ConfigDescription("Fraction of a beat *before* the whole beat when the color transition should start.", colorTransitionRange));
|
new ConfigDescription("Fraction of a beat *before* the whole beat when the color transition should start.", colorTransitionRange));
|
||||||
colorTransitionOutSyncedEntry = configFile.BindSyncedEntry(section, "Color Transition Out", 0.25f,
|
colorTransitionOutEntry = configFile.Bind(section, "Color Transition Out", 0.25f,
|
||||||
new ConfigDescription("Fraction of a beat *after* the whole beat when the color transition should end.", colorTransitionRange));
|
new ConfigDescription("Fraction of a beat *after* the whole beat when the color transition should end.", colorTransitionRange));
|
||||||
colorTransitionEasingSyncedEntry = configFile.BindSyncedEntry(section, "Color Transition Easing", Easing.Linear.Name,
|
colorTransitionEasingEntry = configFile.Bind(section, "Color Transition Easing", Easing.Linear.Name,
|
||||||
new ConfigDescription("Interpolation/easing method to use for color transitions", new AcceptableValueList<string>(Easing.AllNames)));
|
new ConfigDescription("Interpolation/easing method to use for color transitions", new AcceptableValueList<string>(Easing.AllNames)));
|
||||||
|
|
||||||
var floatSliderOptions = Default(new FloatSliderOptions());
|
var floatSliderOptions = Default(new FloatSliderOptions());
|
||||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutBeatSyncedEntry.Entry, floatSliderOptions));
|
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutBeatEntry, floatSliderOptions));
|
||||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutDurationSyncedEntry.Entry, floatSliderOptions));
|
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(fadeOutDurationEntry, floatSliderOptions));
|
||||||
LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(flickerLightsTimeSeriesSyncedEntry.Entry, Default(new TextInputFieldOptions())));
|
LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(flickerLightsTimeSeriesEntry, Default(new TextInputFieldOptions())));
|
||||||
LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(lyricsTimeSeriesSyncedEntry.Entry, Default(new TextInputFieldOptions())));
|
LethalConfigManager.AddConfigItem(new TextInputFieldConfigItem(lyricsTimeSeriesEntry, Default(new TextInputFieldOptions())));
|
||||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(beatsOffsetSyncedEntry.Entry, floatSliderOptions));
|
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(beatsOffsetEntry, floatSliderOptions));
|
||||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionInSyncedEntry.Entry, floatSliderOptions));
|
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionInEntry, floatSliderOptions));
|
||||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionOutSyncedEntry.Entry, floatSliderOptions));
|
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(colorTransitionOutEntry, floatSliderOptions));
|
||||||
LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingSyncedEntry.Entry, Default(new TextDropDownOptions())));
|
LethalConfigManager.AddConfigItem(new TextDropDownConfigItem(colorTransitionEasingEntry, Default(new TextDropDownOptions())));
|
||||||
|
|
||||||
registerStruct(fadeOutBeatSyncedEntry, t => t.FadeOutBeat, x => FadeOutBeatOverride = x);
|
registerStruct(fadeOutBeatEntry, t => t.FadeOutBeat, x => FadeOutBeatOverride = x);
|
||||||
registerStruct(fadeOutDurationSyncedEntry, t => t.FadeOutDuration, x => FadeOutDurationOverride = x);
|
registerStruct(fadeOutDurationEntry, t => t.FadeOutDuration, x => FadeOutDurationOverride = x);
|
||||||
registerArray(flickerLightsTimeSeriesSyncedEntry, t => t.FlickerLightsTimeSeries, xs => FlickerLightsTimeSeriesOverride = xs, float.Parse, sort: true);
|
registerArray(flickerLightsTimeSeriesEntry, t => t.FlickerLightsTimeSeries, xs => FlickerLightsTimeSeriesOverride = xs, float.Parse, sort: true);
|
||||||
registerArray(lyricsTimeSeriesSyncedEntry, t => t.LyricsTimeSeries, xs => LyricsTimeSeriesOverride = xs, float.Parse, sort: true);
|
registerArray(lyricsTimeSeriesEntry, t => t.LyricsTimeSeries, xs => LyricsTimeSeriesOverride = xs, float.Parse, sort: true);
|
||||||
registerStruct(beatsOffsetSyncedEntry, t => t.BeatsOffset, x => BeatsOffsetOverride = x);
|
registerStruct(beatsOffsetEntry, t => t.BeatsOffset, x => BeatsOffsetOverride = x);
|
||||||
registerStruct(colorTransitionInSyncedEntry, t => t.ColorTransitionIn, x => ColorTransitionInOverride = x);
|
registerStruct(colorTransitionInEntry, t => t.ColorTransitionIn, x => ColorTransitionInOverride = x);
|
||||||
registerStruct(colorTransitionOutSyncedEntry, t => t.ColorTransitionOut, x => ColorTransitionOutOverride = x);
|
registerStruct(colorTransitionOutEntry, t => t.ColorTransitionOut, x => ColorTransitionOutOverride = x);
|
||||||
registerClass(colorTransitionEasingSyncedEntry, t => t.ColorTransitionEasing.Name, x => ColorTransitionEasingOverride = x);
|
registerClass(colorTransitionEasingEntry, t => t.ColorTransitionEasing.Name, x => ColorTransitionEasingOverride = x);
|
||||||
|
|
||||||
void register<T>(SyncedEntry<T> syncedEntry, Func<IAudioTrack, T> getter, Action applier)
|
void register<T>(ConfigEntry<T> entry, Func<IAudioTrack, T> getter, Action applier)
|
||||||
{
|
{
|
||||||
CSyncHackAddSyncedEntry(syncedEntry);
|
entry.SettingChanged += (sender, args) => applier();
|
||||||
syncedEntry.SyncHostToLocal();
|
|
||||||
syncedEntry.Changed += (sender, args) => applier();
|
|
||||||
void loader(IAudioTrack? track)
|
void loader(IAudioTrack? track)
|
||||||
{
|
{
|
||||||
// if track is null, set everything to defaults
|
// if track is null, set everything to defaults
|
||||||
syncedEntry.LocalValue = track == null ? (T)syncedEntry.Entry.DefaultValue : getter(track);
|
entry.Value = track == null ? (T)entry.DefaultValue : getter(track);
|
||||||
}
|
}
|
||||||
entries.Add((loader, applier));
|
entries.Add((loader, applier));
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerStruct<T>(SyncedEntry<T> syncedEntry, Func<IAudioTrack, T> getter, Action<T?> setter) where T : struct =>
|
void registerStruct<T>(ConfigEntry<T> entry, Func<IAudioTrack, T> getter, Action<T?> setter) where T : struct =>
|
||||||
register(syncedEntry, getter, () => setter.Invoke(overrideTimingsSyncedEntry.Value ? syncedEntry.Value : null));
|
register(entry, getter, () => setter.Invoke(overrideTimingsEntry.Value ? entry.Value : null));
|
||||||
void registerClass<T>(SyncedEntry<T> syncedEntry, Func<IAudioTrack, T> getter, Action<T?> setter) where T : class =>
|
void registerClass<T>(ConfigEntry<T> entry, Func<IAudioTrack, T> getter, Action<T?> setter) where T : class =>
|
||||||
register(syncedEntry, getter, () => setter.Invoke(overrideTimingsSyncedEntry.Value ? syncedEntry.Value : null));
|
register(entry, getter, () => setter.Invoke(overrideTimingsEntry.Value ? entry.Value : null));
|
||||||
void registerArray<T>(SyncedEntry<string> syncedEntry, Func<IAudioTrack, T[]> getter, Action<T[]?> setter, Func<string, T> parser, bool sort = false) where T : struct =>
|
void registerArray<T>(ConfigEntry<string> entry, Func<IAudioTrack, T[]> getter, Action<T[]?> setter, Func<string, T> parser, bool sort = false) where T : struct =>
|
||||||
register(syncedEntry,
|
register(entry,
|
||||||
(track) => string.Join(", ", getter(track)),
|
(track) => string.Join(", ", getter(track)),
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
var values = parseStringArray(syncedEntry.Value, parser, sort);
|
var values = parseStringArray(entry.Value, parser, sort);
|
||||||
if (values != null)
|
if (values != null)
|
||||||
{
|
{
|
||||||
// ensure the entry is sorted and formatted
|
// ensure the entry is sorted and formatted
|
||||||
syncedEntry.LocalValue = string.Join(", ", values);
|
entry.Value = string.Join(", ", values);
|
||||||
}
|
}
|
||||||
setter.Invoke(overrideTimingsSyncedEntry.Value ? values : null);
|
setter.Invoke(overrideTimingsEntry.Value ? values : null);
|
||||||
});
|
});
|
||||||
|
|
||||||
T[]? parseStringArray<T>(string str, Func<string, T> parser, bool sort = false) where T : struct
|
T[]? parseStringArray<T>(string str, Func<string, T> parser, bool sort = false) where T : struct
|
||||||
|
|
|
@ -36,7 +36,6 @@ Any player can change their personal preferences locally.
|
||||||
|
|
||||||
1. Actually not limited to Inverse teleporter or Titan.
|
1. Actually not limited to Inverse teleporter or Titan.
|
||||||
|
|
||||||
[`CSync`]: https://thunderstore.io/c/lethal-company/p/Sigurd/CSync/
|
|
||||||
[`LethalConfig`]: https://thunderstore.io/c/lethal-company/p/AinaVT/LethalConfig/
|
[`LethalConfig`]: https://thunderstore.io/c/lethal-company/p/AinaVT/LethalConfig/
|
||||||
[`LobbyCompatibility`]: https://thunderstore.io/c/lethal-company/p/BMX/LobbyCompatibility/
|
[`LobbyCompatibility`]: https://thunderstore.io/c/lethal-company/p/BMX/LobbyCompatibility/
|
||||||
[`V70PoweredLights_Fix`]: https://thunderstore.io/c/lethal-company/p/WaterGun/V70PoweredLights_Fix/
|
[`V70PoweredLights_Fix`]: https://thunderstore.io/c/lethal-company/p/WaterGun/V70PoweredLights_Fix/
|
||||||
|
|
Loading…
Reference in New Issue