using System;
using System.Collections;
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 System.Xml.Linq;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils;
using Fusion;
using HarmonyLib;
using HarmonyLib.Tools;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.IO;
using Microsoft.CodeAnalysis;
using SSSGame;
using SSSGame.UI;
using SandSailorStudio.UI;
using SandSailorStudio.Utils;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("io.abukaff.bepinex.aska.core")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d835557e65c5945f60b3a04edbc064ea6aaa5ece")]
[assembly: AssemblyProduct("io.abukaff.bepinex.core")]
[assembly: AssemblyTitle("io.abukaff.bepinex.aska.core")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[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 UnityEngine
{
public class Il2CppAssetBundleManager
{
private delegate IntPtr GetAllLoadedAssetBundles_NativeDelegate();
private delegate IntPtr LoadFromFile_InternalDelegate(IntPtr path, uint crc, ulong offset);
private delegate IntPtr LoadFromFileAsync_InternalDelegate(IntPtr path, uint crc, ulong offset);
private delegate IntPtr LoadFromMemory_InternalDelegate(IntPtr binary, uint crc);
private delegate IntPtr LoadFromMemoryAsync_InternalDelegate(IntPtr binary, uint crc);
private delegate IntPtr LoadFromStreamInternalDelegate(IntPtr stream, uint crc, uint managedReadBufferSize);
private delegate IntPtr LoadFromStreamAsyncInternalDelegate(IntPtr stream, uint crc, uint managedReadBufferSize);
private delegate IntPtr UnloadAllAssetBundlesDelegate(bool unloadAllObjects);
private static readonly GetAllLoadedAssetBundles_NativeDelegate GetAllLoadedAssetBundles_NativeDelegateField;
private static readonly LoadFromFile_InternalDelegate LoadFromFile_InternalDelegateField;
private static readonly LoadFromFileAsync_InternalDelegate LoadFromFileAsync_InternalDelegateField;
private static readonly LoadFromMemory_InternalDelegate LoadFromMemory_InternalDelegateField;
private static readonly LoadFromMemoryAsync_InternalDelegate LoadFromMemoryAsync_InternalDelegateField;
private static readonly LoadFromStreamInternalDelegate LoadFromStreamInternalDelegateField;
private static readonly LoadFromStreamAsyncInternalDelegate LoadFromStreamAsyncInternalDelegateField;
private static readonly UnloadAllAssetBundlesDelegate UnloadAllAssetBundlesDelegateField;
static Il2CppAssetBundleManager()
{
GetAllLoadedAssetBundles_NativeDelegateField = IL2CPP.ResolveICall<GetAllLoadedAssetBundles_NativeDelegate>("UnityEngine.AssetBundle::GetAllLoadedAssetBundles_Native");
LoadFromFile_InternalDelegateField = IL2CPP.ResolveICall<LoadFromFile_InternalDelegate>("UnityEngine.AssetBundle::LoadFromFile_Internal(System.String,System.UInt32,System.UInt64)");
LoadFromFileAsync_InternalDelegateField = IL2CPP.ResolveICall<LoadFromFileAsync_InternalDelegate>("UnityEngine.AssetBundle::LoadFromFileAsync_Internal");
LoadFromMemory_InternalDelegateField = IL2CPP.ResolveICall<LoadFromMemory_InternalDelegate>("UnityEngine.AssetBundle::LoadFromMemory_Internal");
LoadFromMemoryAsync_InternalDelegateField = IL2CPP.ResolveICall<LoadFromMemoryAsync_InternalDelegate>("UnityEngine.AssetBundle::LoadFromMemoryAsync_Internal");
LoadFromStreamInternalDelegateField = IL2CPP.ResolveICall<LoadFromStreamInternalDelegate>("UnityEngine.AssetBundle::LoadFromStreamInternal");
LoadFromStreamAsyncInternalDelegateField = IL2CPP.ResolveICall<LoadFromStreamAsyncInternalDelegate>("UnityEngine.AssetBundle::LoadFromStreamAsyncInternal");
UnloadAllAssetBundlesDelegateField = IL2CPP.ResolveICall<UnloadAllAssetBundlesDelegate>("UnityEngine.AssetBundle::UnloadAllAssetBundles");
}
public static AssetBundle[] GetAllLoadedAssetBundles()
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
if (GetAllLoadedAssetBundles_NativeDelegateField == null)
{
throw new NullReferenceException("The GetAllLoadedAssetBundles_NativeDelegateField cannot be null.");
}
IntPtr intPtr = GetAllLoadedAssetBundles_NativeDelegateField();
Il2CppReferenceArray<Object> val = ((intPtr != IntPtr.Zero) ? new Il2CppReferenceArray<Object>(intPtr) : null);
if (val == null)
{
throw new NullReferenceException("The refarr cannot be null.");
}
List<AssetBundle> list = new List<AssetBundle>();
for (int i = 0; i < ((Il2CppArrayBase<Object>)(object)val).Length; i++)
{
list.Add(new AssetBundle(IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase)(object)((Il2CppArrayBase<Object>)(object)val)[i])));
}
return list.ToArray();
}
public static AssetBundle LoadFromFile(string path)
{
return LoadFromFile(path, 0u, 0uL);
}
public static AssetBundle LoadFromFile(string path, uint crc)
{
return LoadFromFile(path, crc, 0uL);
}
public static AssetBundle LoadFromFile(string path, uint crc, ulong offset)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(path))
{
throw new ArgumentException("The input asset bundle path cannot be null or empty.");
}
if (LoadFromFile_InternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromFile_InternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromFile_InternalDelegateField(IL2CPP.ManagedStringToIl2Cpp(path), crc, offset);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundle)null) : new AssetBundle(intPtr);
}
public static AssetBundleCreateRequest LoadFromFileAsync(string path)
{
return LoadFromFileAsync(path, 0u, 0uL);
}
public static AssetBundleCreateRequest LoadFromFileAsync(string path, uint crc)
{
return LoadFromFileAsync(path, crc, 0uL);
}
public static AssetBundleCreateRequest LoadFromFileAsync(string path, uint crc, ulong offset)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(path))
{
throw new ArgumentException("The input asset bundle path cannot be null or empty.");
}
if (LoadFromFileAsync_InternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromFileAsync_InternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromFileAsync_InternalDelegateField(IL2CPP.ManagedStringToIl2Cpp(path), crc, offset);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundleCreateRequest)null) : new AssetBundleCreateRequest(intPtr);
}
public static AssetBundle LoadFromMemory(Il2CppStructArray<byte> binary)
{
return LoadFromMemory(binary, 0u);
}
public static AssetBundle LoadFromMemory(Il2CppStructArray<byte> binary, uint crc)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (binary == null)
{
throw new ArgumentException("The binary cannot be null or empty.");
}
if (LoadFromMemory_InternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromMemory_InternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromMemory_InternalDelegateField(IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase)(object)binary), crc);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundle)null) : new AssetBundle(intPtr);
}
public static AssetBundleCreateRequest LoadFromMemoryAsync(Il2CppStructArray<byte> binary)
{
return LoadFromMemoryAsync(binary, 0u);
}
public static AssetBundleCreateRequest LoadFromMemoryAsync(Il2CppStructArray<byte> binary, uint crc)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (binary == null)
{
throw new ArgumentException("The binary cannot be null or empty.");
}
if (LoadFromMemoryAsync_InternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromMemoryAsync_InternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromMemoryAsync_InternalDelegateField(IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase)(object)binary), crc);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundleCreateRequest)null) : new AssetBundleCreateRequest(intPtr);
}
public static AssetBundle LoadFromStream(Stream stream)
{
return LoadFromStream(stream, 0u, 0u);
}
public static AssetBundle LoadFromStream(Stream stream, uint crc)
{
return LoadFromStream(stream, crc, 0u);
}
public static AssetBundle LoadFromStream(Stream stream, uint crc, uint managedReadBufferSize)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (stream == null)
{
throw new ArgumentException("The stream cannot be null or empty.");
}
if (LoadFromStreamInternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromStreamInternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromStreamInternalDelegateField(IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase)(object)stream), crc, managedReadBufferSize);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundle)null) : new AssetBundle(intPtr);
}
public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream)
{
return LoadFromStreamAsync(stream, 0u, 0u);
}
public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream, uint crc)
{
return LoadFromStreamAsync(stream, crc, 0u);
}
public static AssetBundleCreateRequest LoadFromStreamAsync(Stream stream, uint crc, uint managedReadBufferSize)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (stream == null)
{
throw new ArgumentException("The stream cannot be null or empty.");
}
if (LoadFromStreamAsyncInternalDelegateField == null)
{
throw new NullReferenceException("The LoadFromStreamAsyncInternalDelegateField cannot be null.");
}
IntPtr intPtr = LoadFromStreamAsyncInternalDelegateField(IL2CPP.Il2CppObjectBaseToPtrNotNull((Il2CppObjectBase)(object)stream), crc, managedReadBufferSize);
return (!(intPtr != IntPtr.Zero)) ? ((AssetBundleCreateRequest)null) : new AssetBundleCreateRequest(intPtr);
}
public static void UnloadAllAssetBundles(bool unloadAllObjects)
{
if (UnloadAllAssetBundlesDelegateField == null)
{
throw new NullReferenceException("The UnloadAllAssetBundlesDelegateField cannot be null.");
}
UnloadAllAssetBundlesDelegateField(unloadAllObjects);
}
}
}
namespace io.abukaff.bepinex.core
{
[HarmonyPatch(typeof(BuildMenu))]
public static class BuildMenuPatch
{
private static GameObject newRow;
[HarmonyPostfix]
[HarmonyPatch("OnActivate")]
public static void OnActivatePostfix(BuildMenu __instance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)__instance).gameObject.transform;
ScrollRect val = UIHelpers.AddScrollView(transform, new Vector2(200f, 400f), Vector2.zero, UIHelpers.ZeroHalf, UIHelpers.ZeroHalf, UIHelpers.ZeroHalf, isVertical: true, 2f);
Transform transform2 = ((Component)val).gameObject.transform;
transform2.localScale *= UIHelpers.UIScaler;
StaticCoreHelpers.OnBuildMenu?.Invoke((Transform)(object)val.content);
}
public static void OnBackPatch()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
Harmony val = new Harmony("io.abukaff.bepinex.aska.core");
MethodInfo method = typeof(BuildMenu).GetMethod("OnBackPressed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method == null)
{
Console.WriteLine("Method not found!");
return;
}
MethodInfo method2 = typeof(BuildMenuPatch).GetMethod("OnBackPrefix");
val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Console.WriteLine("Patch applied!");
}
public static bool OnBackPrefix(BuildMenu __instance)
{
if ((Object)(object)newRow != (Object)null)
{
Object.Destroy((Object)(object)newRow);
}
return true;
}
}
[HarmonyPatch(typeof(Character))]
public static class CharacterPatch
{
[HarmonyPostfix]
[HarmonyPatch("Spawned")]
public static void Spawned(Character __instance)
{
if (__instance.IsPlayer() && ((NetworkBehaviour)__instance).GetLocalAuthorityMask() == 1)
{
Console.WriteLine("Player spawned");
StaticCoreHelpers.PlayerCharacter = ((Component)__instance).gameObject;
StaticCoreHelpers.OnPlayerCharacterSpawned?.Invoke();
}
}
}
public class CoreHelper : MonoBehaviour
{
private void Update()
{
if (Input.GetKeyDown((KeyCode)91) || Input.GetKeyDown((KeyCode)292))
{
StaticCoreHelpers.OnCloseModsUI?.Invoke();
}
}
}
public class CoroutineHelper : MonoBehaviour
{
private void Start()
{
Object.DontDestroyOnLoad((Object)(object)this);
}
public Coroutine StartCoroutineHelper(IEnumerator coroutine)
{
return MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)this, coroutine);
}
public void StopCoroutineHelper(Coroutine coroutine)
{
((MonoBehaviour)this).StopCoroutine(coroutine);
}
}
public class CustomTabButtonCategory : TabButtonCategory
{
public Action OnSelected;
public override void _OnSelect()
{
Plugin.Log.LogInfo((object)"_OnSelect");
OnSelected?.Invoke();
}
public override void OnSelect(BaseEventData eventData)
{
Plugin.Log.LogInfo((object)"OnSelect");
}
}
public static class ExtensionMethods
{
public static T FindComponentInParent<T>(this GameObject child) where T : Component
{
Transform val = child.transform;
while ((Object)(object)val != (Object)null)
{
T component = ((Component)val).GetComponent<T>();
if ((Object)(object)component != (Object)null)
{
return component;
}
val = val.parent;
}
return default(T);
}
public static Transform FindChildWithName(this Transform parent, string childName)
{
return parent.Find(childName);
}
public static Transform FindParentWithName(this Transform child, string parentName)
{
Transform val = child;
while ((Object)(object)val != (Object)null)
{
if (((Object)((Component)val).gameObject).name == parentName)
{
return val;
}
val = val.parent;
}
return null;
}
public static List<string> ToListString(this Enum enumValue)
{
Type type = enumValue.GetType();
if (!type.IsEnum)
{
throw new ArgumentException("Type parameter must be an enum type");
}
List<string> list = new List<string>();
foreach (object value in Enum.GetValues(type))
{
list.Add(value.ToString());
}
return list;
}
public static float GetFloatValue(this Dictionary<string, string> dictionary, string key, float defaultValue)
{
float result;
if (dictionary.TryGetValue(key, out var value))
{
return float.TryParse(value, out result) ? result : defaultValue;
}
return defaultValue;
}
public static T GetCopyOf<T>(this T comp, T other) where T : Component
{
Type type = ((object)comp).GetType();
Type type2 = ((object)other).GetType();
if (type != type2)
{
Debug.LogError(Object.op_Implicit($"The type \"{type.AssemblyQualifiedName}\" of \"{comp}\" does not match the type \"{type2.AssemblyQualifiedName}\" of \"{other}\"!"));
return default(T);
}
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanWrite)
{
try
{
propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
}
return comp;
}
public static T AddComponent<T>(this GameObject go, T toAdd) where T : Component
{
return go.AddComponent<T>().GetCopyOf(toAdd);
}
public static T GetCopyOf<T>(this T comp, Component other) where T : Component
{
Type type = ((object)comp).GetType();
Type type2 = ((object)other).GetType();
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] properties2 = type2.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo compProperty in array)
{
if (!compProperty.CanWrite)
{
continue;
}
PropertyInfo propertyInfo = properties2.FirstOrDefault((PropertyInfo p) => p.Name == compProperty.Name && p.PropertyType == compProperty.PropertyType);
if (propertyInfo != null && propertyInfo.CanRead)
{
try
{
compProperty.SetValue(comp, propertyInfo.GetValue(other, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] fields2 = type2.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo compField in array2)
{
FieldInfo fieldInfo = fields2.FirstOrDefault((FieldInfo f) => f.Name == compField.Name && f.FieldType == compField.FieldType);
if (fieldInfo != null)
{
try
{
compField.SetValue(comp, fieldInfo.GetValue(other));
}
catch
{
}
}
}
return comp;
}
public static T AddComponent<T>(this GameObject go, Component toAdd) where T : Component
{
return go.AddComponent<T>().GetCopyOf(toAdd);
}
}
[HarmonyPatch(typeof(WidgetMenu))]
public class HudPatch
{
[HarmonyPostfix]
[HarmonyPatch("OnActivate")]
public static void OnActivatePostfix(WidgetMenu __instance)
{
PlayerHUDMenu val = ((Il2CppObjectBase)__instance).TryCast<PlayerHUDMenu>();
Console.WriteLine("OnActivatePostfix");
if ((Object)(object)val != (Object)null)
{
Console.WriteLine("HUD OnActivatePostfix");
StaticCoreHelpers.PlayerHUD = ((Component)__instance).gameObject;
StaticCoreHelpers.OnPlayerHudActivate?.Invoke(((Component)__instance).transform);
}
}
}
[HarmonyPatch(typeof(MainMenu))]
public class MainMenuPatch
{
[HarmonyPostfix]
[HarmonyPatch("OnActivate")]
public static void OnActivatePostfix(MainMenu __instance)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
StaticCoreHelpers.OnMainMenu?.Invoke();
if (!Object.op_Implicit((Object)(object)StaticCoreHelpers.coroutineHelper))
{
GameObject val = new GameObject("CoroutineHelper");
StaticCoreHelpers.coroutineHelper = val.AddComponent<CoroutineHelper>();
Object.DontDestroyOnLoad((Object)(object)val);
}
if (!Object.op_Implicit((Object)(object)StaticCoreHelpers.coreHelper))
{
GameObject val2 = new GameObject("CoreHelper");
StaticCoreHelpers.coreHelper = val2.AddComponent<CoreHelper>();
Object.DontDestroyOnLoad((Object)(object)val2);
}
}
}
[BepInPlugin("io.abukaff.bepinex.aska.core", "io.abukaff.bepinex.core", "1.0.0")]
public class Plugin : BasePlugin
{
internal static ManualLogSource Log;
public override void Load()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("io.abukaff.bepinex.aska.core");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
ClassInjector.RegisterTypeInIl2Cpp<CustomTabButtonCategory>();
ClassInjector.RegisterTypeInIl2Cpp<CoroutineHelper>();
ClassInjector.RegisterTypeInIl2Cpp<CoreHelper>();
HarmonyFileLog.Enabled = true;
Harmony.CreateAndPatchAll(typeof(TestPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(MainMenuPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(SettingsMenuPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(BuildMenuPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(CharacterPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(HudPatch), (string)null);
BuildMenuPatch.OnBackPatch();
StaticCoreHelpers.RefreshResourceInfos();
ReadSettings();
StaticCoreHelpers.OnSettingsMenu = (Action<Transform>)Delegate.Combine(StaticCoreHelpers.OnSettingsMenu, new Action<Transform>(OnSettingsMenu));
}
private void OnSettingsMenu(Transform parent)
{
//IL_0031: 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_003b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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)
string filePath = Path.Combine(StaticCoreHelpers.assetsDirectory, "Core.xml");
UIHelpers.AddTextMeshPro("--- Core ---", 24f, parent, new Vector2(0f, 50f), UIHelpers.HalfHalf, Vector2.zero, Vector2.right, UIHelpers.HalfHalf);
UnityAction<float> callback = UnityAction<float>.op_Implicit((Action<float>)delegate(float value)
{
UIHelpers.UIScaler = value;
StaticCoreHelpers.UpdateXMLElementValue(filePath, UIHelpers.xml_UIScaler, value.ToString());
});
UIHelpers.AddSlider("Mod UI Scale", parent, new Vector2(0f, 50f), Vector2.zero, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0.5f), Color.red, 0.1f, 5f, 1f, UIHelpers.UIScaler, callback);
}
private void ReadSettings()
{
string filePath = Path.Combine(StaticCoreHelpers.assetsDirectory, "Core.xml");
Dictionary<string, string> dictionary = StaticCoreHelpers.ReadXMLFile(filePath);
dictionary.TryGetValue(UIHelpers.xml_UIScaler, out var value);
if (!float.TryParse(value, out UIHelpers.UIScaler))
{
UIHelpers.UIScaler = 1f;
}
}
}
[HarmonyPatch(typeof(SettingsMenu))]
public static class SettingsMenuPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void StartPostfix(SettingsMenu __instance)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)__instance).transform.FindChild("Panel");
Transform val2 = val.FindChild("VideoPage");
GameObject val3 = new GameObject("ModSettingsPage");
val3.transform.SetParent(val, false);
val3.transform.localPosition = Vector3.zero;
val3.AddComponent<TabPage>();
val3.AddComponent<TransformEventsHelper>();
Transform val4 = val.FindChild("TabsButtons");
Transform val5 = val4.FindChild("LayoutGroup");
Transform val6 = StaticCoreHelpers.FindChildByNameCaseInsensitive(val5, "VideoTabButton");
GameObject val7 = Object.Instantiate<GameObject>(((Component)val6).gameObject, val6.parent);
val7.transform.SetSiblingIndex(val5.childCount - 2);
((Object)val7).name = "ModTabButton";
Transform obj = val7.transform.FindChild("Icon");
GameObject val8 = ((obj != null) ? ((Component)obj).gameObject : null);
Transform obj2 = val7.transform.FindChild("Icon_Shadow");
GameObject val9 = ((obj2 != null) ? ((Component)obj2).gameObject : null);
Image component = val8.GetComponent<Image>();
Image component2 = val9.GetComponent<Image>();
Texture2D texture2D = ((Il2CppObjectBase)StaticCoreHelpers.LoadAssetBundle(StaticCoreHelpers.assetsDirectory, "markerbundle.bundle", "wrench")).TryCast<Texture2D>();
component.sprite = StaticCoreHelpers.GetSpriteFromTexture2D(texture2D);
component2.sprite = StaticCoreHelpers.GetSpriteFromTexture2D(texture2D);
val7.GetComponent<TabButton>().page = val3.GetComponent<TabPage>();
val7.GetComponent<TabButton>().order = 4;
RectTransform val10 = val3.GetComponent<RectTransform>() ?? val3.AddComponent<RectTransform>();
val10.anchorMin = Vector2.zero;
val10.anchorMax = Vector2.one;
val10.sizeDelta = new Vector2(-150f, -150f);
val3.SetActive(false);
val7.GetComponent<TabButtonTooltip>().toolTipDetails = "Mod Settings";
ScrollRect val11 = UIHelpers.AddScrollView((Transform)(object)val10, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), isVertical: true, 5f);
StaticCoreHelpers.OnSettingsMenu?.Invoke((Transform)(object)val11.content);
}
}
public static class StaticCoreHelpers
{
public static Action OnMainMenu;
public static Action<Transform> OnBuildMenu;
public static Action<Transform> OnPlayerHudActivate;
public static Action OnCloseModsUI;
public static List<ResourceInfo> resouceInfoScriptableObjects;
public static Action<Transform> OnSettingsMenu;
public static Action OnPlayerCharacterSpawned;
public static GameObject PlayerCharacter;
public static GameObject PlayerHUD;
private static Dictionary<string, AssetBundle> loadedAssetBundles;
public static CoroutineHelper coroutineHelper;
public static CoreHelper coreHelper;
public static string assetsDirectory;
private static List<InputMaps> cachedInputMaps;
private static InputMaps? cachedEnabledMap;
private static bool inputCurrentStatus;
static StaticCoreHelpers()
{
resouceInfoScriptableObjects = new List<ResourceInfo>();
loadedAssetBundles = new Dictionary<string, AssetBundle>();
cachedInputMaps = new List<InputMaps>();
cachedEnabledMap = null;
inputCurrentStatus = true;
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";
assetsDirectory = Path.Combine(path, "Assets");
Directory.CreateDirectory(assetsDirectory);
}
public static void RefreshResourceInfos()
{
Type type = Type.GetType("SSSGame.ResourceInfo, Assembly-CSharp");
Il2CppReferenceArray<Object> source = Resources.LoadAll("", type);
resouceInfoScriptableObjects = (from so in (IEnumerable<Object>)source
select ((Il2CppObjectBase)so).TryCast<ResourceInfo>() into ri
where (Object)(object)ri != (Object)null
select ri).ToList();
}
public static Sprite GetSpriteFromTexture2D(Texture2D texture2D)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)texture2D))
{
return null;
}
Rect val = default(Rect);
((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)texture2D).width, (float)((Texture)texture2D).height);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0.5f, 0.5f);
return Sprite.Create(texture2D, val, val2);
}
public static Object LoadAssetBundle(string folderPath, string assetBundleFileName, string prefabName, bool dontDestroyOnLoad = true)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
string text = Path.Combine(folderPath, assetBundleFileName);
if (!File.Exists(text))
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AssetBundle not found at path: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
}
log.LogError(val);
return null;
}
AssetBundle val2;
if (loadedAssetBundles.ContainsKey(text))
{
val2 = loadedAssetBundles[text];
Debug.Log(Object.op_Implicit("AssetBundle is already loaded."));
}
else
{
val2 = AssetBundle.LoadFromFile(text);
if ((Object)(object)val2 == (Object)null)
{
Plugin.Log.LogError((object)"Failed to load AssetBundle!");
return null;
}
loadedAssetBundles[text] = val2;
}
return val2.LoadAsset(prefabName);
}
public static void EnableGameInput(bool value, InputMaps? mapToEnable = null)
{
//IL_0045: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_007d: 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_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
InputManager val = Object.FindObjectOfType<InputManager>();
if ((Object)(object)val == (Object)null)
{
return;
}
if (!value && inputCurrentStatus)
{
cachedInputMaps.Clear();
Enumerator<InputMaps> enumerator = val._mapsToEnable.GetEnumerator();
while (enumerator.MoveNext())
{
InputMaps current = enumerator.Current;
cachedInputMaps.Add(current);
}
Enumerator<InputMaps> enumerator2 = val._mapsToEnable.GetEnumerator();
while (enumerator2.MoveNext())
{
InputMaps current2 = enumerator2.Current;
InputActionMap val2 = InputManager.GenInputActionMap(current2);
val.DisableActionMap(val2);
}
if (mapToEnable.HasValue)
{
cachedEnabledMap = mapToEnable;
InputActionMap val3 = InputManager.GenInputActionMap(mapToEnable.Value);
val.EnableActionMap(val3);
}
inputCurrentStatus = value;
}
else if (value && !inputCurrentStatus)
{
if (cachedEnabledMap.HasValue)
{
InputActionMap val4 = InputManager.GenInputActionMap(cachedEnabledMap.Value);
val.DisableActionMap(val4);
}
Enumerator<InputMaps> enumerator3 = cachedInputMaps.GetEnumerator();
while (enumerator3.MoveNext())
{
InputMaps current3 = enumerator3.Current;
InputActionMap val5 = InputManager.GenInputActionMap(current3);
val.EnableActionMap(val5);
}
inputCurrentStatus = value;
}
}
public static void EnableGameInputV2(InputManager inputManager, bool active)
{
if (active)
{
InputActionMap val = InputManager.GenInputActionMap((InputMaps)7);
inputManager.EnableActionMap(val);
InputActionMap val2 = InputManager.GenInputActionMap((InputMaps)9);
inputManager.EnableActionMap(val2);
InputActionMap val3 = InputManager.GenInputActionMap((InputMaps)12);
inputManager.EnableActionMap(val3);
}
else
{
InputActionMap val4 = InputManager.GenInputActionMap((InputMaps)7);
inputManager.DisableActionMap(val4);
InputActionMap val5 = InputManager.GenInputActionMap((InputMaps)9);
inputManager.DisableActionMap(val5);
InputActionMap val6 = InputManager.GenInputActionMap((InputMaps)12);
inputManager.DisableActionMap(val6);
}
}
public static Transform FindChildByNameCaseInsensitive(Transform parent, string name)
{
IEnumerator enumerator = parent.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
Object current = enumerator.Current;
Transform val = ((Il2CppObjectBase)current).TryCast<Transform>();
if (string.Equals(((Object)val).name, name, StringComparison.OrdinalIgnoreCase))
{
return val;
}
Transform val2 = FindChildByNameCaseInsensitive(val, name);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
}
finally
{
if (enumerator is IDisposable disposable)
{
disposable.Dispose();
}
}
return null;
}
public static Dictionary<string, string> ReadXMLFile(string filePath)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
try
{
XDocument xDocument = XDocument.Load(filePath);
foreach (XElement item in xDocument.Root.Elements())
{
dictionary.Add(item.Name.LocalName, item.Value);
}
}
catch (Exception ex)
{
Plugin.Log.LogWarning((object)ex.Message);
}
return dictionary;
}
public static void WriteXMLFile(string rootName, string filePath, Dictionary<string, string> data)
{
XElement xElement = new XElement(rootName);
foreach (KeyValuePair<string, string> datum in data)
{
XElement content = new XElement(datum.Key, datum.Value);
xElement.Add(content);
}
XDocument xDocument = new XDocument(xElement);
xDocument.Save(filePath);
}
public static void UpdateXMLElementValue(string filePath, string elementName, string newValue)
{
XDocument xDocument;
if (File.Exists(filePath))
{
xDocument = XDocument.Load(filePath);
}
else
{
string text = "Config";
XElement xElement = new XElement(text);
xDocument = new XDocument(xElement);
}
XElement xElement2 = xDocument.Descendants(elementName).FirstOrDefault();
if (xElement2 != null)
{
xElement2.Value = newValue;
}
else
{
XElement content = new XElement(elementName, newValue);
xDocument.Root.Add(content);
}
xDocument.Save(filePath);
}
}
[HarmonyPatch(typeof(MainMenu))]
public class TestPatch
{
[HarmonyPostfix]
[HarmonyPatch("OnActivate")]
public static void OnActivatePostfix(MainMenu __instance)
{
Plugin.Log.LogInfo((object)"MainMenu.OnActivate");
Type type = Type.GetType("SSSGame.DynamicDimensionTemplate, Assembly-CSharp");
Il2CppReferenceArray<Object> val = Resources.FindObjectsOfTypeAll(type);
foreach (Object item in (Il2CppArrayBase<Object>)(object)val)
{
if (item.name == "Item_Structures_TerrainLevelField")
{
DynamicDimensionTemplate val2 = ((Il2CppObjectBase)item).TryCast<DynamicDimensionTemplate>();
if (Object.op_Implicit((Object)(object)val2))
{
val2.maxNumberOfTiles = 125;
}
}
}
}
}
public static class UIHelpers
{
public static string xml_UIScaler = "UIScaler";
public static float UIScaler = 1f;
public static Color backGroundColor = new Color(0f, 0f, 0f, 0.8f);
public static Color greenColor = new Color(0f, 0.5f, 0f, 1f);
public static Color redColor = new Color(0.5f, 0f, 0f, 1f);
public static readonly Vector2 HalfHalf = new Vector2(0.5f, 0.5f);
public static readonly Vector2 HalfZero = new Vector2(0.5f, 0f);
public static readonly Vector2 ZeroHalf = new Vector2(0f, 0.5f);
public static readonly Vector2 OneZero = new Vector2(1f, 0f);
public static readonly Vector2 ZeroOne = new Vector2(0f, 1f);
public static readonly Vector2 HalfOne = new Vector2(0.5f, 1f);
public static readonly Vector2 OneHalf = new Vector2(1f, 0.5f);
public static Toggle CreateToggle(string name, string text, bool startValue, Transform parent, Vector2 size, Vector2 anchorPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, UnityAction<bool>? callback = null, Color bgColor = default(Color))
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001e: 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_0033: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_00a2: 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_00d0: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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)
//IL_0106: Expected O, but got Unknown
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: 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_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Expected O, but got Unknown
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).localPosition = Vector3.zero;
val2.sizeDelta = size;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchorPosition;
Rect rect = val2.rect;
Vector2 size2 = ((Rect)(ref rect)).size;
Toggle val3 = val.AddComponent<Toggle>();
GameObject val4 = new GameObject("Toggle");
val4.transform.SetParent(val.transform, false);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMin = new Vector2(0f, 0.5f);
val5.anchorMax = new Vector2(0f, 0.5f);
val5.pivot = new Vector2(0f, 0.5f);
val5.sizeDelta = new Vector2(size2.x / 4f, size2.y);
GameObject val6 = new GameObject("Background");
val6.transform.SetParent(val4.transform, false);
RectTransform val7 = val6.AddComponent<RectTransform>();
val7.sizeDelta = new Vector2(16f, 16f);
val7.anchorMin = new Vector2(0.5f, 0.5f);
val7.anchorMax = new Vector2(0.5f, 0.5f);
val7.pivot = new Vector2(0.5f, 0.5f);
val7.anchoredPosition = new Vector2(0f, 0f);
Image val8 = val6.AddComponent<Image>();
((Graphic)val8).color = Color.white;
GameObject val9 = new GameObject("Checkmark");
val9.transform.SetParent(val6.transform, false);
RectTransform val10 = val9.AddComponent<RectTransform>();
val10.sizeDelta = new Vector2(13f, 13f);
val10.anchorMin = new Vector2(0.5f, 0.5f);
val10.anchorMax = new Vector2(0.5f, 0.5f);
val10.pivot = new Vector2(0.5f, 0.5f);
val10.anchoredPosition = new Vector2(0f, 0f);
Image val11 = val9.AddComponent<Image>();
((Graphic)val11).color = Color.green;
((Selectable)val3).targetGraphic = (Graphic)(object)val8;
val3.graphic = (Graphic)(object)val11;
val3.isOn = startValue;
GameObject val12 = new GameObject("text");
RectTransform val13 = val12.AddComponent<RectTransform>();
((Transform)val13).SetParent((Transform)(object)val2, false);
val13.anchorMin = new Vector2(0f, 0f);
val13.anchorMax = new Vector2(1f, 1f);
val13.offsetMin = new Vector2(size2.x / 4f, 0f);
val13.offsetMax = new Vector2(0f, 0f);
TextMeshProUGUI val14 = val12.AddComponent<TextMeshProUGUI>();
((TMP_Text)val14).text = text;
((TMP_Text)val14).fontSize = val2.sizeDelta.y / 2f;
((TMP_Text)val14).alignment = (TextAlignmentOptions)513;
if ((Delegate)(object)callback != (Delegate)null)
{
((UnityEvent<bool>)(object)val3.onValueChanged).AddListener(callback);
}
return val3;
}
public static Slider AddSlider(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, float minSliderValue, float maxSliderValue, float stepSize, float initialValue, UnityAction<float>? callback)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0052: 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_0065: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
float num = size.y / 3f;
GameObject val = new GameObject("SliderContainer");
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(parent, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.anchoredPosition = anchoredPosition;
val2.pivot = pivot;
val2.sizeDelta = size;
TextMeshProUGUI val3 = AddTextMeshPro(text, num, (Transform)(object)val2, new Vector2(size.x, num), new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f));
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
TextMeshProUGUI valueText = AddTextMeshPro("1.0", num, (Transform)(object)val2, new Vector2(size.x, num), new Vector2(0f, (0f - size.y) / 3f), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f));
((TMP_Text)valueText).alignment = (TextAlignmentOptions)514;
GameObject val4 = new GameObject("Slider");
RectTransform val5 = val4.AddComponent<RectTransform>();
((Transform)val5).SetParent((Transform)(object)val2, false);
val5.anchorMin = new Vector2(0f, 0f);
val5.anchorMax = new Vector2(1f, 0f);
val5.anchoredPosition = new Vector2(0f, 0f);
val5.pivot = new Vector2(0.5f, 0f);
val5.sizeDelta = new Vector2(-5f, num / 2f);
Image val6 = val4.AddComponent<Image>();
((Graphic)val6).color = color;
Slider slider = val4.AddComponent<Slider>();
slider.minValue = minSliderValue;
slider.maxValue = maxSliderValue;
slider.wholeNumbers = false;
slider.value = initialValue;
RectTransform val7 = new GameObject("fill").AddComponent<RectTransform>();
RectTransform val8 = new GameObject("bar").AddComponent<RectTransform>();
((Transform)val7).SetParent((Transform)(object)val5, false);
((Transform)val8).SetParent((Transform)(object)val5, false);
Vector2 val9 = default(Vector2);
((Vector2)(ref val9))..ctor(0f, 0f);
val8.anchoredPosition = val9;
val7.anchoredPosition = val9;
((Vector2)(ref val9))..ctor(0.5f, 0.5f);
val8.anchorMin = val9;
val7.anchorMin = val9;
((Vector2)(ref val9))..ctor(0.5f, 0.5f);
val8.anchorMax = val9;
val7.anchorMax = val9;
((Vector2)(ref val9))..ctor(0.5f, 0.5f);
val8.pivot = val9;
val7.pivot = val9;
val8.sizeDelta = new Vector2(val5.sizeDelta.y + 2f, val5.sizeDelta.y + 2f);
((Graphic)((Component)val8).gameObject.AddComponent<Image>()).color = Color.white;
slider.fillRect = val7;
slider.handleRect = val8;
UnityAction<float> val10 = UnityAction<float>.op_Implicit((Action<float>)delegate(float value)
{
float num2 = value / stepSize * stepSize;
num2 = Mathf.Round(num2 * 10f) / 10f;
slider.value = num2;
((TMP_Text)valueText).text = value.ToString("F1");
});
callback = ((!((Delegate)(object)callback == (Delegate)null)) ? (callback + val10) : val10);
((UnityEvent<float>)(object)slider.onValueChanged).AddListener(callback);
((UnityEvent<float>)(object)slider.onValueChanged)?.Invoke(slider.value);
return slider;
}
public static TMP_Dropdown AddDropDown(string name, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, List<string> values, UnityAction<int>? callback)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_002d: 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_003f: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_0094: 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)
//IL_00c2: 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)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: 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)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Expected O, but got Unknown
GameObject val = new GameObject("DropDown");
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(parent, false);
val2.sizeDelta = size;
val2.anchoredPosition = anchoredPosition;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color.white;
TMP_Dropdown val4 = val.AddComponent<TMP_Dropdown>();
((Selectable)val4).targetGraphic = (Graphic)(object)val3;
GameObject val5 = new GameObject("arrow");
RectTransform val6 = val5.AddComponent<RectTransform>();
((Transform)val6).SetParent((Transform)(object)val2, false);
val6.anchorMin = new Vector2(1f, 0f);
val6.anchorMax = new Vector2(1f, 1f);
val6.pivot = new Vector2(1f, 0.5f);
val6.anchoredPosition = new Vector2(-10f, 0f);
val6.sizeDelta = new Vector2(24f, 24f);
Image val7 = val5.AddComponent<Image>();
val7.sprite = SpriteHelpers.GetSprite(ESprite.DropDown);
((Graphic)val7).color = new Color(0f, 0f, 0f, 0.8f);
ScrollRect val8 = AddScrollView((Transform)(object)val2, new Vector2(0f, 150f), Vector2.zero, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 1f), isVertical: true, 1f);
TextMeshProUGUI captionText = AddTextMeshPro("Options", 16f, (Transform)(object)val2, new Vector2(0f, 30f), Vector2.zero, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f));
Toggle val9 = CreateToggle("toggle", "OptionA", startValue: false, (Transform)(object)val8.content, new Vector2(0f, 20f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f));
val4.template = ((Component)val8).gameObject.GetComponent<RectTransform>();
val4.captionText = (TMP_Text)(object)captionText;
((Graphic)val4.captionText).color = Color.black;
val4.itemText = (TMP_Text)(object)((Component)val9).GetComponentInChildren<TextMeshProUGUI>();
List<OptionData> val10 = new List<OptionData>();
foreach (string value in values)
{
val10.Add(new OptionData(value));
}
val4.AddOptions(val10);
if ((Delegate)(object)callback != (Delegate)null)
{
((UnityEvent<int>)(object)val4.onValueChanged).AddListener(callback);
}
return val4;
}
public static Button AddButton(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, UnityAction? callback)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Button");
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = color;
Button val4 = val.AddComponent<Button>();
val2.sizeDelta = size;
((Transform)val2).localPosition = Vector3.zero;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchoredPosition;
Rect rect = val2.rect;
Vector2 size2 = ((Rect)(ref rect)).size;
AddTextMeshPro(text, size2.y / 2f, val.transform, Vector2.zero, Vector2.zero, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f));
if ((Delegate)(object)callback != (Delegate)null)
{
((UnityEvent)val4.onClick).AddListener(callback);
}
return val4;
}
public static Button AddButton(string text, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Color color, Sprite backGroundImage, UnityAction? callback)
{
//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)
//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)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Button val = AddButton(text, parent, size, anchoredPosition, anchorMin, anchorMax, pivot, color, callback);
Image component = ((Component)val).GetComponent<Image>();
component.sprite = backGroundImage;
return val;
}
public static void AddUnityInputField(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0022: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_0071: Expected O, but got Unknown
//IL_0095: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MyInputField");
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = size;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchoredPosition;
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color.white;
InputField val4 = val.AddComponent<InputField>();
GameObject val5 = new GameObject("Placeholder");
RectTransform val6 = val5.AddComponent<RectTransform>();
((Transform)val6).SetParent(val.transform, false);
val6.anchorMin = new Vector2(0f, 0f);
val6.anchorMax = new Vector2(1f, 1f);
val6.offsetMin = Vector2.zero;
val6.offsetMax = Vector2.zero;
Text val7 = val5.AddComponent<Text>();
val7.text = "Enter text...";
((Graphic)val7).color = Color.gray;
val7.supportRichText = false;
GameObject val8 = new GameObject("Text");
RectTransform val9 = val8.AddComponent<RectTransform>();
val8.transform.SetParent(val.transform, false);
Text val10 = val8.AddComponent<Text>();
((Graphic)val10).color = Color.black;
val10.supportRichText = false;
val4.placeholder = (Graphic)(object)val7;
val4.textComponent = val10;
}
public static TMP_InputField AddInputField(Transform parent, string placeHolderText, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool disableESC = false, UnityAction<string> OnTextChangedCallback = null, UnityAction<string> onSelectedCallback = null, UnityAction<string> onDeSelectCallback = null)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0022: 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_0033: 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)
//IL_0045: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_00b5: 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_00c9: Expected O, but got Unknown
//IL_0101: 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_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Expected O, but got Unknown
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("InputField");
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = size;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchoredPosition;
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = Color.white;
TMP_InputField val4 = ((!disableESC) ? val.AddComponent<TMP_InputField>() : val.AddComponent<TMP_InputField>());
((Selectable)val4).targetGraphic = (Graphic)(object)val3;
val4.readOnly = false;
ColorBlock colors = ((Selectable)val4).colors;
((ColorBlock)(ref colors)).selectedColor = new Color(0.8f, 1f, 0.8f, 1f);
((Selectable)val4).colors = colors;
GameObject val5 = new GameObject("Text Area");
val5.transform.SetParent(val.transform, false);
RectTransform val6 = val5.AddComponent<RectTransform>();
val5.AddComponent<RectMask2D>().padding = new Vector4(-8f, -8f, -5f, -5f);
val6.sizeDelta = Vector2.zero;
val6.anchorMin = new Vector2(0f, 0f);
val6.anchorMax = new Vector2(1f, 1f);
val6.pivot = new Vector2(0.5f, 0.5f);
val6.anchoredPosition = Vector2.zero;
GameObject val7 = new GameObject("Placeholder");
val7.transform.SetParent(val5.transform, false);
RectTransform val8 = val7.AddComponent<RectTransform>();
val8.sizeDelta = Vector2.zero;
val8.anchorMin = new Vector2(0f, 0f);
val8.anchorMax = new Vector2(1f, 1f);
val8.pivot = new Vector2(0.5f, 0.5f);
val8.anchoredPosition = Vector2.zero;
TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>();
((TMP_Text)val9).text = placeHolderText;
((TMP_Text)val9).fontSize = 14f;
((Graphic)val9).color = new Color(0.5f, 0.5f, 0.5f, 1f);
((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
GameObject val10 = new GameObject("Text");
val10.transform.SetParent(val5.transform, false);
RectTransform val11 = val10.AddComponent<RectTransform>();
val11.sizeDelta = Vector2.zero;
val11.anchorMin = new Vector2(0f, 0f);
val11.anchorMax = new Vector2(1f, 1f);
val11.pivot = new Vector2(0.5f, 0.5f);
val11.anchoredPosition = Vector2.zero;
TextMeshProUGUI val12 = val10.AddComponent<TextMeshProUGUI>();
((TMP_Text)val12).fontSize = 14f;
((Graphic)val12).color = Color.black;
((TMP_Text)val12).alignment = (TextAlignmentOptions)514;
val4.textViewport = val6;
val4.textComponent = (TMP_Text)(object)val12;
val4.placeholder = (Graphic)(object)val9;
if ((Delegate)(object)OnTextChangedCallback != (Delegate)null)
{
((UnityEvent<string>)(object)val4.onValueChanged).AddListener(OnTextChangedCallback);
}
if ((Delegate)(object)onSelectedCallback != (Delegate)null)
{
((UnityEvent<string>)(object)val4.onSelect).AddListener(onSelectedCallback);
}
if ((Delegate)(object)onDeSelectCallback != (Delegate)null)
{
((UnityEvent<string>)(object)val4.onDeselect).AddListener(onDeSelectCallback);
}
return val4;
}
public static RectTransform AddPanel(string name, Transform parent, Vector2 size, Color color, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = color;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.anchoredPosition = anchoredPosition;
val2.pivot = pivot;
val2.sizeDelta = size;
return val2;
}
public static RectTransform AddVerticalPanel(string name, Transform parent, Vector2 size, Color color, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, float spacing = 0f)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_005d: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
RectTransform val2 = val.AddComponent<RectTransform>();
Image val3 = val.AddComponent<Image>();
VerticalLayoutGroup val4 = val.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)val4).childAlignment = (TextAnchor)4;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)val4).spacing = spacing;
((Graphic)val3).color = color;
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.anchoredPosition = anchoredPosition;
val2.pivot = pivot;
val2.sizeDelta = size;
return val2;
}
public static TextMeshProUGUI AddTextMeshPro(string text, float fontSize, Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
{
//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_004d: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MyText");
RectTransform val2 = val.AddComponent<RectTransform>();
val2.sizeDelta = size;
TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)val3).text = text;
((TMP_Text)val3).fontSize = fontSize;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
val.transform.SetParent(parent, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.anchoredPosition = anchoredPosition;
return val3;
}
public static ScrollRect AddScrollView(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: 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_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ScrollView");
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(parent, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.sizeDelta = size;
val2.anchoredPosition = anchoredPosition;
ScrollRect val3 = val.AddComponent<ScrollRect>();
val3.scrollSensitivity = 25f;
GameObject val4 = new GameObject("Mask");
val4.transform.SetParent(val.transform, false);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMax = new Vector2(1f, 1f);
val5.anchorMin = new Vector2(0f, 0f);
val5.sizeDelta = Vector2.zero;
Image val6 = val4.AddComponent<Image>();
((Graphic)val6).color = backGroundColor;
val4.AddComponent<Mask>();
GameObject val7 = new GameObject("content");
val7.transform.SetParent(val4.transform, false);
val7.transform.localPosition = Vector3.zero;
RectTransform val8 = val7.AddComponent<RectTransform>();
val8.anchorMax = new Vector2(1f, 1f);
val8.anchorMin = new Vector2(0f, 0f);
val8.pivot = new Vector2(0.5f, 1f);
val8.offsetMin = Vector2.zero;
val8.offsetMax = Vector2.zero;
val5.sizeDelta = Vector2.zero;
if (isVertical)
{
VerticalLayoutGroup val9 = val7.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val9).childForceExpandHeight = false;
((HorizontalOrVerticalLayoutGroup)val9).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val9).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val9).spacing = spacing;
ContentSizeFitter val10 = val7.AddComponent<ContentSizeFitter>();
val10.verticalFit = (FitMode)2;
val10.horizontalFit = (FitMode)0;
}
else
{
HorizontalLayoutGroup val11 = val7.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = true;
((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = false;
((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = false;
((HorizontalOrVerticalLayoutGroup)val11).spacing = spacing;
ContentSizeFitter val12 = val7.AddComponent<ContentSizeFitter>();
val12.verticalFit = (FitMode)0;
val12.horizontalFit = (FitMode)2;
}
val3.content = val8;
val3.horizontal = !isVertical;
val3.vertical = isVertical;
val3.viewport = val5;
val3.movementType = (MovementType)2;
return val3;
}
public static ScrollRect AddScrollViewGrid(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f, float childHeight = 100f, float childWidth = 100f)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_002e: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0072: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("ScrollView");
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(parent, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.sizeDelta = size + new Vector2(spacing, spacing);
val2.anchoredPosition = anchoredPosition;
ScrollRect val3 = val.AddComponent<ScrollRect>();
val3.scrollSensitivity = 25f;
GameObject val4 = new GameObject("Mask");
val4.transform.SetParent(val.transform, false);
RectTransform val5 = val4.AddComponent<RectTransform>();
val5.anchorMax = new Vector2(1f, 1f);
val5.anchorMin = new Vector2(0f, 0f);
val5.sizeDelta = Vector2.zero;
Image val6 = val4.AddComponent<Image>();
((Graphic)val6).color = backGroundColor;
val4.AddComponent<Mask>();
GameObject val7 = new GameObject("content");
val7.transform.SetParent(val4.transform, false);
val7.transform.localPosition = Vector3.zero;
RectTransform val8 = val7.AddComponent<RectTransform>();
val8.anchorMax = new Vector2(1f, 1f);
val8.anchorMin = new Vector2(0f, 0f);
val8.pivot = new Vector2(0.5f, 1f);
val8.offsetMin = Vector2.zero;
val8.offsetMax = Vector2.zero;
val5.sizeDelta = Vector2.zero;
GridLayoutGroup val9 = val7.gameObject.AddComponent<GridLayoutGroup>();
val9.spacing = new Vector2(spacing, spacing);
val9.cellSize = new Vector2(childHeight, childWidth);
Rect rect = val2.rect;
int constraintCount = (int)Math.Floor(((Rect)(ref rect)).width / childWidth);
rect = val2.rect;
int constraintCount2 = (int)Math.Floor(((Rect)(ref rect)).height / childHeight);
if (isVertical)
{
val9.constraint = (Constraint)1;
val9.constraintCount = constraintCount;
}
else
{
val9.constraint = (Constraint)2;
val9.constraintCount = constraintCount2;
}
ContentSizeFitter val10 = val7.AddComponent<ContentSizeFitter>();
val10.horizontalFit = (FitMode)2;
val10.verticalFit = (FitMode)2;
val3.content = val8;
val3.horizontal = !isVertical;
val3.vertical = isVertical;
val3.viewport = val5;
val3.movementType = (MovementType)2;
return val3;
}
public static RectTransform AddGrid(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, bool isVertical = false, float spacing = 0f, float childHeight = 100f, float childWidth = 100f)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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_002e: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_006e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("GridView");
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(parent, false);
val2.anchorMin = anchorMin;
val2.anchorMax = anchorMax;
val2.pivot = pivot;
val2.sizeDelta = size;
val2.anchoredPosition = anchoredPosition;
GridLayoutGroup val3 = val.AddComponent<GridLayoutGroup>();
val3.spacing = new Vector2(spacing, spacing);
val3.cellSize = new Vector2(childHeight, childWidth);
Rect rect = val2.rect;
int constraintCount = (int)Math.Floor(((Rect)(ref rect)).width / childWidth);
rect = val2.rect;
int constraintCount2 = (int)Math.Floor(((Rect)(ref rect)).height / childHeight);
if (isVertical)
{
val3.constraint = (Constraint)1;
val3.constraintCount = constraintCount;
}
else
{
val3.constraint = (Constraint)2;
val3.constraintCount = constraintCount2;
}
ContentSizeFitter val4 = val.AddComponent<ContentSizeFitter>();
val4.horizontalFit = (FitMode)2;
val4.verticalFit = (FitMode)2;
return val2;
}
}
public static class SpriteHelpers
{
private static Dictionary<ESprite, string> _sprites;
private static string dropDownb64;
static SpriteHelpers()
{
_sprites = new Dictionary<ESprite, string>();
dropDownb64 = "iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAAAcFJREFUeF7t2TtOxEAUBVHPGhBiucByEWINgxyQIBA/z5zXopw4c9lVvlGfti5q4ETpwbcC4J+gAAXABjC+BRQAG8D4FlAAbADjW0ABsAGMbwEFwAYwvgUUABvA+BZQAGwA41tAAbABjG8BBcAGML4FFAAbwPgWUABsAONbQAGwAYxvAQXABjC+BRQAG8D4FlAAbADjW0ABsAGMbwEFwAYwvgUUABvA+Bbw3wI8Pb/cn8/bA/7uD/Gn0/Zwd3vzeM13IwuYGEHI30OTADt4UgQlnwaYEkHK5wF0BC1/RAAVYYL8MQGuHWGK/FEBrhVhkvxxAS4dYZr8kQEuFWGi/LEBjo4wVf7oAEdFmCx/fIC/Rpguf4kAv42wgvxlAvw0wirylwrw3QgryV8uwFcRVpO/ZIDPIqwof9kA7yOsKn/pAG8R9vu1jxF35lEXOxE76gNWf04BcMECFAAbwPgWUABsAONbQAGwAYxvAQXABjC+BRQAG8D4FlAAbADjW0ABsAGMbwEFwAYwvgUUABvA+BZQAGwA41tAAbABjG8BBcAGML4FFAAbwPgWUABsAONbQAGwAYxvAQXABjC+BRQAG8D4V6UFiWHb963kAAAAAElFTkSuQmCC";
_sprites[ESprite.DropDown] = dropDownb64;
}
public static Sprite GetSprite(ESprite spriteName)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0042: 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)
byte[] array = Convert.FromBase64String(_sprites[spriteName]);
Texture2D val = new Texture2D(12, 12);
ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array));
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
}
}
public enum ESprite
{
DropDown
}
public class ModImage
{
public GameObject gameobject;
public RectTransform transform;
public Image image;
public ModImage(Transform parent, Sprite sprite, Vector2 size, Vector2 anchoredPosition, Vector2 anchorPivot, Vector2 anchorMin, Vector2 anchorMax)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_003b: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_0091: Unknown result type (might be due to invalid IL or missing references)
gameobject = new GameObject();
transform = gameobject.AddComponent<RectTransform>();
((Object)gameobject).name = "ModImage";
((Transform)transform).position = Vector3.zero;
((Transform)transform).SetParent(parent, false);
transform.sizeDelta = size;
transform.anchoredPosition = anchoredPosition;
transform.anchorMin = anchorMin;
transform.anchorMax = anchorMax;
transform.pivot = anchorPivot;
image = gameobject.AddComponent<Image>();
image.sprite = sprite;
((Graphic)image).raycastTarget = false;
}
}
public class ModTabGroup
{
public RectTransform transform;
public List<ScrollRect> tabScrollView = new List<ScrollRect>();
private List<RectTransform> buttons = new List<RectTransform>();
private RectTransform scrollViewButtonsContent;
private int selectedIndex = 0;
public ModTabGroup(Transform parent, Vector2 size, Vector2 anchoredPosition, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b4: 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)
GameObject val = new GameObject("ModTabGroup");
transform = val.AddComponent<RectTransform>();
((Transform)transform).SetParent(parent, false);
transform.anchorMin = anchorMin;
transform.anchorMax = anchorMax;
transform.pivot = pivot;
transform.sizeDelta = size;
transform.anchoredPosition = anchoredPosition;
ScrollRect val2 = UIHelpers.AddScrollView((Transform)(object)transform, new Vector2(-20f, size.y * 0.1f), Vector2.zero, UIHelpers.ZeroOne, Vector2.one, UIHelpers.HalfOne, isVertical: false, 4f);
scrollViewButtonsContent = val2.content;
}
public RectTransform AddTab(string title, bool isVertical)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0056: 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_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
int index = tabScrollView.Count;
UnityAction callback = UnityAction.op_Implicit((Action)delegate
{
ChangeTab(index);
});
RectTransform parent = scrollViewButtonsContent;
Rect rect = scrollViewButtonsContent.rect;
Button val = UIHelpers.AddButton(title, (Transform)(object)parent, new Vector2(100f, ((Rect)(ref rect)).height), Vector2.zero, UIHelpers.HalfHalf, UIHelpers.HalfHalf, UIHelpers.HalfHalf, UIHelpers.greenColor, callback);
ScrollRect val2 = UIHelpers.AddScrollView((Transform)(object)transform, new Vector2(-20f, transform.sizeDelta.y * 0.88f), new Vector2(0f, (0f - transform.sizeDelta.y) * 0.11f), UIHelpers.ZeroOne, Vector2.one, UIHelpers.HalfOne, isVertical, 2f);
tabScrollView.Add(val2);
((Component)val2).gameObject.SetActive(false);
return val2.content;
}
public void ChangeTab(int tabIndex)
{
if (tabIndex >= tabScrollView.Count)
{
return;
}
selectedIndex = tabIndex;
foreach (ScrollRect item in tabScrollView)
{
((Component)item).gameObject.SetActive(false);
}
((Component)tabScrollView[tabIndex]).gameObject.SetActive(true);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "io.abukaff.bepinex.aska.core";
public const string PLUGIN_NAME = "io.abukaff.bepinex.core";
public const string PLUGIN_VERSION = "1.0.0";
}
}