using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ModNames")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModNames")]
[assembly: AssemblyTitle("ModNames")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ModNames;
[BepInPlugin("com.WackyModer.ModNames", "ModNames", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
public ManualLogSource Log;
private GameObject mod_text;
private Canvas current_canvas;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ModNames is loaded!");
}
private void spawnshit()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
Canvas val = current_canvas;
val = GameObject.Find("Canvas (1)").GetComponent<Canvas>();
if ((Object)(object)val == (Object)null)
{
MonoBehaviour.print((object)"WTF?!??! There was no canvas object!");
return;
}
int num = 0;
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
mod_text = new GameObject("Mod_List_TextBox", new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
mod_text.transform.SetParent(((Component)val).transform);
TextMeshProUGUI component = mod_text.GetComponent<TextMeshProUGUI>();
((Graphic)component).raycastTarget = false;
if (pluginInfo.Key.Split(new char[1] { '.' }).Length == 3)
{
((TMP_Text)component).text = "";
if (pluginInfo.Key.Split(new char[1] { '.' })[2] == "ModNames")
{
((TMP_Text)component).text = "(This mod) ";
}
((TMP_Text)component).text = ((TMP_Text)component).text + $"{pluginInfo.Value} by \"{pluginInfo.Key.Split(new char[1] { '.' })[1]}\"";
}
else if (pluginInfo.Key.Split(new char[1] { '.' }).Length == 2)
{
((TMP_Text)component).text = $"{pluginInfo.Value} by \"{pluginInfo.Key.Split(new char[1] { '.' })[0]}\"";
}
else
{
((TMP_Text)component).text = "(Mod contains incorrect plugin info)";
}
((TMP_Text)component).font = LocalizedText.localizationTable.GetFont(Settings.Get().Language, false);
((Graphic)component).color = Color.black;
((Graphic)component).raycastTarget = false;
((TMP_Text)component).fontSize = 0.27f;
((TMP_Text)component).alignment = (TextAlignmentOptions)516;
RectTransform component2 = mod_text.GetComponent<RectTransform>();
Rect rect = ((Component)val).GetComponent<RectTransform>().rect;
_ = ((Rect)(ref rect)).height;
rect = ((Component)val).GetComponent<RectTransform>().rect;
_ = ((Rect)(ref rect)).width;
component2.anchorMin = new Vector2(1f, 0f);
component2.anchorMax = new Vector2(1f, 0f);
component2.sizeDelta = new Vector2(7f, 0.5f);
component2.anchoredPosition = new Vector2(-30f, (float)(100 + 80 * num));
component2.pivot = new Vector2(1f, 0f);
num++;
}
mod_text.SetActive(true);
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "MainMenu")
{
try
{
Object.Destroy((Object)(object)GameObject.Find("ModNamesCanvas"));
return;
}
catch
{
return;
}
}
bool flag = false;
for (int i = 0; i < GameObject.Find("Canvas (1)").transform.childCount; i++)
{
if (((Object)((Component)GameObject.Find("Canvas (1)").transform.GetChild(i)).gameObject).name == "Mod_List_TextBox")
{
flag = true;
break;
}
}
if (!flag)
{
spawnshit();
}
}
private void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ModNamesCanvas");
Canvas val2 = val.AddComponent<Canvas>();
val2.renderMode = (RenderMode)2;
current_canvas = val2;
val.AddComponent<CanvasScaler>();
Rect rect = ((Component)val2).GetComponent<RectTransform>().rect;
MonoBehaviour.print((object)((Rect)(ref rect)).height);
val2 = Object.FindObjectOfType<Canvas>();
MonoBehaviour.print((object)((Object)val2).name);
val2 = GameObject.Find("Canvas (1)").GetComponent<Canvas>();
MonoBehaviour.print((object)((Object)val2).name);
if ((Object)(object)val2 == (Object)null)
{
MonoBehaviour.print((object)"WTF?!??! There was no canvas object!");
return;
}
GameObject.Find("Canvas (1)/TEXT");
spawnshit();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ModNames";
public const string PLUGIN_NAME = "ModNames";
public const string PLUGIN_VERSION = "1.0.0";
}