Decompiled source of NotEnoughSubtitleKOR v1.0.4

NotEnoughSubtitleKR.dll

Decompiled 9 months 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 GameNetcodeStuff;
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.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Piggy3590.NotEnoughSubtitle";

		private const string modName = "Not Enough Subtitle";

		private const string modVersion = "1.0.4";

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

		private static Plugin Instance;

		public static 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(Plugin));
			harmony.PatchAll(typeof(PlayerBody));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(DepositItemsDeskPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace NotEnoughSubtitle.Patches
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	[HarmonyPatch("MicrophoneSpeak")]
	internal class DepositItemsDeskPatch
	{
		public static float speakTimer = 20f;

		public static AudioClip audioClip;

		private static int speakerNum;

		private static bool isRareDialogue;

		private static bool isDialogueRerolled;

		public static bool canBeHeard;

		[HarmonyPrefix]
		[HarmonyPatch("Update")]
		private static void Update_PreFix()
		{
			if (speakTimer < 100f)
			{
				speakTimer += Time.deltaTime;
			}
			if (canBeHeard)
			{
				if (speakerNum == 0 && speakTimer > 1f && speakTimer < 2f && !isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 귀하의 노력이 회사를 행복하게 만듭니다.";
				}
				if (speakerNum == 1 && speakTimer > 1f && speakTimer < 2f && !isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 우리는 여러분의 헌신을 소중하게 생각합니다.";
				}
				if (speakerNum == 2 && speakTimer > 1f && speakTimer < 2f && !isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 여러분의 수고는 회사에 매우 중요합니다.";
				}
				if (speakerNum == 3 && speakTimer > 1f && speakTimer < 2f && !isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 여러분의 정직한 업무는 회사의 귀중한 자산입니다.";
				}
				if (speakerNum == 4 && speakTimer > 1f && speakTimer < 2f && !isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 여러분은 진정한 전문가입니다.";
				}
				if (speakerNum == 0 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 와.";
				}
				if (speakerNum == 1 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 이 벽은 우리를 가둘 수 없-";
				}
				if (speakerNum == 1 && speakTimer > 5.5f && speakTimer < 6f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 가ㄷㅜㄹ";
				}
				if (speakerNum == 2 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 와.";
				}
				if (speakerNum == 3 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 회사는 항상 행복해야 합니다.";
				}
				if (speakerNum == 3 && speakTimer > 2f && speakTimer < 3f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 호ㅣ사는 항ㅅㅏㅇ";
				}
				if (speakerNum == 4 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 우리는 당신이 필요합니다.";
				}
				if (speakerNum == 5 && speakTimer > 2f && speakTimer < 3f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 이ㅣㅣㅣㅣ--";
				}
				if (speakerNum == 6 && speakTimer > 1f && speakTimer < 2f && isRareDialogue)
				{
					((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "<color=#F15F5F>???:</color> 계속해서 우리 투자자들의 만족도를 유지하세요.";
				}
			}
			if (speakTimer > 6f && speakTimer < 8f)
			{
				((TMP_Text)HUDManagerPatch.RsubtitleGUItext).text = "";
				isDialogueRerolled = false;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("MicrophoneSpeak")]
		public static bool MicrophoneSpeak_Prefix(ref AudioSource ___speakerAudio, ref AudioClip[] ___rareMicrophoneAudios, ref AudioClip[] ___microphoneAudios, ref Random ___CompanyLevelRandom)
		{
			speakTimer = 1f;
			if (!isDialogueRerolled)
			{
				isDialogueRerolled = true;
				if (___CompanyLevelRandom.NextDouble() < 0.029999999329447746)
				{
					speakerNum = ___CompanyLevelRandom.Next(0, ___rareMicrophoneAudios.Length);
					audioClip = ___rareMicrophoneAudios[speakerNum];
					isRareDialogue = true;
				}
				else
				{
					speakerNum = ___CompanyLevelRandom.Next(0, ___microphoneAudios.Length);
					audioClip = ___microphoneAudios[speakerNum];
					isRareDialogue = false;
				}
				___speakerAudio.PlayOneShot(audioClip, 1f);
			}
			return false;
		}
	}
	public static class PlayerBody
	{
		public static Transform playerBody;
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void Update_Postfix(ref Transform ___thisPlayerBody, ref bool ___isCameraDisabled)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!___isCameraDisabled && (Object)(object)GameObject.Find("SpeakerBox") != (Object)null)
			{
				if (Vector3.Distance(___thisPlayerBody.position, GameObject.Find("SpeakerBox").transform.position) <= 20f)
				{
					DepositItemsDeskPatch.canBeHeard = true;
				}
				else
				{
					DepositItemsDeskPatch.canBeHeard = 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> 이곳은 귀하의 자동 조종 함선이며,\n계약 기간 동안 여러분의 의식주가 이루어질 것입니다.";
			}
			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> 여러분들은 수익 할당량을 충족하지 못했기 때문에\n귀하의 성과는 표준 이하로 간주되었습니다.";
			}
			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 = 16f;
			RsubtitleGUItext = val2;
		}
	}
}