using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BombRushMP.Plugin.Gamemodes; using HarmonyLib; using Microsoft.CodeAnalysis; using Reptile; using UnityEngine; using UnityEngine.UI; using VisFeedback.Patches; [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.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("VisFeedback")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.0.2.0")] [assembly: AssemblyInformationalVersion("3.0.2+c182a00b54e1e54df14ab8a9d87033924b15e56a")] [assembly: AssemblyProduct("Visual Feedback")] [assembly: AssemblyTitle("VisFeedback")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.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 VisFeedback { public class Animator : MonoBehaviour { public bool IsOn = false; public bool animating = false; public bool looping; public bool Interrupt; public List SL; public GameObject ovalay; public float framerate; public float duration; public string AnimName; public bool Impulse; public float frametimer; public float passedtime; private int index = 0; public int order; public int priority; public static int currentPrio; public configTemplate theConfig; public void initAnim(GameObject uovalay, List uSL, bool uImpulse, configTemplate configAccess) { theConfig = configAccess; ovalay = uovalay; SL = uSL; Impulse = uImpulse; } private void Update() { if (!Plugin.enable.Value) { if (Pawake.wasOn) { ((Behaviour)ovalay.GetComponent()).enabled = false; } return; } framerate = theConfig.Fps.Value; duration = theConfig.Duration.Value; AnimName = theConfig.Name.Value; looping = theConfig.Loop.Value; Interrupt = theConfig.Interupt.Value; order = theConfig.Order.Value; priority = theConfig.Prio.Value; IsOn = theConfig.Enable.Value; ((Behaviour)ovalay.GetComponent()).enabled = false; if (!IsOn) { return; } ovalay.GetComponent().sortingOrder = order; if (animating) { if (Interrupt) { if (priority < currentPrio) { animating = false; return; } currentPrio = priority; } index = 0; ((Behaviour)ovalay.GetComponent()).enabled = true; index = (int)Math.Floor(frametimer * framerate); ovalay.GetComponent().sprite = SL[index]; ((Behaviour)ovalay.GetComponent()).enabled = Plugin.visible.Value; if (Impulse && passedtime >= duration * (1f / framerate)) { ResetAll(); } if (index >= SL.Count - 1) { if (!looping) { passedtime += Time.deltaTime; return; } index = 0; frametimer = 0f; } passedtime += Time.deltaTime; frametimer += Time.deltaTime; } else { ResetAll(); if (priority == currentPrio) { currentPrio = 0; } ((Behaviour)ovalay.GetComponent()).enabled = false; } } public void ResetAll() { passedtime = 0f; frametimer = 0f; index = 0; animating = false; } } public class configTemplate { public string categoryName; public ConfigEntry Enable; public ConfigEntry Fps; public ConfigEntry Duration; public ConfigEntry Loop; public ConfigEntry Order; public ConfigEntry Prio; public ConfigEntry Name; public ConfigEntry Interupt; public configTemplate(string category, ConfigFile config) { categoryName = category; Enable = config.Bind(category + " Overlay", "Enable", false, ""); Fps = config.Bind(category + " Overlay", "Framerate", 1f, ""); Duration = config.Bind(category + " Overlay", "Duration", 1f, ""); Loop = config.Bind(category + " Overlay", "loop", true, ""); Order = config.Bind(category + " Overlay", "Order", 1, ""); Prio = config.Bind(category + " Overlay", "Priority", 1, ""); Name = config.Bind(category + " Overlay", "File Name", "test", ""); Interupt = config.Bind(category + " Overlay", "Interrupt", false, ""); base..ctor(); } } internal class initNewOvalay : MonoBehaviour { public GameObject theObject; public List theSpriteList; public Animator theAnimator; public initNewOvalay(configTemplate configtemp, bool impulse) { theObject = OvalayMaker(); theAnimator = theObject.AddComponent(typeof(Animator)) as Animator; theSpriteList = spritelistmaker(configtemp.Name.Value); theAnimator.initAnim(theObject, theSpriteList, impulse, configtemp); } public GameObject OvalayMaker() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(); Component obj = val.AddComponent(typeof(RectTransform)); RectTransform val2 = (RectTransform)(object)((obj is RectTransform) ? obj : null); Component obj2 = val.AddComponent(typeof(Canvas)); Canvas val3 = (Canvas)(object)((obj2 is Canvas) ? obj2 : null); val3.renderMode = (RenderMode)0; Component obj3 = val.AddComponent(typeof(Image)); Image val4 = (Image)(object)((obj3 is Image) ? obj3 : null); val2.anchoredPosition = new Vector2(0f, 0f); return val; } public static List spritelistmaker(string name) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) List list = new List(); bool flag = true; int num = 0; while (flag) { Debug.Log((object)(Paths.BepInExRootPath + "\\img/" + name + num + ".png")); if (File.Exists(Paths.BepInExRootPath + "\\img/" + name + num + ".png")) { Texture2D val = new Texture2D(1, 1); byte[] array = File.ReadAllBytes(Paths.BepInExRootPath + "\\img/" + name + num + ".png"); ImageConversion.LoadImage(val, array); Sprite item = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); list.Add(item); num++; } else { flag = false; } } return list; } } [BepInPlugin("VisFeedback", "Visual Feedback", "3.0.2")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static Harmony Harmony; public static ConfigEntry enable; public static ConfigEntry enableToggle; public static ConfigEntry visible; public static configTemplate gspot; public static configTemplate gspotRange; public static configTemplate p; public static configTemplate isCombo; public static configTemplate ComboDrop; public static configTemplate boost; public static configTemplate ComboTimeoutVis; public static configTemplate PressJump; public static configTemplate PressSpray; public static configTemplate PressMoveStyle; public static configTemplate PressSlide; public static configTemplate PressBoost; public static configTemplate PressTrick1; public static configTemplate PressTrick2; public static configTemplate PressTrick3; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Harmony = new Harmony("VisFeedback.Harmony"); Harmony.PatchAll(); enableToggle = ((BaseUnityPlugin)this).Config.Bind("1. General", "Toggle Enable Button", (KeyCode)0, "button to toggle visibiltiy"); enable = ((BaseUnityPlugin)this).Config.Bind("1. General", "Enable Plugin", true, "enable the plugin vro"); visible = ((BaseUnityPlugin)this).Config.Bind("1. General", "Overlay Visible", true, "show/hide overlay"); p = new configTemplate("Default", ((BaseUnityPlugin)this).Config); gspot = new configTemplate("Graffiti Spot", ((BaseUnityPlugin)this).Config); gspotRange = new configTemplate("Graffiti Spot in range", ((BaseUnityPlugin)this).Config); isCombo = new configTemplate("Is Comboin", ((BaseUnityPlugin)this).Config); ComboDrop = new configTemplate("Combo Drop", ((BaseUnityPlugin)this).Config); boost = new configTemplate("Boost", ((BaseUnityPlugin)this).Config); ComboTimeoutVis = new configTemplate("Combo Timeout Bar visable", ((BaseUnityPlugin)this).Config); PressJump = new configTemplate("Pressing Jump", ((BaseUnityPlugin)this).Config); PressSpray = new configTemplate("Pressing Spray", ((BaseUnityPlugin)this).Config); PressMoveStyle = new configTemplate("Pressing MoveStyle", ((BaseUnityPlugin)this).Config); PressSlide = new configTemplate("Pressing Slide", ((BaseUnityPlugin)this).Config); PressBoost = new configTemplate("Pressing Boost", ((BaseUnityPlugin)this).Config); PressTrick1 = new configTemplate("Pressing Trick1", ((BaseUnityPlugin)this).Config); PressTrick2 = new configTemplate("Pressing Trick2", ((BaseUnityPlugin)this).Config); PressTrick3 = new configTemplate("Pressing Trick3", ((BaseUnityPlugin)this).Config); } private void Update() { if (!Pawake.wasOn && enable.Value) { Pawake.Startup(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "VisFeedback"; public const string PLUGIN_NAME = "Visual Feedback"; public const string PLUGIN_VERSION = "3.0.2"; } } namespace VisFeedback.Patches { [HarmonyPatch(typeof(GraffitiRace), "MarkGraffitiSpotDone")] internal class GracePatch : MonoBehaviour { public static void Postfix(GraffitiRace __instance) { if (Plugin.enable.Value) { Pawake.gspotOva.theAnimator.animating = true; } } } [HarmonyPatch(typeof(GameplayUI), "OnStageInitialized")] internal class Pawake : MonoBehaviour { public static bool wasOn; public static initNewOvalay gspotOva; public static initNewOvalay gspotRangeOva; public static initNewOvalay isComboOva; public static initNewOvalay ComboDropOva; public static initNewOvalay pOva; public static initNewOvalay boostOva; public static initNewOvalay ComboTimeoutVisOva; public static initNewOvalay PressJumpOva; public static initNewOvalay PressSprayOva; public static initNewOvalay PressMoveStyleOva; public static initNewOvalay PressSlideOva; public static initNewOvalay PressBoostOva; public static initNewOvalay PressTrick1Ova; public static initNewOvalay PressTrick2Ova; public static initNewOvalay PressTrick3Ova; public static void Postfix(GameplayUI __instance) { if (!Plugin.enable.Value) { wasOn = false; } else { Startup(); } } public static void Startup() { pOva = new initNewOvalay(Plugin.p, impulse: false); gspotOva = new initNewOvalay(Plugin.gspot, impulse: true); gspotRangeOva = new initNewOvalay(Plugin.gspotRange, impulse: false); isComboOva = new initNewOvalay(Plugin.isCombo, impulse: false); ComboDropOva = new initNewOvalay(Plugin.ComboDrop, impulse: true); boostOva = new initNewOvalay(Plugin.boost, impulse: false); ComboTimeoutVisOva = new initNewOvalay(Plugin.ComboTimeoutVis, impulse: false); PressJumpOva = new initNewOvalay(Plugin.PressJump, impulse: false); PressSprayOva = new initNewOvalay(Plugin.PressSpray, impulse: false); PressMoveStyleOva = new initNewOvalay(Plugin.PressMoveStyle, impulse: false); PressSlideOva = new initNewOvalay(Plugin.PressSlide, impulse: false); PressBoostOva = new initNewOvalay(Plugin.PressBoost, impulse: false); PressTrick1Ova = new initNewOvalay(Plugin.PressTrick1, impulse: false); PressTrick2Ova = new initNewOvalay(Plugin.PressTrick2, impulse: false); PressTrick3Ova = new initNewOvalay(Plugin.PressTrick3, impulse: false); wasOn = true; } } [HarmonyPatch(typeof(Player))] internal class PhonePatch : MonoBehaviour { [HarmonyPostfix] [HarmonyPatch("FixedUpdatePlayer")] public static void Postfix1(Player __instance) { } } [HarmonyPatch(typeof(Player))] internal class PlayerPatch : MonoBehaviour { [HarmonyPostfix] [HarmonyPatch("FixedUpdatePlayer")] public static void Postfix1(Player __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!__instance.isAI && Plugin.enable.Value) { if (Input.GetKeyDown(Plugin.enableToggle.Value)) { Plugin.visible.Value = !Plugin.visible.Value; } Pawake.pOva.theAnimator.animating = true; if (Plugin.p.Interupt.Value) { Pawake.pOva.theAnimator.animating = Plugin.p.Prio.Value >= Animator.currentPrio; } Pawake.PressJumpOva.theAnimator.animating = __instance.jumpButtonHeld; Pawake.PressSprayOva.theAnimator.animating = __instance.sprayButtonHeld; Pawake.PressMoveStyleOva.theAnimator.animating = __instance.switchStyleButtonHeld; Pawake.PressSlideOva.theAnimator.animating = __instance.slideButtonHeld; Pawake.PressBoostOva.theAnimator.animating = __instance.boostButtonHeld; Pawake.PressTrick1Ova.theAnimator.animating = __instance.trick1ButtonHeld; Pawake.PressTrick2Ova.theAnimator.animating = __instance.trick2ButtonHeld; Pawake.PressTrick3Ova.theAnimator.animating = __instance.trick3ButtonHeld; Pawake.isComboOva.theAnimator.animating = __instance.IsComboing(); Pawake.gspotRangeOva.theAnimator.animating = __instance.graffitiContextAvailable > 0; Pawake.boostOva.theAnimator.animating = __instance.boosting; Pawake.ComboTimeoutVisOva.theAnimator.animating = __instance.ui.comboTimeOutBackdrop.fillAmount != 0f; } } [HarmonyPostfix] [HarmonyPatch("HitScore")] public static void Postfix2(Player __instance) { if (!__instance.isAI && Plugin.enable.Value) { Pawake.ComboDropOva.theAnimator.animating = true; } } } }