using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace UltrakillOldUI;
[BepInPlugin("local.ultrakill.oldui", "Ultrakill Old UI", "1.0.0")]
public class UltrakillOldUIPlugin : BaseUnityPlugin
{
private Sprite logoSprite;
private Sprite buttonSprite;
private Sprite panelSprite;
private Sprite socialSprite;
private GameObject oldSocials;
private float shopScanAt = 2f;
private float nextShopRestyle;
private readonly List<RectTransform> shopCanvases = new List<RectTransform>();
private readonly HashSet<int> styledImages = new HashSet<int>();
private readonly HashSet<int> styledTexts = new HashSet<int>();
private TMP_FontAsset menuFont;
private readonly Dictionary<RectTransform, int> shopBurst = new Dictionary<RectTransform, int>();
private int scanRounds;
private RectTransform root;
private float nextApply;
private float nextSearch;
private string lastScene;
private int searches;
private bool loggedApplied;
private bool loggedError;
private readonly HashSet<int> styledButtons = new HashSet<int>();
private float nextFontSearch;
private readonly List<TMP_Text> sliderTexts = new List<TMP_Text>();
private readonly HashSet<int> sliderIds = new HashSet<int>();
private readonly Dictionary<int, string> sliderLast = new Dictionary<int, string>();
private readonly HashSet<int> sliderShrunk = new HashSet<int>();
private const float SliderLabelTopMargin = 10f;
private readonly List<TMP_Text> requirementTexts = new List<TMP_Text>();
private readonly HashSet<int> requirementIds = new HashSet<int>();
private readonly Dictionary<int, float> sliderBase = new Dictionary<int, float>();
private readonly HashSet<int> sliderMoved = new HashSet<int>();
private static readonly Vector3[] cornersA = (Vector3[])(object)new Vector3[4];
private static readonly Vector3[] cornersB = (Vector3[])(object)new Vector3[4];
private void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0084: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
SceneManager.sceneLoaded += OnSceneLoaded;
Canvas.willRenderCanvases += new WillRenderCanvases(OnWillRenderCanvases);
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
Texture2D val = LoadTexture(Path.Combine(directoryName, "title_logo.png"), (FilterMode)0);
if ((Object)(object)val != (Object)null)
{
logoSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0);
}
Texture2D val2 = LoadTexture(Path.Combine(directoryName, "button_sprite.png"), (FilterMode)1);
if ((Object)(object)val2 != (Object)null)
{
buttonSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 200f, 0u, (SpriteMeshType)0, new Vector4(10f, 10f, 10f, 10f));
}
Texture2D val3 = LoadTexture(Path.Combine(directoryName, "panel_sprite.png"), (FilterMode)1);
if ((Object)(object)val3 != (Object)null)
{
panelSprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 200f, 0u, (SpriteMeshType)0, new Vector4(10f, 10f, 10f, 10f));
}
Texture2D val4 = LoadTexture(Path.Combine(directoryName, "social_sprite.png"), (FilterMode)0);
if ((Object)(object)val4 != (Object)null)
{
socialSprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(2f, 2f, 2f, 2f));
}
((BaseUnityPlugin)this).Logger.LogInfo((object)("Ultrakill Old UI loaded (logo: " + ((Object)(object)logoSprite != (Object)null) + ", button: " + ((Object)(object)buttonSprite != (Object)null) + ")"));
}
private Texture2D LoadTexture(string path, FilterMode filter)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!File.Exists(path))
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Missing file: " + path));
return null;
}
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
ImageConversion.LoadImage(val, File.ReadAllBytes(path));
((Texture)val).filterMode = filter;
((Texture)val).wrapMode = (TextureWrapMode)1;
return val;
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load " + path + ": " + ex));
return null;
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
root = null;
nextSearch = 0f;
styledButtons.Clear();
shopCanvases.Clear();
styledImages.Clear();
styledTexts.Clear();
requirementTexts.Clear();
sliderTexts.Clear();
sliderIds.Clear();
sliderLast.Clear();
sliderShrunk.Clear();
sliderBase.Clear();
sliderMoved.Clear();
requirementIds.Clear();
oldSocials = null;
shopBurst.Clear();
scanRounds = 0;
try
{
ScanShops();
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Early shop scan failed: " + ex.Message));
}
shopScanAt = Time.unscaledTime + 0.4f;
}
private void LateUpdate()
{
//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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
float unscaledTime = Time.unscaledTime;
try
{
ShopPass(unscaledTime);
}
catch (Exception ex)
{
if (!loggedError)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Shop pass failed: " + ex));
loggedError = true;
}
}
if ((Object)(object)root == (Object)null)
{
Scene activeScene = SceneManager.GetActiveScene();
string text = ((Scene)(ref activeScene)).name ?? "";
bool flag = text.IndexOf("menu", StringComparison.OrdinalIgnoreCase) >= 0;
if (unscaledTime < nextSearch)
{
return;
}
nextSearch = ((!flag) ? (unscaledTime + 1f) : 0f);
if (flag && searches > 600)
{
nextSearch = unscaledTime + 0.25f;
}
searches++;
if (text != lastScene)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Active scene: '" + text + "'"));
lastScene = text;
}
int num = 0;
Canvas[] array = Resources.FindObjectsOfTypeAll<Canvas>();
foreach (Canvas val in array)
{
Scene scene = ((Component)val).gameObject.scene;
if (!((Scene)(ref scene)).IsValid())
{
continue;
}
num++;
Transform val2 = ((Component)val).transform.Find("Main Menu (1)");
if (!((Object)(object)val2 == (Object)null))
{
RectTransform val3 = (RectTransform)(object)((val2 is RectTransform) ? val2 : null);
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((Transform)val3).Find("LeftSide") == (Object)null))
{
root = val3;
loggedApplied = false;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Found main menu in scene '" + text + "'"));
break;
}
}
}
if ((Object)(object)root == (Object)null)
{
if (searches <= 5 || searches % 30 == 0)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Main menu not found yet (scene '" + text + "', canvases: " + num + ")"));
}
return;
}
}
try
{
Apply();
if (!loggedApplied)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Old UI applied.");
loggedApplied = true;
}
}
catch (Exception ex2)
{
if (!loggedError)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Apply failed: " + ex2));
loggedError = true;
}
}
}
private void Apply()
{
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Expected O, but got Unknown
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0422: Unknown result type (might be due to invalid IL or missing references)
//IL_0344: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
Hide((Transform)(object)root, "V1");
Hide((Transform)(object)root, "BackgroundSwapper");
Hide((Transform)(object)root, "Border");
Hide((Transform)(object)root, "Image");
Transform obj = ((Transform)root).Find("LeftSide");
RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
if ((Object)(object)val == (Object)null)
{
return;
}
Hide((Transform)(object)val, "Text (3)");
Hide((Transform)(object)val, "Text (2)");
SetRect(val, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0f, 0f, 100f, 100f);
Rect rect = root.rect;
float num;
if (((Rect)(ref rect)).height > 1f)
{
Rect rect2 = root.rect;
num = ((Rect)(ref rect2)).height * 0.5f;
}
else
{
num = 540f;
}
float num2 = num;
Transform obj2 = ((Transform)val).Find("Title");
RectTransform val2 = (RectTransform)(object)((obj2 is RectTransform) ? obj2 : null);
if ((Object)(object)val2 != (Object)null)
{
SetRect(val2, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 1f, 0f, num2 - 80f, 1000f, 120f);
((Transform)val2).localScale = Vector3.one;
Image component = ((Component)val2).GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
if ((Object)(object)logoSprite != (Object)null)
{
component.sprite = logoSprite;
}
component.type = (Type)0;
component.preserveAspect = true;
((Graphic)component).color = Color.white;
}
}
StyleButton(val, "Continue", 60f);
StyleButton(val, "Options", -20f);
StyleButton(val, "Credits", -100f);
StyleButton(val, "Quit", -180f);
Hide((Transform)(object)val, "Panel");
if ((Object)(object)oldSocials == (Object)null)
{
BuildSocials(val);
}
Transform parent = ((Transform)root).parent;
if ((Object)(object)parent != (Object)null)
{
Transform val3 = parent.Find("Chapter Select/Background");
if ((Object)(object)val3 != (Object)null)
{
RawImage[] componentsInChildren = ((Component)val3).GetComponentsInChildren<RawImage>(true);
foreach (RawImage val4 in componentsInChildren)
{
if (((Graphic)val4).color.a > 0f)
{
((Graphic)val4).color = new Color(1f, 1f, 1f, 0f);
((Graphic)val4).raycastTarget = false;
}
}
}
Hide(parent, "Difficulty Select (1)/Background/V1");
Hide(parent, "Difficulty Select (1)/Info Background/V1");
Transform val5 = parent.Find("Difficulty Select (1)/Interactables");
bool flag = false;
if ((Object)(object)val5 != (Object)null)
{
foreach (Transform item in val5)
{
Transform val6 = item;
if (((Object)val6).name.EndsWith(" Info"))
{
if (((Component)val6).gameObject.activeSelf)
{
flag = true;
}
Image component2 = ((Component)val6).GetComponent<Image>();
if ((Object)(object)component2 != (Object)null && ((Graphic)component2).color.a < 0.97f)
{
((Graphic)component2).color = new Color(0f, 0f, 0f, 0.97f);
}
}
}
}
Transform val7 = parent.Find("Difficulty Select (1)/Info Background");
if ((Object)(object)val7 != (Object)null)
{
Image component3 = ((Component)val7).GetComponent<Image>();
float num3 = ((!flag) ? 0f : 0.97f);
if ((Object)(object)component3 != (Object)null && Mathf.Abs(((Graphic)component3).color.a - num3) > 0.01f)
{
((Graphic)component3).color = new Color(0f, 0f, 0f, num3);
}
}
}
Transform obj3 = ((Transform)val).Find("Holiday Greetings");
RectTransform val8 = (RectTransform)(object)((obj3 is RectTransform) ? obj3 : null);
if ((Object)(object)val8 != (Object)null)
{
SetRect(val8, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0f, -215f, 100f, 100f);
}
}
private void StyleButton(RectTransform parent, string name, float y)
{
//IL_004f: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
Transform obj = ((Transform)parent).Find(name);
RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
if ((Object)(object)val == (Object)null)
{
return;
}
SetRect(val, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0f, y, 480f, 80f);
((Transform)val).localScale = Vector3.one;
Image component = ((Component)val).GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
if ((Object)(object)buttonSprite != (Object)null)
{
component.sprite = buttonSprite;
component.type = (Type)1;
component.fillCenter = true;
}
((Graphic)component).color = Color.white;
}
Button component2 = ((Component)val).GetComponent<Button>();
if ((Object)(object)component2 != (Object)null && styledButtons.Add(((Object)component2).GetInstanceID()))
{
ColorBlock colors = ((Selectable)component2).colors;
((ColorBlock)(ref colors)).normalColor = new Color(0f, 0f, 0f, 0.5019608f);
((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 1f, 1f, 0.5019608f);
((ColorBlock)(ref colors)).pressedColor = new Color(1f, 0f, 0f, 1f);
((ColorBlock)(ref colors)).selectedColor = new Color(0.509434f, 0.509434f, 0.509434f, 1f);
((ColorBlock)(ref colors)).disabledColor = new Color(0.7843137f, 0.7843137f, 0.7843137f, 0.5019608f);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((ColorBlock)(ref colors)).fadeDuration = 0.1f;
((Selectable)component2).colors = colors;
}
TMP_Text componentInChildren = ((Component)val).GetComponentInChildren<TMP_Text>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.enableAutoSizing = false;
componentInChildren.fontSize = 36f;
componentInChildren.alignment = (TextAlignmentOptions)514;
if (((Graphic)componentInChildren).color != Color.white)
{
((Graphic)componentInChildren).color = Color.white;
}
RectTransform rectTransform = componentInChildren.rectTransform;
SetRect(rectTransform, 0f, 0f, 1f, 1f, 0.5f, 0.5f, 0f, 0f, 0f, 0f);
}
}
private void BuildSocials(RectTransform left)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: 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)
TMP_Text val = null;
Transform val2 = ((Transform)left).Find("Options");
if ((Object)(object)val2 != (Object)null)
{
val = ((Component)val2).GetComponentInChildren<TMP_Text>(true);
}
if ((Object)(object)val != (Object)null)
{
menuFont = val.font;
}
GameObject val3 = new GameObject("OldSocials", new Type[1] { typeof(RectTransform) });
RectTransform component = val3.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)left, false);
SetRect(component, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0f, -275f, 480f, 52f);
((Transform)component).localScale = Vector3.one;
MakeSocial(component, val, "DISCORD", "https://discord.com/invite/newblood", new Color(0.4470588f, 0.5372549f, 0.8549019f, 1f), 0f);
MakeSocial(component, val, "TWITTER", "https://twitter.com/ULTRAKILLGame", new Color(0.1137255f, 0.6313726f, 81f / 85f, 1f), 0.5f);
MakeSocial(component, val, "YOUTUBE", "https://youtube.com/c/Hakita", new Color(1f, 0f, 0f, 1f), 1f);
oldSocials = val3;
}
private void MakeSocial(RectTransform parent, TMP_Text refLabel, string label, string url, Color tint, float x)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_00c0: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_0122: 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_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(label, new Type[4]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(Image),
typeof(Button)
});
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent, false);
SetRect(component, x, 0.5f, x, 0.5f, x, 0.5f, 0f, 0f, 150f, 52f);
Image component2 = val.GetComponent<Image>();
if ((Object)(object)socialSprite != (Object)null)
{
component2.sprite = socialSprite;
}
component2.type = (Type)1;
component2.fillCenter = false;
((Graphic)component2).color = tint;
Button component3 = val.GetComponent<Button>();
((Selectable)component3).targetGraphic = (Graphic)(object)component2;
ColorBlock colors = ((Selectable)component3).colors;
((ColorBlock)(ref colors)).normalColor = Color.white;
((ColorBlock)(ref colors)).highlightedColor = new Color(0.509434f, 0.509434f, 0.509434f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(1f, 0f, 0f, 1f);
((ColorBlock)(ref colors)).selectedColor = new Color(0.509434f, 0.509434f, 0.509434f, 1f);
((ColorBlock)(ref colors)).fadeDuration = 0.1f;
((Selectable)component3).colors = colors;
((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
{
Application.OpenURL(url);
});
GameObject val2 = new GameObject("Text", new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(TextMeshProUGUI)
});
RectTransform component4 = val2.GetComponent<RectTransform>();
((Transform)component4).SetParent((Transform)(object)component, false);
SetRect(component4, 0f, 0f, 1f, 1f, 0.5f, 0.5f, 0f, 0f, 0f, 0f);
TextMeshProUGUI component5 = val2.GetComponent<TextMeshProUGUI>();
if ((Object)(object)refLabel != (Object)null)
{
((TMP_Text)component5).font = refLabel.font;
if ((Object)(object)refLabel.fontSharedMaterial != (Object)null)
{
((TMP_Text)component5).fontSharedMaterial = refLabel.fontSharedMaterial;
}
}
((TMP_Text)component5).text = label;
((TMP_Text)component5).fontSize = 20f;
((TMP_Text)component5).enableAutoSizing = false;
((TMP_Text)component5).alignment = (TextAlignmentOptions)514;
((Graphic)component5).color = Color.white;
((Graphic)component5).raycastTarget = false;
}
private void ShopPass(float now)
{
//IL_0000: 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)
Scene activeScene = SceneManager.GetActiveScene();
string text = ((Scene)(ref activeScene)).name ?? "";
bool flag = text.IndexOf("menu", StringComparison.OrdinalIgnoreCase) >= 0;
if (now >= shopScanAt)
{
shopScanAt = now + ((scanRounds >= 4) ? 3f : 0.5f);
scanRounds++;
if (!flag)
{
ScanShops();
}
}
bool flag2 = now >= nextShopRestyle;
if (flag2)
{
nextShopRestyle = now + 0.5f;
}
for (int num = shopCanvases.Count - 1; num >= 0; num--)
{
RectTransform val = shopCanvases[num];
if ((Object)(object)val == (Object)null)
{
shopCanvases.RemoveAt(num);
}
else
{
if (!shopBurst.TryGetValue(val, out var value))
{
value = 90;
}
if (!((Component)val).gameObject.activeInHierarchy)
{
shopBurst[val] = -1;
}
else
{
if (value < 0)
{
value = 90;
}
Transform val2 = ((Transform)val).Find("Background");
if ((Object)(object)val2 != (Object)null)
{
Transform val3 = val2.Find("Title");
Transform val4 = val2.Find("Money Display");
if ((Object)(object)val3 != (Object)null)
{
bool flag3 = (Object)(object)val4 != (Object)null && ((Component)val4).gameObject.activeInHierarchy;
CanvasGroup val5 = ((Component)val3).GetComponent<CanvasGroup>();
if ((Object)(object)val5 == (Object)null)
{
val5 = ((Component)val3).gameObject.AddComponent<CanvasGroup>();
}
val5.alpha = ((!flag3) ? 1f : 0f);
}
}
RestyleShop(val, flag2);
shopBurst[val] = value;
}
}
}
}
private void ScanShops()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
Canvas[] array = Resources.FindObjectsOfTypeAll<Canvas>();
foreach (Canvas val in array)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
Scene scene = ((Component)val).gameObject.scene;
if (!((Scene)(ref scene)).IsValid())
{
continue;
}
Transform val2 = ((Component)val).transform.Find("Background");
if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.Find("Title") == (Object)null) && !((Object)(object)val2.Find("Main Panel") == (Object)null))
{
Transform transform = ((Component)val).transform;
RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
if ((Object)(object)val3 != (Object)null && !shopCanvases.Contains(val3))
{
shopCanvases.Add(val3);
((BaseUnityPlugin)this).Logger.LogInfo((object)("Found shop terminal: " + ((Object)val3).name));
}
}
}
}
private static void ClearImage(Transform t)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_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_005b: 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)
if (!((Object)(object)t == (Object)null))
{
Image component = ((Component)t).GetComponent<Image>();
if ((Object)(object)component != (Object)null && ((Graphic)component).color.a > 0f)
{
((Graphic)component).color = new Color(((Graphic)component).color.r, ((Graphic)component).color.g, ((Graphic)component).color.b, 0f);
}
}
}
private void AddFill(RectTransform parent, float inset, float alpha, bool ignoreGroups = false)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0061: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("OldFill", new Type[4]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(Image),
typeof(LayoutElement)
});
val.GetComponent<LayoutElement>().ignoreLayout = true;
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent((Transform)(object)parent, false);
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.pivot = new Vector2(0.5f, 0.5f);
component.offsetMin = new Vector2(inset, inset);
component.offsetMax = new Vector2(0f - inset, 0f - inset);
Image component2 = val.GetComponent<Image>();
if ((Object)(object)buttonSprite != (Object)null)
{
component2.sprite = buttonSprite;
}
component2.type = (Type)1;
((Graphic)component2).color = new Color(0f, 0f, 0f, alpha);
((Graphic)component2).raycastTarget = false;
if (ignoreGroups)
{
CanvasGroup val2 = val.AddComponent<CanvasGroup>();
val2.ignoreParentGroups = true;
val2.alpha = 1f;
val2.blocksRaycasts = false;
val2.interactable = false;
}
((Transform)component).SetAsFirstSibling();
}
private static bool IsChrome(Transform t)
{
switch (((Object)t).name)
{
case "Logo":
return true;
case "Icon":
case "Button 1":
case "Button 2":
case "Button 3":
case "Top Button 1":
case "Top Button 2":
case "Top Button 3":
{
Transform parent = t.parent;
return (Object)(object)parent != (Object)null && ((Object)(object)parent.Find("Title") != (Object)null || (Object)(object)parent.Find("Menu Title") != (Object)null);
}
default:
return false;
}
}
private void RestyleShop(RectTransform canvasRt, bool full)
{
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Invalid comparison between Unknown and I4
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: 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_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: 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_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_057f: Unknown result type (might be due to invalid IL or missing references)
//IL_0675: Unknown result type (might be due to invalid IL or missing references)
//IL_067a: Unknown result type (might be due to invalid IL or missing references)
//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Transform)canvasRt).Find("Background");
if ((Object)(object)val == (Object)null || (Object)(object)panelSprite == (Object)null)
{
return;
}
Image[] componentsInChildren = ((Component)val).GetComponentsInChildren<Image>(true);
foreach (Image val2 in componentsInChildren)
{
if ((Object)(object)val2 == (Object)null)
{
continue;
}
int instanceID = ((Object)val2).GetInstanceID();
if (styledImages.Contains(instanceID))
{
continue;
}
Transform transform = ((Component)val2).transform;
if (((Object)transform).name == "OldFill")
{
styledImages.Add(instanceID);
continue;
}
if (IsChrome(transform))
{
styledImages.Add(instanceID);
CanvasGroup val3 = ((Component)transform).GetComponent<CanvasGroup>();
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)transform).gameObject.AddComponent<CanvasGroup>();
}
val3.alpha = 0f;
val3.blocksRaycasts = false;
if (((Object)transform).name == "Logo" && (Object)(object)transform.parent != (Object)null && (Object)(object)transform.parent.Find("OldMenuTitle") == (Object)null)
{
MakeMenuTitle((RectTransform)(object)((transform is RectTransform) ? transform : null));
}
continue;
}
if ((int)val2.type != 1)
{
styledImages.Add(instanceID);
continue;
}
styledImages.Add(instanceID);
if ((Object)(object)((Component)val2).GetComponent<Mask>() != (Object)null || (Object)(object)((Component)val2).GetComponent<RectMask2D>() != (Object)null)
{
continue;
}
val2.sprite = panelSprite;
val2.type = (Type)1;
val2.fillCenter = false;
((Graphic)val2).color = Color.white;
RectTransform rectTransform = ((Graphic)val2).rectTransform;
if ((Object)(object)transform.Find("OldFill") == (Object)null)
{
AddFill(rectTransform, 4f, 1f);
}
Button component = ((Component)val2).GetComponent<Button>();
if ((Object)(object)component != (Object)null)
{
((Selectable)component).transition = (Transition)1;
((Selectable)component).spriteState = default(SpriteState);
val2.overrideSprite = null;
ColorBlock colors = ((Selectable)component).colors;
((ColorBlock)(ref colors)).normalColor = Color.white;
((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 0f, 0f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.7843137f, 0.7843137f, 0.7843137f, 1f);
((ColorBlock)(ref colors)).selectedColor = new Color(1f, 0f, 0f, 1f);
((ColorBlock)(ref colors)).disabledColor = new Color(0.8f, 0.8f, 0.8f, 1f);
((ColorBlock)(ref colors)).colorMultiplier = 1f;
((ColorBlock)(ref colors)).fadeDuration = 0.1f;
((Selectable)component).colors = colors;
Transform val4 = transform.Find("OldFill");
if ((Object)(object)val4 != (Object)null && (Object)(object)((Component)component).GetComponent<OldFillTint>() == (Object)null)
{
OldFillTint oldFillTint = ((Component)component).gameObject.AddComponent<OldFillTint>();
oldFillTint.fill = ((Component)val4).GetComponent<Image>();
}
}
}
TMP_FontAsset val5 = menuFont;
if ((Object)(object)val5 == (Object)null && Time.unscaledTime >= nextFontSearch)
{
nextFontSearch = Time.unscaledTime + 2f;
TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
foreach (TMP_FontAsset val6 in array)
{
if ((Object)(object)val6 != (Object)null && ((Object)val6).name.IndexOf("vcr", StringComparison.OrdinalIgnoreCase) >= 0)
{
val5 = val6;
menuFont = val6;
break;
}
}
}
TMP_Text[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<TMP_Text>(true);
foreach (TMP_Text val7 in componentsInChildren2)
{
if ((Object)(object)val7 == (Object)null)
{
continue;
}
int instanceID2 = ((Object)val7).GetInstanceID();
bool flag = styledTexts.Add(instanceID2);
if (!flag && !full)
{
continue;
}
Transform parent = val7.transform.parent;
bool flag2 = (Object)(object)((Component)val7).GetComponentInParent<Button>() != (Object)null;
bool flag3 = (Object)(object)parent != (Object)null && (((Object)val7).name == "Menu Title" || (((Object)val7).name == "Title" && (Object)(object)parent.Find("Button 1") != (Object)null)) && !flag2;
if (flag)
{
if ((Object)(object)val5 != (Object)null && (Object)(object)val7.font != (Object)(object)val5)
{
TMP_FontAsset font = val7.font;
if ((Object)(object)font != (Object)null && (Object)(object)font != (Object)(object)val5)
{
if (val5.fallbackFontAssetTable == null)
{
val5.fallbackFontAssetTable = new List<TMP_FontAsset>();
}
if (!val5.fallbackFontAssetTable.Contains(font))
{
val5.fallbackFontAssetTable.Add(font);
}
}
val7.font = val5;
((Graphic)val7).SetAllDirty();
}
val7.fontStyle = (FontStyles)16;
if (flag3)
{
val7.enableAutoSizing = true;
val7.fontSizeMin = 12f;
val7.fontSizeMax = 28f;
val7.enableWordWrapping = false;
val7.overflowMode = (TextOverflowModes)0;
val7.alignment = (TextAlignmentOptions)514;
((Graphic)val7).color = Color.white;
SetRect(val7.rectTransform, 0f, 1f, 1f, 1f, 0.5f, 1f, 0f, -8f, -20f, 40f);
}
else
{
bool flag4 = (Object)(object)((Component)val7).GetComponentInParent<Slider>() != (Object)null;
float fontSize = val7.fontSize;
if (fontSize > 4f && (flag2 || flag4 || ((Object)(object)parent != (Object)null && (Object)(object)((Component)parent).GetComponent<Image>() != (Object)null)))
{
val7.enableAutoSizing = true;
val7.fontSizeMax = fontSize;
val7.fontSizeMin = ((!flag2) ? Mathf.Max(4f, fontSize * 0.4f) : Mathf.Max(3f, fontSize * 0.3f));
if (flag2 && !flag4)
{
Vector4 margin = val7.margin;
if (margin.x < 5f)
{
margin.x = 5f;
}
if (margin.z < 5f)
{
margin.z = 5f;
}
val7.margin = margin;
}
}
}
}
if (flag3)
{
string text = val7.text ?? "";
if (text.Length > 0 && !text.StartsWith("--"))
{
val7.text = "--" + text.Trim() + "--";
}
}
else
{
if ((Object)(object)parent != (Object)null && flag)
{
RectTransform val8 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
if ((Object)(object)val8 != (Object)null)
{
LayoutRebuilder.ForceRebuildLayoutImmediate(val8);
}
}
if ((Object)(object)parent != (Object)null && ((Object)val7).name != "Requirement" && (Object)(object)parent.Find("Cover Inset") != (Object)null)
{
FixRowMargin(val7);
}
}
if (IsSliderPart(val7) && sliderIds.Add(instanceID2))
{
sliderTexts.Add(val7);
}
if (IsSliderPart(val7))
{
ProcessSliderText(val7);
}
if (((Object)val7).name == "Requirement" && (Object)(object)parent != (Object)null && requirementIds.Add(instanceID2))
{
requirementTexts.Add(val7);
}
}
}
private static bool IsSliderPart(TMP_Text tx)
{
if ((Object)(object)((Component)tx).GetComponentInParent<Slider>() != (Object)null)
{
return true;
}
Transform parent = tx.transform.parent;
return ((Object)tx).name == "Label" && (Object)(object)parent != (Object)null && (Object)(object)((Component)parent).GetComponentInChildren<Slider>(true) != (Object)null;
}
private void ProcessSliderText(TMP_Text st)
{
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: 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_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: 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_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
string text = (st.text ?? "").Trim();
int instanceID = ((Object)st).GetInstanceID();
if (sliderLast.TryGetValue(instanceID, out var value) && value == text)
{
return;
}
sliderLast[instanceID] = text;
if (!sliderBase.TryGetValue(instanceID, out var value2))
{
value2 = ((!st.enableAutoSizing) ? st.fontSize : st.fontSizeMax);
sliderBase[instanceID] = value2;
}
Slider val = ((Component)st).GetComponentInParent<Slider>();
if ((Object)(object)val == (Object)null && (Object)(object)st.transform.parent != (Object)null)
{
val = ((Component)st.transform.parent).GetComponentInChildren<Slider>(true);
}
bool flag = false;
if ((Object)(object)val != (Object)null)
{
Transform val2 = ((!((Object)(object)((Component)val).transform.parent != (Object)null)) ? ((Component)val).transform : ((Component)val).transform.parent);
TMP_Text[] componentsInChildren = ((Component)val2).GetComponentsInChildren<TMP_Text>(true);
foreach (TMP_Text val3 in componentsInChildren)
{
if ((Object)(object)val3 != (Object)null && (val3.text ?? "").IndexOf("intensity", StringComparison.OrdinalIgnoreCase) >= 0)
{
flag = true;
break;
}
}
}
Vector4 margin = st.margin;
if (flag)
{
bool flag2 = text.Length > 4;
TextAlignmentOptions val4 = (TextAlignmentOptions)((!flag2) ? 1026 : 258);
if (st.alignment != val4)
{
st.alignment = val4;
}
if (flag2)
{
margin.y = 10f;
}
if (sliderShrunk.Add(instanceID))
{
st.fontSizeMax *= 0.7f;
}
if (margin != st.margin)
{
st.margin = margin;
}
return;
}
if (st.enableWordWrapping)
{
st.enableWordWrapping = false;
}
if ((int)st.overflowMode != 0)
{
st.overflowMode = (TextOverflowModes)0;
}
if (text.Length == 1)
{
RectTransform rectTransform = st.rectTransform;
if (sliderMoved.Add(instanceID))
{
rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x + 7f, rectTransform.anchoredPosition.y);
rectTransform.sizeDelta = new Vector2(Mathf.Max(8f, rectTransform.sizeDelta.x - 7f), rectTransform.sizeDelta.y);
}
st.enableAutoSizing = false;
st.fontSize = value2 * 0.65f;
if (st.margin != Vector4.zero)
{
st.margin = Vector4.zero;
}
}
else if (text.Length > 1 && text.Length <= 6)
{
st.enableAutoSizing = false;
st.margin = Vector4.zero;
st.fontSize = value2;
float x = st.GetPreferredValues(text, 100000f, 100000f).x;
Rect rect = st.rectTransform.rect;
float num = ((Rect)(ref rect)).width - 4f;
if (x > 0f && num > 0f && x > num)
{
st.fontSize = Mathf.Max(4f, value2 * num / x);
}
margin.z = 4f;
st.margin = new Vector4(0f, 0f, 4f, 0f);
}
}
private void OnWillRenderCanvases()
{
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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)
for (int num = sliderTexts.Count - 1; num >= 0; num--)
{
TMP_Text val = sliderTexts[num];
if ((Object)(object)val == (Object)null)
{
sliderTexts.RemoveAt(num);
}
else
{
ProcessSliderText(val);
}
}
for (int num2 = requirementTexts.Count - 1; num2 >= 0; num2--)
{
TMP_Text val2 = requirementTexts[num2];
if ((Object)(object)val2 == (Object)null)
{
requirementTexts.RemoveAt(num2);
}
else
{
string text = val2.text ?? "";
bool flag = text.Length == 0 || text.IndexOf("unlocked", StringComparison.OrdinalIgnoreCase) >= 0;
CanvasGroup val3 = ((Component)val2).GetComponent<CanvasGroup>();
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)val2).gameObject.AddComponent<CanvasGroup>();
}
float num3 = ((!flag) ? 1f : 0f);
if (val3.alpha != num3)
{
val3.alpha = num3;
}
Transform parent = val2.transform.parent;
RectTransform val4 = (RectTransform)((!((Object)(object)parent != (Object)null)) ? null : /*isinst with value type is only supported in some contexts*/);
if ((Object)(object)val4 != (Object)null && flag && Mathf.Abs(val4.pivot.y - 0.5f) > 0.01f)
{
val4.pivot = new Vector2(val4.pivot.x, 0.5f);
TMP_Text component = ((Component)val4).GetComponent<TMP_Text>();
if ((Object)(object)component != (Object)null)
{
component.alignment = (TextAlignmentOptions)4097;
}
}
}
}
}
private static void FixRowMargin(TMP_Text tx)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
Transform parent = tx.transform.parent;
RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null);
if ((Object)(object)val == (Object)null)
{
return;
}
float num = Mathf.Abs(((Transform)tx.rectTransform).lossyScale.x);
if (num < 0.0001f)
{
return;
}
tx.rectTransform.GetWorldCorners(cornersA);
float x = cornersA[0].x;
float num2 = (cornersA[0].x + cornersA[2].x) * 0.5f;
val.GetWorldCorners(cornersB);
float num3 = cornersB[2].x - cornersB[0].x;
float num4 = 0f;
for (int i = 0; i < parent.childCount; i++)
{
Transform child = parent.GetChild(i);
if ((Object)(object)child == (Object)(object)tx.transform || ((Object)child).name == "OldFill")
{
continue;
}
Image component = ((Component)child).GetComponent<Image>();
RectTransform val2 = (RectTransform)(object)((child is RectTransform) ? child : null);
if ((Object)(object)component == (Object)null || (Object)(object)val2 == (Object)null || !((Component)child).gameObject.activeInHierarchy)
{
continue;
}
val2.GetWorldCorners(cornersB);
float num5 = cornersB[2].x - cornersB[0].x;
float num6 = (cornersB[0].x + cornersB[2].x) * 0.5f;
if (!(num5 <= 0f) && !(num5 > num3 * 0.4f) && !(num6 >= num2))
{
float num7 = cornersB[2].x - x;
if (num7 > num4)
{
num4 = num7;
}
}
}
float num8 = ((!(num4 > 0f)) ? 5f : (num4 / num + 6f));
if (num8 < 5f)
{
num8 = 5f;
}
Vector4 margin = tx.margin;
if (Mathf.Abs(margin.x - num8) > 0.5f)
{
margin.x = num8;
tx.margin = margin;
}
}
private void MakeMenuTitle(RectTransform logo)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005b: 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_0073: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)logo == (Object)null))
{
GameObject val = new GameObject("OldMenuTitle", new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(TextMeshProUGUI)
});
RectTransform component = val.GetComponent<RectTransform>();
((Transform)component).SetParent(((Transform)logo).parent, false);
component.anchorMin = logo.anchorMin;
component.anchorMax = logo.anchorMax;
component.pivot = logo.pivot;
component.anchoredPosition = logo.anchoredPosition;
component.sizeDelta = logo.sizeDelta;
TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>();
if ((Object)(object)menuFont != (Object)null)
{
((TMP_Text)component2).font = menuFont;
}
((TMP_Text)component2).text = "--MENU--";
((TMP_Text)component2).fontSize = 32f;
((TMP_Text)component2).enableAutoSizing = false;
((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
((Graphic)component2).color = Color.white;
((Graphic)component2).raycastTarget = false;
}
}
private static void Hide(Transform parent, string childName)
{
Transform val = parent.Find(childName);
if (!((Object)(object)val == (Object)null))
{
CanvasGroup val2 = ((Component)val).GetComponent<CanvasGroup>();
if ((Object)(object)val2 == (Object)null)
{
val2 = ((Component)val).gameObject.AddComponent<CanvasGroup>();
}
val2.alpha = 0f;
val2.blocksRaycasts = false;
}
}
private static void SetRect(RectTransform rt, float aminX, float aminY, float amaxX, float amaxY, float pivX, float pivY, float posX, float posY, float sizeX, float sizeY)
{
//IL_0035: 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_004d: 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_0046: 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_005e: 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_0082: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(aminX, aminY);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(amaxX, amaxY);
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(pivX, pivY);
Vector2 val4 = default(Vector2);
((Vector2)(ref val4))..ctor(posX, posY);
Vector2 val5 = default(Vector2);
((Vector2)(ref val5))..ctor(sizeX, sizeY);
if (rt.anchorMin != val)
{
rt.anchorMin = val;
}
if (rt.anchorMax != val2)
{
rt.anchorMax = val2;
}
if (rt.pivot != val3)
{
rt.pivot = val3;
}
if (rt.anchoredPosition != val4)
{
rt.anchoredPosition = val4;
}
if (rt.sizeDelta != val5)
{
rt.sizeDelta = val5;
}
}
}
public class OldFillTint : MonoBehaviour, ISelectHandler, IDeselectHandler, IPointerEnterHandler, IPointerExitHandler, IEventSystemHandler
{
public Image fill;
private bool selected;
private bool hover;
private static readonly Color Normal = new Color(0f, 0f, 0f, 1f);
private static readonly Color Active = new Color(0.4f, 0f, 0f, 1f);
private void Apply()
{
//IL_002d: 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)
if ((Object)(object)fill != (Object)null)
{
((Graphic)fill).color = ((!selected && !hover) ? Normal : Active);
}
}
public void OnSelect(BaseEventData e)
{
selected = true;
Apply();
}
public void OnDeselect(BaseEventData e)
{
selected = false;
Apply();
}
public void OnPointerEnter(PointerEventData e)
{
hover = true;
Apply();
}
public void OnPointerExit(PointerEventData e)
{
hover = false;
Apply();
}
private void OnDisable()
{
selected = false;
hover = false;
Apply();
}
}