using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using HarmonyLib;
using LCBetterSaves;
using LCBetterSaves.Properties;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[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("LCBetterSaves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Better save files for Lethal Company")]
[assembly: AssemblyFileVersion("1.7.3.0")]
[assembly: AssemblyInformationalVersion("1.7.3+a2dc06eb8878819ddec7c1fd8cd6bac050c25d3c")]
[assembly: AssemblyProduct("LCBetterSaves")]
[assembly: AssemblyTitle("LCBetterSaves")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.3.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;
}
}
}
public class NewFileUISlot_BetterSaves : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
public bool isSelected;
public void Awake()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
buttonAnimator = ((Component)this).GetComponent<Animator>();
button = ((Component)this).GetComponent<Button>();
((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
}
public void SetFileToThis()
{
string currentSaveFileName = "LCSaveFile" + Plugin.newSaveFileNum;
GameNetworkManager.Instance.currentSaveFileName = currentSaveFileName;
GameNetworkManager.Instance.saveFileNum = Plugin.newSaveFileNum;
SetButtonColorForAllFileSlots();
isSelected = true;
SetButtonColor();
}
public void SetButtonColorForAllFileSlots()
{
SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
SaveFileUISlot_BetterSaves[] array2 = array;
foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
{
saveFileUISlot_BetterSaves.SetButtonColor();
saveFileUISlot_BetterSaves.deleteButton.SetActive(false);
saveFileUISlot_BetterSaves.renameButton.SetActive(false);
}
}
public void SetButtonColor()
{
buttonAnimator.SetBool("isPressed", isSelected);
}
}
public class SaveFileUISlot_BetterSaves : MonoBehaviour
{
public Animator buttonAnimator;
public Button button;
public TextMeshProUGUI fileStatsText;
public int fileNum;
public string fileString;
public TextMeshProUGUI fileNotCompatibleAlert;
public GameObject deleteButton;
public GameObject renameButton;
public void Awake()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
buttonAnimator = ((Component)this).GetComponent<Animator>();
button = ((Component)this).GetComponent<Button>();
((UnityEvent)button.onClick).AddListener(new UnityAction(SetFileToThis));
fileStatsText = ((Component)((Component)this).transform.GetChild(2)).GetComponent<TextMeshProUGUI>();
fileNotCompatibleAlert = ((Component)((Component)this).transform.GetChild(4)).GetComponent<TextMeshProUGUI>();
deleteButton = ((Component)((Component)this).transform.GetChild(3)).gameObject;
}
public void Start()
{
UpdateStats();
}
private void OnEnable()
{
if (!Object.FindObjectOfType<MenuManager>().filesCompatible[fileNum])
{
((Behaviour)fileNotCompatibleAlert).enabled = true;
}
}
public void UpdateStats()
{
try
{
if (ES3.FileExists(fileString))
{
int num = ES3.Load<int>("GroupCredits", fileString, 30);
int num2 = ES3.Load<int>("Stats_DaysSpent", fileString, 0);
((TMP_Text)fileStatsText).text = $"${num}\nDays: {num2}";
}
else
{
((TMP_Text)fileStatsText).text = "";
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error updating stats: " + ex.Message));
}
}
public void SetButtonColor()
{
buttonAnimator.SetBool("isPressed", GameNetworkManager.Instance.currentSaveFileName == fileString);
}
public void SetFileToThis()
{
Plugin.fileToModify = fileNum;
GameNetworkManager.Instance.currentSaveFileName = fileString;
GameNetworkManager.Instance.saveFileNum = fileNum;
SetButtonColorForAllFileSlots();
}
public void SetButtonColorForAllFileSlots()
{
SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
SaveFileUISlot_BetterSaves[] array2 = array;
foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
{
saveFileUISlot_BetterSaves.SetButtonColor();
saveFileUISlot_BetterSaves.deleteButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
saveFileUISlot_BetterSaves.renameButton.SetActive((Object)(object)saveFileUISlot_BetterSaves == (Object)(object)this);
}
NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = Object.FindObjectOfType<NewFileUISlot_BetterSaves>();
newFileUISlot_BetterSaves.isSelected = false;
newFileUISlot_BetterSaves.SetButtonColor();
}
}
public class RenameFileButton_BetterSaves : MonoBehaviour
{
public void RenameFile()
{
string text = $"LCSaveFile{Plugin.fileToModify}";
string text2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions/OptionsNormal/ServerNameField/Text Area/Text").GetComponent<TMP_Text>().text;
if (ES3.FileExists(text))
{
ES3.Save<string>("Alias_BetterSaves", text2, text);
Debug.Log((object)("Granted alias " + text2 + " to file " + text));
}
Plugin.RefreshNameFields();
}
}
public class DeleteFileButton_BetterSaves : MonoBehaviour
{
public int fileToDelete;
public AudioClip deleteFileSFX;
public TextMeshProUGUI deleteFileText;
public void UpdateFileToDelete()
{
fileToDelete = Plugin.fileToModify;
if (ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") != "")
{
((TMP_Text)deleteFileText).text = "Do you want to delete file (" + ES3.Load<string>("Alias_BetterSaves", $"LCSaveFile{fileToDelete}", "") + ")?";
}
else
{
((TMP_Text)deleteFileText).text = $"Do you want to delete File {fileToDelete + 1}?";
}
}
public void DeleteFile()
{
string text = $"LCSaveFile{fileToDelete}";
if (ES3.FileExists(text))
{
ES3.DeleteFile(text);
Object.FindObjectOfType<MenuManager>().MenuAudio.PlayOneShot(deleteFileSFX);
}
SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>(true);
SaveFileUISlot_BetterSaves[] array2 = array;
foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
{
Debug.Log((object)$"Deleted {fileToDelete}");
if (saveFileUISlot_BetterSaves.fileNum == fileToDelete)
{
((Behaviour)saveFileUISlot_BetterSaves.fileNotCompatibleAlert).enabled = false;
Object.FindObjectOfType<MenuManager>().filesCompatible[fileToDelete] = true;
if (ES3.FileExists($"LGU_{fileToDelete}.json"))
{
Debug.Log((object)("Deleting LGU file located at " + text));
ES3.DeleteFile($"LGU_{fileToDelete}.json");
}
}
}
Plugin.InitializeBetterSaves();
}
}
namespace LCBetterSaves
{
[BepInPlugin("LCBetterSaves", "LCBetterSaves", "1.7.3")]
public class Plugin : BaseUnityPlugin
{
private Harmony _harmony = new Harmony("BetterSaves");
public static int fileToModify = -1;
public static int newSaveFileNum;
public static Sprite renameSprite;
public static MenuManager menuManager;
public static AudioClip deleteFileSFX;
public static TextMeshProUGUI deleteFileText;
public static float buttonBaseY;
public void Awake()
{
_harmony.PatchAll(typeof(Plugin));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LCBetterSaves is loaded!");
}
[HarmonyPatch(typeof(MenuManager), "Start")]
public static void Postfix(MenuManager __instance)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
menuManager = __instance;
if ((Object)(object)renameSprite == (Object)null)
{
AssetBundle val = AssetBundle.LoadFromMemory(Resources.lcbettersaves);
Texture2D val2 = val.LoadAsset<Texture2D>("Assets/RenameSprite.png");
renameSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
}
InitializeBetterSaves();
}
public static void InitializeBetterSaves()
{
try
{
DestroyBetterSavesButtons();
DestroyOriginalSaveButtons();
UpdateTopText();
CreateModdedDeleteFileButton();
CreateBetterSaveButtons();
UpdateFilesPanelRect(CountSaveFiles() + 1);
GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
val.SetActive(false);
}
catch (Exception ex)
{
Debug.LogError((object)("An error occurred during initialization: " + ex.Message));
}
}
public static void DestroyBetterSavesButtons()
{
try
{
SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array)
{
Object.Destroy((Object)(object)((Component)saveFileUISlot_BetterSaves).gameObject);
}
NewFileUISlot_BetterSaves[] array2 = Object.FindObjectsOfType<NewFileUISlot_BetterSaves>();
foreach (NewFileUISlot_BetterSaves newFileUISlot_BetterSaves in array2)
{
Object.Destroy((Object)(object)((Component)newFileUISlot_BetterSaves).gameObject);
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error occurred while destroying better saves buttons: " + ex.Message));
}
}
public static void UpdateTopText()
{
GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/EnterAName");
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Panel label not found.");
}
else
{
((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = "BetterSaves";
}
}
public static void CreateModdedDeleteFileButton()
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
GameObject val = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete");
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Delete file game object not found.");
return;
}
if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() != (Object)null)
{
Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
return;
}
DeleteFileButton component = val.GetComponent<DeleteFileButton>();
if ((Object)(object)component == (Object)null)
{
Debug.LogError((object)"DeleteFileButton component not found on deleteFileGO");
return;
}
if ((Object)(object)deleteFileSFX == (Object)null)
{
deleteFileSFX = component.deleteFileSFX;
}
if ((Object)(object)deleteFileText == (Object)null)
{
deleteFileText = component.deleteFileText;
}
Object.Destroy((Object)(object)component);
if ((Object)(object)val.GetComponent<DeleteFileButton_BetterSaves>() == (Object)null)
{
DeleteFileButton_BetterSaves deleteFileButton_BetterSaves = val.AddComponent<DeleteFileButton_BetterSaves>();
deleteFileButton_BetterSaves.deleteFileSFX = deleteFileSFX;
deleteFileButton_BetterSaves.deleteFileText = deleteFileText;
Button component2 = val.GetComponent<Button>();
if ((Object)(object)component2 != (Object)null)
{
((UnityEventBase)component2.onClick).RemoveAllListeners();
((UnityEvent)component2.onClick).AddListener(new UnityAction(deleteFileButton_BetterSaves.DeleteFile));
}
else
{
Debug.LogError((object)"Button component not found on deleteFileGO");
}
}
else
{
Debug.LogWarning((object)"DeleteFileButton_BetterSaves component already exists on deleteFileGO");
}
}
public static void CreateBetterSaveButtons()
{
try
{
GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
val.SetActive(true);
int numSaves = CountSaveFiles();
Debug.Log((object)("Positioning based on " + numSaves + " saves."));
NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = CreateNewFileNode(numSaves);
List<string> list = NormalizeFileNames();
newSaveFileNum = list.Count + 1;
menuManager.filesCompatible = new bool[16];
for (int i = 0; i < menuManager.filesCompatible.Length; i++)
{
menuManager.filesCompatible[i] = true;
}
for (int j = 0; j < list.Count; j++)
{
CreateModdedSaveNode(int.Parse(list[j].Replace("LCSaveFile", "")), ((Component)newFileUISlot_BetterSaves).gameObject);
}
val.SetActive(false);
}
catch (Exception ex)
{
Debug.LogError((object)("Error occurred while refreshing save buttons: " + ex.Message));
}
}
public static NewFileUISlot_BetterSaves CreateNewFileNode(int numSaves)
{
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Original GameObject not found.");
return null;
}
Transform parent = val.transform.parent;
SaveFileUISlot component = val.GetComponent<SaveFileUISlot>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
GameObject val2 = Object.Instantiate<GameObject>(val, parent);
((Object)val2).name = "NewFile";
TMP_Text component2 = ((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>();
if ((Object)(object)component2 != (Object)null)
{
component2.text = "New File";
NewFileUISlot_BetterSaves newFileUISlot_BetterSaves = val2.AddComponent<NewFileUISlot_BetterSaves>();
if ((Object)(object)newFileUISlot_BetterSaves == (Object)null)
{
Debug.LogError((object)"Failed to add NewFileUISlot_BetterSaves component.");
return null;
}
Transform child = val2.transform.GetChild(3);
if ((Object)(object)child != (Object)null)
{
Object.Destroy((Object)(object)((Component)child).gameObject);
try
{
RectTransform component3 = val2.GetComponent<RectTransform>();
if (!((Object)(object)component3 != (Object)null))
{
Debug.LogError((object)"RectTransform component not found.");
return null;
}
float x = component3.anchoredPosition.x;
if (buttonBaseY == 0f)
{
buttonBaseY = component3.anchoredPosition.y - component3.sizeDelta.y * 1.75f;
}
float num = buttonBaseY + component3.sizeDelta.y * (float)(numSaves + 1) / 2f;
component3.anchoredPosition = new Vector2(x, num);
}
catch (Exception ex)
{
Debug.LogError((object)("Error setting anchored position: " + ex.Message));
return null;
}
return newFileUISlot_BetterSaves;
}
Debug.LogError((object)"Delete button not found.");
return null;
}
Debug.LogError((object)"Text component not found.");
return null;
}
private static int CountSaveFiles()
{
int num = 0;
string[] files = ES3.GetFiles();
foreach (string text in files)
{
if (ES3.FileExists(text) && Regex.IsMatch(text, "^LCSaveFile\\d+$"))
{
num++;
}
}
return num;
}
public static void DestroyOriginalSaveButtons()
{
Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File2"));
Object.Destroy((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File3"));
}
public static List<string> NormalizeFileNames()
{
List<string> list = new List<string>();
List<string> list2 = new List<string>();
string text = "PH";
string format = "LGUTempFile{0}";
string format2 = "LGU_{0}.json";
string[] files = ES3.GetFiles();
foreach (string text2 in files)
{
if (ES3.FileExists(text2) && Regex.IsMatch(text2, "^LCSaveFile\\d+$"))
{
Debug.Log((object)("Found file: " + text2));
list.Add(text2);
string text3 = string.Format(format2, text2.Substring("LCSaveFile".Length));
if (ES3.FileExists(text3))
{
Debug.Log((object)("Found LGU file: " + text3));
list2.Add(text3);
}
else
{
list2.Add(text);
}
}
}
list.Sort(delegate(string a, string b)
{
int num3 = int.Parse(a.Substring("LCSaveFile".Length));
int value = int.Parse(b.Substring("LCSaveFile".Length));
return num3.CompareTo(value);
});
int num = 1;
foreach (string item in list)
{
string text4 = "TempFile" + num;
ES3.RenameFile(item, text4);
Debug.Log((object)("Renamed " + item + " to " + text4));
num++;
}
num = 1;
foreach (string item2 in list2)
{
if (item2 == text)
{
num++;
continue;
}
string text5 = string.Format(format, num.ToString());
ES3.RenameFile(item2, text5);
Debug.Log((object)("Renamed " + item2 + " to " + text5));
num++;
}
int num2 = 1;
List<string> list3 = new List<string>();
foreach (string item3 in list)
{
string text6 = "TempFile" + num2;
string text7 = "LCSaveFile" + num2;
if (ES3.FileExists(text6))
{
ES3.RenameFile(text6, text7);
list3.Add(text7);
Debug.Log((object)("Renamed " + text6 + " to " + text7));
}
else
{
Debug.Log((object)("Temporary file " + text6 + " not found. It might have been moved or deleted."));
}
num2++;
}
num2 = 1;
foreach (string item4 in list2)
{
string text8 = string.Format(format, num2.ToString());
string text9 = string.Format(format2, num2.ToString());
if (item4 == text)
{
num2++;
continue;
}
if (ES3.FileExists(text8))
{
ES3.RenameFile(text8, text9);
list3.Add(text9);
Debug.Log((object)("Renamed " + text8 + " to " + text9));
}
else
{
Debug.Log((object)("Temporary file " + text8 + " not found. It might have been moved or deleted."));
}
num2++;
}
return list3;
}
public static void CreateModdedSaveNode(int fileNum, GameObject newFileButton)
{
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Original GameObject not found.");
return;
}
Transform parent = val.transform.parent;
GameObject val2 = Object.Instantiate<GameObject>(val, parent);
((Object)val2).name = "File" + fileNum + "_BetterSaves";
string text = ES3.Load<string>("Alias_BetterSaves", "LCSaveFile" + fileNum, "");
if (text == "")
{
((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + fileNum;
}
else
{
((Component)val2.transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
}
val2.AddComponent<SaveFileUISlot_BetterSaves>();
SaveFileUISlot_BetterSaves component = val2.GetComponent<SaveFileUISlot_BetterSaves>();
if ((Object)(object)component != (Object)null)
{
component.fileNum = fileNum;
component.fileString = "LCSaveFile" + fileNum;
RectTransform component2 = val2.GetComponent<RectTransform>();
if ((Object)(object)component2 != (Object)null)
{
float x = component2.anchoredPosition.x;
float y = newFileButton.GetComponent<RectTransform>().anchoredPosition.y;
float num = y - component2.sizeDelta.y * (float)fileNum;
component2.anchoredPosition = new Vector2(x, num);
}
GameObject gameObject = ((Component)val2.transform.GetChild(3)).gameObject;
DeleteFileButton_BetterSaves component3 = GameObject.Find("Canvas/MenuContainer/DeleteFileConfirmation/Panel/Delete").GetComponent<DeleteFileButton_BetterSaves>();
((UnityEvent)gameObject.gameObject.GetComponent<Button>().onClick).AddListener(new UnityAction(component3.UpdateFileToDelete));
gameObject.SetActive(false);
component.renameButton = CreateRenameFileButton(val2);
}
else
{
Debug.LogError((object)"SaveFileUISlot_BetterSaves component not found on the cloned GameObject.");
Object.Destroy((Object)(object)val2);
}
}
public static GameObject CreateRenameFileButton(GameObject fileNode)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject gameObject = ((Component)fileNode.transform.GetChild(3)).gameObject;
GameObject val = Object.Instantiate<GameObject>(gameObject, fileNode.transform);
((Object)val).name = "RenameButton";
val.GetComponent<Image>().sprite = renameSprite;
Button component = val.GetComponent<Button>();
component.onClick = new ButtonClickedEvent();
val.AddComponent<RenameFileButton_BetterSaves>();
RenameFileButton_BetterSaves component2 = val.GetComponent<RenameFileButton_BetterSaves>();
if ((Object)(object)component2 != (Object)null)
{
((UnityEvent)component.onClick).AddListener(new UnityAction(component2.RenameFile));
}
else
{
Debug.LogError((object)"RenameFileButton_BetterSaves component not found on renameButton");
}
RectTransform component3 = val.GetComponent<RectTransform>();
if ((Object)(object)component3 != (Object)null)
{
float num = ((Transform)component3).localPosition.x + 20f;
float y = ((Transform)component3).localPosition.y;
((Transform)component3).localPosition = Vector2.op_Implicit(new Vector2(num, y));
}
val.SetActive(false);
return val;
}
catch (Exception ex)
{
Debug.LogError((object)("Error occurred while creating rename file button: " + ex.Message));
return null;
}
}
public static void UpdateFilesPanelRect(int numSaves)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
try
{
GameObject obj = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel");
RectTransform val = ((obj != null) ? obj.GetComponent<RectTransform>() : null);
if ((Object)(object)val == (Object)null)
{
throw new Exception("Failed to find FilesPanel RectTransform.");
}
Vector2 sizeDelta = val.sizeDelta;
GameObject obj2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/File1");
RectTransform val2 = ((obj2 != null) ? obj2.GetComponent<RectTransform>() : null);
if ((Object)(object)val2 == (Object)null)
{
throw new Exception("Failed to find File1 RectTransform.");
}
float y = val2.sizeDelta.y;
sizeDelta.y = y * (float)(numSaves + 3);
val.sizeDelta = sizeDelta;
GameObject val3 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings/FilesPanel/ChallengeMoonButton");
RectTransform component = val3.GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null)
{
component.anchorMin = new Vector2(0.5f, 0.05f);
component.anchorMax = new Vector2(0.5f, 0.05f);
component.pivot = new Vector2(0.5f, 0.05f);
component.anchoredPosition = new Vector2(0f, 0f);
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error occurred while updating files panel rect: " + ex.Message));
}
}
public static void RefreshNameFields()
{
SaveFileUISlot_BetterSaves[] array = Object.FindObjectsOfType<SaveFileUISlot_BetterSaves>();
SaveFileUISlot_BetterSaves[] array2 = array;
foreach (SaveFileUISlot_BetterSaves saveFileUISlot_BetterSaves in array2)
{
string text = ES3.Load<string>("Alias_BetterSaves", saveFileUISlot_BetterSaves.fileString, "");
if (text == "")
{
((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = "File " + (saveFileUISlot_BetterSaves.fileNum + 1);
}
else
{
((Component)((Component)saveFileUISlot_BetterSaves).transform.GetChild(1)).GetComponent<TMP_Text>().text = text;
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LCBetterSaves";
public const string PLUGIN_NAME = "LCBetterSaves";
public const string PLUGIN_VERSION = "1.7.3";
}
}
namespace LCBetterSaves.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
public class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("LCBetterSaves.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
public static byte[] lcbettersaves
{
get
{
object @object = ResourceManager.GetObject("lcbettersaves", resourceCulture);
return (byte[])@object;
}
}
internal Resources()
{
}
}
}