Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Deactivates PP Toggle if Component Toggle is Installed
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaakDl authored and IsaakDl committed Jul 16, 2022
1 parent f5fd59e commit 306d39f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
30 changes: 24 additions & 6 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,32 @@ public class Main : MelonMod
public static MelonPreferences_Entry<bool> VignetteState;

public static bool SettingChanged = false;
public static bool IsComponentToggleInstalled = false;

public override void OnApplicationStart()
{
Category = MelonPreferences.CreateCategory("WorldEffectToggle");

PostprocessingState = Category.CreateEntry("Disable PostProcessing", false);
PostprocessingState.OnValueChanged += TogglePP;
foreach (var m in MelonHandler.Mods)
{
if (m.Info.Name == "ComponentToggle")
{
mlog.Msg(ConsoleColor.Yellow, "Found ComponentToggle Mod. Disabling Post Processing Toggle.");
IsComponentToggleInstalled = true;
break;
}
}

CreateMelonPreferences();
}

private void CreateMelonPreferences()
{
if (!IsComponentToggleInstalled)
{
PostprocessingState = Category.CreateEntry("Disable PostProcessing", false);
PostprocessingState.OnValueChanged += TogglePP;
}

AOState = Category.CreateEntry("Disable Ambient Occlusion", false);
AOState.OnValueChanged += AOState_OnValueChanged;
Expand Down Expand Up @@ -66,14 +85,13 @@ public override void OnApplicationStart()

VignetteState = Category.CreateEntry("Disable Vignette", false);
VignetteState.OnValueChanged += VignetteState_OnValueChanged;

}

public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
if (buildIndex == -1)
{
if (PostprocessingState.Value)
if (!IsComponentToggleInstalled && PostprocessingState.Value)
TogglePP();

AOState_OnValueChanged();
Expand All @@ -94,9 +112,9 @@ public override void OnPreferencesSaved()
{
if (!SettingChanged) return;

string msg = "Re-enabled some Postprocessing effects. Rejoin the world for changes to take effect.";
string msg = "Re-enabled some Postprocessing effects. Rejoin or change world for changes to take effect.";
VRCUiManager.prop_VRCUiManager_0.field_Private_List_1_String_0.Add(msg);
mlog.Warning(msg);
mlog.Msg(ConsoleColor.Yellow, msg);

SettingChanged = false;
}
Expand Down
8 changes: 4 additions & 4 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("WorldEffectToggle")]
[assembly: AssemblyDescription("Universal Melonloader mod that toggles specified effects in the Games Default Postprocessing Profile. ")]
[assembly: AssemblyDescription("A VRChat mod that toggles specified effects in a World's default Post-processing Profile. ")]
[assembly: AssemblyProduct("WorldEffectToggle")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: ComVisible(false)]
[assembly: Guid("a4016eec-d63a-4d43-83d4-c55d3f5f8faf")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: MelonInfo(typeof(WorldEffectToggle.Main), "WorldEffectToggle", "1.0.0", "I5UCC")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: MelonInfo(typeof(WorldEffectToggle.Main), "WorldEffectToggle", "1.0.1", "I5UCC")]
[assembly: MelonGame("VRChat", "VRChat")]

0 comments on commit 306d39f

Please sign in to comment.