Decompiled source of NotEnoughSubtitleRUS v1.0.0

NotEnoughSubtitleRU.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NotEnoughSubtitle.Patches;
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: AssemblyTitle("RadiationIsCool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadiationIsCool")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 NotEnoughSubtitle
{
	[BepInPlugin("Piggy3590.NotEnoughSubtitle", "Not Enough Subtitle", "1.0.0")]
	public class SubtitleModBase : BaseUnityPlugin
	{
		private const string modGUID = "Piggy3590.NotEnoughSubtitle";

		private const string modName = "Not Enough Subtitle";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Piggy3590.NotEnoughSubtitle");

		private static SubtitleModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Piggy3590.NotEnoughSubtitle");
			mls.LogInfo((object)"Not Enough Subtitle is loaded");
			harmony.PatchAll(typeof(SubtitleModBase));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(DepositItemsDeskPatch));
		}
	}
}
namespace NotEnoughSubtitle.Patches
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	[HarmonyPatch("MicrophoneSpeak")]
	internal class DepositItemsDeskPatch
	{
		public static float speakTimer = 20f;

		public static AudioClip audioClip;

		[HarmonyPatch("Update")]
		private static void Update_Fix()
		{
			if (speakTimer < 100f)
			{
				speakTimer += Time.deltaTime;
			}
			((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = ((Object)audioClip).name + "/" + speakTimer;
			if (((Object)audioClip).name == "Mic1" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> Your work keeps The Company happy.";
			}
			if (((Object)audioClip).name == "Mic2" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> We value your commitment.";
			}
			if (((Object)audioClip).name == "Mic3" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> We need you.";
			}
			if (((Object)audioClip).name == "Mic3" && speakTimer > 2f && speakTimer < 3f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> eeeeeeeee";
			}
			if (((Object)audioClip).name == "Mic4" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> Your handwork is invaluable to the company. ";
			}
			if (((Object)audioClip).name == "Mic6" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> Wa.";
			}
			if (((Object)audioClip).name == "Mic7" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> The Company must stay happy.";
			}
			if (((Object)audioClip).name == "Mic7" && speakTimer > 2f && speakTimer < 3f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> eetche compny muast";
			}
			if (((Object)audioClip).name == "Mic8" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> this wall cannot contain it-";
			}
			if (((Object)audioClip).name == "Mic8" && speakTimer > 2f && speakTimer < 3f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> ccontai n";
			}
			if (((Object)audioClip).name == "Mic9" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> Your honest work is invaluable to the Company.";
			}
			if (((Object)audioClip).name == "Mic10" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> You are true professionals.";
			}
			if (((Object)audioClip).name == "Mic11" && speakTimer > 1f && speakTimer < 2f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>???:</color> Keep our investors happy.";
			}
			if (speakTimer > 4f && speakTimer < 6f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
			}
		}

		[HarmonyPrefix]
		public static bool MicrophoneSpeak_Prefix(ref AudioSource ___speakerAudio, ref AudioClip[] ___rareMicrophoneAudios, ref AudioClip[] ___microphoneAudios, ref Random ___CompanyLevelRandom)
		{
			speakTimer = 0f;
			if (___CompanyLevelRandom.NextDouble() < 0.029999999329447746)
			{
				audioClip = ___rareMicrophoneAudios[___CompanyLevelRandom.Next(0, ___rareMicrophoneAudios.Length)];
			}
			else
			{
				audioClip = ___microphoneAudios[___CompanyLevelRandom.Next(0, ___microphoneAudios.Length)];
			}
			___speakerAudio.PlayOneShot(audioClip, 1f);
			return false;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		public static float introTimer = 5000f;

		public static float firedTimer = 5000f;

		public static float zeroDayTimer = 5000f;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix()
		{
			introTimer = 5000f;
			firedTimer = 5000f;
			zeroDayTimer = 5000f;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Update_Postfix()
		{
			if (introTimer < 5000f)
			{
				introTimer += Time.deltaTime;
			}
			if (firedTimer < 5000f)
			{
				firedTimer += Time.deltaTime;
			}
			if (zeroDayTimer < 5000f)
			{
				zeroDayTimer += Time.deltaTime;
			}
			if (introTimer > 7f && introTimer < 7.3f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Добро пожаловать на ваш первый рабочий день.";
			}
			if (introTimer > 10.1f && introTimer < 10.4f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Это ваш собственный корабль с автопилотом,";
			}
			if (introTimer > 12.5f && introTimer < 13f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  где вы едите и спите в течение всего срока действия вашего контракта.";
			}
			if (introTimer > 15.3f && introTimer < 15.5f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "(неразборчивые слова)";
			}
			if (introTimer > 20f && (double)introTimer < 20.3)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Чувствуйте себя как дома.";
			}
			if ((double)introTimer > 21.7 && introTimer < 22f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Завершите процесс регистрации,\nвам нужно будет проверить руководство по эксплуатации и войти в компьютерный терминал вашего корабля.";
			}
			if ((double)introTimer > 28.3 && introTimer < 29f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Мы уверены, что вы станете отличным работником для компании.";
			}
			if (introTimer > 31f && introTimer < 32f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  от-от-отличным работником для компании ...";
			}
			if (introTimer > 37f && introTimer < 38f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
			}
			if (firedTimer > 0.15f && firedTimer < 1f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Поскольку вы не выполнили норму прибыли,";
			}
			if (firedTimer > 2.2f && firedTimer < 2.5f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  ваши действия признаны ниже стандартных.";
			}
			if (firedTimer > 5.5f && firedTimer < 6f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Добро пожаловать на наш дисциплинарный процесс.";
			}
			if (firedTimer > 8f && firedTimer < 9f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
			}
			if (zeroDayTimer > 5.25f && zeroDayTimer < 5.5f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Немедленно явитесь в здание компании, чтобы продать металлолом и другие товары.";
			}
			if (zeroDayTimer > 10f && zeroDayTimer < 11f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  У вас осталось 0 дней, чтобы выполнить норму прибыли.";
			}
			if (zeroDayTimer > 13.4f && zeroDayTimer < 14f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#5CD1E5>КОМПЬЮТЕРНЫЙ ПИЛОТ:</color>  Вы можете использовать терминал, чтобы направить автопилот к зданию компании.";
			}
			if (zeroDayTimer > 17f && zeroDayTimer < 18f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("playersFiredGameOver")]
		private static void playersFiredGameOver_Postfix()
		{
			firedTimer = -5f;
		}

		[HarmonyPostfix]
		[HarmonyPatch("playDaysLeftAlertSFXDelayed")]
		private static void playDaysLeftAlertSFXDelayed_Postfix()
		{
			zeroDayTimer = -3f;
		}

		[HarmonyPostfix]
		[HarmonyPatch("firstDayAnimation")]
		private static void firstDayAnimation_Postfix()
		{
			introTimer = -6f;
		}

		[HarmonyPostfix]
		[HarmonyPatch("DisableShipSpeakerLocalClient")]
		private static void DisableShipSpeakerLocalClient_Postfix()
		{
			introTimer = 5000f;
			firedTimer = 5000f;
			zeroDayTimer = 5000f;
			((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		private static TextMeshProUGUI textComponent;

		public static TextMeshProUGUI RsubtitleGUItext;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(ref HUDManager __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("testSubtitlesGUI");
			val.AddComponent<RectTransform>();
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			RectTransform rectTransform = ((TMP_Text)val2).rectTransform;
			((Transform)rectTransform).SetParent(GameObject.Find("Systems/UI/Canvas/Panel/GameObject/PlayerScreen").transform, false);
			rectTransform.sizeDelta = new Vector2(600f, 200f);
			rectTransform.anchoredPosition = new Vector2(0f, -125f);
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).font = ((TMP_Text)__instance.controlTipLines[0]).font;
			((TMP_Text)val2).fontSize = 17f;
			RsubtitleGUItext = val2;
		}
	}
}