using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BaboonAPI.Hooks.Initializer;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using TootTallyCore;
using TootTallyCore.Graphics;
using TootTallyCore.Graphics.Animations;
using TootTallyCore.Utils.Assets;
using TootTallyCore.Utils.TootTallyModules;
using TootTallySettings.TootTallySettingsObjects;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("TootTallySettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("TootTally Settings Management for Trombone Champ Mods")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: AssemblyInformationalVersion("1.1.3")]
[assembly: AssemblyProduct("TootTallySettings")]
[assembly: AssemblyTitle("TootTallySettings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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;
}
}
}
namespace TootTallySettings
{
[BepInPlugin("TootTallySettings", "TootTallySettings", "1.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin, ITootTallyModule
{
public static Plugin Instance;
private static Harmony _harmony;
public static TootTallySettingPage ModulesSettingPage;
public static TootTallySettingPage MainTootTallySettingPage;
public ConfigEntry<bool> ModuleConfigEnabled { get; set; }
public bool IsConfigInitialized { get; set; }
public string Name
{
get
{
return "TootTally Settings";
}
set
{
Name = value;
}
}
public static void LogInfo(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
}
public static void LogError(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
}
private void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
if (!((Object)(object)Instance != (Object)null))
{
Instance = this;
_harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize);
}
}
private void TryInitialize()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
ModuleConfigEnabled = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>("Modules", "TootTallySettings", true, "TootTally Setting Panel for mods");
MainTootTallySettingPage = TootTallySettingsManager.AddNewPage("TootTally", "TootTally", 40f, new Color(0.1f, 0.1f, 0.1f, 0.3f));
string path2 = Path.Combine(Paths.BepInExRootPath, "Themes");
if (!Directory.Exists(path2))
{
Directory.CreateDirectory(path2);
}
string[] files = Directory.GetFiles(path2);
List<string> fileNames = new List<string>();
fileNames.AddRange(new string[4] { "Day", "Night", "Random", "Default" });
files.ToList().ForEach(delegate(string path)
{
fileNames.Add(Path.GetFileNameWithoutExtension(path));
});
MainTootTallySettingPage.AddLabel("GameThemesLabel", "Game Theme", 24f, (FontStyles)0, (TextAlignmentOptions)1025);
MainTootTallySettingPage.AddDropdown("Themes", Plugin.Instance.ThemeName, fileNames.ToArray());
MainTootTallySettingPage.AddButton("ResetThemeButton", new Vector2(350f, 50f), "Refresh Theme", (Action)ThemeManager.RefreshTheme);
MainTootTallySettingPage.AddToggle("Change pitch speed", Plugin.Instance.ChangePitch);
MainTootTallySettingPage.AddToggle("Run GC While Playing", Plugin.Instance.RunGCWhilePlaying);
ThemeManager.OnThemeRefreshEvents = (Action)Delegate.Combine(ThemeManager.OnThemeRefreshEvents, new Action(TootTallySettingsManager.OnRefreshTheme));
TootTallyModuleManager.AddModule((ITootTallyModule)(object)this);
}
public void LoadModule()
{
AssetManager.LoadAssets(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "Assets"));
MainTootTallySettingPage.AddImageToPageButton("icon.png");
TryAddThunderstoreIconToPageButton(((BaseUnityPlugin)Instance).Info.Location, Name, ModulesSettingPage);
_harmony.PatchAll(typeof(TootTallySettingsManager));
}
public void AddModuleToSettingPage(ITootTallyModule module)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (ModulesSettingPage == null)
{
ModulesSettingPage = TootTallySettingsManager.AddNewPage("Enable / Disable Modules", "TTModules", 40f, new Color(0f, 0f, 0f, 0f));
}
ModulesSettingPage.AddToggle(module.Name, module.ModuleConfigEnabled);
}
public static void TryAddThunderstoreIconToPageButton(string pluginLocation, string moduleName, TootTallySettingPage page)
{
string text = Path.Combine(Path.GetDirectoryName(pluginLocation), "icon.png");
if (!File.Exists(text))
{
text = Path.Combine(Path.GetDirectoryName(pluginLocation), "../icon.png");
}
if (File.Exists(text))
{
AssetManager.LoadSingleAsset(text, moduleName + ".png", (Action<Sprite>)delegate
{
page.AddImageToPageButton(moduleName + ".png");
});
}
else
{
LogError("Couldn't find " + moduleName + " icon image.");
}
}
public void UnloadModule()
{
_harmony.UnpatchSelf();
LogInfo("Module unloaded!");
}
}
public abstract class BaseTootTallySettingObject
{
public bool isDisposed;
public string name;
public bool isInitialized;
protected TootTallySettingPage _page;
public BaseTootTallySettingObject(string name, TootTallySettingPage page)
{
this.name = name;
_page = page;
}
public virtual void Initialize()
{
isInitialized = true;
}
public void Remove()
{
Dispose();
isDisposed = true;
_page.RemoveSettingObjectFromList(this);
}
public abstract void Dispose();
}
public static class TootTallySettingObjectFactory
{
private static GameObject _mainCanvas;
private static GameObject _panelPrefab;
private static Slider _sliderPrefab;
private static Toggle _togglePrefab;
private static Dropdown _dropdownPrefab;
private static TMP_InputField _inputFieldPrefab;
private static bool _isInitialized;
public static void Initialize(HomeController __instance)
{
if (!_isInitialized)
{
_mainCanvas = GameObject.Find("MainCanvas");
SetPanelPrefab();
SetSliderPrefab(__instance);
SetTogglePrefab(__instance);
SetDropdownPrefab(__instance);
SetInputFieldPrefab(__instance);
_isInitialized = true;
}
}
private static void SetPanelPrefab()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)_mainCanvas.transform.Find("MainMenu")).gameObject;
GameObject val = Object.Instantiate<GameObject>(((Component)_mainCanvas.transform.Find("SettingsPanel")).gameObject, gameObject.transform);
((Object)val).name = "TootTallySettingsPanelPrefab";
((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0.2f, 0f, 0f);
int num = val.transform.childCount - 1;
for (int num2 = num; num2 >= 0; num2--)
{
Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num2)).gameObject);
}
GameObject val2 = Object.Instantiate<GameObject>(val, val.transform);
((Object)val2).name = "SettingsPanelGridHolder";
val2.SetActive(true);
val2.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
((Graphic)val2.GetComponent<Image>()).color = new Color(0.2f, 0f, 0f, 0f);
ContentSizeFitter val3 = val2.AddComponent<ContentSizeFitter>();
val3.verticalFit = (FitMode)2;
TMP_Text val4 = GameObjectFactory.CreateSingleText(val.transform, "TootTallySettingsHeader", "TootTally Settings", (TextFont)0);
((Component)val4).gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 475f);
val4.fontSize = 72f;
val4.fontStyle = (FontStyles)17;
val4.alignment = (TextAlignmentOptions)258;
_panelPrefab = Object.Instantiate<GameObject>(val);
Object.DestroyImmediate((Object)(object)val);
((Object)_panelPrefab).name = "SettingPanelPrefab";
_panelPrefab.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
Object.DontDestroyOnLoad((Object)(object)_panelPrefab);
}
private static void SetSliderPrefab(HomeController __instance)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
_sliderPrefab = Object.Instantiate<Slider>(((Component)__instance.fullsettingspanel.transform.Find("Settings/AUDIO/master_volume/SET_sld_volume")).GetComponent<Slider>());
((Object)_sliderPrefab).name = "TootTallySettingsSliderPrefab";
Transform val = ((Component)_sliderPrefab).transform.Find("Handle Slide Area/Handle");
TMP_Text val2 = GameObjectFactory.CreateSingleText(val, "SliderHandleText", "1", (TextFont)0);
val2.text = "50";
_sliderPrefab.onValueChanged = new SliderEvent();
_sliderPrefab.minValue = 0f;
_sliderPrefab.maxValue = 1f;
_sliderPrefab.value = 0.5f;
Object.DontDestroyOnLoad((Object)(object)_sliderPrefab);
}
private static void SetTogglePrefab(HomeController __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
_togglePrefab = Object.Instantiate<Toggle>(__instance.set_tog_accessb_jumpscare);
((Object)_togglePrefab).name = "TootTallySettingsTogglePrefab";
_togglePrefab.onValueChanged = new ToggleEvent();
Object.DontDestroyOnLoad((Object)(object)_togglePrefab);
}
private static void SetDropdownPrefab(HomeController __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
_dropdownPrefab = Object.Instantiate<Dropdown>(__instance.set_drp_antialiasing);
((Object)_dropdownPrefab).name = "TootTallySettingsDropdownPrefab";
_dropdownPrefab.onValueChanged = new DropdownEvent();
_dropdownPrefab.ClearOptions();
Object.DontDestroyOnLoad((Object)(object)_dropdownPrefab);
}
private static void SetInputFieldPrefab(HomeController __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("InputFieldHolder");
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchoredPosition = Vector2.zero;
val2.sizeDelta = new Vector2(350f, 50f);
GameObject val3 = Object.Instantiate<GameObject>(val, val.transform);
GameObject val4 = Object.Instantiate<GameObject>(val3, val.transform);
((Object)val3).name = "Image";
((Object)val4).name = "Text";
_inputFieldPrefab = val.AddComponent<TMP_InputField>();
Vector2 anchorMax = (val2.anchorMin = Vector2.zero);
val2.anchorMax = anchorMax;
((Selectable)_inputFieldPrefab).image = val3.AddComponent<Image>();
RectTransform component = val3.GetComponent<RectTransform>();
Vector2 val5 = (component.pivot = Vector2.zero);
anchorMax = (component.anchorMax = val5);
component.anchorMin = anchorMax;
component.anchoredPosition = new Vector2(0f, 4f);
component.sizeDelta = new Vector2(350f, 2f);
RectTransform component2 = val4.GetComponent<RectTransform>();
Vector2 val7 = (component2.pivot = Vector2.zero);
val5 = (component2.anchorMax = val7);
anchorMax = (component2.anchorMin = val5);
component2.anchoredPosition = anchorMax;
component2.sizeDelta = new Vector2(350f, 50f);
_inputFieldPrefab.textComponent = GameObjectFactory.CreateSingleText(val4.transform, "TextLabel", "", (TextFont)0);
_inputFieldPrefab.textComponent.rectTransform.pivot = new Vector2(0f, 0.5f);
_inputFieldPrefab.textComponent.alignment = (TextAlignmentOptions)513;
_inputFieldPrefab.textComponent.margin = new Vector4(5f, 0f, 0f, 0f);
_inputFieldPrefab.textComponent.enableWordWrapping = true;
_inputFieldPrefab.textViewport = _inputFieldPrefab.textComponent.rectTransform;
Object.DontDestroyOnLoad((Object)(object)_inputFieldPrefab);
}
public static GameObject CreateMainSettingPanel(Transform canvasTransform)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(_panelPrefab, canvasTransform);
val.GetComponent<RectTransform>().anchoredPosition = new Vector2(-1940f, 0f);
GameObject gameObject = ((Component)val.transform.Find("SettingsPanelGridHolder")).gameObject;
GridLayoutGroup val2 = gameObject.AddComponent<GridLayoutGroup>();
val2.spacing = new Vector2(25f, 25f);
((LayoutGroup)val2).childAlignment = (TextAnchor)1;
val2.cellSize = new Vector2(400f, 85f);
GameObjectFactory.CreateCustomButton(val.transform, new Vector2(-50f, -66f), new Vector2(250f, 80f), "Back", "TTSettingsBackButton", (Action)TootTallySettingsManager.OnBackButtonClick);
return val;
}
public static GameObject CreateSettingPanel(Transform canvasTransform, string name, string headerText, float elementSpacing, Color bgColor)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
GameObject val = Object.Instantiate<GameObject>(_panelPrefab, canvasTransform);
((Object)val).name = "TootTally" + name + "Panel";
((Graphic)val.GetComponent<Image>()).color = bgColor;
TMP_Text component = ((Component)val.transform.Find("TootTallySettingsHeader")).GetComponent<TMP_Text>();
component.text = headerText;
((Graphic)component).color = Theme.colors.leaderboard.text;
GameObject gameObject = ((Component)val.transform.Find("SettingsPanelGridHolder")).gameObject;
gameObject.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f);
gameObject.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 1f);
gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(-950f, -150f);
VerticalLayoutGroup val2 = gameObject.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)val2).childAlignment = (TextAnchor)0;
bool childControlHeight = (((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = false);
((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = childControlHeight;
childControlHeight = (((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false);
((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = childControlHeight;
childControlHeight = (((HorizontalOrVerticalLayoutGroup)val2).childScaleWidth = false);
((HorizontalOrVerticalLayoutGroup)val2).childScaleHeight = childControlHeight;
((LayoutGroup)val2).padding = new RectOffset(100, 100, 20, 20);
((HorizontalOrVerticalLayoutGroup)val2).spacing = elementSpacing;
return val;
}
public static Slider CreateSlider(Transform canvasTransform, string name, float min, float max, bool integerOnly)
{
Slider val = Object.Instantiate<Slider>(_sliderPrefab, canvasTransform);
((Object)val).name = name;
val.maxValue = max;
val.minValue = min;
val.wholeNumbers = integerOnly;
return val;
}
public static Slider CreateVerticalSlider(Transform canvasTransform, string name, Vector2 position, Vector2 size)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
Slider val = Object.Instantiate<Slider>(_sliderPrefab, canvasTransform);
((Object)val).name = name;
RectTransform component = ((Component)val).GetComponent<RectTransform>();
component.sizeDelta = size;
component.anchoredPosition = position;
((Transform)component).eulerAngles = new Vector3(0f, 0f, -90f);
Object.DestroyImmediate((Object)(object)((Component)((Component)val).transform.Find("Handle Slide Area/Handle/SliderHandleText")).gameObject);
float minValue = (val.value = 0f);
val.minValue = minValue;
val.maxValue = 1f;
val.wholeNumbers = false;
return val;
}
public static Toggle CreateToggle(Transform canvasTransform, string name, Vector2 size, string text, ConfigEntry<bool> config = null)
{
//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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
Toggle val = Object.Instantiate<Toggle>(_togglePrefab, canvasTransform);
RectTransform component = ((Component)val).GetComponent<RectTransform>();
component.pivot = Vector2.op_Implicit(Vector3.zero);
component.anchoredPosition = Vector2.op_Implicit(Vector3.zero);
TMP_Text val2 = GameObjectFactory.CreateSingleText(((Component)val).transform, name + "Label", text, Vector2.zero, new Vector2(250f, 0f), Theme.colors.leaderboard.text, (TextFont)1);
val2.alignment = (TextAlignmentOptions)513;
val2.fontStyle = (FontStyles)4;
val2.enableWordWrapping = false;
val2.rectTransform.anchoredPosition = new Vector2(40f, 0f);
RectTransform rectTransform = val2.rectTransform;
RectTransform rectTransform2 = val2.rectTransform;
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(1f, 0.5f);
rectTransform2.anchorMin = val3;
rectTransform.anchorMax = val3;
val2.fontSize = 28f;
((Object)val).name = name;
if (config != null)
{
val.isOn = config.Value;
((UnityEvent<bool>)(object)val.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value)
{
config.Value = value;
});
}
else
{
val.isOn = false;
}
((Component)((Component)val).transform.Find("Label")).GetComponent<Text>().text = text;
return val;
}
public static Dropdown CreateDropdown(Transform canvasTransform, string name)
{
Dropdown val = Object.Instantiate<Dropdown>(_dropdownPrefab, canvasTransform);
((Object)val).name = name;
return val;
}
public static TMP_InputField CreateInputField(Transform canvasTransform, string name, Vector2 size, float fontSize, string text, bool isPassword)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
TMP_InputField val = Object.Instantiate<TMP_InputField>(_inputFieldPrefab, canvasTransform);
((Object)val).name = name;
((Component)val).GetComponent<RectTransform>().sizeDelta = size;
((Component)((Component)val).transform.Find("Image")).GetComponent<RectTransform>().sizeDelta = new Vector2(size.x, 2f);
((Component)((Component)val).transform.Find("Text")).GetComponent<RectTransform>().sizeDelta = size;
((Component)val.textComponent).GetComponent<RectTransform>().sizeDelta = size;
val.textComponent.fontSize = fontSize;
val.text = text;
val.inputType = (InputType)(isPassword ? 2 : 0);
return val;
}
}
public class TootTallySettingPage
{
public static readonly Vector2 DEFAULT_OBJECT_SIZE = new Vector2(350f, 50f);
public static readonly float DEFAULT_SLIDER_LENGTH = 250f;
public static readonly float DEFAULT_HEADER_FONTSIZE = 40f;
public static readonly float DEFAULT_FONTSIZE = 20f;
public Action<TootTallySettingPage> OnShowEvent;
public Action<TootTallySettingPage> OnHideEvent;
public string name;
public string headerName;
public float elementSpacing;
protected List<BaseTootTallySettingObject> _settingObjectList;
private CustomButton _pageButton;
protected GameObject _fullPanel;
protected CustomButton _backButton;
protected Slider _verticalSlider;
protected ScrollableSliderHandler _scrollableSliderHandler;
public GameObject gridPanel;
private Color _bgColor;
private ColorBlock _btnColors;
private bool _isInitialized;
private string _extraImagePath;
private Sprite _extraImage;
public TootTallySettingPage(string pageName, string headerName, float elementSpacing, Color bgColor, ColorBlock btnColors)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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)
name = pageName;
this.headerName = headerName;
this.elementSpacing = elementSpacing;
_bgColor = bgColor;
_btnColors = btnColors;
_settingObjectList = new List<BaseTootTallySettingObject>();
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public virtual void Initialize()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
_fullPanel = TootTallySettingObjectFactory.CreateSettingPanel(GameObject.Find("MainCanvas").transform, name, headerName, elementSpacing, _bgColor);
gridPanel = ((Component)_fullPanel.transform.Find("SettingsPanelGridHolder")).gameObject;
_backButton = GameObjectFactory.CreateCustomButton(_fullPanel.transform, new Vector2(-1570f, -66f), new Vector2(250f, 80f), "Return", name + "ReturnButton", (Action)TootTallySettingsManager.OnBackButtonClick);
_verticalSlider = TootTallySettingObjectFactory.CreateVerticalSlider(_fullPanel.transform, name + "VerticalSlider", new Vector2(1700f, -200f), new Vector2(-1080f, 20f));
((UnityEvent<float>)(object)_verticalSlider.onValueChanged).AddListener((UnityAction<float>)delegate
{
OnSliderValueChangeScrollGridPanel(gridPanel, _verticalSlider.value);
});
_scrollableSliderHandler = ((Component)_verticalSlider).gameObject.AddComponent<ScrollableSliderHandler>();
((Behaviour)_scrollableSliderHandler).enabled = false;
_pageButton = GameObjectFactory.CreateCustomButton(TootTallySettingsManager.GetSettingPanelGridHolderTransform, Vector2.zero, new Vector2(250f, 60f), name, "Open" + name + "Button", (Action)delegate
{
TootTallySettingsManager.SwitchActivePage(this);
});
_ = _btnColors;
if (true)
{
((Selectable)_pageButton.button).colors = _btnColors;
}
if ((Object)(object)_extraImage != (Object)null)
{
AddImageToPageButton(_extraImage);
}
else if (_extraImagePath != null)
{
AddImageToPageButton(_extraImagePath);
}
_settingObjectList.ForEach(delegate(BaseTootTallySettingObject obj)
{
try
{
obj.Initialize();
}
catch (Exception ex)
{
Plugin.LogError("Couldn't initialize toottallysetting object " + obj.name);
Plugin.LogError(ex.Message);
Plugin.LogError(ex.StackTrace);
}
});
_isInitialized = true;
}
public void AddImageToPageButton(string spriteName)
{
//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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
_extraImagePath = spriteName;
if ((Object)(object)_pageButton != (Object)null)
{
_extraImage = AssetManager.GetSprite(spriteName);
GameObject val = GameObjectFactory.CreateImageHolder(((Component)_pageButton).transform, Vector2.zero, Vector2.one * 78f, _extraImage, name + "PageIcon");
RectTransform component = val.GetComponent<RectTransform>();
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0.15f, 0.5f);
component.anchorMin = val2;
component.anchorMax = val2;
((Component)((Component)_pageButton).transform.GetChild(0)).GetComponent<RectTransform>().anchorMin = new Vector2(0.2f, 0f);
}
}
public void AddImageToPageButton(Sprite sprite)
{
//IL_0027: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
_extraImage = sprite;
if ((Object)(object)_pageButton != (Object)null)
{
GameObject val = GameObjectFactory.CreateImageHolder(((Component)_pageButton).transform, Vector2.zero, Vector2.one * 78f, sprite, name + "PageIcon");
RectTransform component = val.GetComponent<RectTransform>();
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0.15f, 0.5f);
component.anchorMin = val2;
component.anchorMax = val2;
((Component)((Component)_pageButton).transform.GetChild(0)).GetComponent<RectTransform>().anchorMin = new Vector2(0.2f, 0f);
}
}
public virtual void OnPageAdd()
{
}
public void OnPageRemove()
{
List<BaseTootTallySettingObject> list = new List<BaseTootTallySettingObject>(_settingObjectList);
list.ForEach(delegate(BaseTootTallySettingObject obj)
{
obj.Remove();
});
Object.DestroyImmediate((Object)(object)_fullPanel);
((Component)_pageButton).gameObject.SetActive(false);
}
public void RemoveSettingObjectFromList(string name)
{
BaseTootTallySettingObject baseTootTallySettingObject = _settingObjectList.Find((BaseTootTallySettingObject obj) => obj.name == name);
if (baseTootTallySettingObject == null)
{
Plugin.LogInfo(name + " object couldn't be found.");
return;
}
RemoveSettingObjectFromList(baseTootTallySettingObject);
UpdateVerticalSlider();
}
private static void OnSliderValueChangeScrollGridPanel(GameObject gridPanel, float value)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = gridPanel.GetComponent<RectTransform>();
component.anchoredPosition = new Vector2(component.anchoredPosition.x, value * component.sizeDelta.y - (1f - value) * 150f);
}
public void RemoveSettingObjectFromList(BaseTootTallySettingObject settingObject)
{
if (!settingObject.isDisposed)
{
settingObject.Dispose();
}
_settingObjectList.Remove(settingObject);
if (_isInitialized)
{
UpdateVerticalSlider();
}
}
public void RemoveAllObjects()
{
BaseTootTallySettingObject[] array = new BaseTootTallySettingObject[_settingObjectList.Count];
_settingObjectList.CopyTo(array);
array.ToList().ForEach(delegate(BaseTootTallySettingObject o)
{
o.Remove();
});
if (_isInitialized)
{
UpdateVerticalSlider();
}
}
public void RefreshTheme()
{
Object.Destroy((Object)(object)_fullPanel.gameObject);
Object.Destroy((Object)(object)((Component)_pageButton).gameObject);
Initialize();
}
public BaseTootTallySettingObject AddSettingObjectToList(BaseTootTallySettingObject settingObject)
{
_settingObjectList.Add(settingObject);
if (_isInitialized)
{
UpdateVerticalSlider();
}
return settingObject;
}
public void Remove()
{
TootTallySettingsManager.RemovePage(this);
}
public BaseTootTallySettingObject GetSettingObjectByName(string name)
{
return _settingObjectList.Find((BaseTootTallySettingObject obj) => obj.name == name);
}
public virtual void OnShow()
{
OnShowEvent?.Invoke(this);
}
public void Show()
{
_fullPanel.SetActive(true);
UpdateVerticalSlider();
OnShow();
}
private void UpdateVerticalSlider()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
LayoutRebuilder.ForceRebuildLayoutImmediate(gridPanel.GetComponent<RectTransform>());
((Component)_verticalSlider).gameObject.SetActive(gridPanel.GetComponent<RectTransform>().sizeDelta.y > -120f);
((Behaviour)_scrollableSliderHandler).enabled = gridPanel.GetComponent<RectTransform>().sizeDelta.y > -120f;
}
public virtual void OnHide()
{
OnHideEvent?.Invoke(this);
}
public void Hide()
{
_fullPanel.SetActive(false);
((Behaviour)_scrollableSliderHandler).enabled = false;
OnHide();
}
public TootTallySettingButton AddButton(string name, Vector2 size, string text, string description = "", Action OnClick = null)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return AddSettingObjectToList(new TootTallySettingButton(this, name, size, text, description, OnClick)) as TootTallySettingButton;
}
public TootTallySettingButton AddButton(string name, Vector2 size, string text, Action OnClick = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return AddButton(name, size, text, "", OnClick);
}
public TootTallySettingButton AddButton(string name, Action OnClick = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return AddButton(name, DEFAULT_OBJECT_SIZE, name, OnClick);
}
public TootTallySettingSlider AddSlider(string name, float min, float max, float length, string text, ConfigEntry<float> config, bool integerOnly)
{
return AddSettingObjectToList(new TootTallySettingSlider(this, name, min, max, length, text, config, integerOnly)) as TootTallySettingSlider;
}
public TootTallySettingSlider AddSlider(string name, float min, float max, ConfigEntry<float> config, bool integerOnly)
{
return AddSlider(name, min, max, DEFAULT_SLIDER_LENGTH, name, config, integerOnly);
}
public TootTallySettingToggle AddToggle(string name, Vector2 size, string text, ConfigEntry<bool> config, UnityAction<bool> onValueChange = null)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return AddSettingObjectToList(new TootTallySettingToggle(this, name, size, text, config, onValueChange)) as TootTallySettingToggle;
}
public TootTallySettingToggle AddToggle(string name, ConfigEntry<bool> config, UnityAction<bool> onValueChange = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return AddToggle(name, DEFAULT_OBJECT_SIZE, name, config, onValueChange);
}
public TootTallySettingDropdown AddDropdown(string name, string text, ConfigEntry<string> config, params string[] optionValues)
{
return AddSettingObjectToList(new TootTallySettingDropdown(this, name, text, config, optionValues)) as TootTallySettingDropdown;
}
public TootTallySettingDropdown AddDropdown(string name, ConfigEntry<string> config, params string[] optionValues)
{
return AddDropdown(name, name, config, optionValues);
}
public TootTallySettingDropdown AddDropdown(string name, ConfigEntryBase config)
{
return AddSettingObjectToList(new TootTallySettingDropdown(this, name, config)) as TootTallySettingDropdown;
}
public TootTallySettingTextField AddTextField(string name, Vector2 size, float fontSize, string defaultValue, string description = "", bool isPassword = false, Action<string> onEditEnd = null)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return AddSettingObjectToList(new TootTallySettingTextField(this, name, size, fontSize, defaultValue, description, isPassword, onEditEnd)) as TootTallySettingTextField;
}
public TootTallySettingTextField AddTextField(string name, Vector2 size, float fontSize, string defaultValue, bool isPassword = false, Action<string> onEditEnd = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return AddTextField(name, size, fontSize, defaultValue, "", isPassword, onEditEnd);
}
public TootTallySettingTextField AddTextField(string name, string defaultValue, bool isPassword = false, Action<string> onEditEnd = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return AddTextField(name, DEFAULT_OBJECT_SIZE, DEFAULT_FONTSIZE, defaultValue, isPassword, onEditEnd);
}
public TootTallySettingColorSliders AddColorSliders(string name, string text, float length, ConfigEntry<Color> config)
{
return AddSettingObjectToList(new TootTallySettingColorSliders(this, name, text, length, config)) as TootTallySettingColorSliders;
}
public TootTallySettingColorSliders AddColorSliders(string name, string text, ConfigEntry<Color> config)
{
return AddColorSliders(name, text, DEFAULT_SLIDER_LENGTH, config);
}
public TootTallySettingLabel AddLabel(string name, string text, float fontSize, FontStyles fontStyles = 0, TextAlignmentOptions align = 4097)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return AddSettingObjectToList(new TootTallySettingLabel(this, name, text, fontSize, fontStyles, align)) as TootTallySettingLabel;
}
public TootTallySettingLabel AddLabel(string name, FontStyles fontStyles = 0, TextAlignmentOptions align = 4097)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
return AddLabel(name, name, DEFAULT_FONTSIZE, fontStyles, align);
}
}
public static class TootTallySettingsManager
{
private const string MAIN_MENU_PATH = "MainCanvas/MainMenu";
public static bool isInitialized;
private static HomeController _currentInstance;
private static GameObject _mainMenu;
private static GameObject _mainSettingPanel;
private static GameObject _settingPanelGridHolder;
private static CustomButton _backButton;
private static List<TootTallySettingPage> _settingPageList = new List<TootTallySettingPage>();
private static TootTallySettingPage _currentActivePage;
private static TootTallyAnimation _currentAnim;
public static Transform GetSettingPanelGridHolderTransform => _settingPanelGridHolder.transform;
private static ColorBlock GetDefaultColorBlock
{
get
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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)
ColorBlock result = default(ColorBlock);
((ColorBlock)(ref result)).normalColor = new Color(0.95f, 0.21f, 0.35f);
((ColorBlock)(ref result)).highlightedColor = new Color(0.77f, 0.17f, 0.28f);
((ColorBlock)(ref result)).pressedColor = new Color(1f, 1f, 0f);
((ColorBlock)(ref result)).selectedColor = new Color(0.95f, 0.21f, 0.35f);
((ColorBlock)(ref result)).fadeDuration = 0.08f;
((ColorBlock)(ref result)).colorMultiplier = 1f;
return result;
}
}
[HarmonyPatch(typeof(GameObjectFactory), "OnHomeControllerInitialize")]
[HarmonyPostfix]
public static void InitializeTootTallySettingsManager(HomeController homeController)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
_currentInstance = homeController;
TootTallySettingObjectFactory.Initialize(_currentInstance);
GameObject val = GameObject.Find("MainCanvas");
_mainMenu = ((Component)val.transform.Find("MainMenu")).gameObject;
CustomButton val2 = GameObjectFactory.CreateCustomButton(_mainMenu.transform, new Vector2(-1661f, -456f), new Vector2(164f, 164f), "Mod\nSettings", "TTSettingsOpenButton", (Action)delegate
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
_mainSettingPanel.SetActive(true);
TootTallyAnimation currentAnim = _currentAnim;
if (currentAnim != null)
{
currentAnim.Dispose();
}
_currentAnim = TootTallyAnimationManager.AddNewPositionAnimation(_mainMenu, Vector2.op_Implicit(new Vector2(1940f, 0f)), 1f, new SecondDegreeDynamicsAnimation(2.1f, 0.98f, 0f), (Action<GameObject>)null);
});
((Graphic)val2.textHolder).color = Color.yellow;
val2.textHolder.fontSize = 26;
((Component)val2).GetComponent<Image>().sprite = AssetManager.GetSprite("PfpMask.png");
((Graphic)((Component)val2).GetComponent<Image>()).color = Color.black;
Button button = val2.button;
ColorBlock colors = default(ColorBlock);
((ColorBlock)(ref colors)).normalColor = Color.white;
((ColorBlock)(ref colors)).pressedColor = Color.gray;
((ColorBlock)(ref colors)).selectedColor = Color.white;
((ColorBlock)(ref colors)).highlightedColor = new Color(0.3f, 0.3f, 0f);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((ColorBlock)(ref colors)).fadeDuration = 0.2f;
((Selectable)button).colors = colors;
Outline val3 = ((Component)val2).gameObject.AddComponent<Outline>();
((Shadow)val3).effectColor = Color.yellow;
((Shadow)val3).effectDistance = new Vector2(3f, -3f);
_mainSettingPanel = TootTallySettingObjectFactory.CreateMainSettingPanel(_mainMenu.transform);
_backButton = GameObjectFactory.CreateCustomButton(_mainSettingPanel.transform, new Vector2(-50f, -66f), new Vector2(250f, 80f), "Back", "TTSettingsBackButton", (Action)OnBackButtonClick);
_settingPanelGridHolder = ((Component)_mainSettingPanel.transform.Find("SettingsPanelGridHolder")).gameObject;
ShowMainSettingPanel();
_settingPageList.ForEach(delegate(TootTallySettingPage page)
{
page.Initialize();
});
isInitialized = true;
}
[HarmonyPatch(typeof(HomeController), "Update")]
[HarmonyPostfix]
public static void Update()
{
if (isInitialized && Input.GetKeyDown((KeyCode)27))
{
OnBackButtonClick();
}
}
public static void OnBackButtonClick()
{
if (_currentActivePage != null)
{
_currentActivePage.Hide();
_currentActivePage = null;
ShowMainSettingPanel();
}
else if (_mainSettingPanel.activeSelf)
{
ReturnToMainMenu();
}
}
public static TootTallySettingPage AddNewPage(string pageName, string headerText, float elementSpacing, Color bgColor)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
return AddNewPage(pageName, headerText, elementSpacing, bgColor, GetDefaultColorBlock);
}
public static TootTallySettingPage AddNewPage(string pageName, string headerText, float elementSpacing, Color bgColor, ColorBlock btnColor)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
TootTallySettingPage settingPageByName = GetSettingPageByName(pageName);
if (settingPageByName != null)
{
Plugin.LogInfo("Page " + pageName + " already exist.");
return settingPageByName;
}
settingPageByName = new TootTallySettingPage(pageName, headerText, elementSpacing, bgColor, btnColor);
settingPageByName.OnPageAdd();
_settingPageList.Add(settingPageByName);
return settingPageByName;
}
public static TootTallySettingPage AddNewPage(TootTallySettingPage settingPage)
{
TootTallySettingPage settingPageByName = GetSettingPageByName(settingPage.name);
if (settingPageByName != null)
{
Plugin.LogInfo("Page " + settingPageByName.name + " already exist.");
return settingPageByName;
}
settingPageByName = settingPage;
settingPageByName.OnPageAdd();
_settingPageList.Add(settingPageByName);
return settingPageByName;
}
public static void SwitchActivePage(TootTallySettingPage page)
{
_currentActivePage?.Hide();
_currentActivePage = page;
HideMainSettingPanel();
page.Show();
}
public static void RemovePage(TootTallySettingPage page)
{
page.OnPageRemove();
if (_settingPageList.Contains(page))
{
_settingPageList.Remove(page);
}
else
{
Plugin.LogInfo("Page " + page.name + " couldn't be found.");
}
}
public static void ShowMainSettingPanel()
{
_mainSettingPanel.SetActive(true);
}
public static void HideMainSettingPanel()
{
_mainSettingPanel.SetActive(false);
}
public static void ReturnToMainMenu()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
_currentInstance.tryToSaveSettings();
TootTallyAnimation currentAnim = _currentAnim;
if (currentAnim != null)
{
currentAnim.Dispose();
}
_currentAnim = TootTallyAnimationManager.AddNewPositionAnimation(_mainMenu, Vector2.op_Implicit(Vector2.zero), 1f, new SecondDegreeDynamicsAnimation(2.1f, 0.98f, 0f), (Action<GameObject>)delegate
{
_mainSettingPanel.SetActive(false);
});
}
public static void OnRefreshTheme()
{
//IL_003f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
if (_settingPageList != null && isInitialized)
{
((Graphic)((Component)_mainSettingPanel.transform.Find("TootTallySettingsHeader")).GetComponent<TMP_Text>()).color = Theme.colors.leaderboard.text;
Object.DestroyImmediate((Object)(object)((Component)_backButton).gameObject);
_backButton = GameObjectFactory.CreateCustomButton(_mainSettingPanel.transform, new Vector2(-50f, -66f), new Vector2(250f, 80f), "Back", "TTSettingsBackButton", (Action)OnBackButtonClick);
_settingPageList.ForEach(delegate(TootTallySettingPage page)
{
page.RefreshTheme();
});
_currentActivePage.Show();
}
}
public static TootTallySettingPage GetSettingPageByName(string name)
{
return _settingPageList?.Find((TootTallySettingPage page) => page.name == name);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "TootTallySettings";
public const string PLUGIN_NAME = "TootTallySettings";
public const string PLUGIN_VERSION = "1.1.3";
}
}
namespace TootTallySettings.TootTallySettingsObjects
{
public class TootTallySettingButton : BaseTootTallySettingObject
{
public CustomButton button;
private Vector2 _size;
private string _text;
private string _description;
private Action _onClick;
public TootTallySettingButton(TootTallySettingPage page, string name, Vector2 size, string text, string description, Action onClick = null)
: base(name, page)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
_size = size;
_text = text;
_description = description;
_onClick = onClick;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
button = GameObjectFactory.CreateCustomButton(_page.gridPanel.transform, Vector2.zero, _size, _text, name, _onClick);
if (_description != "")
{
BubblePopupHandler val = ((Component)button).gameObject.AddComponent<BubblePopupHandler>();
val.Initialize(GameObjectFactory.CreateBubble(Vector2.zero, name + "Bubble", _description, Vector2.zero, 6, true, 22), true);
}
}
public override void Dispose()
{
Object.DestroyImmediate((Object)(object)((Component)button).gameObject);
}
}
public class TootTallySettingColorSliders : BaseTootTallySettingObject
{
public Slider sliderR;
public Slider sliderG;
public Slider sliderB;
public TMP_Text labelR;
public TMP_Text labelG;
public TMP_Text labelB;
private float _length;
private string _text;
private GameObject _bubble;
private ConfigEntry<Color> _config;
public TootTallySettingColorSliders(TootTallySettingPage page, string name, string text, float length, ConfigEntry<Color> config)
: base(name, page)
{
_text = text;
_length = length;
_config = config;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_00a4: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
sliderR = TootTallySettingObjectFactory.CreateSlider(_page.gridPanel.transform, name, 0f, 2f, integerOnly: false);
sliderG = TootTallySettingObjectFactory.CreateSlider(_page.gridPanel.transform, name, 0f, 2f, integerOnly: false);
sliderB = TootTallySettingObjectFactory.CreateSlider(_page.gridPanel.transform, name, 0f, 2f, integerOnly: false);
SetSlider(sliderR, _length, _config.Value.r, "Red", out labelR);
SetSlider(sliderG, _length, _config.Value.g, "Green", out labelG);
SetSlider(sliderB, _length, _config.Value.b, "Blue", out labelB);
_bubble = GameObjectFactory.CreateImageHolder(((Component)sliderR).transform, new Vector2(200f, -60f), Vector2.one * 64f, AssetManager.GetSprite("PfpMask.png"), "ColorBubble");
Outline val = _bubble.AddComponent<Outline>();
((Shadow)val).effectColor = Color.black;
((Shadow)val).effectDistance = Vector2.one * 2f;
((Graphic)_bubble.GetComponent<Image>()).color = new Color(sliderR.value, sliderG.value, sliderB.value);
TMP_Text handleTextR = ((Component)((Component)sliderR).transform.Find("Handle Slide Area/Handle/SliderHandleText")).GetComponent<TMP_Text>();
handleTextR.text = SliderValueToText(sliderR, _config.Value.r);
((UnityEvent<float>)(object)sliderR.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
{
OnSliderValueChange(sliderB, handleTextR, value);
});
TMP_Text handleTextG = ((Component)((Component)sliderG).transform.Find("Handle Slide Area/Handle/SliderHandleText")).GetComponent<TMP_Text>();
handleTextG.text = SliderValueToText(sliderG, _config.Value.g);
((UnityEvent<float>)(object)sliderG.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
{
OnSliderValueChange(sliderB, handleTextG, value);
});
TMP_Text handleTextB = ((Component)((Component)sliderB).transform.Find("Handle Slide Area/Handle/SliderHandleText")).GetComponent<TMP_Text>();
handleTextB.text = SliderValueToText(sliderB, _config.Value.b);
((UnityEvent<float>)(object)sliderB.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
{
OnSliderValueChange(sliderB, handleTextB, value);
});
base.Initialize();
}
public void OnSliderValueChange(Slider s, TMP_Text label, float value)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
label.text = SliderValueToText(s, value);
UpdateConfig();
((Graphic)_bubble.GetComponent<Image>()).color = new Color(sliderR.value, sliderG.value, sliderB.value);
}
public void UpdateConfig()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
_config.Value = new Color(sliderR.value, sliderG.value, sliderB.value);
}
public static void SetSlider(Slider s, float length, float value, string text, out TMP_Text label)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
((Component)s).GetComponent<RectTransform>().sizeDelta = new Vector2(length, 20f);
TMP_Text component = ((Component)((Component)s).transform.Find("Handle Slide Area/Handle/SliderHandleText")).GetComponent<TMP_Text>();
component.rectTransform.anchoredPosition = Vector2.zero;
component.rectTransform.sizeDelta = new Vector2(35f, 0f);
component.fontSize = 10f;
s.value = value;
label = GameObjectFactory.CreateSingleText(((Component)s).transform, ((Object)s).name + "Label", text, (TextFont)0);
label.rectTransform.anchoredPosition = new Vector2(0f, 35f);
label.alignment = (TextAlignmentOptions)257;
}
public static string SliderValueToText(Slider s, float value)
{
if (s.minValue == 0f && s.maxValue == 1f)
{
return (int)(value * 100f) + "%";
}
if (s.wholeNumbers)
{
return value.ToString();
}
return $"{(s.wholeNumbers ? value : (value * 100f)):0.00}";
}
public override void Dispose()
{
Object.DestroyImmediate((Object)(object)((Component)sliderR).gameObject);
Object.DestroyImmediate((Object)(object)((Component)sliderG).gameObject);
Object.DestroyImmediate((Object)(object)((Component)sliderB).gameObject);
}
}
public class TootTallySettingDropdown : BaseTootTallySettingObject
{
public Dropdown dropdown;
public TMP_Text label;
private List<string> _optionValues;
private ConfigEntryBase _config;
private BubblePopupHandler _bubble;
public TootTallySettingDropdown(TootTallySettingPage page, string name, string text, ConfigEntry<string> config, string[] optionValues = null)
: base(name, page)
{
_config = (ConfigEntryBase)(object)config;
_optionValues = optionValues.ToList();
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public TootTallySettingDropdown(TootTallySettingPage page, string name, ConfigEntryBase config)
: base(name, page)
{
_config = config;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public void ConfigureDropdownEnum()
{
dropdown.AddOptions(Enum.GetNames(_config.BoxedValue.GetType()).ToList());
dropdown.value = dropdown.options.FindIndex((OptionData x) => x.text == _config.BoxedValue.ToString());
((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int value)
{
_config.BoxedValue = Enum.Parse(_config.BoxedValue.GetType(), dropdown.options[value].text);
});
}
public void ConfigureDropdownString()
{
if (_optionValues != null)
{
AddOptions(_optionValues.ToArray());
}
if (!_optionValues.Contains(_config.BoxedValue))
{
AddOptions(_config.BoxedValue.ToString());
}
dropdown.value = dropdown.options.FindIndex((OptionData x) => x.text == _config.BoxedValue.ToString());
((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int value)
{
_config.BoxedValue = dropdown.options[value].text;
});
}
public void AddOptions(params string[] name)
{
if (name.Length != 0)
{
if ((Object)(object)dropdown != (Object)null)
{
dropdown.AddOptions(name.ToList());
}
else
{
_optionValues.AddRange(name);
}
}
}
public override void Initialize()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
dropdown = TootTallySettingObjectFactory.CreateDropdown(_page.gridPanel.transform, name);
Dropdown obj = dropdown;
Navigation navigation = default(Navigation);
((Navigation)(ref navigation)).mode = (Mode)0;
((Selectable)obj).navigation = navigation;
if (_config.BoxedValue.GetType() == typeof(string))
{
ConfigureDropdownString();
}
else
{
ConfigureDropdownEnum();
}
if (_config.Description.Description != null && _config.Description.Description.Length > 0)
{
_bubble = ((Component)dropdown).gameObject.AddComponent<BubblePopupHandler>();
_bubble.Initialize(GameObjectFactory.CreateBubble(Vector2.zero, name + "Bubble", _config.Description.Description, Vector2.zero, 6, true, 22), true);
}
base.Initialize();
}
public override void Dispose()
{
if ((Object)(object)dropdown != (Object)null)
{
Object.DestroyImmediate((Object)(object)((Component)dropdown).gameObject);
}
}
}
public class TootTallySettingLabel : BaseTootTallySettingObject
{
public TMP_Text label;
private string _text;
private float _fontSize;
private FontStyles _fontStyles;
private TextAlignmentOptions _align;
public TootTallySettingLabel(TootTallySettingPage page, string name, string text, float fontSize, FontStyles fontStyles, TextAlignmentOptions align)
: base(name, page)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
_text = text;
_fontSize = fontSize;
_fontStyles = fontStyles;
_align = align;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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)
label = GameObjectFactory.CreateSingleText(_page.gridPanel.transform, name, _text, (TextFont)0);
label.rectTransform.anchoredPosition = Vector2.zero;
label.rectTransform.pivot = Vector2.one / 2f;
label.enableWordWrapping = false;
label.fontSize = _fontSize;
label.fontStyle = _fontStyles;
label.alignment = _align;
label.autoSizeTextContainer = true;
base.Initialize();
}
public void SetText(string text)
{
_text = text;
label.text = text;
}
public override void Dispose()
{
if ((Object)(object)label != (Object)null)
{
Object.DestroyImmediate((Object)(object)((Component)label).gameObject);
}
}
}
public class TootTallySettingSlider : BaseTootTallySettingObject
{
public Slider slider;
public TMP_Text label;
private float _min;
private float _max;
private float _length;
private string _text;
private bool _integerOnly;
private ConfigEntry<float> _config;
public TootTallySettingSlider(TootTallySettingPage page, string name, float min, float max, float length, string text, ConfigEntry<float> config, bool integerOnly)
: base(name, page)
{
_min = min;
_max = max;
_length = length;
_text = text;
_config = config;
_integerOnly = integerOnly;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
slider = TootTallySettingObjectFactory.CreateSlider(_page.gridPanel.transform, name, _min, _max, _integerOnly);
((Component)slider).GetComponent<RectTransform>().sizeDelta = new Vector2(_length, 20f);
if (((ConfigEntryBase)_config).Description.Description != null && ((ConfigEntryBase)_config).Description.Description.Length > 0)
{
BubblePopupHandler val = ((Component)slider).gameObject.AddComponent<BubblePopupHandler>();
val.Initialize(GameObjectFactory.CreateBubble(Vector2.zero, name + "Bubble", ((ConfigEntryBase)_config).Description.Description, Vector2.zero, 6, true, 22), true);
}
TMP_Text handleText = ((Component)((Component)slider).transform.Find("Handle Slide Area/Handle/SliderHandleText")).GetComponent<TMP_Text>();
handleText.rectTransform.anchoredPosition = Vector2.zero;
handleText.rectTransform.sizeDelta = new Vector2(35f, 0f);
handleText.fontSize = 10f;
((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
{
handleText.text = SliderValueToText(value);
_config.Value = value;
});
slider.value = _config.Value;
label = GameObjectFactory.CreateSingleText(((Component)slider).transform, name + "Label", _text, (TextFont)0);
label.rectTransform.anchoredPosition = new Vector2(0f, 35f);
label.alignment = (TextAlignmentOptions)257;
base.Initialize();
}
public string SliderValueToText(float value)
{
if (slider.minValue == 0f && slider.maxValue == 1f)
{
return (int)(value * 100f) + "%";
}
if (slider.wholeNumbers)
{
return value.ToString();
}
return $"{value:0.00}";
}
public override void Dispose()
{
Object.DestroyImmediate((Object)(object)((Component)slider).gameObject);
}
}
public class TootTallySettingTextField : BaseTootTallySettingObject
{
public TMP_InputField inputField;
public TMP_Text label;
private string _defaultValue;
private string _description;
private float _fontSize;
private bool _isPassword;
private Vector2 _size;
public Action<string> onValueChanged;
public Action<string> onEditEnd;
public Action<string> onSubmit;
public Action<string> onSelect;
public Action<string> onDeselect;
public TootTallySettingTextField(TootTallySettingPage page, string name, Vector2 size, float fontSize, string defaultValue, string description, bool isPassword, Action<string> onEditEnd = null)
: base(name, page)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
_defaultValue = defaultValue;
_description = description;
_size = size;
_fontSize = fontSize;
_isPassword = isPassword;
this.onEditEnd = onEditEnd;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
inputField = TootTallySettingObjectFactory.CreateInputField(_page.gridPanel.transform, name, _size, _fontSize, _defaultValue, _isPassword);
if (_description != "")
{
BubblePopupHandler val = ((Component)inputField).gameObject.AddComponent<BubblePopupHandler>();
val.Initialize(GameObjectFactory.CreateBubble(Vector2.zero, name + "Bubble", _description, Vector2.zero, 6, true, 22), true);
}
label = inputField.textComponent;
((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)OnInputFieldTextChangeResizeBox);
if (onValueChanged != null)
{
((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)onValueChanged.Invoke);
}
if (onEditEnd != null)
{
((UnityEvent<string>)(object)inputField.onEndEdit).AddListener((UnityAction<string>)onEditEnd.Invoke);
}
if (onSubmit != null)
{
((UnityEvent<string>)(object)inputField.onSubmit).AddListener((UnityAction<string>)onSubmit.Invoke);
}
if (onSelect != null)
{
((UnityEvent<string>)(object)inputField.onSelect).AddListener((UnityAction<string>)onSelect.Invoke);
}
if (onDeselect != null)
{
((UnityEvent<string>)(object)inputField.onDeselect).AddListener((UnityAction<string>)onDeselect.Invoke);
}
base.Initialize();
}
public void OnInputFieldTextChangeResizeBox(string text)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
Vector2 sizeDelta = default(Vector2);
((Vector2)(ref sizeDelta))..ctor(_size.x, _size.y + (float)(label.textInfo.lineCount - 1) * (_fontSize + 2.5f));
((Component)inputField).GetComponent<RectTransform>().sizeDelta = sizeDelta;
((Component)((Component)inputField).transform.Find("Text")).GetComponent<RectTransform>().sizeDelta = sizeDelta;
((Component)label).GetComponent<RectTransform>().sizeDelta = sizeDelta;
LayoutRebuilder.ForceRebuildLayoutImmediate(_page.gridPanel.GetComponent<RectTransform>());
}
public override void Dispose()
{
Object.DestroyImmediate((Object)(object)((Component)inputField).gameObject);
}
}
public class TootTallySettingToggle : BaseTootTallySettingObject
{
public Toggle toggle;
private Vector2 _size;
private string _text;
private UnityAction<bool> _onValueChange;
private ConfigEntry<bool> _config;
public TootTallySettingToggle(TootTallySettingPage page, string name, Vector2 size, string text, ConfigEntry<bool> config, UnityAction<bool> onValueChange)
: base(name, page)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
_size = size;
_text = text;
_config = config;
_onValueChange = onValueChange;
if (TootTallySettingsManager.isInitialized)
{
Initialize();
}
}
public override void Initialize()
{
//IL_0019: 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_009d: Unknown result type (might be due to invalid IL or missing references)
toggle = TootTallySettingObjectFactory.CreateToggle(_page.gridPanel.transform, name, _size, _text, _config);
if (((ConfigEntryBase)_config).Description.Description != null && ((ConfigEntryBase)_config).Description.Description.Length > 0)
{
BubblePopupHandler val = ((Component)toggle).gameObject.AddComponent<BubblePopupHandler>();
val.Initialize(GameObjectFactory.CreateBubble(Vector2.zero, name + "Bubble", ((ConfigEntryBase)_config).Description.Description, Vector2.zero, 6, true, 22), true);
}
if (_onValueChange != null)
{
((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener(_onValueChange);
}
base.Initialize();
}
public override void Dispose()
{
Object.DestroyImmediate((Object)(object)((Component)toggle).gameObject);
}
}
}