using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SWEMenuCleaner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SWEMenuCleaner")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("13aac952-dfd1-4f49-8187-a9da2fcd71a7")]
[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")]
namespace SWEMenuCleaner;
[BepInPlugin("com.SWE.MenuCleaner", "SWE Menu Cleaner", "1.7.0")]
public class SWECleanerPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(FejdStartup), "Update")]
private class MenuPatch
{
private static float temporizador;
private static void Postfix(FejdStartup __instance)
{
if (!((Component)__instance).gameObject.activeInHierarchy)
{
return;
}
temporizador += Time.deltaTime;
if (temporizador < 0.5f)
{
return;
}
temporizador = 0f;
GameObject val = GameObject.Find("StartGui");
if ((Object)(object)val != (Object)null)
{
Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true);
foreach (Transform val2 in componentsInChildren)
{
string text = ((Object)val2).name.ToLower();
if ((text.Contains("store") || text.Contains("merch") || text.Contains("hugin") || text.Contains("changelog") || text.Contains("twitter") || text.Contains("discord") || text.Contains("facebook")) && ((Component)val2).gameObject.activeSelf)
{
((Component)val2).gameObject.SetActive(false);
}
}
}
MonoBehaviour[] array = Resources.FindObjectsOfTypeAll<MonoBehaviour>();
foreach (MonoBehaviour val3 in array)
{
if ((Object)(object)val3 == (Object)null || !((Component)val3).gameObject.activeInHierarchy)
{
continue;
}
PropertyInfo property = ((object)val3).GetType().GetProperty("text");
if (!(property != null))
{
continue;
}
try
{
string text2 = property.GetValue(val3, null) as string;
if (!string.IsNullOrEmpty(text2))
{
string text3 = text2.ToLower();
if (text3.Contains("versión de valheim con mods") || text3.Contains("modded") || text3.Contains("afectar a la experiencia") || text3.Contains("welcome to valheim"))
{
((Component)val3).gameObject.SetActive(false);
}
}
}
catch
{
}
}
}
}
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(MenuPatch), (string)null);
}
}