using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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("GoidaLoad")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GoidaLoad")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ba99c000-4b6d-4ef3-9dda-ef050f9aaf4e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public static class FontLoader
{
public static TMP_FontAsset russianFont;
public static void LoadLocalFont()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
string directoryName = Path.GetDirectoryName(typeof(FontLoader).Assembly.Location);
string text = Path.Combine(directoryName, "Tiny5-Regular.ttf");
if (!File.Exists(text))
{
Debug.LogError((object)("[WHTestMod] Файл шрифта не найден: " + text));
return;
}
Debug.Log((object)("[WHTestMod] Загружаем шрифт с диска: " + text));
Font val = new Font(text);
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"[WHTestMod] Не удалось создать Font из файла!");
return;
}
russianFont = TMP_FontAsset.CreateFontAsset(val);
if ((Object)(object)russianFont != (Object)null)
{
Debug.Log((object)("[WHTestMod] Успешно создан TMP_FontAsset: " + ((Object)russianFont).name));
}
else
{
Debug.LogError((object)"[WHTestMod] Ошибка при создании TMP_FontAsset!");
}
}
}
[BepInPlugin("ru.terra.goidaload", "GoidaLoad", "1.0.6")]
public class GoidaLoad : BaseUnityPlugin
{
[HarmonyPatch(typeof(UT_Intro), "EndIntro")]
public static class EndIntroPatch
{
[CompilerGenerated]
private sealed class <UpdateLoadingText>d__1 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public UT_Intro intro;
public AsyncOperation op;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateLoadingText>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
intro.onEnd.Invoke();
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
break;
case 3:
<>1__state = -1;
<>2__current = null;
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
if ((double)op.progress >= 0.89)
{
op.allowSceneActivation = true;
}
break;
}
if (!op.isDone)
{
intro.loadPercentageText.enableAutoSizing = true;
intro.loadPercentageText.fontSizeMin = 16f;
intro.loadPercentageText.fontSizeMax = 36f;
intro.loadPercentageText.font = FontLoader.russianFont;
intro.loadPercentageText.text = $"Гойда: {Mathf.RoundToInt(op.progress * 100f)}%";
<>2__current = null;
<>1__state = 3;
return true;
}
intro.loadPercentageText.enableAutoSizing = true;
intro.loadPercentageText.fontSizeMin = 16f;
intro.loadPercentageText.fontSizeMax = 36f;
intro.loadPercentageText.font = FontLoader.russianFont;
intro.loadPercentageText.text = $"Гойда: {Mathf.RoundToInt(op.progress * 100f)}%";
op.allowSceneActivation = true;
Debug.Log((object)"[GoidaLoad] Загрузка завершена");
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPostfix]
public static void Postfix(UT_Intro __instance, AsyncOperation ___loadMenuOperation)
{
Debug.Log((object)"[GoidaLoad] EndIntro вызван — запускаем патч!");
if ((Object)(object)__instance.loadPercentageText != (Object)null)
{
__instance.loadPercentageText.enableAutoSizing = true;
__instance.loadPercentageText.fontSizeMin = 16f;
__instance.loadPercentageText.fontSizeMax = 36f;
__instance.loadPercentageText.font = FontLoader.russianFont;
__instance.loadPercentageText.text = "Гойда: 0%";
Debug.Log((object)"Установлен текст.");
((MonoBehaviour)__instance).StartCoroutine(UpdateLoadingText(__instance, ___loadMenuOperation));
Debug.Log((object)"Запустил корутину");
}
}
[IteratorStateMachine(typeof(<UpdateLoadingText>d__1))]
private static IEnumerator UpdateLoadingText(UT_Intro intro, AsyncOperation op)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateLoadingText>d__1(0)
{
intro = intro,
op = op
};
}
[HarmonyPrefix]
public static void Prefix(UT_Intro __instance)
{
((MonoBehaviour)__instance).StopCoroutine("WaitOneFrame");
Debug.Log((object)"[GoidaLoad] Остановил стандартную корутину");
}
}
public static GoidaLoad Instance { get; private set; }
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("ru.terra.goidaload");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"GoidaLoad загружен!");
FontLoader.LoadLocalFont();
}
private void OnEnable()
{
Instance = this;
}
}