Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Managers/SettingsCategories/Interface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using MelonLoader;

namespace SelectiveEffects.Managers;

internal class Interface : Category
{
private readonly MelonPreferences_Entry<bool> _disableHealthBar;
private readonly MelonPreferences_Entry<bool> _disableScore;
private readonly MelonPreferences_Entry<bool> _disableCombo;
private readonly MelonPreferences_Entry<bool> _disablePauseButton;
private readonly MelonPreferences_Entry<bool> _disableProgressBar;

public Interface()
:base("Interface")
{
_disableHealthBar = _category.CreateEntry(
"DisableHealthBar",
false,
description: "Disable the health & fever bar."
);

_disableScore = _category.CreateEntry(
"DisableScore",
false,
description: "Disable the score."
);

_disableCombo = _category.CreateEntry(
"DisableCombo",
false,
description: "Disable the combo."
);

_disablePauseButton = _category.CreateEntry(
"DisablePauseButton",
false,
description: "Disable the pause button."
);

_disableProgressBar = _category.CreateEntry(
"DisableProgressBar",
false,
description: "Disable the progress bar."
);
}

internal bool DisableHealthBar => _disableHealthBar.Value;
internal bool DisableScore => _disableScore.Value;
internal bool DisableCombo => _disableCombo.Value;
internal bool DisablePauseButton => _disablePauseButton.Value;
internal bool DisableProgressBar => _disableProgressBar.Value;
}
1 change: 1 addition & 0 deletions Managers/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private static void Init()
Init<Misc>();
Init<Stage>();
Init<GameScene>();
Init<Interface>();
}

private static void Init<T>()
Expand Down
55 changes: 55 additions & 0 deletions Patches/InterfacePatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using HarmonyLib;
using Il2CppAssets.Scripts.UI.Panels;
using SelectiveEffects.Managers;
using UnityEngine;

namespace SelectiveEffects.Patches;

[HarmonyPatch(typeof(PnlBattle), nameof(PnlBattle.GameStart))]
internal static class InterfacePatch
{
private static readonly Interface Interface = SettingsManager.Get<Interface>();

private static void Prefix()
{
var pnlBattleOthers = GameObject.Find("PnlBattleOthers");
var up = pnlBattleOthers.transform.Find("Up");

if (Interface.DisableHealthBar)
{
var healthBar = pnlBattleOthers.transform.Find("Below").gameObject;
if (healthBar != null)
healthBar.SetActive(false);
}

if (Interface.DisableScore)
{
var score = pnlBattleOthers.transform.Find("Score").gameObject;
if (score != null)
score.SetActive(false);
}

if (Interface.DisableCombo)
{
var combo = GameObject.Find("PnlCommonUI");
if (combo != null)
combo.SetActive(false);

combo = GameObject.Find("PnlNewComboUI");
if (combo != null)
combo.SetActive(false);
}

if (Interface.DisablePauseButton)
{
var pauseButton = up.Find("BtnPause").GetChild(0).gameObject;
if (pauseButton != null)
pauseButton.SetActive(false);
}

if (!Interface.DisableProgressBar) return;
var progressBar = up.Find("SldStageProgress").gameObject;
if (progressBar != null)
progressBar.SetActive(false);
}
}