using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AchievementsTab;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(AchievementsTabMod), "Achievements Tab", "1.4.0", "PenguinInABox", null)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AchievementsTab")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AchievementsTab")]
[assembly: AssemblyTitle("AchievementsTab")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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;
}
}
}
namespace AchievementsTab
{
public class AchievementsTabMod : MelonMod
{
public override void OnUpdate()
{
if (AchievementsPanel.IsOpen && Input.GetKeyDown((KeyCode)27))
{
AchievementsPanel.Close();
}
}
}
[HarmonyPatch(typeof(MainMenuOptionsController), "Start")]
public static class MainMenuStartPatch
{
public static void Postfix(MainMenuOptionsController __instance)
{
try
{
MenuTabBuilder.Build(__instance);
}
catch (Exception ex)
{
MelonLogger.Error("Achievements Tab: menu button failed: " + ex);
}
}
}
public static class MenuTabBuilder
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__2_0;
public static Func<RectTransform, float> <>9__4_0;
internal void <Build>b__2_0()
{
AchievementsPanel.Toggle();
}
internal float <InsertIntoStack>b__4_0(RectTransform c)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return c.anchoredPosition.y;
}
}
private static readonly Color PinkTop = new Color(1f, 0.45f, 0.68f, 1f);
private static readonly Color PinkBase = new Color(0.82f, 0.24f, 0.48f, 1f);
public static void Build(MainMenuOptionsController controller)
{
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Expected O, but got Unknown
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03aa: Expected O, but got Unknown
//IL_0176: 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_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: 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_022e: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
GameObject value = Traverse.Create((object)controller).Field("_statsGO").GetValue<GameObject>();
GameObject value2 = Traverse.Create((object)controller).Field("_challengesGO").GetValue<GameObject>();
GameObject val = (((Object)(object)value != (Object)null) ? value : value2);
if ((Object)(object)val == (Object)null)
{
MelonLogger.Warning("Achievements Tab: no menu button to clone.");
return;
}
bool flag = (Object)(object)value != (Object)null;
string value3 = (flag ? "STATS" : "QUEST");
Transform parent = val.transform.parent;
if ((Object)(object)parent == (Object)null || (Object)(object)parent.Find("AchievementsOption") != (Object)null)
{
return;
}
GameObject val2 = Object.Instantiate<GameObject>(val, parent);
((Object)val2).name = "AchievementsOption";
TextMeshProUGUI val3 = null;
TextMeshProUGUI val4 = null;
TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI val5 in componentsInChildren)
{
if (((TMP_Text)val5).text != null && ((TMP_Text)val5).text.ToUpperInvariant().Contains(value3))
{
val3 = val5;
}
}
componentsInChildren = val2.GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI val6 in componentsInChildren)
{
if (((TMP_Text)val6).text != null && ((TMP_Text)val6).text.ToUpperInvariant().Contains(value3))
{
((TMP_Text)val6).text = "ACHIEVEMENTS";
val4 = val6;
AchievementsPanel.MenuFont = ((TMP_Text)val6).font;
}
}
Image[] componentsInChildren2 = val2.GetComponentsInChildren<Image>(true);
float num = -1f;
Image[] array = componentsInChildren2;
foreach (Image val7 in array)
{
float num2 = ((Graphic)val7).color.r * 0.299f + ((Graphic)val7).color.g * 0.587f + ((Graphic)val7).color.b * 0.114f;
if (num2 > num)
{
num = num2;
}
}
array = componentsInChildren2;
foreach (Image val8 in array)
{
float num3 = ((Graphic)val8).color.r * 0.299f + ((Graphic)val8).color.g * 0.587f + ((Graphic)val8).color.b * 0.114f;
Color color = ((num - num3 < 0.08f) ? PinkTop : PinkBase);
color.a = ((Graphic)val8).color.a;
((Graphic)val8).color = color;
}
Transform transform = val.transform;
RectTransform val9 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
Transform transform2 = val2.transform;
RectTransform val10 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null);
if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)val9 != (Object)null && (Object)(object)val10 != (Object)null)
{
try
{
((TMP_Text)val4).fontSize = ((TMP_Text)val3).fontSize;
float x = ((TMP_Text)val3).GetPreferredValues(((TMP_Text)val3).text).x;
float x2 = ((TMP_Text)val4).GetPreferredValues("ACHIEVEMENTS").x;
if (x > 1f && x2 > x)
{
float num4 = Mathf.Clamp(x2 / x, 1f, 2.4f);
Rect rect = val9.rect;
float width = ((Rect)(ref rect)).width;
float num5 = width * num4;
val10.SetSizeWithCurrentAnchors((Axis)0, num5);
if (flag)
{
float num6 = num5 - width;
val10.anchoredPosition -= new Vector2((1f - val10.pivot.x) * num6, 0f);
}
}
}
catch
{
}
}
Button componentInChildren = val2.GetComponentInChildren<Button>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.onClick = new ButtonClickedEvent();
ButtonClickedEvent onClick = componentInChildren.onClick;
object obj2 = <>c.<>9__2_0;
if (obj2 == null)
{
UnityAction val11 = delegate
{
AchievementsPanel.Toggle();
};
<>c.<>9__2_0 = val11;
obj2 = (object)val11;
}
((UnityEvent)onClick).AddListener((UnityAction)obj2);
}
if (flag)
{
PlaceUnderStats(controller, value, val2);
}
else
{
InsertIntoStack(value2, val2);
}
val2.SetActive(true);
AchievementsPanel.Build();
MelonLogger.Msg(flag ? "Achievements Tab: button added under STATS." : "Achievements Tab: button added under QUESTS.");
}
private static void PlaceUnderStats(MainMenuOptionsController controller, GameObject statsGO, GameObject clone)
{
//IL_00c6: 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_00dd: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Transform transform = statsGO.transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
Transform transform2 = clone.transform;
RectTransform val2 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null);
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
{
return;
}
Rect rect = val.rect;
float num = ((Rect)(ref rect)).height + 16f;
try
{
GameObject value = Traverse.Create((object)controller).Field("_collectionGO").GetValue<GameObject>();
RectTransform val3 = (RectTransform)(((Object)(object)value != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null);
if ((Object)(object)val3 != (Object)null && (Object)(object)((Transform)val3).parent == (Object)(object)((Transform)val).parent)
{
float num2 = val3.anchoredPosition.y - val.anchoredPosition.y;
if (num2 > 40f && num2 < 300f)
{
num = num2;
}
}
}
catch
{
}
val2.anchoredPosition = new Vector2(val2.anchoredPosition.x, val.anchoredPosition.y - num);
((Transform)val2).SetSiblingIndex(((Transform)val).GetSiblingIndex() + 1);
}
private static void InsertIntoStack(GameObject questsGO, GameObject clone)
{
//IL_0063: 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)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: 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_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)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: 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)
Transform transform = questsGO.transform;
RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null);
Transform transform2 = clone.transform;
RectTransform val2 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null);
Transform parent = questsGO.transform.parent;
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)parent == (Object)null)
{
return;
}
if ((Object)(object)((Component)parent).GetComponent<LayoutGroup>() != (Object)null)
{
clone.transform.SetSiblingIndex(((Transform)val).GetSiblingIndex() + 1);
return;
}
Vector2 anchoredPosition = val.anchoredPosition;
List<RectTransform> list = new List<RectTransform>();
for (int i = 0; i < parent.childCount; i++)
{
Transform child = parent.GetChild(i);
RectTransform val3 = (RectTransform)(object)((child is RectTransform) ? child : null);
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)val) && !((Object)(object)val3 == (Object)(object)val2))
{
Vector2 anchoredPosition2 = val3.anchoredPosition;
if (Mathf.Abs(anchoredPosition2.x - anchoredPosition.x) < 60f && anchoredPosition2.y < anchoredPosition.y - 1f)
{
list.Add(val3);
}
}
}
float num;
if (list.Count <= 0)
{
Rect rect = val.rect;
num = ((Rect)(ref rect)).height + 24f;
}
else
{
num = anchoredPosition.y - list.Max((RectTransform c) => c.anchoredPosition.y);
}
float num2 = num;
val2.anchoredPosition = new Vector2(anchoredPosition.x, anchoredPosition.y - num2);
((Transform)val2).SetSiblingIndex(((Transform)val).GetSiblingIndex() + 1);
foreach (RectTransform item in list)
{
item.anchoredPosition = new Vector2(item.anchoredPosition.x, item.anchoredPosition.y - num2);
}
}
}
public class ProgressInfo
{
public double Current;
public double Target;
public bool IsPercent;
public double Fraction
{
get
{
if (!(Target > 0.0))
{
return 0.0;
}
return Math.Min(1.0, Current / Target);
}
}
public string Text
{
get
{
double num = (IsPercent ? Current : (Fraction * 100.0));
string text = ((num >= 10.0) ? num.ToString("0") : num.ToString("0.0"));
if (IsPercent)
{
return text + "%";
}
return text + "% · " + ((long)Current).ToString("N0") + " / " + ((long)Target).ToString("N0");
}
}
}
public static class ProgressTrackers
{
public static ProgressInfo GetProgress(string steamName)
{
try
{
switch (steamName)
{
case "ACH_ONE_HUNDRED":
{
if (double.TryParse(SaveManager.GetPercentageCompletion((SaveFile)null), out var result))
{
return new ProgressInfo
{
Current = result,
Target = 100.0,
IsPercent = true
};
}
return null;
}
case "ACH_QUESTING_ADVENTURER":
{
int count = ChallengeRuns.ChallengeSteamAchievementNames.Count;
int num2 = SaveManager.GetCompletedChallengeTypes().Count((Type t) => ChallengeRuns.ChallengeSteamAchievementNames.ContainsKey(t));
return new ProgressInfo
{
Current = num2,
Target = count
};
}
case "ACH_CACHE_EM_ALL":
{
List<Type> lockedItems = ItemPools.GetLockedItems();
if (lockedItems == null)
{
return null;
}
int num3 = Assembly.GetAssembly(typeof(Item)).GetTypes().Count((Type t) => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(Item)));
return new ProgressInfo
{
Current = num3 - lockedItems.Count,
Target = num3
};
}
case "ACH_LORD_OF_THE_FLIES":
return new ProgressInfo
{
Current = SaveManager.GetCharacterHasBeatenFinalBossAmount(),
Target = Character.GetAllCharacters().Count
};
case "ACH_ONE_MILLION":
return BestWordProgress(1000000L);
case "ACH_ONE_BILLION":
return BestWordProgress(1000000000L);
case "ACH_TWENTY_FIVE_TILES":
{
int num = 0;
foreach (GuttedHistoricRun historicRun in SaveManager.GetHistoricRuns())
{
if (historicRun?.LongestWord?.Tiles != null)
{
num = Math.Max(num, historicRun.LongestWord.Tiles.Count);
}
}
return new ProgressInfo
{
Current = num,
Target = 25.0
};
}
default:
return null;
}
}
catch
{
return null;
}
}
private static ProgressInfo BestWordProgress(long target)
{
long num = 0L;
foreach (GuttedHistoricRun historicRun in SaveManager.GetHistoricRuns())
{
HistoricWord val = historicRun?.BestModifiedScoreWord;
if (!(val?.Score == (ScorePacket)null))
{
if (val.Score.IsInfinite)
{
num = target;
break;
}
if (val.Score.Score > num)
{
num = val.Score.Score;
}
}
}
return new ProgressInfo
{
Current = num,
Target = target
};
}
}
public static class AchievementsPanel
{
private enum SortMode
{
UnlockedFirst,
LockedFirst,
NameAZ
}
private class Row
{
public string Name;
public string Description;
public string UnlocksItem;
public bool Unlocked;
public DateTime? UnlockedDate;
public ProgressInfo Progress;
public double ProgressFraction
{
get
{
if (Progress == null)
{
return -1.0;
}
return Progress.Fraction;
}
}
}
[CompilerGenerated]
private static class <>O
{
public static UnityAction <0>__CycleSort;
public static UnityAction <1>__Close;
}
public static TMP_FontAsset MenuFont;
private static GameObject _root;
private static RectTransform _contentRT;
private static TextMeshProUGUI _subtitle;
private static TextMeshProUGUI _sortLabel;
private static SortMode _sortMode = SortMode.UnlockedFirst;
private static readonly string[] SortNames = new string[3] { "Unlocked first", "Locked first", "Name A-Z" };
private static Sprite _roundedSprite;
private static readonly (string Steam, string Name, string Desc)[] ExtraAchievements = new(string, string, string)[13]
{
("ACH_ONE_HUNDRED", "One Hundred", "Reach 100% completion on this save file"),
("ACH_QUESTING_ADVENTURER", "Questing Adventurer", "Complete every challenge"),
("ACH_CACHE_EM_ALL", "Cache 'Em All", "Unlock every item in the collection"),
("ACH_LORD_OF_THE_FLIES", "Lord of the Flies", "Beat the final boss with every character"),
("ACH_FAIRY_SHEPHERD", "Fairy Shepherd", "Beat the final boss with any character"),
("ACH_DONT_HUG_ME", "Don't Hug Me", "Earn the final crown with Michael"),
("ACH_ONE_MILLION", "One Million", "Score 1,000,000 or more with a single word"),
("ACH_ONE_BILLION", "One Billion", "Score 1,000,000,000 or more with a single word"),
("ACH_INFINITY", "Infinity", "Score infinite points with a single word"),
("ACH_TWENTY_FIVE_TILES", "Twenty-Five Tiles", "Submit a word using 25 or more tiles"),
("ACH_SPEEDRUN_JANE", "Speedrun Jane", "Beat the Jane speedrun time - 3:42.75"),
("ACH_SPEEDRUN_MAT", "Speedrun Mat", "Beat the Mat speedrun time - 3:55.25"),
("ACH_SPEEDRUN_NIZ", "Speedrun Niz", "Beat the Niz speedrun time - 3:22.56")
};
public static bool IsOpen
{
get
{
if ((Object)(object)_root != (Object)null)
{
return _root.activeSelf;
}
return false;
}
}
private static Sprite RoundedSprite
{
get
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_roundedSprite == (Object)null)
{
int num = 64;
int num2 = 16;
Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
Color[] array = (Color[])(object)new Color[num * num];
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
float num3 = Mathf.Max(new int[3]
{
num2 - j,
0,
j - (num - 1 - num2)
});
float num4 = Mathf.Max(new int[3]
{
num2 - i,
0,
i - (num - 1 - num2)
});
float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
float num6 = Mathf.Clamp01((float)num2 - num5 + 0.5f);
array[i * num + j] = new Color(1f, 1f, 1f, num6);
}
}
val.SetPixels(array);
val.Apply();
_roundedSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)num2, (float)num2, (float)num2, (float)num2));
}
return _roundedSprite;
}
}
public static void Build()
{
//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_003e: 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_006a: 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_0077: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: 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_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0423: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Expected O, but got Unknown
//IL_0487: Unknown result type (might be due to invalid IL or missing references)
//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Expected O, but got Unknown
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_0528: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0601: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Unknown result type (might be due to invalid IL or missing references)
//IL_0642: Unknown result type (might be due to invalid IL or missing references)
//IL_064c: Unknown result type (might be due to invalid IL or missing references)
//IL_0666: Unknown result type (might be due to invalid IL or missing references)
//IL_0670: Expected O, but got Unknown
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Expected O, but got Unknown
if ((Object)(object)_root != (Object)null)
{
Object.Destroy((Object)(object)_root);
_root = null;
}
GameObject val = new GameObject("AchievementsTabCanvas");
Canvas obj = val.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 400;
CanvasScaler obj2 = val.AddComponent<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
obj2.matchWidthOrHeight = 0.5f;
val.AddComponent<GraphicRaycaster>();
_root = val;
Transform transform = NewImage(val.transform, "Backdrop", new Color(0.02f, 0.02f, 0.04f, 0.82f), null).transform;
Stretch((RectTransform)(object)((transform is RectTransform) ? transform : null));
GameObject val2 = NewImage(val.transform, "Panel", new Color(0.09f, 0.09f, 0.12f, 0.99f), RoundedSprite);
Transform transform2 = val2.transform;
Transform obj3 = ((transform2 is RectTransform) ? transform2 : null);
((RectTransform)obj3).anchorMin = new Vector2(0.5f, 0.5f);
((RectTransform)obj3).anchorMax = new Vector2(0.5f, 0.5f);
((RectTransform)obj3).pivot = new Vector2(0.5f, 0.5f);
((RectTransform)obj3).sizeDelta = new Vector2(1760f, 940f);
((RectTransform)obj3).anchoredPosition = Vector2.zero;
Transform transform3 = ((TMP_Text)NewText(val2.transform, "Title", "STEAM ACHIEVEMENTS", 46f, Color.white, (TextAlignmentOptions)513)).transform;
Transform obj4 = ((transform3 is RectTransform) ? transform3 : null);
((RectTransform)obj4).anchorMin = new Vector2(0f, 1f);
((RectTransform)obj4).anchorMax = new Vector2(1f, 1f);
((RectTransform)obj4).pivot = new Vector2(0.5f, 1f);
((RectTransform)obj4).offsetMin = new Vector2(48f, -92f);
((RectTransform)obj4).offsetMax = new Vector2(-470f, -24f);
_subtitle = NewText(val2.transform, "Subtitle", "", 26f, new Color(0.75f, 0.78f, 0.85f), (TextAlignmentOptions)513);
Transform transform4 = ((TMP_Text)_subtitle).transform;
Transform obj5 = ((transform4 is RectTransform) ? transform4 : null);
((RectTransform)obj5).anchorMin = new Vector2(0f, 1f);
((RectTransform)obj5).anchorMax = new Vector2(1f, 1f);
((RectTransform)obj5).pivot = new Vector2(0.5f, 1f);
((RectTransform)obj5).offsetMin = new Vector2(48f, -132f);
((RectTransform)obj5).offsetMax = new Vector2(-470f, -96f);
GameObject obj6 = NewImage(val2.transform, "SortButton", new Color(0.16f, 0.19f, 0.26f, 1f), RoundedSprite);
Transform transform5 = obj6.transform;
Transform obj7 = ((transform5 is RectTransform) ? transform5 : null);
((RectTransform)obj7).anchorMin = new Vector2(1f, 1f);
((RectTransform)obj7).anchorMax = new Vector2(1f, 1f);
((RectTransform)obj7).pivot = new Vector2(1f, 1f);
((RectTransform)obj7).sizeDelta = new Vector2(330f, 56f);
((RectTransform)obj7).anchoredPosition = new Vector2(-96f, -24f);
ButtonClickedEvent onClick = obj6.AddComponent<Button>().onClick;
object obj8 = <>O.<0>__CycleSort;
if (obj8 == null)
{
UnityAction val3 = CycleSort;
<>O.<0>__CycleSort = val3;
obj8 = (object)val3;
}
((UnityEvent)onClick).AddListener((UnityAction)obj8);
obj6.AddComponent<ButtonFeel>();
_sortLabel = NewText(obj6.transform, "SortLabel", "", 22f, Color.white, (TextAlignmentOptions)514);
Transform transform6 = ((TMP_Text)_sortLabel).transform;
Stretch((RectTransform)(object)((transform6 is RectTransform) ? transform6 : null));
UpdateSortLabel();
GameObject obj9 = NewImage(val2.transform, "CloseButton", new Color(0.85f, 0.2f, 0.22f, 1f), RoundedSprite);
Transform transform7 = obj9.transform;
Transform obj10 = ((transform7 is RectTransform) ? transform7 : null);
((RectTransform)obj10).anchorMin = new Vector2(1f, 1f);
((RectTransform)obj10).anchorMax = new Vector2(1f, 1f);
((RectTransform)obj10).pivot = new Vector2(1f, 1f);
((RectTransform)obj10).sizeDelta = new Vector2(56f, 56f);
((RectTransform)obj10).anchoredPosition = new Vector2(-24f, -24f);
ButtonClickedEvent onClick2 = obj9.AddComponent<Button>().onClick;
object obj11 = <>O.<1>__Close;
if (obj11 == null)
{
UnityAction val4 = Close;
<>O.<1>__Close = val4;
obj11 = (object)val4;
}
((UnityEvent)onClick2).AddListener((UnityAction)obj11);
obj9.AddComponent<ButtonFeel>();
Transform transform8 = ((TMP_Text)NewText(obj9.transform, "X", "×", 36f, Color.white, (TextAlignmentOptions)514)).transform;
Stretch((RectTransform)(object)((transform8 is RectTransform) ? transform8 : null));
GameObject val5 = new GameObject("ScrollView", new Type[4]
{
typeof(RectTransform),
typeof(ScrollRect),
typeof(Image),
typeof(Mask)
});
val5.transform.SetParent(val2.transform, false);
Transform transform9 = val5.transform;
RectTransform val6 = (RectTransform)(object)((transform9 is RectTransform) ? transform9 : null);
val6.anchorMin = new Vector2(0f, 0f);
val6.anchorMax = new Vector2(1f, 1f);
val6.offsetMin = new Vector2(56f, 40f);
val6.offsetMax = new Vector2(-56f, -152f);
((Graphic)val5.GetComponent<Image>()).color = new Color(0.05f, 0.05f, 0.07f, 1f);
val5.GetComponent<Mask>().showMaskGraphic = false;
ScrollRect component = val5.GetComponent<ScrollRect>();
component.horizontal = false;
component.vertical = true;
component.movementType = (MovementType)2;
component.scrollSensitivity = 42f;
GameObject val7 = new GameObject("Content", new Type[1] { typeof(RectTransform) });
val7.transform.SetParent(val5.transform, false);
Transform transform10 = val7.transform;
_contentRT = (RectTransform)(object)((transform10 is RectTransform) ? transform10 : null);
_contentRT.anchorMin = new Vector2(0f, 1f);
_contentRT.anchorMax = new Vector2(1f, 1f);
_contentRT.pivot = new Vector2(0.5f, 1f);
_contentRT.anchoredPosition = Vector2.zero;
VerticalLayoutGroup obj12 = val7.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj12).spacing = 10f;
((LayoutGroup)obj12).padding = new RectOffset(14, 14, 14, 14);
((HorizontalOrVerticalLayoutGroup)obj12).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj12).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj12).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)obj12).childForceExpandHeight = false;
val7.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
component.viewport = val6;
component.content = _contentRT;
_root.SetActive(false);
}
private static void CycleSort()
{
_sortMode = (SortMode)((int)(_sortMode + 1) % SortNames.Length);
UpdateSortLabel();
Refresh();
}
private static void UpdateSortLabel()
{
if ((Object)(object)_sortLabel != (Object)null)
{
((TMP_Text)_sortLabel).text = "Sort: " + SortNames[(int)_sortMode];
}
}
public static void Toggle()
{
if (!((Object)(object)_root == (Object)null))
{
if (_root.activeSelf)
{
Close();
return;
}
_root.SetActive(true);
Refresh();
}
}
public static void Close()
{
if ((Object)(object)_root != (Object)null)
{
_root.SetActive(false);
}
}
private static bool SteamHasAchievement(string steamName)
{
try
{
bool result = default(bool);
if (SteamManager.Initialized && SteamUserStats.GetAchievement(steamName, ref result))
{
return result;
}
}
catch
{
}
return false;
}
private static void Refresh()
{
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
if ((Object)(object)_contentRT == (Object)null)
{
return;
}
for (int num = ((Transform)_contentRT).childCount - 1; num >= 0; num--)
{
Object.Destroy((Object)(object)((Component)((Transform)_contentRT).GetChild(num)).gameObject);
}
List<Row> list = new List<Row>();
HashSet<string> hashSet = new HashSet<string>();
Dictionary<Type, DateTime> dictionary = new Dictionary<Type, DateTime>();
try
{
foreach (UnlockedAchievement achievement in SaveManager.GetAchievements())
{
if (achievement != null && achievement.AchievementType != null)
{
dictionary[achievement.AchievementType] = achievement.DateUnlocked;
}
}
}
catch
{
}
try
{
foreach (Type item in from t in Assembly.GetAssembly(typeof(Achievement)).GetTypes()
where t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(Achievement))
select t)
{
Achievement val = (Achievement)Activator.CreateInstance(item);
DateTime value;
bool flag = dictionary.TryGetValue(item, out value);
if (!string.IsNullOrEmpty(val.SteamAchievementName))
{
hashSet.Add(val.SteamAchievementName);
}
list.Add(new Row
{
Name = (val.Name ?? item.Name),
Description = ((!flag && val.IsDescriptionHidden) ? "Hidden achievement — unlock it to reveal how." : SafeDescription(val)),
UnlocksItem = SafeUnlocksItemName(val),
Unlocked = flag,
UnlockedDate = (flag ? new DateTime?(value) : ((DateTime?)null)),
Progress = (flag ? null : ProgressTrackers.GetProgress(val.SteamAchievementName))
});
}
}
catch (Exception ex)
{
MelonLogger.Error("Achievements Tab: enumeration failed: " + ex);
}
(string, string, string)[] extraAchievements = ExtraAchievements;
for (int num2 = 0; num2 < extraAchievements.Length; num2++)
{
var (text, name, description) = extraAchievements[num2];
if (!hashSet.Contains(text))
{
ProgressInfo progress = ProgressTrackers.GetProgress(text);
bool flag2 = SteamHasAchievement(text) || (progress != null && progress.Fraction >= 1.0);
list.Add(new Row
{
Name = name,
Description = description,
Unlocked = flag2,
Progress = (flag2 ? null : progress)
});
}
}
List<Row> list2 = (_sortMode switch
{
SortMode.LockedFirst => list.Where((Row r) => !r.Unlocked).OrderBy<Row, string>((Row r) => r.Name, StringComparer.OrdinalIgnoreCase).Concat(from r in list
where r.Unlocked
orderby r.UnlockedDate ?? DateTime.MinValue descending
select r),
SortMode.NameAZ => list.OrderBy<Row, string>((Row r) => r.Name, StringComparer.OrdinalIgnoreCase),
_ => (from r in list
where r.Unlocked
orderby r.UnlockedDate ?? DateTime.MinValue descending
select r).Concat(list.Where((Row r) => !r.Unlocked).OrderBy<Row, string>((Row r) => r.Name, StringComparer.OrdinalIgnoreCase)),
}).ToList();
if ((Object)(object)_subtitle != (Object)null)
{
string text2 = "";
try
{
text2 = " · Save completion " + SaveManager.GetPercentageCompletion((SaveFile)null) + "%";
}
catch
{
}
((TMP_Text)_subtitle).text = "Unlocked " + list.Count((Row r) => r.Unlocked) + " of " + list.Count + text2;
}
foreach (Row item2 in list2)
{
BuildRow(item2);
}
LayoutRebuilder.ForceRebuildLayoutImmediate(_contentRT);
LayoutRebuilder.ForceRebuildLayoutImmediate(_contentRT);
}
private static void BuildRow(Row row)
{
//IL_0041: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: 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_0208: 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_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
GameObject val = NewImage((Transform)(object)_contentRT, "Row", row.Unlocked ? new Color(0.13f, 0.13f, 0.17f, 1f) : new Color(0.07f, 0.07f, 0.1f, 1f), RoundedSprite);
val.AddComponent<LayoutElement>().minHeight = 104f;
HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>();
((LayoutGroup)obj).padding = new RectOffset(44, 44, 14, 14);
((HorizontalOrVerticalLayoutGroup)obj).spacing = 16f;
((LayoutGroup)obj).childAlignment = (TextAnchor)3;
((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
GameObject val2 = new GameObject("Left", new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(val.transform, false);
val2.AddComponent<LayoutElement>().flexibleWidth = 1f;
VerticalLayoutGroup obj2 = val2.AddComponent<VerticalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj2).spacing = 3f;
((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
TextMeshProUGUI obj3 = NewText(val2.transform, "Name", row.Name, 27f, row.Unlocked ? new Color(1f, 0.82f, 0.35f) : new Color(0.72f, 0.74f, 0.8f), (TextAlignmentOptions)513);
((TMP_Text)obj3).fontStyle = (FontStyles)1;
((TMP_Text)obj3).textWrappingMode = (TextWrappingModes)0;
((TMP_Text)obj3).overflowMode = (TextOverflowModes)1;
((TMP_Text)NewText(val2.transform, "Description", row.Description, 21f, row.Unlocked ? new Color(0.88f, 0.89f, 0.93f) : new Color(0.58f, 0.6f, 0.66f), (TextAlignmentOptions)513)).textWrappingMode = (TextWrappingModes)1;
if (row.UnlocksItem != null)
{
NewText(val2.transform, "Unlocks", "Unlocks: " + row.UnlocksItem, 19f, new Color(0.45f, 0.85f, 0.8f), (TextAlignmentOptions)513);
}
if (!row.Unlocked && row.Progress != null && row.Progress.Current > 0.0)
{
GameObject val3 = new GameObject("Progress", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val2.transform, false);
val3.AddComponent<LayoutElement>().preferredHeight = 26f;
HorizontalLayoutGroup obj4 = val3.AddComponent<HorizontalLayoutGroup>();
((HorizontalOrVerticalLayoutGroup)obj4).spacing = 10f;
((LayoutGroup)obj4).childAlignment = (TextAnchor)3;
((HorizontalOrVerticalLayoutGroup)obj4).childControlWidth = true;
((HorizontalOrVerticalLayoutGroup)obj4).childControlHeight = true;
((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandWidth = false;
((HorizontalOrVerticalLayoutGroup)obj4).childForceExpandHeight = false;
GameObject obj5 = NewImage(val3.transform, "Bar", new Color(0.1f, 0.12f, 0.18f, 1f), RoundedSprite);
LayoutElement obj6 = obj5.AddComponent<LayoutElement>();
obj6.flexibleWidth = 1f;
obj6.preferredHeight = 12f;
obj6.minHeight = 12f;
GameObject obj7 = NewImage(obj5.transform, "Fill", new Color(0.3f, 0.62f, 1f, 1f), RoundedSprite);
Image component = obj7.GetComponent<Image>();
component.type = (Type)3;
component.fillMethod = (FillMethod)0;
component.fillOrigin = 0;
component.fillAmount = (float)row.Progress.Fraction;
Transform transform = obj7.transform;
Stretch((RectTransform)(object)((transform is RectTransform) ? transform : null));
((TMP_Text)NewText(val3.transform, "Pct", row.Progress.Text, 18f, new Color(0.65f, 0.8f, 1f), (TextAlignmentOptions)513)).textWrappingMode = (TextWrappingModes)0;
}
string text = ((!row.Unlocked) ? "LOCKED" : (row.UnlockedDate.HasValue ? ("UNLOCKED\n" + row.UnlockedDate.Value.ToString("MMM d, yyyy")) : "UNLOCKED"));
TextMeshProUGUI obj8 = NewText(val.transform, "Status", text, 21f, row.Unlocked ? new Color(0.55f, 0.95f, 0.55f) : new Color(0.45f, 0.47f, 0.52f), (TextAlignmentOptions)516);
((TMP_Text)obj8).textWrappingMode = (TextWrappingModes)1;
LayoutElement obj9 = ((Component)obj8).gameObject.AddComponent<LayoutElement>();
obj9.preferredWidth = 200f;
obj9.minWidth = 200f;
}
private static string SafeDescription(Achievement ach)
{
try
{
return ach.GetDescription() ?? "";
}
catch
{
return ach.Description ?? "";
}
}
private static string SafeUnlocksItemName(Achievement ach)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
try
{
if (ach.TypeOfItemUnlocked == null)
{
return null;
}
return ((Item)Activator.CreateInstance(ach.TypeOfItemUnlocked))?.Name;
}
catch
{
return null;
}
}
private static GameObject NewImage(Transform parent, string name, Color color, Sprite sprite)
{
//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_0033: 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_0059: Expected O, but got Unknown
GameObject val = new GameObject(name, new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(parent, false);
Image component = val.GetComponent<Image>();
((Graphic)component).color = color;
if ((Object)(object)sprite != (Object)null)
{
component.sprite = sprite;
component.type = (Type)1;
}
return val;
}
private static TextMeshProUGUI NewText(Transform parent, string name, string text, float size, Color color, TextAlignmentOptions align)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_007e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent, false);
TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
if ((Object)(object)MenuFont != (Object)null)
{
((TMP_Text)val2).font = MenuFont;
}
((TMP_Text)val2).text = text;
((TMP_Text)val2).fontSize = size;
((Graphic)val2).color = color;
((TMP_Text)val2).alignment = align;
((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
((TMP_Text)val2).margin = new Vector4(14f, 0f, 14f, 0f);
return val2;
}
private static void Stretch(RectTransform rt)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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)
rt.anchorMin = Vector2.zero;
rt.anchorMax = Vector2.one;
rt.offsetMin = Vector2.zero;
rt.offsetMax = Vector2.zero;
}
}
public class ButtonFeel : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler
{
private RectTransform _rt;
private Vector2 _startPos;
private bool _pressed;
private bool _hovered;
private Coroutine _pop;
private void Awake()
{
//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)
_rt = ((Component)this).GetComponent<RectTransform>();
if ((Object)(object)_rt != (Object)null)
{
_startPos = _rt.anchoredPosition;
}
}
public void OnPointerEnter(PointerEventData eventData)
{
_hovered = true;
}
public void OnPointerExit(PointerEventData eventData)
{
_hovered = false;
if (_pressed)
{
_pressed = false;
Restore();
PlayRelease();
}
}
public void OnPointerDown(PointerEventData eventData)
{
//IL_004a: 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_0073: 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_0082: 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)
if ((Object)(object)_rt == (Object)null)
{
_rt = ((Component)this).GetComponent<RectTransform>();
}
if ((Object)(object)_rt == (Object)null)
{
return;
}
if (_pop != null)
{
((MonoBehaviour)this).StopCoroutine(_pop);
_pop = null;
}
((Transform)_rt).localScale = Vector3.one;
_startPos = _rt.anchoredPosition;
_pressed = true;
_rt.anchoredPosition = _startPos - Vector2.up * 6f;
try
{
if ((Object)(object)PersistentSound.SingletonSoundController != (Object)null)
{
PersistentSound.SingletonSoundController.ButtonPress();
}
}
catch
{
}
}
public void OnPointerUp(PointerEventData eventData)
{
if (!_pressed)
{
return;
}
_pressed = false;
Restore();
PlayRelease();
if (_hovered && (Object)(object)_rt != (Object)null)
{
if (_pop != null)
{
((MonoBehaviour)this).StopCoroutine(_pop);
}
_pop = ((MonoBehaviour)this).StartCoroutine(Pop());
}
}
private void Restore()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_rt != (Object)null)
{
_rt.anchoredPosition = _startPos;
}
}
private static void PlayRelease()
{
try
{
if ((Object)(object)PersistentSound.SingletonSoundController != (Object)null)
{
PersistentSound.SingletonSoundController.ButtonRelease();
}
}
catch
{
}
}
private IEnumerator Pop()
{
float t = 0f;
while (t < 0.22f)
{
t += Time.unscaledDeltaTime;
float num = Mathf.Clamp01(t / 0.22f);
float num2 = 1f + 0.18f * Mathf.Sin(num * (float)Math.PI * 1.35f) * (1f - num * 0.55f);
if ((Object)(object)_rt == (Object)null)
{
yield break;
}
((Transform)_rt).localScale = new Vector3(num2, num2, 1f);
yield return null;
}
if ((Object)(object)_rt != (Object)null)
{
((Transform)_rt).localScale = Vector3.one;
}
_pop = null;
}
}
}