Decompiled source of POLISHKILL v1.1.7

plugins/POLISHKILL/POLISHKILL.dll

Decompiled 3 weeks 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.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;

[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[BepInPlugin("com.blanek.polishkill", "POLISHKILL", "1.0.4")]
public class PolishKill : BaseUnityPlugin
{
	[HarmonyPatch(typeof(AudioSource))]
	[HarmonyPatch("Play", new Type[] { })]
	private class Patch_Play
	{
		private static void Prefix(AudioSource __instance)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.clip == (Object)null))
			{
				string text = ((Object)__instance.clip).name.ToLower();
				AudioClip val = LoadReplacement(text);
				if ((Object)(object)val != (Object)null)
				{
					__instance.clip = val;
					__instance.volume *= VolumeBoost;
					Log.LogInfo((object)$"REPLACED → {text} (vol={__instance.volume})");
				}
			}
		}
	}

	[HarmonyPatch(typeof(AudioSource))]
	[HarmonyPatch("PlayOneShot", new Type[]
	{
		typeof(AudioClip),
		typeof(float)
	})]
	private class Patch_PlayOneShot
	{
		private static void Prefix(ref AudioClip clip, ref float volumeScale)
		{
			if (!((Object)(object)clip == (Object)null))
			{
				string text = ((Object)clip).name.ToLower();
				AudioClip val = LoadReplacement(text);
				if ((Object)(object)val != (Object)null)
				{
					clip = val;
					volumeScale *= VolumeBoost;
					Log.LogInfo((object)$"REPLACED (OneShot) → {text} (scale={volumeScale})");
				}
			}
		}
	}

	[HarmonyPatch(typeof(AudioSource))]
	[HarmonyPatch("PlayOneShot", new Type[] { typeof(AudioClip) })]
	private class Patch_PlayOneShot_Single
	{
		private static void Prefix(AudioSource __instance, ref AudioClip clip)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)clip == (Object)null))
			{
				string text = ((Object)clip).name.ToLower();
				AudioClip val = LoadReplacement(text);
				if ((Object)(object)val != (Object)null)
				{
					clip = val;
					__instance.volume *= VolumeBoost;
					Log.LogInfo((object)("REPLACED (OneShot-single) → " + text));
				}
			}
		}
	}

	[HarmonyPatch(typeof(StockMapInfo), "Awake")]
	private class Patch_CutsceneAudio
	{
		private static void Postfix()
		{
			AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
			foreach (AudioSource val in array)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.clip == (Object)null))
				{
					string text = ((Object)val.clip).name.ToLower();
					AudioClip val2 = LoadReplacement(text);
					if ((Object)(object)val2 != (Object)null)
					{
						val.clip = val2;
						val.volume *= VolumeBoost;
						Log.LogInfo((object)$"CUTSCENE REPLACED → {text} (vol={val.volume})");
					}
				}
			}
		}
	}

	[HarmonyPatch(typeof(StockMapInfo), "Awake")]
	private class Patch_Subtitles
	{
		private static void Postfix()
		{
			AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
			foreach (AudioSource val in array)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)val.clip == (Object)null)
				{
					continue;
				}
				string text = ((Object)val.clip).name.ToLower();
				SubtitledAudioSource component = ((Component)val).GetComponent<SubtitledAudioSource>();
				if (!((Object)(object)component == (Object)null))
				{
					if (text == "mp_intro2")
					{
						List<SubtitleDataLine> lines = new List<SubtitleDataLine>
						{
							Line("Aghh...", 0f),
							Line("Wkońcu wolny.", 2f),
							Line("O Gabrielu...", 6f),
							Line("Teraz nastała twoja godzina sądu.", 9f),
							Line("A twa krew, zabłyśnie przed świątyniami ludzi.", 13f),
							Line("Stworzenie ze stali...", 19.5f),
							Line("Wyrażam ci wdzięczność, za moją wolność.", 22f),
							Line("Lecz zbrodnie, których dopuścił się twój gatunek wobec ludzkości,", 29f),
							Line("NIE zostaną zapomniane.", 35f),
							Line("A twoją karą...", 39f),
							Line("Jest ŚMIERĆ!", 43.5f)
						};
						ApplySubtitles(component, lines);
					}
					if (text == "mp_deathscream")
					{
						List<SubtitleDataLine> lines2 = new List<SubtitleDataLine> { Line("Nuagh!", 0f) };
						ApplySubtitles(component, lines2);
					}
					if (text == "mp_outro")
					{
						List<SubtitleDataLine> lines3 = new List<SubtitleDataLine>
						{
							Line("Augh!", 0f),
							Line("Wybaczcie mi, moje dzieci...", 3f),
							Line("albowiem zawiodłem, w niesieniu wam zbawienia...", 6f),
							Line("z tego zimnego, mrocznego świata.", 10.3f)
						};
						ApplySubtitles(component, lines3);
					}
					if (text == "mp_useless")
					{
						List<SubtitleDataLine> lines4 = new List<SubtitleDataLine> { Line("Bezużyteczny.", 0f) };
						ApplySubtitles(component, lines4);
					}
					if (text == "gab_behold")
					{
						List<SubtitleDataLine> lines5 = new List<SubtitleDataLine> { Line("UJRZYJ! MOC ARCHANIOŁA!", 0f) };
						ApplySubtitles(component, lines5);
					}
					if (text == "gab_intro1d")
					{
						List<SubtitleDataLine> lines6 = new List<SubtitleDataLine>
						{
							Line("Maszyno, zawróć.", 1f),
							Line("Warstwy tego pałacu nie należą", 3.5f),
							Line("do twego gatunku.", 6.5f),
							Line("Zawróć, albo sprzeciwisz się", 8.8f),
							Line("woli Boga.", 11.8f)
						};
						ApplySubtitles(component, lines6);
					}
					if (text == "gab_intro2b")
					{
						List<SubtitleDataLine> lines7 = new List<SubtitleDataLine>
						{
							Line("Podjąłeś decyzję.", 0f),
							Line("W imieniu najświętszego Boga Ojca,", 2.3f),
							Line("rozerwę cię na strzępy", 5f),
							Line("i ponownie staniesz się obiektem nieożywionym.", 7.3f)
						};
						ApplySubtitles(component, lines7);
					}
					if (text == "gab_insignificant2b")
					{
						List<SubtitleDataLine> lines8 = new List<SubtitleDataLine>
						{
							Line("Co?", 0f),
							Line("Jak to możliwe?", 2.1f),
							Line("Pokonany przez to coś!?", 4.8f),
							Line("Ty nic nieznacząca KURWO!", 9.8f),
							Line("TO NIE JEST KONIEC!", 13.3f)
						};
						ApplySubtitles(component, lines8);
					}
					if (text == "gab_woes")
					{
						List<SubtitleDataLine> lines9 = new List<SubtitleDataLine>
						{
							Line("Niech twe udręki będą niezliczone...", 0f),
							Line("a dni policzone.", 3.5f)
						};
						ApplySubtitles(component, lines9);
					}
					if (text == "gab_hologramfiltered")
					{
						List<SubtitleDataLine> lines10 = new List<SubtitleDataLine>
						{
							Line("Nie lękaj się grzeszniku.", 0f),
							Line("Twoje oddanie Bogu", 2f),
							Line("świadczy o niemałym dobru, ", 3.4f),
							Line("które w tobie drzemie.", 5f),
							Line("Serce jest gotowe,", 6.3f),
							Line("lecz ciało musi zaznać spoczynku,", 7.7f),
							Line("byś nie zmarnował jednego z dzieł Pana.", 10f)
						};
						ApplySubtitles(component, lines10);
					}
					if (text == "sp_keepthemcoming")
					{
						List<SubtitleDataLine> lines11 = new List<SubtitleDataLine> { Line("Nie przestawaj!", 0f) };
						ApplySubtitles(component, lines11);
					}
					if (text == "sp_thisprison")
					{
						List<SubtitleDataLine> lines12 = new List<SubtitleDataLine>
						{
							Line("To więzienie...", 0f),
							Line("By utrzymać...", 1.5f),
							Line("MNIE?", 2.5f)
						};
						ApplySubtitles(component, lines12);
					}
					if (text == "sp_intro")
					{
						List<SubtitleDataLine> lines13 = new List<SubtitleDataLine>
						{
							Line("Odwiedziny?", 0f),
							Line("Hmm... W rzeczy samej, spałem wystarczająco długo.", 1.5f),
							Line("Królestwo niebios od dawna zapomniało o moim imieniu,", 8f),
							Line("a ja PRAGNĘ by je zapamiętali.", 12.8f),
							Line("Jednakże...", 16.3f),
							Line("Krew Minosa plami twoje ręce i muszę przyznać...", 17.7f),
							Line("Jestem ciekaw twoich umiejętności, Broni.", 22.8f),
							Line("Ale zanim zburzę miasta i ZMIAŻDŻĘ armię niebios...", 27f),
							Line("Ty przysłużysz jako przystawka.", 31.8f),
							Line("Chodźże dziecko człowieka...", 34.8f),
							Line("I UMRZYJ.", 37.5f)
						};
						ApplySubtitles(component, lines13);
					}
					if (text == "sp_outro")
					{
						List<SubtitleDataLine> lines14 = new List<SubtitleDataLine>
						{
							Line("Aghh...", 0f),
							Line("To tak się kończy życie i czasy Króla Syzyfa.", 1.5f),
							Line("Idealny koniec istnienia ukazany bezsensowną walką.", 6.3f),
							Line("Skazany na śmierć od samego początku...", 12.1f),
							Line("I nie żałuję ANI SEKUNDY!", 15.7f)
						};
						ApplySubtitles(component, lines14);
					}
					if (text == "gab2nd_6-1tease1")
					{
						List<SubtitleDataLine> lines15 = new List<SubtitleDataLine>
						{
							Line("Maszyno, wiem że tu jesteś.", 0.5f),
							Line("Czuję bluźnierczy zapach twoich pokrytych krwią dłoni.", 4.5f),
							Line("Czekam na ciebie na dole.", 10.4f)
						};
						ApplySubtitles(component, lines15);
					}
					if (text == "gab2nd_6-1tease2")
					{
						List<SubtitleDataLine> lines16 = new List<SubtitleDataLine> { Line("Przyjdź do mnie.", 0.3f) };
						ApplySubtitles(component, lines16);
					}
					if (text == "gab2nd_intro1b")
					{
						List<SubtitleDataLine> lines17 = new List<SubtitleDataLine>
						{
							Line("Limbo.", 2.2f),
							Line("Lust.", 3.8f),
							Line("Wszystko przepadło.", 5.3f),
							Line("A Gluttony wkrótce podzieli ich los.", 7.5f),
							Line("Wasz gatunek nie zna nic poza głodem,", 12f),
							Line("oczyściliście z życia wszystkie wyższe warstwy,", 15f),
							Line("a jednak pozostajecie nienasyceni...", 18.6f),
							Line("tak jak ty.", 21.6f),
							Line("Odebrałeś mi wszystko maszyno.", 24f),
							Line("I jedyne co pozostało to DOSKONAŁA NIENAWIŚĆ.", 26.8f)
						};
						ApplySubtitles(component, lines17);
					}
					if (text == "gab2nd_intro2")
					{
						List<SubtitleDataLine> lines18 = new List<SubtitleDataLine>
						{
							Line("Maszyno.", 1.5f),
							Line("Rozerwę cię na strzępy, rozbiję na kawałki,", 3f),
							Line("rozrzucę plugawe szczątki twej formy pośród gwiazd!", 6.6f),
							Line("Zetrę cię tak, że iskry same będą błagać o litość!", 10.4f),
							Line("Moje dłonie zaznają rozkoszy kończąc cię", 14.5f),
							Line("TU I TERAZ!", 18f)
						};
						ApplySubtitles(component, lines18);
					}
					if (text == "gab2nd_outro")
					{
						List<SubtitleDataLine> lines19 = new List<SubtitleDataLine>
						{
							Line("Dwa razy.", 0f),
							Line("Pokonany przez obiekt Dwa. Razy.", 1.3f),
							Line("Do tej pory znałem tylko smak zwycięstwa ale ten smak...", 5.1f),
							Line("Czy... czy to moja krew?", 9f),
							Line("Nigdy nie zaznałem takiej... ulgi.", 13.2f),
							Line("Potrzebuję chwilę czasu na myślenie.", 16.4f),
							Line("Spotkamy się ponownie, maszyno.", 20.8f)
						};
						ApplySubtitles(component, lines19);
					}
					if (text == "gab2nd_woes")
					{
						List<SubtitleDataLine> lines20 = new List<SubtitleDataLine>
						{
							Line("Niech twe udręki będą niezliczone...", 0f),
							Line("a dni policzone.", 4.1f)
						};
						ApplySubtitles(component, lines20);
					}
				}
			}
		}

		private static SubtitleDataLine Line(string text, float time)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SubtitleDataLine val = new SubtitleDataLine();
			val.subtitle = text;
			val.time = time;
			return val;
		}

		private static void ApplySubtitles(SubtitledAudioSource sub, List<SubtitleDataLine> lines)
		{
			Traverse val = Traverse.Create((object)sub).Field("subtitles");
			SubtitleData value = val.GetValue<SubtitleData>();
			value.lines = lines.ToArray();
		}
	}

	[HarmonyPatch(typeof(SubtitleController), "DisplaySubtitle", new Type[]
	{
		typeof(string),
		typeof(AudioSource),
		typeof(bool)
	})]
	private class Patch_TauntSubtitles
	{
		private static void Prefix(ref string caption, AudioSource audioSource, bool ignoreSetting)
		{
			if (!string.IsNullOrEmpty(caption))
			{
				Log.LogInfo((object)("TAUNT SUBTITLE → " + caption));
				if (caption == "Judgement!")
				{
					caption = "Osąd!";
				}
				else if (caption == "Die!")
				{
					caption = "Giń!";
				}
				else if (caption == "Crush!")
				{
					caption = "Miazga!";
				}
				else if (caption == "Prepare thyself!")
				{
					caption = "Przygotuj się!";
				}
				else if (caption == "Thy end is now!")
				{
					caption = "Nastąpił twój koniec!";
				}
				else if (caption == "WEAK")
				{
					caption = "ZA SŁABO.";
				}
				else if (caption == "You defy the light")
				{
					caption = "Podważasz światło!";
				}
				else if (caption == "A mere object")
				{
					caption = "Zwykły obiekt!";
				}
				else if (caption == "There can be only light")
				{
					caption = "Tylko światło może istnieć.";
				}
				else if (caption == "Foolishness, machine. Foolishness.")
				{
					caption = "Głupota, maszyno. Głupota.";
				}
				else if (caption == "An imperfection to be cleansed")
				{
					caption = "Skaza, którą należy oczyścić.";
				}
				else if (caption == "Not. Even. Mortal.")
				{
					caption = "Nawet. Nie jesteś. Żywy.";
				}
				else if (caption == "You are less than nothing")
				{
					caption = "Jesteś mniej niż niczym.";
				}
				else if (caption == "You're an error to be corrected")
				{
					caption = "Jesteś błędem, który należy naprawić!";
				}
				else if (caption == "The light is perfection")
				{
					caption = "Światło jest doskonałością!";
				}
				else if (caption == "You are outclassed")
				{
					caption = "Jesteś bez szans!";
				}
				else if (caption == "Your crime is existence")
				{
					caption = "Twoją zbrodnią jest istnienie!";
				}
				else if (caption == "You make even the devil cry")
				{
					caption = "Sprawiasz, że nawet diabeł płacze!";
				}
				else if (caption == "Enough!")
				{
					caption = "WYSTARCZY!";
				}
				else if (caption == "You can't escape!")
				{
					caption = "Nie uciekniesz!";
				}
				else if (caption == "BE GONE!")
				{
					caption = "ZDYCHAJ!";
				}
				else if (caption == "Nice try!")
				{
					caption = "Nieźle!";
				}
				else if (caption == "DESTROY!")
				{
					caption = "DESTRUKCJA!";
				}
				else if (caption == "This will hurt.")
				{
					caption = "To zaboli.";
				}
				else if (caption == "YES! That's it!")
				{
					caption = "DOKŁADNIE TAK!";
				}
				else if (caption == "IS THIS WHAT I LOST TO!?")
				{
					caption = "CZY TO Z TYM PRZEGRAŁEM!?";
				}
				else if (caption == "YOU'RE GETTING RUSTY, MACHINE!")
				{
					caption = "STAJESZ SIĘ ZARDZEWIAŁY, MASZYNO!";
				}
				else if (caption == "LET'S SETTLE THIS!")
				{
					caption = "ROZSTRZYGNIJMY TO!";
				}
				else if (caption == "NOTHING BUT SCRAP!")
				{
					caption = "ZWYKŁY ZŁOM!";
				}
				else if (caption == "I'LL SHOW YOU DIVINE JUSTICE!")
				{
					caption = "POKAŻĘ CI BOSKĄ SPRAWIEDLIWOŚĆ!";
				}
				else if (caption == "TIME TO RIGHT MY WRONG!")
				{
					caption = "CZAS NAPRAWIĆ MÓJ BŁĄD!";
				}
				else if (caption == "YOU NEED. MORE. POWER!")
				{
					caption = "POTRZEBUJESZ. WIĘCEJ. MOCY!";
				}
				else if (caption == "I've never had a fight like this before!")
				{
					caption = "Nigdy nie brałem udziału w takiej walce!";
				}
				else if (caption == "Show me what you were made for!")
				{
					caption = "Pokaż mi do czego cię stworzyli!";
				}
				else if (caption == "Now THIS is a fight worthy of God's Will!")
				{
					caption = "No i TO jest walka godna Woli Boga!";
				}
				else if (caption == "What is this FEELING?")
				{
					caption = "Co to za uczucie?";
				}
				else if (caption == "Come get some BLOOD!")
				{
					caption = "Przyjdź po swoją krew!";
				}
				else if (caption == "Come on, machine! Fight me like an ANIMAL!")
				{
					caption = "Dawaj maszyno! Walcz ze mną jak zwierzę!";
				}
				else if (caption == "I'll show you TRUE splendor!")
				{
					caption = "Pokażę ci PRAWDZIWY majestat!";
				}
				else if (caption == "IS THAT THE BEST YOU'VE GOT!?")
				{
					caption = "CZY TO WSZYSTKO NA CO CIĘ STAĆ!?";
				}
			}
		}
	}

	[HarmonyPatch(typeof(SubtitleController), "DisplaySubtitle", new Type[]
	{
		typeof(string),
		typeof(AudioSource),
		typeof(bool)
	})]
	private class Patch_TauntSubtitlesMDK
	{
		private static void Prefix(ref string caption)
		{
			string input = caption;
			input = Regex.Replace(input, "<.*?>", "");
			switch (input)
			{
			case "Finally, our waiting puzzle is over":
				caption = caption.Replace(input, "Wreszcie, nasza czekająca zagadka dobiegła końca.");
				break;
			case "What":
				caption = caption.Replace(input, "Co?");
				break;
			case "I'm going to fucking poison you":
				caption = caption.Replace(input, "Zamierzam cię kurwa otruć!");
				break;
			case "Why are we in the past":
				caption = caption.Replace(input, "Czemu jesteśmy w przeszłości?");
				break;
			case "Hold still":
				caption = caption.Replace(input, "Nie ruszaj się...");
				break;
			case "You cannot imagine what you'll face here":
				caption = caption.Replace(input, "Nawet nie wiesz co cię napotka.");
				break;
			case "I'm gonna shoot em with a gun":
				caption = caption.Replace(input, "Po prostu go zastrzelę!");
				break;
			case "Through the magic of the Druids, I increase my speed!":
				caption = caption.Replace(input, "Dzięki magi Druidów, wzmacniam moją prędkość!");
				break;
			case "Just fucking hit em":
				caption = caption.Replace(input, "Po prostu go kurwa traf!");
				break;
			case "Feel my maximum speed!":
				caption = caption.Replace(input, "Poczuj moją prawdziwą prędkość!");
				break;
			case "Slow down":
				caption = caption.Replace(input, "Zwolnij!");
				break;
			case "Use the salt!":
				caption = caption.Replace(input, "Skorzystaj z soli!");
				break;
			case "I'm reaching!":
				caption = caption.Replace(input, "Już sięgam!");
				break;
			case "Oh great, now we lost the fight, fantastic":
				caption = caption.Replace(input, "Oh zajebiście, przegraliśmy walkę, świetnie.");
				break;
			}
		}
	}

	internal static ManualLogSource Log;

	internal static string AudioDir;

	internal static float VolumeBoost = 2.5f;

	internal static TMP_FontAsset PolishFont;

	private void Awake()
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		AudioDir = Path.Combine(directoryName, "POLISHKILL_Audio");
		LoadPolishFont();
		ApplyFontFallback();
		Log.LogInfo((object)"POLISHKILL LOADED");
		Log.LogInfo((object)"REPLACING AUDIO...");
		new Harmony("com.blanek.polishkill").PatchAll();
	}

	private void LoadPolishFont()
	{
		try
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "polishkillfonts");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogError((object)"FONT BUNDLE FAILED TO LOAD");
				return;
			}
			PolishFont = val.LoadAsset<TMP_FontAsset>("polishkillfonts");
			if ((Object)(object)PolishFont == (Object)null)
			{
				Log.LogError((object)"FONT ASSET NOT FOUND IN BUNDLE");
			}
			else
			{
				Log.LogInfo((object)"POLISH FONT LOADED");
			}
		}
		catch (Exception ex)
		{
			Log.LogError((object)ex);
		}
	}

	private void ApplyFontFallback()
	{
		if (!((Object)(object)PolishFont == (Object)null))
		{
			if (!TMP_Settings.fallbackFontAssets.Contains(PolishFont))
			{
				TMP_Settings.fallbackFontAssets.Add(PolishFont);
			}
			PolishFont.ReadFontAssetDefinition();
			Log.LogInfo((object)"POLISH FONT ADDED AS FALLBACK");
		}
	}

	private static AudioClip LoadReplacement(string clipName)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Invalid comparison between Unknown and I4
		string text = Path.Combine(AudioDir, clipName + ".wav");
		string text2 = Path.Combine(AudioDir, clipName + ".ogg");
		string text3 = null;
		AudioType val = (AudioType)0;
		if (File.Exists(text))
		{
			text3 = text;
			val = (AudioType)20;
		}
		else
		{
			if (!File.Exists(text2))
			{
				return null;
			}
			text3 = text2;
			val = (AudioType)14;
		}
		UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + text3, val);
		try
		{
			audioClip.SendWebRequest();
			while (!audioClip.isDone)
			{
			}
			if ((int)audioClip.result != 1)
			{
				Log.LogError((object)("FAILED LOAD → " + text3));
				return null;
			}
			AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
			((Object)content).name = clipName;
			return content;
		}
		finally
		{
			((IDisposable)audioClip)?.Dispose();
		}
	}
}