using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TextureReplacer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("TextureReplacer for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a090744b089e076c379064e79eeda665dc406c7a")]
[assembly: AssemblyProduct("TextureReplacer")]
[assembly: AssemblyTitle("TextureReplacer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 TextureReplacer
{
[BepInPlugin("TextureReplacer", "TextureReplacer for Lethal Company", "1.0")]
public class TextureReplacer : BaseUnityPlugin
{
private string[] texturepaths = new string[7] { "/TipsPoster2.png", "/posters.png", "/StickyNoteTex.png", "/manual1.png", "/manual2v2.png", "/manual3v2.png", "/manual4v2.png" };
private string[] hierarchypaths = new string[7] { "Environment/HangarShip/Plane.001", "Environment/HangarShip/Plane.001", "Environment/HangarShip/StickyNoteItem", "Environment/HangarShip/ClipboardManual/Plane", "Environment/HangarShip/ClipboardManual/Plane.001", "Environment/HangarShip/ClipboardManual/Plane.002", "Environment/HangarShip/ClipboardManual/Plane.003" };
private int[] materialnumber = new int[7] { 2, 1, 1, 1, 1, 1, 1 };
private Texture2D[] textures = (Texture2D[])(object)new Texture2D[7];
private static TextureReplacer Instance;
public void Awake()
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
}
else if ((Object)(object)Instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"TextureReplacer is loaded!");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Internal processing was implemented with reference to");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Solos_Poster_Changer by Solo, and we thanks to them cooperation!");
for (int i = 0; i < texturepaths.Length; i++)
{
if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loading!");
textures[i] = new Texture2D(2, 2);
ImageConversion.LoadImage(textures[i], File.ReadAllBytes(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + texturepaths[i]));
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Texture {i} loaded!");
}
}
SceneManager.sceneLoaded += OnSceneLoaded;
}
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions"))
{
((MonoBehaviour)this).StartCoroutine(LoadTextures());
}
}
private IEnumerator LoadTextures()
{
yield return (object)new WaitForSeconds(5f);
for (int i = 0; i < texturepaths.Length; i++)
{
if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() != (Object)null)
{
GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>().materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
}
else if ((Object)(object)GameObject.Find(hierarchypaths[i]).GetComponent<Renderer>() == (Object)null)
{
((Renderer)GameObject.Find(hierarchypaths[i]).GetComponent<MeshRenderer>()).materials[materialnumber[i] - 1].mainTexture = (Texture)(object)textures[i];
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TextureReplacer";
public const string PLUGIN_NAME = "TextureReplacer";
public const string PLUGIN_VERSION = "1.0.0";
}
}