using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using Reptile.Phone;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HideHud")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Allows hiding of individual HUD areas")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2")]
[assembly: AssemblyProduct("HideHud")]
[assembly: AssemblyTitle("HideHud")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HideHud
{
[BepInPlugin("HideHud", "HideHud", "1.1.2")]
public class Plugin : BaseUnityPlugin
{
private CanvasGroup _dieMenu;
private CanvasGroup _pauseUI;
private CanvasGroup _effectsUI;
private CanvasGroup _gameplayUI;
private CanvasGroup _dialogueUI;
private CanvasGroup _characterSelectUI;
private CanvasGroup _danceAbilityUI;
private CanvasGroup _styleSwitchUI;
private CanvasGroup _outfitSwitchUI;
private CanvasGroup _taxiUI;
private Canvas _dynamicPhoneCanvas;
private Canvas _openPhoneCanvas;
private Canvas _closedPhoneCanvas;
private List<LineRenderer> _graffitiLines = new List<LineRenderer>();
private List<GameObject> _graffitiTargets = new List<GameObject>();
private List<GameObject> _nameplates = new List<GameObject>();
private bool _uiReady = false;
private bool _phoneReady = false;
private bool _hudIsVisible = true;
private PluginConfig _config;
public static Plugin Instance { get; private set; }
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
Instance = this;
_config = new PluginConfig(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HideHud is loaded!");
Harmony val = new Harmony("sgiygas.hideHud");
val.PatchAll();
}
private void Update()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (_uiReady && _phoneReady && Input.GetKeyDown(_config.ToggleKey.Value))
{
ToggleHudVisibility();
}
}
private void ToggleHudVisibility()
{
_hudIsVisible = !_hudIsVisible;
float alpha = (_hudIsVisible ? 1f : 0f);
if (_config.HideDeathUI.Value)
{
_dieMenu.alpha = alpha;
}
if (_config.HidePauseMenu.Value)
{
_pauseUI.alpha = alpha;
}
if (_config.HideScreenEffects.Value)
{
_effectsUI.alpha = alpha;
}
_gameplayUI.alpha = alpha;
if (_config.HideDialogue.Value)
{
_dialogueUI.alpha = alpha;
}
if (_config.HideCypher.Value)
{
_characterSelectUI.alpha = alpha;
}
if (_config.HideDanceWheel.Value)
{
_danceAbilityUI.alpha = alpha;
}
if (_config.HideGearSelect.Value)
{
_styleSwitchUI.alpha = alpha;
}
if (_config.HideOutfitSelect.Value)
{
_outfitSwitchUI.alpha = alpha;
}
if (_config.HideTaxiUI.Value)
{
_taxiUI.alpha = alpha;
}
if (_config.HidePhone.Value)
{
((Behaviour)_dynamicPhoneCanvas).enabled = _hudIsVisible;
((Behaviour)_closedPhoneCanvas).enabled = _hudIsVisible;
((Behaviour)_openPhoneCanvas).enabled = _hudIsVisible;
}
if (_config.HideSlopCrewNameplates.Value)
{
foreach (GameObject nameplate in _nameplates)
{
nameplate.SetActive(_hudIsVisible);
}
}
if (!_config.HideGraffitiUI.Value)
{
return;
}
foreach (GameObject graffitiTarget in _graffitiTargets)
{
graffitiTarget.SetActive(_hudIsVisible);
}
foreach (LineRenderer graffitiLine in _graffitiLines)
{
((Renderer)graffitiLine).enabled = _hudIsVisible;
}
}
public void SetMainReferences(UIManager uiManager)
{
Traverse traverse = Traverse.Create((object)uiManager);
_dieMenu = CreateCanvasGroupForUI<DieMenu>(traverse, "dieMenu");
_pauseUI = CreateCanvasGroupForUI<PauseMenu>(traverse, "pauseMenu");
_effectsUI = CreateCanvasGroupForUI<EffectsUI>(traverse, "effects");
_gameplayUI = CreateCanvasGroupForUI<GameplayUI>(traverse, "gameplay");
_dialogueUI = CreateCanvasGroupForUI<DialogueUI>(traverse, "dialogueUI");
_characterSelectUI = CreateCanvasGroupForUI<CharacterSelectUI>(traverse, "characterSelectUI");
_danceAbilityUI = CreateCanvasGroupForUI<DanceAbilityUI>(traverse, "danceAbilityUI");
_styleSwitchUI = CreateCanvasGroupForUI<StyleSwitchMenu>(traverse, "styleSwitchUI");
_outfitSwitchUI = CreateCanvasGroupForUI<OutfitSwitchMenu>(traverse, "outfitSwitchUI");
_taxiUI = CreateCanvasGroupForUI<TaxiUI>(traverse, "taxiUI");
_uiReady = true;
}
private CanvasGroup CreateCanvasGroupForUI<T>(Traverse traverse, string fieldName) where T : Component
{
object value = traverse.Field(fieldName).GetValue();
T val = (T)((value is T) ? value : null);
return ((Component)val).gameObject.AddComponent<CanvasGroup>();
}
public void SetPhoneReferences(Phone phone)
{
Traverse val = Traverse.Create((object)phone);
_dynamicPhoneCanvas = ((Component)((Component)phone.dynamicGameplayScreen).transform.parent).GetComponent<Canvas>();
object value = val.Field("openPhoneCanvas").GetValue();
GameObject val2 = (GameObject)((value is GameObject) ? value : null);
_openPhoneCanvas = val2.GetComponent<Canvas>();
object value2 = val.Field("closedPhoneCanvas").GetValue();
GameObject val3 = (GameObject)((value2 is GameObject) ? value2 : null);
_closedPhoneCanvas = val3.GetComponent<Canvas>();
_phoneReady = true;
}
public void AddGraffitiGameReference(GraffitiGame game)
{
GameObject gameObject = ((Component)((Component)game).transform.Find("Targets")).gameObject;
gameObject.SetActive(_hudIsVisible);
_graffitiTargets.Add(gameObject);
GameObject gameObject2 = ((Component)((Component)game).transform.Find("BackgroundCircle")).gameObject;
gameObject2.SetActive(_hudIsVisible);
_graffitiTargets.Add(gameObject2);
}
public void RemoveGraffitiGameReference(GraffitiGame game)
{
GameObject gameObject = ((Component)((Component)game).transform.Find("Targets")).gameObject;
_graffitiTargets.Remove(gameObject);
GameObject gameObject2 = ((Component)((Component)game).transform.Find("BackgroundCircle")).gameObject;
_graffitiTargets.Remove(gameObject2);
}
public void AddGraffitiLineReference(LineRenderer line)
{
_graffitiLines.Add(line);
((Renderer)line).enabled = _hudIsVisible;
}
public void ClearGraffitiLineReferences(GraffitiGame game)
{
_graffitiLines.RemoveAll((LineRenderer line) => (Object)(object)((Component)line).transform.parent == (Object)(object)((Component)game).transform);
}
public void AddPlayerReference(Player player)
{
if (_config.HideSlopCrewNameplates.Value)
{
((MonoBehaviour)this).StartCoroutine(SetInitialNameplateState(player));
}
}
private IEnumerator SetInitialNameplateState(Player player)
{
yield return (object)new WaitForEndOfFrame();
Transform nameplate = ((Component)player.interactionCollider).transform.Find("SlopCrew_NameplateContainer");
if ((Object)(object)nameplate != (Object)null)
{
GameObject nameplateObject = ((Component)nameplate).gameObject;
_nameplates.Add(nameplateObject);
nameplateObject.SetActive(_hudIsVisible);
}
}
public void RemovePlayerReference(Player player)
{
if (_config.HideSlopCrewNameplates.Value)
{
Transform val = ((Component)player.interactionCollider).transform.Find("SlopCrew_NameplateContainer");
if ((Object)(object)val != (Object)null)
{
GameObject gameObject = ((Component)val).gameObject;
_nameplates.Remove(gameObject);
}
}
}
public void SetNotReady()
{
_phoneReady = false;
_hudIsVisible = true;
}
}
public class PluginConfig
{
private const string ConfigTitle = "Settings";
public ConfigEntry<KeyCode> ToggleKey { get; private set; }
public ConfigEntry<bool> HidePauseMenu { get; private set; }
public ConfigEntry<bool> HidePhone { get; private set; }
public ConfigEntry<bool> HideScreenEffects { get; private set; }
public ConfigEntry<bool> HideDialogue { get; private set; }
public ConfigEntry<bool> HideCypher { get; private set; }
public ConfigEntry<bool> HideDanceWheel { get; private set; }
public ConfigEntry<bool> HideGearSelect { get; private set; }
public ConfigEntry<bool> HideOutfitSelect { get; private set; }
public ConfigEntry<bool> HideDeathUI { get; private set; }
public ConfigEntry<bool> HideTaxiUI { get; private set; }
public ConfigEntry<bool> HideGraffitiUI { get; private set; }
public ConfigEntry<bool> HideSlopCrewNameplates { get; private set; }
public PluginConfig(ConfigFile file)
{
ToggleKey = file.Bind<KeyCode>("Settings", "Toggle Key", (KeyCode)111, (ConfigDescription)null);
HidePauseMenu = file.Bind<bool>("Settings", "Hide Pause Menu", false, (ConfigDescription)null);
HidePhone = file.Bind<bool>("Settings", "Hide Phone UI", true, (ConfigDescription)null);
HideScreenEffects = file.Bind<bool>("Settings", "Hide Screen Effects", true, (ConfigDescription)null);
HideDialogue = file.Bind<bool>("Settings", "Hide Dialogue UI", true, (ConfigDescription)null);
HideCypher = file.Bind<bool>("Settings", "Hide Character Select UI", true, (ConfigDescription)null);
HideDanceWheel = file.Bind<bool>("Settings", "Hide Dance Wheel", true, (ConfigDescription)null);
HideGearSelect = file.Bind<bool>("Settings", "Hide Gear Skin UI", false, (ConfigDescription)null);
HideOutfitSelect = file.Bind<bool>("Settings", "Hide Outfit Select UI", false, (ConfigDescription)null);
HideDeathUI = file.Bind<bool>("Settings", "Hide Death UI", false, (ConfigDescription)null);
HideTaxiUI = file.Bind<bool>("Settings", "Hide Taxi UI", false, (ConfigDescription)null);
HideGraffitiUI = file.Bind<bool>("Settings", "Hide Graffiti UI", true, (ConfigDescription)null);
HideSlopCrewNameplates = file.Bind<bool>("Settings", "Hide Slop Crew Nameplates", true, (ConfigDescription)null);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HideHud";
public const string PLUGIN_NAME = "HideHud";
public const string PLUGIN_VERSION = "1.1.2";
}
}
namespace HideHud.Patches
{
[HarmonyPatch(typeof(BaseModule), "SetupNewStage")]
public class BaseModulePatches
{
public static void Prefix()
{
Plugin.Instance.SetNotReady();
}
}
[HarmonyPatch(typeof(GraffitiGame), "Init")]
public class GraffitiGameInitPatch
{
public static void Postfix(GraffitiGame __instance)
{
Plugin.Instance.AddGraffitiGameReference(__instance);
}
}
[HarmonyPatch(typeof(GraffitiGame), "End")]
public class GraffitiGameEndPatch
{
public static void Postfix(GraffitiGame __instance)
{
Plugin.Instance.RemoveGraffitiGameReference(__instance);
Plugin.Instance.ClearGraffitiLineReferences(__instance);
}
}
[HarmonyPatch(typeof(GraffitiGame), "HitTarget")]
public class GraffitiGameHitTargetPatch
{
public static void Postfix(LineRenderer ___line)
{
Plugin.Instance.AddGraffitiLineReference(___line);
}
}
[HarmonyPatch(typeof(GraffitiGame), "InitVisual")]
public class GraffitiGameInitVisualPatch
{
public static void Postfix(LineRenderer ___line)
{
Plugin.Instance.AddGraffitiLineReference(___line);
}
}
[HarmonyPatch(typeof(Phone), "PhoneInit")]
public class PhoneInitPatch
{
public static void Postfix(Phone __instance)
{
Plugin.Instance.SetPhoneReferences(__instance);
}
}
[HarmonyPatch(typeof(Player), "Init")]
public class PlayerInitPatch
{
public static void Postfix(Player __instance)
{
Plugin.Instance.AddPlayerReference(__instance);
}
}
[HarmonyPatch(typeof(Player), "OnDestroy")]
public class PlayerOnDestroyPatch
{
public static void Prefix(Player __instance)
{
Plugin.Instance.RemovePlayerReference(__instance);
}
}
[HarmonyPatch(typeof(UIManager), "InitGameMenu")]
public class UIManagerInitPatch
{
public static void Postfix(UIManager __instance)
{
Plugin.Instance.SetMainReferences(__instance);
}
}
}