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 BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
using TabsBuilderApi.Patches;
using TabsBuilderApi.Utils;
using TabsBuilderApi.backend;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Cosmella")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Api for tabs in among us")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+3616f359a37db6de13a6c0da8fab21e87f37533b")]
[assembly: AssemblyProduct("TabsBuilder")]
[assembly: AssemblyTitle("TabsBuilder")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Cosmella-v/TabsBuilderApi")]
[assembly: AssemblyVersion("1.2.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.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]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[HarmonyPatch(typeof(ModManager), "LateUpdate")]
internal class ModManagerLateUpdatePatch
{
public static void Prefix(ModManager __instance)
{
__instance.ShowModStamp();
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace TabsBuilderApi
{
[BepInProcess("Among Us.exe")]
[BepInPlugin("tabsbuilder.api", "TabsBuilderApi", "1.2.0+3616f359a37db6de13a6c0da8fab21e87f37533b")]
public class TabBuilderPlugin : BasePlugin
{
public static ManualLogSource mls;
public const string Id = "tabsbuilder.api";
internal Harmony Harmony { get; } = new Harmony("tabsbuilder.api");
public static string Name => "TabsBuilderApi";
public static string Version => "1.2.0+3616f359a37db6de13a6c0da8fab21e87f37533b";
public override void Load()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
mls = Logger.CreateLogSource("tabsbuilder.api");
ManualLogSource obj = mls;
bool flag = default(bool);
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("tabsbuilder.api");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" the api has Awaken");
}
obj.LogDebug(val);
Harmony.PatchAll(typeof(PlayerCustomizationMenuPatched));
PlayerCustomizationMenuPatched.registerClass();
ClassInjector.RegisterTypeInIl2Cpp<TabScript>();
}
}
}
namespace TabsBuilderApi.backend
{
public class ExpandedTabButton : MonoBehaviour
{
public Action<PlayerCustomizationMenu>? action;
public void InvokeAction(PlayerCustomizationMenu menu)
{
action?.Invoke(menu);
}
}
public static class TabRegistry
{
public static void BuildAll(PlayerCustomizationMenu instance)
{
foreach (Type item in (from t in AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly assembly2)
{
try
{
return assembly2.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
return ex.Types.Where((Type t) => t != null);
}
catch
{
return Enumerable.Empty<Type>();
}
})
where t.IsDefined(typeof(TabBuilderAttribute), inherit: false)
select t).ToList())
{
Assembly assembly = item.Assembly;
TabBuilderAttribute[] array = (TabBuilderAttribute[])Attribute.GetCustomAttributes(item, typeof(TabBuilderAttribute));
for (int num = 0; num < array.Length; num++)
{
array[num]?.Build(instance, assembly);
}
}
}
}
}
namespace TabsBuilderApi.Patches
{
public class PlayerCustomizationMenuBehaviourPatched : MonoBehaviour
{
public Scroller anotherScroller;
private AspectSpacer aspectSpacer;
private PlayerCustomizationMenu instance;
private int orderSize;
protected List<Transform> funSpacingSort()
{
List<Transform> val = new List<Transform>();
if (Object.op_Implicit((Object)(object)instance))
{
if ((Object)(object)instance.BackButton != (Object)null)
{
val.Add(((Component)instance.BackButton).transform);
}
foreach (TabButton item in (Il2CppArrayBase<TabButton>)(object)instance.Tabs)
{
if (item != null)
{
Transform transform = ((Component)item.Button).transform;
object obj;
if (transform == null)
{
obj = null;
}
else
{
Transform parent = transform.parent;
obj = ((parent != null) ? parent.parent : null);
}
Transform val2 = (Transform)obj;
if ((Object)(object)val2 != (Object)null && !val.Contains(val2))
{
val.Add(val2);
}
}
}
}
for (int i = 0; i < anotherScroller.Inner.childCount; i++)
{
Transform child = anotherScroller.Inner.GetChild(i);
if (!val.Contains(child))
{
val.Add(child);
}
}
val.Remove(instance.glyphR.transform);
val.Add(instance.glyphR.transform);
val.Remove(instance.glyphL.transform);
return val;
}
public void triggerSpacing()
{
//IL_00bd: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)aspectSpacer) || !Object.op_Implicit((Object)(object)anotherScroller) || !Object.op_Implicit((Object)(object)anotherScroller.Inner))
{
return;
}
Camera main = Camera.main;
if (!Object.op_Implicit((Object)(object)main) || (main.aspect > aspectSpacer.defaultAspectRatio && !aspectSpacer.spaceWiderAspectRatios))
{
return;
}
float num = aspectSpacer.xSpacing * (main.aspect / aspectSpacer.defaultAspectRatio);
List<Transform> val = funSpacingSort();
if (val.Count == 0)
{
return;
}
float num2 = Mathf.Ceil((float)(-val.Count) / 2f) * num;
for (int i = 0; i < val.Count; i++)
{
Transform val2 = val[i];
val2.localPosition = new Vector3(num2 + (float)i * num, val2.localPosition.y, val2.localPosition.z);
}
orderSize = val.Count;
float num3 = Mathf.Max(0f, (float)(orderSize - 1) * num);
anotherScroller.SetBoundsMin(0f, (0f - num3) / 2f);
anotherScroller.SetBoundsMax(0f, num3 / 2f);
PlayerCustomizationMenu obj = instance;
if (Object.op_Implicit((Object)(object)((obj != null) ? obj.glyphL : null)))
{
PlayerCustomizationMenu obj2 = instance;
if (Object.op_Implicit((Object)(object)((obj2 != null) ? obj2.BackButton : null)))
{
instance.glyphL.transform.position = new Vector3(((Component)instance.BackButton).transform.position.x, instance.glyphL.transform.position.y, instance.glyphL.transform.position.z);
}
}
}
public void OpenTab(PlayerCustomizationMenu __instance, InventoryTab tab)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)tab).transform;
Transform val = ((transform != null) ? transform.Find("viper.cosmella.tabAPI") : null);
if ((Object)(object)anotherScroller != (Object)null && (Object)(object)((Component)anotherScroller).gameObject != (Object)null && (int)ActiveInputManager.currentControlType == 0)
{
anotherScroller.ScrollPercentX(1f - (float)__instance.selectedTab / (float)orderSize);
}
ManualLogSource mls = TabBuilderPlugin.mls;
bool flag = default(bool);
BepInExMessageLogInterpolatedStringHandler val2 = new BepInExMessageLogInterpolatedStringHandler(9, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>((float)__instance.selectedTab / (float)((Il2CppArrayBase<TabButton>)(object)__instance.Tabs).Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is the %");
}
mls.LogMessage(val2);
if ((Object)(object)val != (Object)null)
{
ExpandedTabButton component = ((Component)val).GetComponent<ExpandedTabButton>();
if (Object.op_Implicit((Object)(object)component))
{
component.InvokeAction(__instance);
}
}
TabScript tabScript = ((Il2CppObjectBase)tab).TryCast<TabScript>();
if (Object.op_Implicit((Object)(object)tabScript))
{
tabScript.componentEnabledFinished(__instance);
}
}
public void onSpawn(PlayerCustomizationMenu __instance)
{
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)__instance))
{
return;
}
instance = __instance;
TabRegistry.BuildAll(__instance);
Transform val = ((Component)__instance).transform.FindChild("Header");
if (Object.op_Implicit((Object)(object)val))
{
val = val.FindChild("Tabs");
}
if ((Object)(object)val == (Object)null)
{
val = ((Component)((Il2CppArrayBase<TabButton>)(object)__instance.Tabs)[1].Button).transform.parent.parent;
}
if ((Object)(object)val == (Object)null)
{
TabBuilderPlugin.mls.LogFatal((object)"unable to find tabs? 3:");
return;
}
aspectSpacer = ((Component)val).gameObject.GetComponent<AspectSpacer>();
if (Object.op_Implicit((Object)(object)aspectSpacer))
{
((Behaviour)aspectSpacer).enabled = false;
}
GameObject gameObject = ((Component)val.parent).gameObject;
BoxCollider2D val2 = gameObject.GetComponent<BoxCollider2D>();
if ((Object)(object)val2 == (Object)null)
{
val2 = gameObject.AddComponent<BoxCollider2D>();
}
val2.size = new Vector2(30f, 1f);
((Collider2D)val2).offset = Vector2.zero;
anotherScroller = gameObject.AddComponent<Scroller>();
anotherScroller.allowX = true;
anotherScroller.allowY = false;
anotherScroller.DragScrollSpeed = 1f;
((PassiveUiElement)anotherScroller).Colliders = new Il2CppReferenceArray<Collider2D>((Collider2D[])(object)new Collider2D[1] { (Collider2D)val2 });
anotherScroller.Inner = val;
((Component)__instance.BackButton).transform.SetParent(val);
triggerSpacing();
anotherScroller.ScrollPercentX(1f);
}
}
[HarmonyPatch(typeof(PlayerCustomizationMenu))]
public class PlayerCustomizationMenuPatched
{
public static void registerClass()
{
ClassInjector.RegisterTypeInIl2Cpp<ExpandedTabButton>();
ClassInjector.RegisterTypeInIl2Cpp<PlayerCustomizationMenuBehaviourPatched>();
}
[HarmonyPatch("Start")]
[HarmonyPrefix]
public static bool Start_Prefix(PlayerCustomizationMenu __instance)
{
if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PlayerCustomizationMenuBehaviourPatched>()))
{
return true;
}
object obj;
if (__instance == null)
{
obj = null;
}
else
{
GameObject gameObject = ((Component)__instance).gameObject;
obj = ((gameObject != null) ? gameObject.AddComponent<PlayerCustomizationMenuBehaviourPatched>() : null);
}
Prefabs.findChips(__instance);
((PlayerCustomizationMenuBehaviourPatched)obj).onSpawn(__instance);
return true;
}
[HarmonyPatch("OpenTab")]
[HarmonyPostfix]
public static void OpenTab_Postfix(PlayerCustomizationMenu __instance, InventoryTab tab)
{
if (Object.op_Implicit((Object)(object)tab))
{
object obj;
if (__instance == null)
{
obj = null;
}
else
{
GameObject gameObject = ((Component)__instance).gameObject;
obj = ((gameObject != null) ? gameObject.GetComponent<PlayerCustomizationMenuBehaviourPatched>() : null);
}
PlayerCustomizationMenuBehaviourPatched playerCustomizationMenuBehaviourPatched = (PlayerCustomizationMenuBehaviourPatched)obj;
if (Object.op_Implicit((Object)(object)playerCustomizationMenuBehaviourPatched))
{
playerCustomizationMenuBehaviourPatched.OpenTab(__instance, tab);
}
}
}
}
}
namespace TabsBuilderApi.Utils
{
public class TabScript : InventoryTab
{
public virtual void componentEnabledFinished(PlayerCustomizationMenu instance)
{
}
}
public static class Prefabs
{
public static CubeChip CubeChip;
public static NameplateChip NameplateChip;
public static ColorChip BaseChip;
internal static void findChips(PlayerCustomizationMenu menu)
{
//IL_004f: 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)
if (Object.op_Implicit((Object)(object)CubeChip) && Object.op_Implicit((Object)(object)NameplateChip) && Object.op_Implicit((Object)(object)BaseChip))
{
return;
}
foreach (GameObject item in Object.FindObjectsOfType<GameObject>(true))
{
if (!((Object)(object)item != (Object)null))
{
continue;
}
Scene scene = item.gameObject.scene;
if (!(((Scene)(ref scene)).name == "HideAndDontSave"))
{
continue;
}
CubeChip component = item.gameObject.GetComponent<CubeChip>();
if ((Object)(object)component != (Object)null)
{
if (!Object.op_Implicit((Object)(object)CubeChip))
{
CubeChip = component;
}
continue;
}
NameplateChip component2 = item.gameObject.GetComponent<NameplateChip>();
if ((Object)(object)component != (Object)null)
{
if (!Object.op_Implicit((Object)(object)NameplateChip))
{
NameplateChip = component2;
}
continue;
}
ColorChip component3 = item.gameObject.GetComponent<ColorChip>();
if ((Object)(object)component3 != (Object)null && !Object.op_Implicit((Object)(object)BaseChip))
{
BaseChip = component3;
}
}
}
}
public class TabBuilder
{
private PlayerCustomizationMenu menu;
private InventoryTab? tab;
private Transform? parent;
private Transform? buttonParent;
private PassiveButton? topButton;
private Action<PlayerCustomizationMenu>? action;
public int? insertIndex;
public static bool StartCheck(PlayerCustomizationMenu __instance)
{
if (Object.op_Implicit((Object)(object)PlayerCustomizationMenu.Instance) && (Object)(object)PlayerCustomizationMenu.Instance != (Object)(object)__instance)
{
return true;
}
return false;
}
public TabBuilder(PlayerCustomizationMenu menu)
{
this.menu = menu;
parent = ((Component)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[0].Tab).transform.parent;
buttonParent = ((Component)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[0].Button).transform.parent.parent.parent;
}
public TabBuilder CreateTab(string tabName)
{
tab = ((Il2CppObjectBase)Object.Instantiate<InventoryTab>(((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[2].Tab, parent)).TryCast<InventoryTab>();
if ((Object)(object)tab == (Object)null)
{
return this;
}
((Object)tab).name = tabName;
((Component)tab).gameObject.SetActive(false);
return this;
}
public TabBuilder ReplaceScript(Type type)
{
if ((Object)(object)tab == (Object)null)
{
return this;
}
string name = ((Object)tab).name;
Scroller scroller = tab.scroller;
ColorChip colorTabPrefab = Prefabs.BaseChip ?? tab.ColorTabPrefab;
PoolablePlayer playerPreview = tab.PlayerPreview;
GameObject gameObject = ((Component)tab).gameObject;
Object.Destroy((Object)(object)tab);
tab = ((Il2CppObjectBase)gameObject.AddComponent(type)).TryCast<InventoryTab>();
if ((Object)(object)tab == (Object)null)
{
return this;
}
tab.scroller = scroller;
tab.PlayerPreview = playerPreview;
tab.ColorTabPrefab = colorTabPrefab;
((Object)tab).name = name;
return this;
}
public TabBuilder CreateTop(Sprite assetImage)
{
//IL_0067: 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_0083: 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)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
if ((Object)(object)tab == (Object)null)
{
return this;
}
Transform val = Object.Instantiate<Transform>(((Component)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[1].Button).transform.parent.parent, buttonParent);
val.position = ((Component)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[1].Button).transform.parent.parent.position;
val.position = new Vector3(-1E+19f, val.position.y, val.position.z);
((Object)val).name = ((Object)tab).name;
Transform child = val.GetChild(0);
PassiveButton component = ((Component)child.Find("Tab Background")).GetComponent<PassiveButton>();
component.OnClick = new ButtonClickedEvent();
Action action = delegate
{
OpenTab();
};
((UnityEvent)component.OnClick).AddListener(UnityAction.op_Implicit(action));
topButton = component;
if (Object.op_Implicit((Object)(object)assetImage))
{
((Component)child.Find("Icon")).GetComponent<SpriteRenderer>().sprite = assetImage;
}
return this;
}
public TabBuilder Before(string existingTabName)
{
insertIndex = null;
for (int i = 0; i < ((Il2CppArrayBase<TabButton>)(object)menu.Tabs).Length; i++)
{
if (((Object)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[i].Tab).name == existingTabName)
{
insertIndex = i;
break;
}
}
return this;
}
public TabBuilder After(string existingTabName)
{
insertIndex = null;
for (int i = 0; i < ((Il2CppArrayBase<TabButton>)(object)menu.Tabs).Length; i++)
{
if (((Object)((Il2CppArrayBase<TabButton>)(object)menu.Tabs)[i].Tab).name == existingTabName)
{
insertIndex = i + 1;
break;
}
}
return this;
}
public TabBuilder SetAction(Action<PlayerCustomizationMenu> callback)
{
action = callback;
return this;
}
public InventoryTab? Build()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
if ((Object)(object)tab == (Object)null)
{
return null;
}
if ((Object)(object)topButton == (Object)null)
{
return null;
}
List<TabButton> list = ((IEnumerable<TabButton>)menu.Tabs).ToList();
GameObject val = new GameObject("viper.cosmella.tabAPI");
val.transform.parent = ((Component)tab).transform;
TabButton val2 = new TabButton();
val2.Tab = tab;
val2.Button = ((Component)topButton).GetComponent<SpriteRenderer>();
val2.tabText = ((Component)((Component)tab).transform.Find("Text")).GetComponent<TextMeshPro>();
if (action != null)
{
val.AddComponent<ExpandedTabButton>().action = action;
}
if (insertIndex.HasValue)
{
list.Insert(insertIndex.Value, val2);
}
else
{
list.Add(val2);
}
menu.Tabs = Il2CppReferenceArray<TabButton>.op_Implicit(list.ToArray());
return tab;
}
private void OpenTab()
{
PlayerCustomizationMenu obj = menu;
object obj2;
if (obj == null)
{
obj2 = null;
}
else
{
TabButton obj3 = ((Il2CppArrayBase<TabButton>)(object)obj.Tabs)[menu.selectedTab];
obj2 = ((obj3 != null) ? obj3.Tab : null);
}
if ((Object)obj2 != (Object)(object)tab)
{
menu.OpenTab(tab);
}
}
protected void RepositionTabs()
{
PlayerCustomizationMenu obj = menu;
object obj2;
if (obj == null)
{
obj2 = null;
}
else
{
GameObject gameObject = ((Component)obj).gameObject;
obj2 = ((gameObject != null) ? gameObject.GetComponent<PlayerCustomizationMenuBehaviourPatched>() : null);
}
PlayerCustomizationMenuBehaviourPatched playerCustomizationMenuBehaviourPatched = (PlayerCustomizationMenuBehaviourPatched)obj2;
if (Object.op_Implicit((Object)(object)playerCustomizationMenuBehaviourPatched))
{
playerCustomizationMenuBehaviourPatched.triggerSpacing();
}
}
}
public enum TabBuilderType
{
None,
After,
Before
}
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
public sealed class TabBuilderAttribute : Attribute
{
public string TabName { get; }
public string[] Before { get; }
public string[] after { get; }
public Type ScriptType { get; }
public string TopSpriteResource { get; }
public Action<PlayerCustomizationMenu> Callback { get; }
public TabBuilderAttribute(string tabName, string sprite, Type scriptType, TabBuilderType type, params string[] list)
{
TabName = tabName;
ScriptType = scriptType;
switch (type)
{
case TabBuilderType.Before:
Before = list ?? Array.Empty<string>();
break;
default:
after = list ?? Array.Empty<string>();
break;
case TabBuilderType.None:
break;
}
TopSpriteResource = sprite;
}
public TabBuilderAttribute(string tabName, string sprite, Action<PlayerCustomizationMenu> callback, TabBuilderType type, params string[] list)
{
TabName = tabName;
switch (type)
{
case TabBuilderType.Before:
Before = list ?? Array.Empty<string>();
break;
default:
after = list ?? Array.Empty<string>();
break;
case TabBuilderType.None:
break;
}
Callback = callback;
TopSpriteResource = sprite;
}
public void Build(PlayerCustomizationMenu instance, Assembly asm)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//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)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
TabBuilder tabBuilder = new TabBuilder(instance).CreateTab(TabName);
if (!string.IsNullOrEmpty(TopSpriteResource))
{
Sprite assetImage = null;
using (Stream stream = asm.GetManifestResourceStream(TopSpriteResource ?? ""))
{
if (stream != null)
{
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array));
assetImage = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
else
{
string text = TopSpriteResource + " ):";
string[] manifestResourceNames = asm.GetManifestResourceNames();
foreach (string value in manifestResourceNames)
{
text = $"{text}\n{asm.FullName} has {value}";
}
ManualLogSource mls = TabBuilderPlugin.mls;
bool flag = default(bool);
BepInExFatalLogInterpolatedStringHandler val2 = new BepInExFatalLogInterpolatedStringHandler(14, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("tabsbuilder.api");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(asm.FullName);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" : ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" | failed");
}
mls.LogFatal(val2);
}
}
tabBuilder.CreateTop(assetImage);
}
else
{
tabBuilder.CreateTop(null);
}
if (ScriptType != null)
{
tabBuilder.ReplaceScript(Il2CppType.From(ScriptType));
}
else if (Callback != null)
{
tabBuilder.SetAction(Callback);
}
if (Before != null)
{
string[] manifestResourceNames = Before;
foreach (string text2 in manifestResourceNames)
{
if (!string.IsNullOrEmpty(text2))
{
tabBuilder.Before(text2);
}
if (tabBuilder.insertIndex.HasValue)
{
break;
}
}
}
if (after != null)
{
string[] manifestResourceNames = after;
foreach (string text3 in manifestResourceNames)
{
if (!string.IsNullOrEmpty(text3))
{
tabBuilder.After(text3);
}
if (tabBuilder.insertIndex.HasValue)
{
break;
}
}
}
tabBuilder.Build();
}
}
}
namespace TabsBuilderApi.Utils.Stubs
{
public static class StubInventoryTab
{
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "HasLocalPlayer")]
public static bool HasLocalPlayer(InventoryTab instance)
{
return false;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "GetDisplayColor")]
public static int GetDisplayColor(InventoryTab instance)
{
return 0;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "UpdateMaterials", new Type[]
{
typeof(SpriteRenderer),
typeof(CosmeticData)
})]
public static void UpdateMaterials(InventoryTab instance, SpriteRenderer spriteRenderer, CosmeticData data)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "SetScrollerBounds")]
public static void SetScrollerBounds(InventoryTab instance)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "ClickEquip")]
public static void ClickEquip(InventoryTab instance)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "OnEnable")]
public static void OnEnable(InventoryTab instance)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "OnDisable")]
public static void OnDisable(InventoryTab instance)
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "GetDefaultSelectable")]
public static ColorChip GetDefaultSelectable(InventoryTab instance)
{
return null;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "IsSelectedItemEquipped")]
public static bool IsSelectedItemEquipped(InventoryTab instance)
{
return false;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "GetCurrentProdID")]
public static string GetCurrentProdID(InventoryTab instance)
{
return string.Empty;
}
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(InventoryTab), "GetDisplayColor")]
public static int GetDisplayColor()
{
return 0;
}
}
}