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 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.8.0")]
[assembly: AssemblyInformationalVersion("1.0.8")]
[assembly: AssemblyProduct("InstantScores")]
[assembly: AssemblyTitle("InstantScores")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.8.0")]
[module: UnverifiableCode]
namespace InstantScores;
[BepInPlugin("InstantScores", "InstantScores", "1.0.8")]
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>();
int gameplay_scoretotal = GlobalVariables.gameplay_scoretotal;
float gameplay_scoreperc = GlobalVariables.gameplay_scoreperc;
string letterScore = getLetterScore(gameplay_scoreperc);
int num = Scores[letterScore];
__instance.totalscore = gameplay_scoretotal;
__instance.scorepercentage = gameplay_scoreperc;
__instance.letterscore = letterScore;
__instance.scoreindex = num;
__instance.txt_trackname.text = GlobalVariables.chosen_track_data.trackname_long;
__instance.txt_prevhigh.text = SaverLoader.grabHighestScore(GlobalVariables.chosen_track_data.trackref).ToString("n0");
__instance.txt_score.text = gameplay_scoretotal.ToString("n0");
__instance.giantscoretext.text = letterScore;
__instance.giantscoretextshad.text = 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, gameplay_scoreperc, num);
__instance.wallbreak.SetActive(gameplay_scoreperc > 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 (num > 3)
{
__instance.confettic.setUpConfetti();
__instance.confettic.startConfetti();
}
__instance.startAnims();
__instance.checkScoreCheevos();
__instance.updateSave();
__instance.doCoins();
return false;
}
private static void setTrackPositions(PointSceneController __instance, float scorepercentage, int scoreindex)
{
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
RectTransform child = getChild<RectTransform>(__instance.trackobj.transform, 0);
RectTransform child2 = getChild<RectTransform>(__instance.trackobj.transform, 1);
RectTransform child3 = getChild<RectTransform>(__instance.trackobj.transform, 2);
for (int i = 0; i < Scores.Count; i++)
{
RectTransform child4 = getChild<RectTransform>(__instance.trackobj.transform, i + 3);
child4.anchoredPosition3D = new Vector3(trackxpos - num + trackdotspacing * (float)i, 0f - trackypos + num, 0f);
if (i <= scoreindex)
{
Image child5 = getChild<Image>(__instance.trackobj.transform, i + 3);
((Graphic)child5).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue));
Text child6 = getChild<Text>(((Component)child4).transform, 0);
((Graphic)child6).color = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
}
}
child3.anchoredPosition3D = new Vector3(trackxpos - 1f + trackfullwidth * scorepercentage, 0f - trackypos, 0f);
child2.SetSizeWithCurrentAnchors((Axis)0, trackfullwidth * scorepercentage);
child2.anchoredPosition3D = new Vector3(trackxpos, (float)((double)(0f - trackypos) + (double)trackbarheight * 0.5), 0f);
child.anchoredPosition3D = new Vector3(trackxpos, (float)((double)(0f - trackypos) + (double)trackbarheight * 0.5), 0f);
child.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.8";
}