using System;
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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WK_More_Saves.core;
[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("WK_More_Saves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+727e94a82ade1f2ea71d0c2a41837bb821131287")]
[assembly: AssemblyProduct("WK_More_Saves")]
[assembly: AssemblyTitle("WK_More_Saves")]
[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 WK_More_Saves
{
[BepInPlugin("WK_More_Saves", "WK_More_Saves", "1.0.0")]
public class MoreSaves : BaseUnityPlugin
{
private bool _patched;
public static ConfigEntry<int> ConfigSaveNum;
private static Harmony _harmony;
public static ManualLogSource Log { get; private set; }
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
if (_patched)
{
Log.LogWarning((object)"Already Patched");
}
Log = ((BaseUnityPlugin)this).Logger;
ConfigSaveNum = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SaveNum", 1, "The current save file index to launch the game with");
_harmony = new Harmony("WK_More_Saves");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
SceneManager.sceneLoaded += UI.OnSceneLoad;
Log.LogInfo((object)"Plugin WK_More_Saves is loaded!");
_patched = true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "WK_More_Saves";
public const string PLUGIN_NAME = "WK_More_Saves";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace WK_More_Saves.patches
{
[HarmonyPatch(typeof(StatManager))]
public class StatManagerPatch
{
[HarmonyPatch("LoadStats")]
[HarmonyPrefix]
private static void LoadSave(StatManager __instance)
{
int value = MoreSaves.ConfigSaveNum.Value;
if (value != 0)
{
Directory.CreateDirectory(Path.Combine(Application.persistentDataPath, $"Save{value}"));
Traverse.Create((object)__instance).Field("filePath").SetValue((object)(Path.Combine(Application.persistentDataPath, $"Save-{value}\\save{value}.json") ?? ""));
}
}
}
}
namespace WK_More_Saves.core
{
public abstract class UI
{
public static void OnSceneLoad(Scene scene, LoadSceneMode loadSceneMode)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
if (!(((Scene)(ref scene)).name != "Main-Menu"))
{
GameObject gameObject = GameObject.Find("Play Game").gameObject;
((LayoutGroup)gameObject.AddComponent<HorizontalLayoutGroup>()).padding = new RectOffset(10, 10, 0, 0);
gameObject.AddComponent<ContentSizeFitter>().horizontalFit = (FitMode)2;
RectTransform component = gameObject.GetComponent<RectTransform>();
gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(component.sizeDelta.x + 100f, component.sizeDelta.y);
GameObject gameObject2 = ((Component)gameObject.transform.Find("Text (TMP)")).gameObject;
gameObject2.GetComponent<RectTransform>().pivot = new Vector2(0f, 0.5f);
gameObject2.GetComponent<TMP_Text>().text = $"PLAY - Save {MoreSaves.ConfigSaveNum.Value}";
gameObject2.AddComponent<ContentSizeFitter>().horizontalFit = (FitMode)2;
gameObject2.AddComponent<LayoutElement>().preferredHeight = 45f;
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)gameObject.transform.parent).GetComponent<RectTransform>());
}
}
}
}