Decompiled source of InstantScores v1.0.10

InstantScores.dll

Decompiled 20 hours ago
using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("InstantScores")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Trombone Champ instant scores")]
[assembly: AssemblyFileVersion("1.0.10.0")]
[assembly: AssemblyInformationalVersion("1.0.10+6c1c72039172dbf52068317f48fa562a5e86cf00")]
[assembly: AssemblyProduct("InstantScores")]
[assembly: AssemblyTitle("InstantScores")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.10.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 InstantScores
{
	[BepInPlugin("InstantScores", "InstantScores", "1.0.10")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("InstantScores").PatchAll();
		}
	}
	[HarmonyPatch(typeof(PointSceneController), "Start")]
	public class PointSceneControllerStartPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(PointSceneController), "doCoins")]
		public class PointSceneControllerDoCoinsPatch : MonoBehaviour
		{
			private static bool Prefix(PointSceneController __instance)
			{
				__instance.tootstext.text = "EARNED " + __instance.getTootsNum() + " TOOTS";
				__instance.totaltootstext.text = GlobalVariables.localsave.currency_toots.ToString("n0");
				return false;
			}
		}

		[HarmonyPatch(typeof(PointSceneController), "showContinue")]
		public class PointSceneControllerShowContinuePatch : MonoBehaviour
		{
			private static bool Prefix()
			{
				return false;
			}
		}

		public static Dictionary<string, int> Scores = new Dictionary<string, int>
		{
			{ "F", 0 },
			{ "D", 1 },
			{ "C", 2 },
			{ "B", 3 },
			{ "A", 4 },
			{ "S", 5 }
		};

		private static float trackdotspacing = 89.5f;

		private static float trackypos = 99f;

		private static float trackxpos = 179f;

		private static float trackdotsize = 20f;

		private static float trackbarheight = 6f;

		private static float trackfullwidth = trackdotspacing * 5f;

		private static float num = trackdotsize * 0.5f;

		private static bool Prefix(PointSceneController __instance)
		{
			SavedCardCollection localsave = GlobalVariables.localsave;
			localsave.tracks_played++;
			Plugin.Log.LogDebug((object)"Starting PointSceneController");
			Object.Destroy((Object)(object)GameObject.Find("Canvas/Perfect"));
			Object.Destroy((Object)(object)GameObject.Find("Canvas/buttons/coingroup/practice_turbo_flag"));
			Object.Destroy((Object)(object)GameObject.Find("Canvas/FullPanel/LeftLabels/txt-highscore"));
			__instance.screenfade.SetActive(false);
			__instance.sfx = __instance.sfxholder.GetComponents<AudioSource>();
			__instance.totalscore = GlobalVariables.gameplay_scoretotal;
			__instance.scorepercentage = GlobalVariables.gameplay_scoreperc;
			__instance.letterscore = getLetterScore(__instance.scorepercentage);
			__instance.scoreindex = Scores[__instance.letterscore];
			__instance.txt_trackname.text = GlobalVariables.chosen_track_data.trackname_long;
			__instance.txt_prevhigh.text = SaverLoader.grabHighestScore(GlobalVariables.chosen_track_data).ToString("n0");
			__instance.txt_score.text = __instance.totalscore.ToString("n0");
			__instance.giantscoretext.text = __instance.letterscore;
			__instance.giantscoretextshad.text = __instance.letterscore;
			__instance.txt_nasties.text = GlobalVariables.gameplay_notescores[0].ToString("n0");
			__instance.txt_mehs.text = GlobalVariables.gameplay_notescores[1].ToString("n0");
			__instance.txt_okays.text = GlobalVariables.gameplay_notescores[2].ToString("n0");
			__instance.txt_nices.text = GlobalVariables.gameplay_notescores[3].ToString("n0");
			__instance.txt_perfectos.text = GlobalVariables.gameplay_notescores[4].ToString("n0");
			setTrackPositions(__instance);
			__instance.wallbreak.SetActive(__instance.scorepercentage > 1.35f);
			__instance.scorepopupcamera.SetActive(false);
			for (int i = 0; i < 4; i++)
			{
				__instance.track_arrows_objs[i].SetActive(false);
				((Component)__instance.txt_scores_mp[i]).gameObject.SetActive(false);
				((Component)__instance.txt_scorelabels_mp[i]).gameObject.SetActive(false);
			}
			if (__instance.scoreindex > 3)
			{
				__instance.confettic.setUpConfetti();
				__instance.confettic.startConfetti();
			}
			__instance.startAnims();
			__instance.checkScoreCheevos();
			__instance.updateSave();
			__instance.doCoins();
			return false;
		}

		private static void setTrackPositions(PointSceneController __instance)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			__instance.track_barempty = getChild<RectTransform>(__instance.trackobj.transform, 0);
			__instance.track_barfill = getChild<RectTransform>(__instance.trackobj.transform, 1);
			__instance.track_arrow = getChild<RectTransform>(__instance.trackobj.transform, 2);
			RectTransform[] array = (RectTransform[])(object)new RectTransform[6];
			for (int i = 0; i < Scores.Count; i++)
			{
				RectTransform child = getChild<RectTransform>(__instance.trackobj.transform, i + 3);
				child.anchoredPosition3D = new Vector3(trackxpos - num + trackdotspacing * (float)i, 0f - trackypos + num, 0f);
				__instance.track_dotimages[i] = getChild<Image>(__instance.trackobj.transform, i + 3);
				__instance.track_dottxts[i] = getChild<Text>(((Component)child).transform, 0);
				__instance.track_ps[i] = getChild<ParticleSystem>(((Component)child).transform, 1);
				if (i <= __instance.scoreindex)
				{
					((Graphic)__instance.track_dotimages[i]).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue));
					((Graphic)__instance.track_dottxts[i]).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
				}
				array[i] = child;
			}
			__instance.track_dot0 = array[0];
			__instance.track_dot1 = array[1];
			__instance.track_dot2 = array[2];
			__instance.track_dot3 = array[3];
			__instance.track_dot4 = array[4];
			__instance.track_dot5 = array[5];
			__instance.track_arrow.anchoredPosition3D = new Vector3(trackxpos - 1f + trackfullwidth * __instance.scorepercentage, 0f - trackypos, 0f);
			__instance.track_barfill.SetSizeWithCurrentAnchors((Axis)0, trackfullwidth * __instance.scorepercentage);
			__instance.track_barfill.anchoredPosition3D = new Vector3(trackxpos, (float)((double)(0f - trackypos) + (double)trackbarheight * 0.5), 0f);
			__instance.track_barempty.anchoredPosition3D = new Vector3(trackxpos, (float)((double)(0f - trackypos) + (double)trackbarheight * 0.5), 0f);
			__instance.track_barempty.SetSizeWithCurrentAnchors((Axis)0, trackfullwidth);
		}

		private static T getChild<T>(Transform transform, int i)
		{
			return ((Component)transform.GetChild(i)).gameObject.GetComponent<T>();
		}

		private static string getLetterScore(float scorepercentage)
		{
			return (!(scorepercentage < 1f)) ? "S" : ((!(scorepercentage < 0.8f)) ? "A" : ((!(scorepercentage < 0.6f)) ? "B" : ((!(scorepercentage < 0.4f)) ? "C" : ((scorepercentage < 0.2f) ? "F" : "D"))));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "InstantScores";

		public const string PLUGIN_NAME = "InstantScores";

		public const string PLUGIN_VERSION = "1.0.10";
	}
}