using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using OpenShot; using OpenShot.Events; using OpenShot.UI; using Shooterlatro.Core; using Shooterlatro.Game; using Shooterlatro.Input; using Shooterlatro.Weapons; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Menugun")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Dedicated menu pistol for Lucky Shot: high fire rate, outline look, one shot per click. Configure via OpenShot MODS hub.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+4135dd1490a61fe647f2a0e54287f36471f5cf7f")] [assembly: AssemblyProduct("Menugun")] [assembly: AssemblyTitle("Menugun")] [assembly: AssemblyVersion("1.2.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Menugun { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.liamgaming.menugun", "Menugun", "1.2.0")] public class MenugunPlugin : BaseUnityPlugin { private struct RendererMaterialBackup { public Renderer Renderer; public Material[] Materials; } [HarmonyPatch(typeof(WeaponManager), "EquipWeapon")] private static class WeaponManager_EquipWeapon_Patch { private static void Postfix() { MenugunPlugin instance = Instance; if (!((Object)(object)instance == (Object)null) && IsMenuGunActive()) { instance.ReapplyMenuGunState(forceOutline: true); } } } [HarmonyPatch(typeof(Weapon), "IsFiringInputHeld")] private static class Weapon_IsFiringInputHeld_Patch { private static void Postfix(ref bool __result) { if (IsMenuGunActive() && ForceSemiAuto.Value) { bool flag = Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame; ControllerInputService instance = ControllerInputService.Instance; bool flag2 = (Object)(object)instance != (Object)null && instance.WasFirePressedThisFrame(); __result = flag || flag2; } } } [HarmonyPatch(typeof(Weapon), "PlayRecoil")] private static class Weapon_PlayRecoil_Patch { private static bool Prefix() { if (IsMenuGunActive()) { return !DisableRecoil.Value; } return true; } } [HarmonyPatch(typeof(RecoilController), "ResolveBallistics")] private static class RecoilController_ResolveBallistics_Patch { private static bool Prefix(Vector3 baseDirection, ref RecoilBallisticsResult __result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!IsMenuGunActive() || !DisableRecoil.Value) { return true; } Vector3 finalDirection = ((((Vector3)(ref baseDirection)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref baseDirection)).normalized : Vector3.forward); __result = new RecoilBallisticsResult { FinalDirection = finalDirection, ChainIndex = 0, DidReset = false, RecoilHorizontalDeg = 0f, RecoilVerticalDeg = 0f, RecoilDeltaHorizontalDeg = 0f, RecoilDeltaVerticalDeg = 0f, ChainResetMs = 0f, SpreadDeg = 0f }; return false; } } [HarmonyPatch(typeof(RecoilController), "OnShotFired")] private static class RecoilController_OnShotFired_Patch { private static bool Prefix() { if (IsMenuGunActive()) { return !DisableRecoil.Value; } return true; } } public const string PluginGuid = "com.liamgaming.menugun"; public const string PluginName = "Menugun"; public const string PluginVersion = "1.2.0"; private const string HologramShaderName = "Shooterlatro/HologramURP"; private Harmony _harmony; private bool _menuModeActive; private bool _hadInfiniteAmmo; private bool _savedUseAutomaticFire; private WeaponData _savedAutomaticWeaponData; private readonly List _rendererBackups = new List(); private readonly List _outlineMaterials = new List(); private GameObject _lastOutlinedModel; private Shader _hologramShader; private static readonly string[] OutlinePresets = new string[7] { "Ice", "Cyan", "Magenta", "Gold", "Red", "White", "Lime" }; public static MenugunPlugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public static ConfigEntry Enabled { get; private set; } public static ConfigEntry MenuFireRate { get; private set; } public static ConfigEntry EnableOutline { get; private set; } public static ConfigEntry HideKeychain { get; private set; } public static ConfigEntry DisableRecoil { get; private set; } public static ConfigEntry ForceSemiAuto { get; private set; } public static ConfigEntry BasePistolOnly { get; private set; } public static ConfigEntry RimIntensity { get; private set; } public static ConfigEntry RimPower { get; private set; } public static ConfigEntry BaseFill { get; private set; } public static ConfigEntry OutlineBrightness { get; private set; } public static ConfigEntry OutlineColor { get; private set; } public static ConfigEntry OutlinePreset { get; private set; } private void Awake() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Use the first pistol as a dedicated menu gun in menus."); MenuFireRate = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "FireRate", 30f, new ConfigDescription("Shots per second while the menu gun is active (still max 1 shot per click).", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 60f), Array.Empty())); EnableOutline = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "EnableOutline", true, "Apply hologram outline look on the menu pistol."); HideKeychain = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "HideKeychain", true, "Hide keychain/charm visuals while menu gun is active."); DisableRecoil = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "DisableRecoil", true, "Suppress recoil / ballistics kick in menus."); ForceSemiAuto = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "ForceSemiAuto", true, "Force one shot per click (disable automatic fire)."); BasePistolOnly = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "BasePistolOnly", true, "Prefer the base pistol (no skin variations) as menu gun."); RimIntensity = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "RimIntensity", 3f, new ConfigDescription("Outline edge strength (higher = stronger rim).", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); RimPower = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "RimPower", 5.5f, new ConfigDescription("Outline thinness (higher = tighter edge, less fill).", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 8f), Array.Empty())); BaseFill = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "BaseFill", 0.03f, new ConfigDescription("Interior fill brightness. Keep near 0 for outline-only.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.35f), Array.Empty())); OutlineBrightness = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "OutlineBrightness", 3.2f, new ConfigDescription("Hologram brightness multiplier for the outline material.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 8f), Array.Empty())); OutlineColor = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "OutlineColor", new Color(0.85f, 0.9f, 1f, 1f), "Rim / outline tint color."); OutlinePreset = ((BaseUnityPlugin)this).Config.Bind("MenuGun", "OutlinePreset", "Ice", "Named outline color preset (Ice, Cyan, Magenta, Gold, Red, White, Lime)."); ModMenu.Tab("Menugun").Toggle(Enabled).Info("— Behaviour —") .Float("Fire Rate", MenuFireRate, 1f, "F0") .Bool("Force Semi-Auto", ForceSemiAuto) .Bool("Disable Recoil", DisableRecoil) .Bool("Hide Keychain", HideKeychain) .Bool("Base Pistol Only", BasePistolOnly) .Info("— Outline —") .Bool("Enable Outline", EnableOutline) .Cycle("Color Preset", (Func)(() => OutlinePreset.Value), (Action)CycleOutlinePreset) .Float("Rim Intensity", RimIntensity, 0.1f, "F1") .Float("Rim Power", RimPower, 0.1f, "F1") .Float("Base Fill", BaseFill, 0.01f, "F2") .Float("Brightness", OutlineBrightness, 0.1f, "F1") .Button("Reapply Look", (Action)delegate { if (IsMenuGunActive()) { Instance?.ApplyOutlineIfNeeded(force: true); } }); OutlinePreset.SettingChanged += delegate { ApplyOutlinePreset(OutlinePreset.Value); }; ApplyOutlinePreset(OutlinePreset.Value); EnableOutline.SettingChanged += delegate { if (IsMenuGunActive()) { if (EnableOutline.Value) { Instance?.ApplyOutlineIfNeeded(force: true); } else { Instance?.RestoreOriginalMaterials(); } } }; OpenShotApi.OnSettingsChanged += HandleSettingsChanged; _harmony = new Harmony("com.liamgaming.menugun"); _harmony.PatchAll(typeof(MenugunPlugin).Assembly); GameEvents.OnGamePhaseChanged += HandleGamePhaseChanged; if ((Object)(object)GameManager.Instance != (Object)null && IsMenuPhase(GameManager.Instance.Phase)) { EnterMenuGunMode(); } Log.LogInfo((object)"Menugun v1.2.0 loaded (OpenShot 2.0.0)."); } private static void CycleOutlinePreset() { int num = Array.IndexOf(OutlinePresets, OutlinePreset.Value); if (num < 0) { num = 0; } OutlinePreset.Value = OutlinePresets[(num + 1) % OutlinePresets.Length]; } private static void ApplyOutlinePreset(string name) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) ConfigEntry outlineColor = OutlineColor; outlineColor.Value = (Color)(name switch { "Cyan" => new Color(0.2f, 0.95f, 1f, 1f), "Magenta" => new Color(1f, 0.25f, 0.9f, 1f), "Gold" => new Color(1f, 0.82f, 0.25f, 1f), "Red" => new Color(1f, 0.28f, 0.28f, 1f), "White" => new Color(1f, 1f, 1f, 1f), "Lime" => new Color(0.45f, 1f, 0.35f, 1f), _ => new Color(0.85f, 0.9f, 1f, 1f), }); if (IsMenuGunActive() && EnableOutline.Value) { Instance?.ApplyOutlineIfNeeded(force: true); } } private void OnDestroy() { OpenShotApi.OnSettingsChanged -= HandleSettingsChanged; GameEvents.OnGamePhaseChanged -= HandleGamePhaseChanged; ExitMenuGunMode(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!Enabled.Value) { if (_menuModeActive) { ExitMenuGunMode(); } return; } GameManager instance = GameManager.Instance; if (!((Object)(object)instance == (Object)null)) { bool flag = IsMenuPhase(instance.Phase); if (flag && !_menuModeActive) { EnterMenuGunMode(); } else if (!flag && _menuModeActive) { ExitMenuGunMode(); } } } private static void HandleSettingsChanged(SettingsChangedContext ctx) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (string.Equals(ctx.ModTab, "Menugun", StringComparison.OrdinalIgnoreCase) && IsMenuGunActive()) { Instance?.ReapplyMenuGunState(); } } private void ReapplyMenuGunState(bool forceOutline = false) { EnsureMenuPistolEquipped(); ApplyMenuStats(); if (EnableOutline.Value) { ApplyOutlineIfNeeded(forceOutline); } else { RestoreOriginalMaterials(); } SetKeychainHidden(HideKeychain.Value); } private void HandleGamePhaseChanged(GamePhaseChangedContext ctx) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Enabled.Value && ctx != null) { if (IsMenuPhase(ctx.Current)) { EnterMenuGunMode(); } else if (_menuModeActive) { ExitMenuGunMode(); } } } internal static bool IsMenuPhase(GamePhase phase) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)phase != 7) { return (int)phase == 9; } return true; } internal static bool IsMenuGunActive() { if ((Object)(object)Instance != (Object)null && Instance._menuModeActive) { return Enabled.Value; } return false; } private void EnterMenuGunMode() { if (_menuModeActive) { EnsureMenuPistolEquipped(); ApplyMenuStats(); if (EnableOutline.Value) { ApplyOutlineIfNeeded(force: true); } else { RestoreOriginalMaterials(); } SetKeychainHidden(HideKeychain.Value); return; } Weapon instance = Weapon.Instance; if ((Object)(object)instance != (Object)null) { _hadInfiniteAmmo = instance.HasInfiniteAmmo; } _menuModeActive = true; EnsureMenuPistolEquipped(); ApplyMenuStats(); if (EnableOutline.Value) { ApplyOutlineIfNeeded(force: true); } SetKeychainHidden(HideKeychain.Value); Log.LogInfo((object)"Menu gun active."); } private void ExitMenuGunMode() { if (_menuModeActive) { RestoreOriginalMaterials(); RestoreMenuStats(); SetKeychainHidden(hidden: false); _menuModeActive = false; Log.LogInfo((object)"Menu gun deactivated."); } } private static void SetKeychainHidden(bool hidden) { WeaponManager instance = WeaponManager.Instance; if ((Object)(object)instance != (Object)null) { instance.SetKeychainCharmVisualsHidden(hidden); } } private void EnsureMenuPistolEquipped() { WeaponManager instance = WeaponManager.Instance; if (!((Object)(object)instance == (Object)null) && instance.AvailableWeapons != null && instance.AvailableWeapons.Count != 0) { WeaponData val = ResolveMenuPistol(instance); if (!((Object)(object)val == (Object)null) && (Object)(object)instance.CurrentWeaponData != (Object)(object)val) { instance.SwitchToWeapon(val); } } } private static WeaponData ResolveMenuPistol(WeaponManager manager) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) IReadOnlyList availableWeapons = manager.AvailableWeapons; if (BasePistolOnly.Value) { for (int i = 0; i < availableWeapons.Count; i++) { WeaponData val = availableWeapons[i]; if ((Object)(object)val != (Object)null && (int)val.weaponName == 0 && (Object)(object)val.variationOf == (Object)null) { return val; } } } for (int j = 0; j < availableWeapons.Count; j++) { WeaponData val2 = availableWeapons[j]; if ((Object)(object)val2 != (Object)null && (int)val2.weaponName == 0) { return val2; } } return availableWeapons[0]; } private void ApplyMenuStats() { Weapon instance = Weapon.Instance; if ((Object)(object)instance == (Object)null) { return; } float num = Mathf.Clamp(MenuFireRate.Value, 0.1f, 60f); Traverse.Create((object)instance).Field("_fireRate").SetValue((object)num); Traverse.Create((object)instance).Field("_cooldownSeconds").SetValue((object)0f); instance.SetInfiniteAmmo(true); WeaponData weaponData = instance.WeaponData; if ((Object)(object)weaponData != (Object)null && ForceSemiAuto.Value) { if ((Object)(object)_savedAutomaticWeaponData != (Object)(object)weaponData) { _savedUseAutomaticFire = weaponData.useAutomaticFire; _savedAutomaticWeaponData = weaponData; } weaponData.useAutomaticFire = false; } } private void RestoreMenuStats() { Weapon instance = Weapon.Instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)instance.WeaponData != (Object)null) { Traverse.Create((object)instance).Field("_fireRate").SetValue((object)Mathf.Clamp(instance.WeaponData.fireRate, 0.1f, 60f)); } instance.SetInfiniteAmmo(_hadInfiniteAmmo); } if ((Object)(object)_savedAutomaticWeaponData != (Object)null) { _savedAutomaticWeaponData.useAutomaticFire = _savedUseAutomaticFire; _savedAutomaticWeaponData = null; } } private void ApplyOutlineIfNeeded(bool force) { WeaponManager instance = WeaponManager.Instance; if (!((Object)(object)instance == (Object)null)) { GameObject value = Traverse.Create((object)instance).Field("_currentWeaponModel").GetValue(); if (!((Object)(object)value == (Object)null) && (force || !((Object)(object)value == (Object)(object)_lastOutlinedModel) || _rendererBackups.Count <= 0)) { RestoreOriginalMaterials(); ApplyOutlineLook(value); _lastOutlinedModel = value; } } } private Shader ResolveHologramShader() { if ((Object)(object)_hologramShader != (Object)null) { return _hologramShader; } _hologramShader = Shader.Find("Shooterlatro/HologramURP"); if ((Object)(object)_hologramShader == (Object)null) { Log.LogWarning((object)"Could not find shader 'Shooterlatro/HologramURP'. Outline look unavailable."); } return _hologramShader; } private void ApplyOutlineLook(GameObject model) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) Shader val = ResolveHologramShader(); if ((Object)(object)val == (Object)null || !EnableOutline.Value) { return; } Color value = OutlineColor.Value; float value2 = RimIntensity.Value; float value3 = RimPower.Value; float value4 = BaseFill.Value; float value5 = OutlineBrightness.Value; Renderer[] componentsInChildren = model.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null) { continue; } Material[] materials = val2.materials; if (materials != null && materials.Length != 0) { _rendererBackups.Add(new RendererMaterialBackup { Renderer = val2, Materials = materials }); Material[] array = (Material[])(object)new Material[materials.Length]; for (int j = 0; j < materials.Length; j++) { Material val3 = new Material(val) { name = (((Object)(object)materials[j] != (Object)null) ? ((Object)materials[j]).name : "Weapon") + " (Menugun Outline)" }; ConfigureOutlineMaterial(val3, value, value2, value3, value4, value5); array[j] = val3; _outlineMaterials.Add(val3); } val2.materials = array; } } } private static void ConfigureOutlineMaterial(Material mat, Color tint, float rim, float power, float fill, float brightness) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (mat.HasProperty("_Tint")) { mat.SetColor("_Tint", tint); } if (mat.HasProperty("_Color")) { mat.SetColor("_Color", tint); } if (mat.HasProperty("_BaseColor")) { mat.SetColor("_BaseColor", tint); } if (mat.HasProperty("_Brightness")) { mat.SetFloat("_Brightness", brightness); } if (mat.HasProperty("_BaseIntensity")) { mat.SetFloat("_BaseIntensity", fill); } if (mat.HasProperty("_RimPower")) { mat.SetFloat("_RimPower", power); } if (mat.HasProperty("_RimIntensity")) { mat.SetFloat("_RimIntensity", rim); } if (mat.HasProperty("_GridIntensity")) { mat.SetFloat("_GridIntensity", 0f); } if (mat.HasProperty("_ScanIntensity")) { mat.SetFloat("_ScanIntensity", 0f); } if (mat.HasProperty("_NoiseIntensity")) { mat.SetFloat("_NoiseIntensity", 0f); } if (mat.HasProperty("_SoftFade")) { mat.SetFloat("_SoftFade", 0f); } if (mat.HasProperty("_UseMainTex")) { mat.SetFloat("_UseMainTex", 0f); } if (mat.HasProperty("_HueOnly")) { mat.SetFloat("_HueOnly", 1f); } if (mat.HasProperty("_Render_Over_Everything")) { mat.SetFloat("_Render_Over_Everything", 1f); } if (mat.HasProperty("_ZTest")) { mat.SetFloat("_ZTest", 4f); } if (mat.HasProperty("_ZWrite")) { mat.SetFloat("_ZWrite", 0f); } mat.EnableKeyword("_HUE_ONLY"); mat.DisableKeyword("_USE_MAINTEX"); mat.renderQueue = 4000; } private void RestoreOriginalMaterials() { for (int i = 0; i < _rendererBackups.Count; i++) { RendererMaterialBackup rendererMaterialBackup = _rendererBackups[i]; if ((Object)(object)rendererMaterialBackup.Renderer != (Object)null && rendererMaterialBackup.Materials != null) { rendererMaterialBackup.Renderer.materials = rendererMaterialBackup.Materials; } } _rendererBackups.Clear(); for (int j = 0; j < _outlineMaterials.Count; j++) { if ((Object)(object)_outlineMaterials[j] != (Object)null) { Object.Destroy((Object)(object)_outlineMaterials[j]); } } _outlineMaterials.Clear(); _lastOutlinedModel = null; } } }