Decompiled source of Inferno v0.6.60

Plugins/bro-CustomRundownLabels/CustomRundownLabels.dll

Decompiled 6 months ago
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.Text.Json;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using GameData;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using TMPro;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CustomRundownLabels")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomRundownLabels")]
[assembly: AssemblyTitle("CustomRundownLabels")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomRundownLabels;

public class ConfigSerializer<T> where T : new()
{
	private string JsonPath;

	private T JsonSettings;

	private FileStream JsonFile;

	private JsonSerializerOptions JsonOptions;

	public T Settings => JsonSettings;

	public ConfigSerializer(string jsonName)
	{
		JsonPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), jsonName + ".json");
		JsonSettings = new T();
		JsonOptions = new JsonSerializerOptions
		{
			AllowTrailingCommas = true,
			WriteIndented = true
		};
		if (File.Exists(JsonPath))
		{
			JsonFile = File.OpenRead(JsonPath);
			JsonSettings = JsonSerializer.Deserialize<T>(JsonFile, JsonOptions);
		}
		else
		{
			JsonFile = File.OpenWrite(JsonPath);
			JsonSerializer.Serialize(JsonFile, JsonSettings, JsonOptions);
		}
		JsonFile.Close();
	}
}
[BepInPlugin("me.bro.customrundownlabels", "CustomRundownLabels", "1.0.0")]
public class EntryPoint : BasePlugin
{
	public ConfigSerializer<fucking> Fucking;

	public override void Load()
	{
		PlayFabManager.OnTitleDataUpdated += Action.op_Implicit((Action)Setup);
	}

	public void Setup()
	{
		Fucking = new ConfigSerializer<fucking>("CustomRundownName");
		int num = 0;
		Enumerator<CM_RundownSelection> enumerator = MainMenuGuiLayer.Current.PageRundownNew.m_rundownSelections.GetEnumerator();
		while (enumerator.MoveNext())
		{
			CM_RundownSelection current = enumerator.Current;
			if ((Object)(object)current.m_altText != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)current.m_altText).gameObject);
			}
			((TMP_Text)current.m_rundownText).text = Fucking.Settings.Labels[num];
			num++;
		}
	}
}
public class fucking
{
	public bool UseCustomNames { get; set; }

	public List<string> Labels { get; set; }

	public fucking()
	{
		Labels = new List<string> { "R1", "R7", "R2", "R3", "R4", "R5", "R6", "R8" };
	}

	private void nextfucking()
	{
		Enumerator<CM_RundownSelection> enumerator = MainMenuGuiLayer.Current.PageRundownNew.m_rundownSelections.GetEnumerator();
		while (enumerator.MoveNext())
		{
			CM_RundownSelection current = enumerator.Current;
			uint num = uint.Parse(current.RundownKey.Substring("Local_".Length));
			if (GameDataBlockBase<RundownDataBlock>.s_blockByID != null && GameDataBlockBase<RundownDataBlock>.s_blockByID.ContainsKey(num))
			{
				RundownDataBlock val = GameDataBlockBase<RundownDataBlock>.s_blockByID[num];
				string untranslatedText = val.StorytellingData.Title.UntranslatedText;
				Labels.Add(untranslatedText);
			}
		}
	}
}