using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("NachoAchievementsGlobalSave")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Global Save Addon for NachoAchievements")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5")]
[assembly: AssemblyProduct("NachoAchievementsGlobalSave")]
[assembly: AssemblyTitle("NachoAchievementsGlobalSave")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace NachoAchievementsGlobalSave
{
public static class AchievementPopupPatches
{
private static GameObject _popupContainer = null;
private const float POPUP_DURATION = 4f;
private const float SLIDE_DURATION = 0.4f;
private static readonly Color POPUP_BG_COLOR = new Color(0.05f, 0.05f, 0.08f, 0.95f);
private static readonly Color GOLD_COLOR = new Color(1f, 0.85f, 0.2f, 1f);
private static int _currentBadgeIndex = -1;
private static Queue<string> _popupQueue = new Queue<string>();
private static bool _isShowingPopup = false;
private static float _nextPopupDelay = 0f;
private static int FindBadgeIndex(string achievementKey)
{
try
{
if (AccessTools.Field(AccessTools.TypeByName("NachoAchievements.NachoAchievements"), "Achievements")?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary)
{
int num = 1;
foreach (string key in dictionary.Keys)
{
if (key == achievementKey)
{
GlobalSavePlugin.Logger.LogInfo((object)$"Found badge index {num} for achievement key: {achievementKey}");
return num;
}
num++;
}
}
GlobalSavePlugin.Logger.LogWarning((object)("Badge not found for achievement key: " + achievementKey));
}
catch (Exception ex)
{
GlobalSavePlugin.Logger.LogError((object)("FindBadgeIndex error: " + ex.Message));
}
return -1;
}
private static string GetAchievementName(string achievementKey)
{
try
{
if (AccessTools.Field(AccessTools.TypeByName("NachoAchievements.NachoAchievements"), "Achievements")?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary && dictionary.ContainsKey(achievementKey))
{
Dictionary<string, string> dictionary2 = dictionary[achievementKey];
if (dictionary2.ContainsKey("name"))
{
return dictionary2["name"];
}
}
}
catch
{
}
return achievementKey;
}
public static bool CreateEnhancedAchievementPopup(string text)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
try
{
if (_isShowingPopup && (Object)_popupContainer != (Object)null)
{
_popupQueue.Enqueue(text);
GlobalSavePlugin.Logger.LogInfo((object)$"Achievement queued: {text} (Queue size: {_popupQueue.Count})");
SetOriginalFields();
return false;
}
ShowPopup(text);
return false;
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"Enhanced popup failed: {arg}");
return true;
}
}
private static void ShowPopup(string achievementKey)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
try
{
CleanupPopup();
_isShowingPopup = true;
_currentBadgeIndex = FindBadgeIndex(achievementKey);
string achievementName = GetAchievementName(achievementKey);
Type type = AccessTools.TypeByName("NachoAchievements.NachoAchievements");
FieldInfo fieldInfo = AccessTools.Field(type, "AchievementsCanvas");
object obj = fieldInfo?.GetValue(null);
Canvas val = (Canvas)((obj is Canvas) ? obj : null);
if ((Object)val == (Object)null)
{
AccessTools.Method(type, "CreateAchievementsCanvas", (Type[])null, (Type[])null)?.Invoke(null, null);
object obj2 = fieldInfo?.GetValue(null);
val = (Canvas)((obj2 is Canvas) ? obj2 : null);
}
if ((Object)val == (Object)null)
{
_isShowingPopup = false;
return;
}
CreatePopupUI(val, achievementName);
PlayAchievementSound();
AccessTools.Field(type, "destroyTimer")?.SetValue(null, 0f);
SetOriginalFields();
StartPopupAnimation();
GlobalSavePlugin.Logger.LogInfo((object)("Showing popup for: " + achievementKey + " (" + achievementName + ")"));
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"ShowPopup failed: {arg}");
_isShowingPopup = false;
}
}
private static void SetOriginalFields()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
try
{
Type type = AccessTools.TypeByName("NachoAchievements.NachoAchievements");
FieldInfo fieldInfo = AccessTools.Field(type, "achievementGetText");
FieldInfo fieldInfo2 = AccessTools.Field(type, "achievementGetTextSubtitle");
if ((Object)_popupContainer != (Object)null)
{
fieldInfo?.SetValue(null, _popupContainer);
fieldInfo2?.SetValue(null, _popupContainer);
}
}
catch
{
}
}
public static void OnPopupComplete()
{
_isShowingPopup = false;
_popupContainer = null;
if (_popupQueue.Count > 0)
{
string text = _popupQueue.Dequeue();
GlobalSavePlugin.Logger.LogInfo((object)$"Showing next queued popup: {text} (Remaining: {_popupQueue.Count})");
ShowPopup(text);
}
}
private static void CreatePopupUI(Canvas canvas, string achievementName)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: 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_01ef: 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)
//IL_0219: 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_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: 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_02ac: 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_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_039d: Unknown result type (might be due to invalid IL or missing references)
//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_049c: Unknown result type (might be due to invalid IL or missing references)
//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Expected O, but got Unknown
//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_0526: Unknown result type (might be due to invalid IL or missing references)
//IL_053b: Unknown result type (might be due to invalid IL or missing references)
//IL_054f: Unknown result type (might be due to invalid IL or missing references)
//IL_055e: Unknown result type (might be due to invalid IL or missing references)
//IL_0563: Unknown result type (might be due to invalid IL or missing references)
//IL_0575: Unknown result type (might be due to invalid IL or missing references)
//IL_057b: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Unknown result type (might be due to invalid IL or missing references)
//IL_0596: Unknown result type (might be due to invalid IL or missing references)
//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05c0: 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_05d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
_popupContainer = new GameObject("EnhancedAchievementPopup");
_popupContainer.transform.SetParent(((Component)canvas).transform, false);
RectTransform obj = _popupContainer.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.5f, 1f);
obj.anchorMax = new Vector2(0.5f, 1f);
obj.pivot = new Vector2(0.5f, 1f);
obj.anchoredPosition = new Vector2(0f, 200f);
obj.sizeDelta = new Vector2(700f, 140f);
GameObject val = new GameObject("Background");
val.transform.SetParent(_popupContainer.transform, false);
((Graphic)val.AddComponent<Image>()).color = POPUP_BG_COLOR;
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
component.anchoredPosition = Vector2.zero;
Outline obj2 = val.AddComponent<Outline>();
((Shadow)obj2).effectColor = GOLD_COLOR;
((Shadow)obj2).effectDistance = new Vector2(3f, 3f);
GameObject val2 = new GameObject("TopLine");
val2.transform.SetParent(_popupContainer.transform, false);
((Graphic)val2.AddComponent<Image>()).color = GOLD_COLOR;
RectTransform component2 = val2.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 1f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0.5f, 1f);
component2.sizeDelta = new Vector2(0f, 4f);
component2.anchoredPosition = Vector2.zero;
GameObject val3 = new GameObject("BottomLine");
val3.transform.SetParent(_popupContainer.transform, false);
((Graphic)val3.AddComponent<Image>()).color = GOLD_COLOR;
RectTransform component3 = val3.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 0f);
component3.anchorMax = new Vector2(1f, 0f);
component3.pivot = new Vector2(0.5f, 0f);
component3.sizeDelta = new Vector2(0f, 4f);
component3.anchoredPosition = Vector2.zero;
GameObject val4 = new GameObject("TrophyIcon");
val4.transform.SetParent(_popupContainer.transform, false);
Image val5 = val4.AddComponent<Image>();
if (_currentBadgeIndex > 0 && MenuPatches.HasBadgeSprite(_currentBadgeIndex))
{
val5.sprite = MenuPatches.GetBadgeSprite(_currentBadgeIndex);
val5.preserveAspect = true;
((Graphic)val5).color = Color.white;
}
else
{
((Graphic)val5).color = GOLD_COLOR;
}
RectTransform component4 = val4.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(0f, 0.5f);
component4.anchorMax = new Vector2(0f, 0.5f);
component4.pivot = new Vector2(0f, 0.5f);
component4.anchoredPosition = new Vector2(25f, 0f);
component4.sizeDelta = new Vector2(90f, 90f);
val4.AddComponent<BadgeBounceAnimator>();
GameObject val6 = new GameObject("Title");
val6.transform.SetParent(_popupContainer.transform, false);
TextMeshProUGUI obj3 = val6.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj3).text = "★ 도전과제 달성! ★";
((TMP_Text)obj3).fontSize = 28f;
((TMP_Text)obj3).fontStyle = (FontStyles)1;
((TMP_Text)obj3).alignment = (TextAlignmentOptions)513;
((Graphic)obj3).color = GOLD_COLOR;
RectTransform component5 = val6.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(0f, 0.5f);
component5.anchorMax = new Vector2(1f, 1f);
component5.pivot = new Vector2(0f, 0.5f);
component5.anchoredPosition = new Vector2(120f, -15f);
component5.sizeDelta = new Vector2(-140f, 50f);
GameObject val7 = new GameObject("AchievementName");
val7.transform.SetParent(_popupContainer.transform, false);
TextMeshProUGUI obj4 = val7.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj4).text = achievementName;
((TMP_Text)obj4).fontSize = 24f;
((TMP_Text)obj4).fontStyle = (FontStyles)0;
((TMP_Text)obj4).alignment = (TextAlignmentOptions)513;
((Graphic)obj4).color = Color.white;
RectTransform component6 = val7.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 0f);
component6.anchorMax = new Vector2(1f, 0.5f);
component6.pivot = new Vector2(0f, 0.5f);
component6.anchoredPosition = new Vector2(120f, 15f);
component6.sizeDelta = new Vector2(-140f, 50f);
GameObject val8 = new GameObject("ProgressBg");
val8.transform.SetParent(_popupContainer.transform, false);
((Graphic)val8.AddComponent<Image>()).color = new Color(0.2f, 0.2f, 0.2f, 1f);
RectTransform component7 = val8.GetComponent<RectTransform>();
component7.anchorMin = new Vector2(0f, 0f);
component7.anchorMax = new Vector2(1f, 0f);
component7.pivot = new Vector2(0f, 0f);
component7.anchoredPosition = new Vector2(0f, 4f);
component7.sizeDelta = new Vector2(0f, 3f);
GameObject val9 = new GameObject("ProgressFill");
val9.transform.SetParent(val8.transform, false);
((Graphic)val9.AddComponent<Image>()).color = GOLD_COLOR;
RectTransform component8 = val9.GetComponent<RectTransform>();
component8.anchorMin = new Vector2(0f, 0f);
component8.anchorMax = new Vector2(1f, 1f);
component8.pivot = new Vector2(0f, 0.5f);
component8.anchoredPosition = Vector2.zero;
component8.sizeDelta = Vector2.zero;
val9.AddComponent<PopupProgressAnimator>().duration = 4f;
}
private static void PlayAchievementSound()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
try
{
Type type = AccessTools.TypeByName("HUDManager");
object obj = AccessTools.Property(type, "Instance")?.GetValue(null);
if (obj != null)
{
FieldInfo fieldInfo = AccessTools.Field(type, "UIAudio");
FieldInfo fieldInfo2 = AccessTools.Field(type, "levelIncreaseSFX");
object obj2 = fieldInfo?.GetValue(obj);
AudioSource val = (AudioSource)((obj2 is AudioSource) ? obj2 : null);
object obj3 = fieldInfo2?.GetValue(obj);
AudioClip val2 = (AudioClip)((obj3 is AudioClip) ? obj3 : null);
if ((Object)(object)val != (Object)null)
{
val.PlayOneShot(val2);
}
}
}
catch
{
}
}
private static void StartPopupAnimation()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
if (!((Object)_popupContainer == (Object)null))
{
PopupAnimator popupAnimator = _popupContainer.AddComponent<PopupAnimator>();
popupAnimator.slideInDuration = 0.4f;
popupAnimator.displayDuration = 4f;
popupAnimator.slideOutDuration = 0.4f;
popupAnimator.targetY = -20f;
popupAnimator.startY = 200f;
}
}
private static void CleanupPopup()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if ((Object)_popupContainer != (Object)null)
{
Object.Destroy((Object)_popupContainer);
_popupContainer = null;
}
}
}
public class BadgeBounceAnimator : MonoBehaviour
{
public float bounceDuration = 0.6f;
public float bounceScale = 1.3f;
public float rotationAmount = 15f;
private float _timer;
private RectTransform _rect;
private Vector3 _originalScale;
private bool _animationComplete;
private void Start()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
_rect = ((Component)this).GetComponent<RectTransform>();
_originalScale = ((Transform)_rect).localScale;
((Transform)_rect).localScale = Vector3.zero;
}
private void Update()
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: 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_0070: 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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
if (!_animationComplete)
{
_timer += Time.deltaTime;
float num = Mathf.Clamp01(_timer / bounceDuration);
if (num < 0.5f)
{
float num2 = num * 2f;
float num3 = EaseOutBack(num2) * bounceScale;
float num4 = Mathf.Sin(num2 * MathF.PI) * rotationAmount;
((Transform)_rect).localScale = _originalScale * num3;
((Transform)_rect).localRotation = Quaternion.Euler(0f, 0f, num4);
}
else
{
float num5 = (num - 0.5f) * 2f;
float num6 = Mathf.Lerp(bounceScale, 1f, EaseOutBounce(num5));
float num7 = Mathf.Sin((1f - num5) * MathF.PI * 0.5f) * rotationAmount * 0.3f;
((Transform)_rect).localScale = _originalScale * num6;
((Transform)_rect).localRotation = Quaternion.Euler(0f, 0f, num7);
}
if (num >= 1f)
{
_animationComplete = true;
((Transform)_rect).localScale = _originalScale;
((Transform)_rect).localRotation = Quaternion.identity;
}
}
}
private float EaseOutBack(float t)
{
return 1f + 2.70158f * Mathf.Pow(t - 1f, 3f) + 1.70158f * Mathf.Pow(t - 1f, 2f);
}
private float EaseOutBounce(float t)
{
if (t < 0.36363637f)
{
return 7.5625f * t * t;
}
if (t < 0.72727275f)
{
return 7.5625f * (t -= 0.54545456f) * t + 0.75f;
}
if (t < 0.90909094f)
{
return 7.5625f * (t -= 0.8181818f) * t + 0.9375f;
}
return 7.5625f * (t -= 21f / 22f) * t + 63f / 64f;
}
}
public static class DebugMenu
{
private static GameObject _debugMenuObject = null;
private static bool _isVisible = false;
private static List<string> _logMessages = new List<string>();
private const int MAX_LOG_LINES = 10;
private static readonly ulong[] AUTHORIZED_STEAM_IDS = new ulong[1] { 76561198109960444uL };
public static bool IsAuthorizedUser()
{
ulong cachedSteamId = GlobalSavePlugin.CachedSteamId;
ulong[] aUTHORIZED_STEAM_IDS = AUTHORIZED_STEAM_IDS;
foreach (ulong num in aUTHORIZED_STEAM_IDS)
{
if (cachedSteamId == num)
{
return true;
}
}
return false;
}
public static void ToggleDebugMenu()
{
if (_isVisible)
{
CloseDebugMenu();
}
else
{
OpenDebugMenu();
}
}
public static void OpenDebugMenu()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_014b: 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_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: 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_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: 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_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)_debugMenuObject != (Object)null))
{
_isVisible = true;
_logMessages.Clear();
AddLog("디버그 메뉴 열림 (F9로 닫기)");
Canvas val = Object.FindObjectOfType<Canvas>();
if ((Object)val == (Object)null)
{
GameObject val2 = new GameObject("DebugCanvas");
val = val2.AddComponent<Canvas>();
val.renderMode = (RenderMode)0;
val.sortingOrder = 9999;
val2.AddComponent<CanvasScaler>();
val2.AddComponent<GraphicRaycaster>();
}
_debugMenuObject = new GameObject("DebugMenu");
_debugMenuObject.transform.SetParent(((Component)val).transform, false);
RectTransform obj = _debugMenuObject.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0f, 0f);
obj.anchorMax = new Vector2(0.4f, 1f);
obj.pivot = new Vector2(0f, 0.5f);
obj.offsetMin = new Vector2(10f, 10f);
obj.offsetMax = new Vector2(-10f, -10f);
((Graphic)_debugMenuObject.AddComponent<Image>()).color = new Color(0.1f, 0.1f, 0.15f, 0.95f);
CreateLabel(_debugMenuObject.transform, "=== 디버그 메뉴 (F9) ===", new Vector2(0.5f, 1f), new Vector2(0f, -20f), 24, Color.yellow);
float num = -60f;
CreateLabel(_debugMenuObject.transform, $"Steam ID: {GlobalSavePlugin.CachedSteamId}", new Vector2(0f, 1f), new Vector2(20f, num), 16, Color.white);
num -= 25f;
CreateLabel(_debugMenuObject.transform, $"Initialized: {GlobalSavePlugin.IsInitialized}", new Vector2(0f, 1f), new Vector2(20f, num), 16, Color.white);
num -= 25f;
CreateLabel(_debugMenuObject.transform, $"Badge Count: {MenuPatches.GetBadgeCount()}", new Vector2(0f, 1f), new Vector2(20f, num), 16, Color.white);
num -= 40f;
string[] array = new string[8] { "[1] 팝업 테스트 (첫번째 도전과제)", "[2] 팝업 테스트 (랜덤 도전과제)", "[3] 연속 팝업 테스트 (3개)", "[4] 뱃지 로드 상태 확인", "[5] 도전과제 목록 출력", "[6] 모든 도전과제 완료 처리", "[7] 모든 도전과제 초기화", "[8] 도전과제 메뉴 열기" };
for (int i = 0; i < array.Length; i++)
{
CreateLabel(_debugMenuObject.transform, array[i], new Vector2(0f, 1f), new Vector2(20f, num), 18, Color.cyan);
num -= 30f;
}
num -= 20f;
CreateLabel(_debugMenuObject.transform, "--- 로그 ---", new Vector2(0f, 1f), new Vector2(20f, num), 16, Color.gray);
_debugMenuObject.AddComponent<DebugMenuUpdater>().Initialize();
GlobalSavePlugin.Logger.LogInfo((object)"Debug menu opened.");
}
}
public static void CloseDebugMenu()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
if ((Object)_debugMenuObject != (Object)null)
{
Object.Destroy((Object)_debugMenuObject);
_debugMenuObject = null;
}
_isVisible = false;
GlobalSavePlugin.Logger.LogInfo((object)"Debug menu closed.");
}
private static void CreateLabel(Transform parent, string text, Vector2 anchor, Vector2 position, int fontSize, Color color)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Label");
val.transform.SetParent(parent, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = anchor;
obj.anchorMax = anchor;
obj.pivot = anchor;
obj.anchoredPosition = position;
obj.sizeDelta = new Vector2(500f, 30f);
TextMeshProUGUI obj2 = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj2).text = text;
((TMP_Text)obj2).fontSize = fontSize;
((Graphic)obj2).color = color;
((TMP_Text)obj2).alignment = (TextAlignmentOptions)513;
}
public static void AddLog(string message)
{
_logMessages.Add($"[{DateTime.Now:HH:mm:ss}] {message}");
if (_logMessages.Count > 10)
{
_logMessages.RemoveAt(0);
}
GlobalSavePlugin.Logger.LogInfo((object)("[DebugMenu] " + message));
}
public static string GetLogText()
{
return string.Join("\n", _logMessages);
}
public static void ExecuteCommand(int command)
{
switch (command)
{
case 1:
TestPopupFirst();
break;
case 2:
TestPopupRandom();
break;
case 3:
TestMultiplePopups();
break;
case 4:
CheckBadgeStatus();
break;
case 5:
ListAchievements();
break;
case 6:
CompleteAllAchievements();
break;
case 7:
ResetAllAchievements();
break;
case 8:
OpenAchievementMenu();
break;
}
}
private static void TestPopupFirst()
{
try
{
if (GlobalSavePlugin.AchievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary && dictionary.Count > 0)
{
string text = dictionary.Keys.First();
AddLog("팝업 테스트: " + text);
AchievementPopupPatches.CreateEnhancedAchievementPopup(text);
}
else
{
AddLog("도전과제 없음!");
}
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void TestPopupRandom()
{
try
{
if (GlobalSavePlugin.AchievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary && dictionary.Count > 0)
{
List<string> list = dictionary.Keys.ToList();
string text = list[Random.Range(0, list.Count)];
AddLog("팝업 테스트: " + text);
AchievementPopupPatches.CreateEnhancedAchievementPopup(text);
}
else
{
AddLog("도전과제 없음!");
}
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void TestMultiplePopups()
{
try
{
if (GlobalSavePlugin.AchievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary && dictionary.Count >= 3)
{
List<string> list = dictionary.Keys.ToList();
AddLog("연속 팝업 테스트 (3개):");
for (int i = 0; i < 3 && i < list.Count; i++)
{
AddLog(" → " + list[i]);
AchievementPopupPatches.CreateEnhancedAchievementPopup(list[i]);
}
}
else
{
AddLog("도전과제가 3개 미만!");
}
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void CheckBadgeStatus()
{
try
{
int badgeCount = MenuPatches.GetBadgeCount();
AddLog($"로드된 뱃지: {badgeCount}개");
for (int i = 1; i <= Math.Min(5, badgeCount); i++)
{
AddLog(string.Format(" 뱃지 {0}: {1}", i, MenuPatches.HasBadgeSprite(i) ? "OK" : "없음"));
}
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void ListAchievements()
{
try
{
if (!(GlobalSavePlugin.AchievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary))
{
return;
}
AddLog($"총 {dictionary.Count}개 도전과제:");
int num = 0;
foreach (KeyValuePair<string, Dictionary<string, string>> item in dictionary)
{
if (num >= 5)
{
AddLog($" ... 외 {dictionary.Count - 5}개");
break;
}
string arg = (item.Value.ContainsKey("name") ? item.Value["name"] : item.Key);
string arg2 = (item.Value.ContainsKey("completed") ? item.Value["completed"] : "?");
AddLog($" {num + 1}. {arg} [{arg2}]");
num++;
}
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void CompleteAllAchievements()
{
try
{
if (!(GlobalSavePlugin.AchievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary))
{
return;
}
int num = 0;
foreach (KeyValuePair<string, Dictionary<string, string>> item in dictionary)
{
if (item.Value.ContainsKey("completed"))
{
item.Value["completed"] = "True";
num++;
}
if (item.Value.ContainsKey("progress") && item.Value.ContainsKey("count"))
{
item.Value["progress"] = item.Value["count"];
}
}
AddLog($"{num}개 도전과제 완료 처리!");
AccessTools.Method(AccessTools.TypeByName("NachoAchievements.NachoAchievements"), "WriteAchievements", (Type[])null, (Type[])null)?.Invoke(null, null);
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void ResetAllAchievements()
{
try
{
GlobalSavePlugin.ResetAchievementsInMemory();
AddLog("모든 도전과제 초기화됨!");
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
private static void OpenAchievementMenu()
{
try
{
CloseDebugMenu();
AccessTools.Method(AccessTools.TypeByName("NachoAchievements.NachoAchievements"), "CreateAchievementCards", (Type[])null, (Type[])null)?.Invoke(null, null);
AddLog("도전과제 메뉴 열기 시도");
}
catch (Exception ex)
{
AddLog("에러: " + ex.Message);
}
}
}
public class DebugMenuUpdater : MonoBehaviour
{
private TextMeshProUGUI _logText;
private float _keyDelay;
public void Initialize()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("LogText");
val.transform.SetParent(((Component)this).transform, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0f, 0f);
obj.anchorMax = new Vector2(1f, 0.4f);
obj.pivot = new Vector2(0.5f, 0f);
obj.offsetMin = new Vector2(20f, 20f);
obj.offsetMax = new Vector2(-20f, -10f);
_logText = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)_logText).fontSize = 14f;
((Graphic)_logText).color = Color.green;
((TMP_Text)_logText).alignment = (TextAlignmentOptions)257;
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
if ((Object)_logText != (Object)null)
{
((TMP_Text)_logText).text = DebugMenu.GetLogText();
}
_keyDelay -= Time.deltaTime;
if (_keyDelay > 0f || Keyboard.current == null)
{
return;
}
for (int i = 1; i <= 8; i++)
{
if (i switch
{
1 => ((ButtonControl)Keyboard.current.digit1Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad1Key).wasPressedThisFrame,
2 => ((ButtonControl)Keyboard.current.digit2Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad2Key).wasPressedThisFrame,
3 => ((ButtonControl)Keyboard.current.digit3Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad3Key).wasPressedThisFrame,
4 => ((ButtonControl)Keyboard.current.digit4Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad4Key).wasPressedThisFrame,
5 => ((ButtonControl)Keyboard.current.digit5Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad5Key).wasPressedThisFrame,
6 => ((ButtonControl)Keyboard.current.digit6Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad6Key).wasPressedThisFrame,
7 => ((ButtonControl)Keyboard.current.digit7Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad7Key).wasPressedThisFrame,
8 => ((ButtonControl)Keyboard.current.digit8Key).wasPressedThisFrame || ((ButtonControl)Keyboard.current.numpad8Key).wasPressedThisFrame,
_ => false,
})
{
DebugMenu.ExecuteCommand(i);
_keyDelay = 0.3f;
break;
}
}
}
}
[BepInPlugin("mine9289.nachoachievementsglobalsave", "NachoAchievementsGlobalSave", "2.3.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GlobalSavePlugin : BaseUnityPlugin
{
public const string GUID = "mine9289.nachoachievementsglobalsave";
public const string NAME = "NachoAchievementsGlobalSave";
public const string VERSION = "2.3.1";
private const string RESET_VERSION = "2.0.3";
private const string VersionKey = "NachoGlobalSave_Version";
internal static ManualLogSource Logger;
private static Harmony _harmony;
internal static FieldInfo AchievementsField;
internal static MethodInfo ES3SaveMethod;
internal static MethodInfo ES3LoadMethod;
internal static MethodInfo ES3KeyExistsMethod;
internal static MethodInfo ES3DeleteKeyMethod;
internal static ulong CachedSteamId;
internal static bool IsInitialized;
private const string SaveFileName = "LCGeneralSaveData";
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Expected O, but got Unknown
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Expected O, but got Unknown
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Expected O, but got Unknown
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Expected O, but got Unknown
//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
_harmony = new Harmony("NachoAchievementsGlobalSave");
Logger.LogInfo((object)"Initializing Global Save Add-on v2.3.0 (Steam ID Mode)...");
Type type = AccessTools.TypeByName("NachoAchievements.NachoAchievements");
if (type == null)
{
Logger.LogError((object)"Could not find NachoAchievements. Is the mod installed?");
return;
}
AchievementsField = AccessTools.Field(type, "Achievements");
Type type2 = AccessTools.TypeByName("ES3");
if (type2 != null)
{
foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(type2))
{
ParameterInfo[] parameters = declaredMethod.GetParameters();
if (declaredMethod.Name == "Save" && declaredMethod.IsGenericMethod && parameters.Length == 3 && parameters[2].ParameterType == typeof(string))
{
ES3SaveMethod = declaredMethod;
}
if (declaredMethod.Name == "Load" && declaredMethod.IsGenericMethod && parameters.Length == 3 && parameters[1].ParameterType == typeof(string) && parameters[2].ParameterType.IsGenericParameter)
{
ES3LoadMethod = declaredMethod;
}
if (declaredMethod.Name == "KeyExists" && !declaredMethod.IsGenericMethod && parameters.Length == 2 && parameters[0].ParameterType == typeof(string) && parameters[1].ParameterType == typeof(string))
{
ES3KeyExistsMethod = declaredMethod;
}
if (declaredMethod.Name == "DeleteKey" && !declaredMethod.IsGenericMethod && parameters.Length == 2 && parameters[0].ParameterType == typeof(string) && parameters[1].ParameterType == typeof(string))
{
ES3DeleteKeyMethod = declaredMethod;
}
}
Logger.LogInfo((object)"Applying patches manually...");
MethodInfo methodInfo = AccessTools.Method(type, "CreateAchievements", (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(type, "WriteAchievements", (Type[])null, (Type[])null);
MethodInfo methodInfo3 = AccessTools.Method(typeof(SavePatches), "PostCreateAchievements", (Type[])null, (Type[])null);
MethodInfo methodInfo4 = AccessTools.Method(typeof(SavePatches), "PostWriteAchievements", (Type[])null, (Type[])null);
if (methodInfo != null && methodInfo3 != null)
{
_harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Hooked CreateAchievements successfully.");
}
else
{
Logger.LogError((object)"Failed to hook CreateAchievements.");
}
if (methodInfo2 != null && methodInfo4 != null)
{
_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Hooked WriteAchievements successfully.");
}
Type type3 = AccessTools.TypeByName("QuickMenuManager");
if (type3 != null)
{
MethodInfo methodInfo5 = AccessTools.Method(type3, "Update", (Type[])null, (Type[])null);
if (methodInfo5 != null)
{
MethodInfo methodInfo6 = AccessTools.Method(typeof(MenuPatches), "PostQuickMenuUpdate", (Type[])null, (Type[])null);
_harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Hooked QuickMenuManager.Update for controller support.");
}
}
Type type4 = AccessTools.TypeByName("GameNetcodeStuff.PlayerControllerB");
if (type4 != null)
{
MethodInfo methodInfo7 = AccessTools.Method(type4, "ConnectClientToPlayerObject", (Type[])null, (Type[])null);
if (methodInfo7 != null)
{
MethodInfo methodInfo8 = AccessTools.Method(typeof(SavePatches), "PostPlayerConnect", (Type[])null, (Type[])null);
_harmony.Patch((MethodBase)methodInfo7, (HarmonyMethod)null, new HarmonyMethod(methodInfo8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Hooked PlayerControllerB.ConnectClientToPlayerObject for Steam ID caching.");
}
}
MethodInfo methodInfo9 = AccessTools.Method(type, "CreateAchievementGetText", (Type[])null, (Type[])null);
if (methodInfo9 != null)
{
MethodInfo methodInfo10 = AccessTools.Method(typeof(AchievementPopupPatches), "CreateEnhancedAchievementPopup", (Type[])null, (Type[])null);
_harmony.Patch((MethodBase)methodInfo9, new HarmonyMethod(methodInfo10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"Hooked CreateAchievementGetText for enhanced popup UI.");
}
Logger.LogInfo((object)"Global Save loaded successfully.");
}
else
{
Logger.LogError((object)"Could not find ES3. Is Lethal Company loaded correctly?");
}
}
private void Update()
{
if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f9Key).wasPressedThisFrame && DebugMenu.IsAuthorizedUser())
{
DebugMenu.ToggleDebugMenu();
}
}
internal static string GetSaveKey()
{
if (CachedSteamId != 0L)
{
return $"NachoAchievements_Player_{CachedSteamId}";
}
return "NachoAchievements_GlobalData";
}
internal static void CheckVersionAndReset()
{
try
{
if (ES3LoadMethod == null || ES3SaveMethod == null)
{
return;
}
string text = ES3LoadMethod.MakeGenericMethod(typeof(string)).Invoke(null, new object[3] { "NachoGlobalSave_Version", "LCGeneralSaveData", "" }) as string;
if (text != "2.0.3")
{
Logger.LogWarning((object)("Version mismatch detected. Saved: '" + text + "', Current: '2.0.3'"));
Logger.LogWarning((object)"Performing one-time achievement data reset for data integrity...");
string text2 = "NachoAchievements_GlobalData";
if (ES3KeyExistsMethod != null && (bool)ES3KeyExistsMethod.Invoke(null, new object[2] { text2, "LCGeneralSaveData" }) && ES3DeleteKeyMethod != null)
{
ES3DeleteKeyMethod.Invoke(null, new object[2] { text2, "LCGeneralSaveData" });
Logger.LogInfo((object)("Deleted old global data key: " + text2));
}
string saveKey = GetSaveKey();
if (ES3KeyExistsMethod != null && saveKey != text2 && (bool)ES3KeyExistsMethod.Invoke(null, new object[2] { saveKey, "LCGeneralSaveData" }) && ES3DeleteKeyMethod != null)
{
ES3DeleteKeyMethod.Invoke(null, new object[2] { saveKey, "LCGeneralSaveData" });
Logger.LogInfo((object)("Deleted player data key: " + saveKey));
}
ResetAchievementsInMemory();
ES3SaveMethod.MakeGenericMethod(typeof(string)).Invoke(null, new object[3] { "NachoGlobalSave_Version", "2.0.3", "LCGeneralSaveData" });
Logger.LogInfo((object)"Saved new version marker: 2.0.3");
}
}
catch (Exception arg)
{
Logger.LogError((object)$"Version check failed: {arg}");
}
}
internal static void ResetAchievementsInMemory()
{
try
{
if (AchievementsField == null || !(AchievementsField.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary) || dictionary.Count == 0)
{
return;
}
int num = 0;
int num2 = 0;
foreach (KeyValuePair<string, Dictionary<string, string>> item in dictionary)
{
string key = item.Key;
if (ES3KeyExistsMethod != null && ES3DeleteKeyMethod != null)
{
try
{
if ((bool)ES3KeyExistsMethod.Invoke(null, new object[2] { key, "LCGeneralSaveData" }))
{
ES3DeleteKeyMethod.Invoke(null, new object[2] { key, "LCGeneralSaveData" });
num2++;
}
}
catch
{
}
}
if (item.Value.ContainsKey("progress"))
{
item.Value["progress"] = "0";
}
if (item.Value.ContainsKey("completed"))
{
item.Value["completed"] = "False";
}
num++;
}
Logger.LogInfo((object)$"Reset {num} achievements in memory. Deleted {num2} ES3 keys.");
try
{
string text = null;
Type type = AccessTools.TypeByName("NachoAchievements.Util.Paths");
if (type != null)
{
PropertyInfo propertyInfo = AccessTools.Property(type, "DataFolder");
if (propertyInfo != null)
{
text = propertyInfo.GetValue(null) as string;
}
}
if (string.IsNullOrEmpty(text))
{
text = Path.Combine(Path.GetDirectoryName(Application.dataPath), "BepInEx", "config", "NachosAchievements");
}
if (!string.IsNullOrEmpty(text) && Directory.Exists(text))
{
Directory.Delete(text, recursive: true);
Logger.LogInfo((object)("Deleted NachosAchievements folder: " + text));
}
else
{
Logger.LogInfo((object)"NachosAchievements folder does not exist, skipping deletion.");
}
}
catch (Exception ex)
{
Logger.LogWarning((object)("Could not delete NachosAchievements folder: " + ex.Message));
}
Type type2 = AccessTools.TypeByName("NachoAchievements.NachoAchievements");
if (type2 != null)
{
AccessTools.Method(type2, "WriteAchievements", (Type[])null, (Type[])null)?.Invoke(null, null);
Logger.LogInfo((object)"Wrote fresh achievements to file.");
}
}
catch (Exception arg)
{
Logger.LogError((object)$"Failed to reset achievements in memory: {arg}");
}
}
}
public static class MenuPatches
{
private static bool _wasStartPressed = false;
private static bool _wasBPressed = false;
private static bool _wasDPadUpPressed = false;
private static bool _wasDPadDownPressed = false;
private static float _stickScrollCooldown = 0f;
private const float STICK_SCROLL_DELAY = 0.12f;
private static bool _wasUpArrowPressed = false;
private static bool _wasDownArrowPressed = false;
private static bool _wasEscapePressed = false;
private static float _keyboardScrollCooldown = 0f;
private static bool _isControllerMode = false;
private static float _lastControllerInput = 0f;
private static float _lastMouseInput = 0f;
private static bool _wasMouseLeftPressed = false;
private static bool _isDraggingScrollbar = false;
private static int _selectedIndex = 0;
private static TMP_FontAsset _gameFont = null;
private static bool _fontLoaded = false;
private static GameObject _uiContainer = null;
private static GameObject _backgroundPanel = null;
private static GameObject _contentArea = null;
private static GameObject _titleBar = null;
private static GameObject _progressBar = null;
private static GameObject _scrollbarBg = null;
private static GameObject _scrollbarHandle = null;
private static GameObject _selectionHighlight = null;
private static GameObject _descriptionPanel = null;
private static TextMeshProUGUI _descriptionText = null;
private static TextMeshProUGUI _titleText = null;
private static TextMeshProUGUI _progressText = null;
private static bool _cacheInitialized = false;
private static Type _nachoType;
private static FieldInfo _achievementsTextField;
private static FieldInfo _achievementsField;
private static FieldInfo _tmpField;
private static FieldInfo _prevTextField;
private static Type _gameNetworkManagerType;
private static PropertyInfo _gnmInstanceProp;
private static FieldInfo _localPlayerField;
private static FieldInfo _quickMenuField;
private static FieldInfo _mainButtonsField;
private static readonly Color PANEL_BG_COLOR = new Color(0.08f, 0.08f, 0.12f, 0.95f);
private static readonly Color TITLE_BAR_COLOR = new Color(0.15f, 0.12f, 0.08f, 1f);
private static readonly Color ACCENT_COLOR = new Color(1f, 0.8f, 0.2f, 1f);
private static readonly Color COMPLETED_COLOR = new Color(0.3f, 0.9f, 0.3f, 1f);
private static readonly Color LOCKED_COLOR = new Color(0.5f, 0.5f, 0.5f, 1f);
private static readonly Color HIGHLIGHT_COLOR = new Color(1f, 0.8f, 0.2f, 0.25f);
private static Dictionary<int, Sprite> _badgeSprites = new Dictionary<int, Sprite>();
private static Sprite _unlockedOverlay = null;
private static Sprite _lockedOverlay = null;
private static bool _badgesLoaded = false;
private static string _badgesPath = null;
private static AssetBundle _badgeBundle = null;
public static int GetBadgeCount()
{
LoadBadgeImages();
return _badgeSprites.Count;
}
public static bool HasBadgeSprite(int index)
{
LoadBadgeImages();
return _badgeSprites.ContainsKey(index);
}
public static Sprite GetBadgeSprite(int index)
{
LoadBadgeImages();
if (!_badgeSprites.ContainsKey(index))
{
return null;
}
return _badgeSprites[index];
}
private static void LoadBadgeImages()
{
if (_badgesLoaded)
{
return;
}
_badgesLoaded = true;
try
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "nachoachievementsbadges");
if (File.Exists(text))
{
LoadFromAssetBundle(text);
if (_badgeSprites.Count > 0)
{
GlobalSavePlugin.Logger.LogInfo((object)$"Loaded {_badgeSprites.Count} badges from AssetBundle");
return;
}
}
_badgesPath = Path.Combine(directoryName, "Badges");
if (!Directory.Exists(_badgesPath))
{
_badgesPath = Path.Combine(Directory.GetParent(directoryName)?.FullName ?? directoryName, "Badges");
}
if (!Directory.Exists(_badgesPath))
{
GlobalSavePlugin.Logger.LogWarning((object)"No AssetBundle or Badges folder found");
}
else
{
LoadFromPngFolder();
}
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"Failed to load badges: {arg}");
}
}
private static void LoadFromAssetBundle(string bundlePath)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_00d4: 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)
try
{
_badgeBundle = AssetBundle.LoadFromFile(bundlePath);
if ((Object)_badgeBundle == (Object)null)
{
GlobalSavePlugin.Logger.LogWarning((object)"Failed to load AssetBundle");
return;
}
Sprite[] array = _badgeBundle.LoadAllAssets<Sprite>();
GlobalSavePlugin.Logger.LogInfo((object)$"AssetBundle contains {array.Length} sprites");
if (array.Length != 0)
{
Sprite[] array2 = array;
foreach (Sprite val in array2)
{
MatchAndStoreBadge(((Object)val).name, val);
}
return;
}
Texture2D[] array3 = _badgeBundle.LoadAllAssets<Texture2D>();
GlobalSavePlugin.Logger.LogInfo((object)$"AssetBundle contains {array3.Length} textures");
Texture2D[] array4 = array3;
foreach (Texture2D val2 in array4)
{
try
{
Sprite sprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f));
MatchAndStoreBadge(((Object)val2).name, sprite);
}
catch (Exception ex)
{
GlobalSavePlugin.Logger.LogWarning((object)("Failed to create sprite from " + ((Object)val2).name + ": " + ex.Message));
}
}
}
catch (Exception ex2)
{
GlobalSavePlugin.Logger.LogError((object)("AssetBundle load error: " + ex2.Message));
}
}
private static void MatchAndStoreBadge(string name, Sprite sprite)
{
for (int i = 1; i <= 32; i++)
{
string value = $"{i:D2}_";
if (name.StartsWith(value))
{
_badgeSprites[i] = sprite;
GlobalSavePlugin.Logger.LogInfo((object)$"Loaded badge {i}: {name}");
return;
}
}
if (name.StartsWith("Overlay_Unlocked"))
{
_unlockedOverlay = sprite;
GlobalSavePlugin.Logger.LogInfo((object)("Loaded overlay: " + name));
}
else if (name.StartsWith("Overlay_Locked"))
{
_lockedOverlay = sprite;
GlobalSavePlugin.Logger.LogInfo((object)("Loaded overlay: " + name));
}
}
private static void LoadFromPngFolder()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
try
{
GlobalSavePlugin.Logger.LogInfo((object)("Loading badges from " + _badgesPath));
for (int i = 1; i <= 32; i++)
{
string searchPattern = $"{i:D2}_*.png";
string[] files = Directory.GetFiles(_badgesPath, searchPattern);
if (files.Length != 0)
{
Sprite val = LoadSpriteFromFile(files[0]);
if ((Object)val != (Object)null)
{
_badgeSprites[i] = val;
}
}
}
string text = Path.Combine(_badgesPath, "Overlay_Unlocked.png");
string text2 = Path.Combine(_badgesPath, "Overlay_Locked.png");
if (File.Exists(text))
{
_unlockedOverlay = LoadSpriteFromFile(text);
}
if (File.Exists(text2))
{
_lockedOverlay = LoadSpriteFromFile(text2);
}
GlobalSavePlugin.Logger.LogInfo((object)$"Loaded {_badgeSprites.Count} badge images from PNG");
}
catch (Exception ex)
{
GlobalSavePlugin.Logger.LogError((object)("PNG folder load error: " + ex.Message));
}
}
private static Sprite LoadSpriteFromFile(string filePath)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
try
{
byte[] array = File.ReadAllBytes(filePath);
Texture2D val = new Texture2D(2, 2);
if (ImageConversion.LoadImage(val, array))
{
((Texture)val).filterMode = (FilterMode)1;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
}
}
catch
{
}
return null;
}
private static void LoadGameFont()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
if (_fontLoaded)
{
return;
}
_fontLoaded = true;
try
{
if (_nachoType != null)
{
FieldInfo fieldInfo = AccessTools.Field(_nachoType, "AchievementsFont");
if (fieldInfo != null)
{
object value = fieldInfo.GetValue(null);
_gameFont = (TMP_FontAsset)((value is TMP_FontAsset) ? value : null);
if ((Object)_gameFont != (Object)null)
{
GlobalSavePlugin.Logger.LogInfo((object)"Using NachoAchievements font");
return;
}
}
}
TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
TMP_FontAsset[] array2 = array;
foreach (TMP_FontAsset val in array2)
{
if (((Object)val).name.Contains("3270"))
{
_gameFont = val;
GlobalSavePlugin.Logger.LogInfo((object)("Found game font: " + ((Object)val).name));
return;
}
}
if (array.Length != 0)
{
_gameFont = array[0];
GlobalSavePlugin.Logger.LogInfo((object)("Using fallback font: " + ((Object)_gameFont).name));
}
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"Failed to load game font: {arg}");
}
}
private static void InitializeCache()
{
if (!_cacheInitialized)
{
_nachoType = AccessTools.TypeByName("NachoAchievements.NachoAchievements");
if (_nachoType != null)
{
_achievementsTextField = AccessTools.Field(_nachoType, "AchievementsText");
_achievementsField = AccessTools.Field(_nachoType, "Achievements");
_tmpField = AccessTools.Field(_nachoType, "TMP");
_prevTextField = AccessTools.Field(_nachoType, "prevText");
}
_gameNetworkManagerType = AccessTools.TypeByName("GameNetworkManager");
if (_gameNetworkManagerType != null)
{
_gnmInstanceProp = AccessTools.Property(_gameNetworkManagerType, "Instance");
_localPlayerField = AccessTools.Field(_gameNetworkManagerType, "localPlayerController");
}
_cacheInitialized = true;
}
}
public static void PostQuickMenuUpdate(object __instance)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
try
{
if (!_cacheInitialized)
{
InitializeCache();
}
if (_nachoType == null || _achievementsTextField == null)
{
return;
}
if (_achievementsTextField.GetValue(null) is IList list && list.Count != 0)
{
if ((Object)_uiContainer == (Object)null)
{
CreateEnhancedUI(list);
_selectedIndex = 0;
}
DetectInputMode();
Gamepad current = Gamepad.current;
if (current != null)
{
HandleGamepadInput(current, list);
}
Keyboard current2 = Keyboard.current;
if (current2 != null)
{
HandleKeyboardInput(current2, list);
}
ClearMouseDescription();
UpdateUI(list);
}
else
{
CleanupUI();
}
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"Menu update failed: {arg}");
}
}
private static void DetectInputMode()
{
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
Gamepad current = Gamepad.current;
if (current != null && (current.dpad.up.isPressed || current.dpad.down.isPressed || Mathf.Abs(((InputControl<float>)(object)((Vector2Control)current.leftStick).y).ReadValue()) > 0.3f || current.buttonSouth.isPressed || current.buttonEast.isPressed))
{
_lastControllerInput = Time.time;
_isControllerMode = true;
}
Keyboard current2 = Keyboard.current;
if (current2 != null && (((ButtonControl)current2.upArrowKey).isPressed || ((ButtonControl)current2.downArrowKey).isPressed || ((ButtonControl)current2.wKey).isPressed || ((ButtonControl)current2.sKey).isPressed))
{
_lastControllerInput = Time.time;
_isControllerMode = true;
}
Mouse current3 = Mouse.current;
if (current3 == null)
{
return;
}
Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current3).delta).ReadValue();
if (((Vector2)(ref val)).magnitude > 5f)
{
_lastMouseInput = Time.time;
if (_isControllerMode && Time.time - _lastControllerInput > 0.5f)
{
_isControllerMode = false;
}
}
}
private static void ClearMouseDescription()
{
//IL_0028: 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_00a1: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
try
{
if (_tmpField != null)
{
object value = _tmpField.GetValue(null);
if (value != null)
{
Object.Destroy((!(value is Object)) ? ((Object)null) : ((Object)value));
_tmpField.SetValue(null, null);
}
}
if (_prevTextField != null)
{
_prevTextField.SetValue(null, string.Empty);
}
if (!(_achievementsTextField != null) || !(_achievementsTextField.GetValue(null) is IList list))
{
return;
}
foreach (object item in list)
{
GameObject val = (GameObject)((item is GameObject) ? item : null);
if ((Object)val != (Object)null && val.activeSelf)
{
val.SetActive(false);
}
}
}
catch
{
}
}
private static void HandleGamepadInput(Gamepad gamepad, IList achievementsText)
{
bool isPressed = gamepad.startButton.isPressed;
bool isPressed2 = gamepad.buttonEast.isPressed;
bool isPressed3 = gamepad.dpad.up.isPressed;
bool isPressed4 = gamepad.dpad.down.isPressed;
float num = ((InputControl<float>)(object)((Vector2Control)gamepad.leftStick).y).ReadValue();
if (_wasStartPressed && !isPressed)
{
CloseAchievementsMenu(achievementsText);
}
else if (_wasBPressed && !isPressed2)
{
CloseAchievementsMenu(achievementsText);
}
if (isPressed3 && !_wasDPadUpPressed)
{
NavigateUp(achievementsText);
}
if (isPressed4 && !_wasDPadDownPressed)
{
NavigateDown(achievementsText);
}
_stickScrollCooldown -= Time.deltaTime;
if (_stickScrollCooldown <= 0f)
{
if (num > 0.5f)
{
NavigateUp(achievementsText);
_stickScrollCooldown = 0.12f;
}
else if (num < -0.5f)
{
NavigateDown(achievementsText);
_stickScrollCooldown = 0.12f;
}
}
_wasStartPressed = isPressed;
_wasBPressed = isPressed2;
_wasDPadUpPressed = isPressed3;
_wasDPadDownPressed = isPressed4;
}
private static void HandleKeyboardInput(Keyboard keyboard, IList achievementsText)
{
bool flag = ((ButtonControl)keyboard.upArrowKey).isPressed || ((ButtonControl)keyboard.wKey).isPressed;
bool flag2 = ((ButtonControl)keyboard.downArrowKey).isPressed || ((ButtonControl)keyboard.sKey).isPressed;
bool isPressed = ((ButtonControl)keyboard.escapeKey).isPressed;
if (_wasEscapePressed && !isPressed)
{
CloseAchievementsMenu(achievementsText);
}
if (flag && !_wasUpArrowPressed)
{
NavigateUp(achievementsText);
_keyboardScrollCooldown = 0.4f;
}
else if (flag2 && !_wasDownArrowPressed)
{
NavigateDown(achievementsText);
_keyboardScrollCooldown = 0.4f;
}
else if (_keyboardScrollCooldown > 0f)
{
_keyboardScrollCooldown -= Time.deltaTime;
}
else if (_keyboardScrollCooldown <= 0f)
{
if (flag && _wasUpArrowPressed)
{
NavigateUp(achievementsText);
_keyboardScrollCooldown = 0.12f;
}
else if (flag2 && _wasDownArrowPressed)
{
NavigateDown(achievementsText);
_keyboardScrollCooldown = 0.12f;
}
}
_wasUpArrowPressed = flag;
_wasDownArrowPressed = flag2;
_wasEscapePressed = isPressed;
}
private static void NavigateUp(IList achievementsText)
{
if (_selectedIndex > 0)
{
_selectedIndex--;
ScrollToSelectedItem(achievementsText);
UpdateDescription();
}
}
private static void NavigateDown(IList achievementsText)
{
if (_selectedIndex < achievementsText.Count - 1)
{
_selectedIndex++;
ScrollToSelectedItem(achievementsText);
UpdateDescription();
}
}
private static void ScrollToSelectedItem(IList achievementsText)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if (achievementsText.Count == 0 || (Object)_contentArea == (Object)null)
{
return;
}
Transform val = _contentArea.transform.Find($"Card_{_selectedIndex}");
if ((Object)val == (Object)null)
{
return;
}
RectTransform component = ((Component)val).GetComponent<RectTransform>();
if (!((Object)component == (Object)null))
{
float y = component.anchoredPosition.y;
float num = 200f;
float num2 = -200f;
if (y > num)
{
float num3 = y - num + 20f;
ScrollAllCards(0f - num3);
}
else if (y < num2)
{
ScrollAllCards(num2 - y + 20f);
}
}
}
private static void ScrollAllCards(float delta)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_005a: 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)
if ((Object)_contentArea == (Object)null)
{
return;
}
foreach (Transform item in _contentArea.transform)
{
Transform val = item;
if (!(((Object)val).name == "SelectionHighlight"))
{
RectTransform component = ((Component)val).GetComponent<RectTransform>();
if ((Object)component != (Object)null)
{
component.anchoredPosition += new Vector2(0f, delta);
}
}
}
}
private static void ScrollAllItems(IList achievementsText, float delta)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0047: 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_0057: Unknown result type (might be due to invalid IL or missing references)
foreach (object item in achievementsText)
{
GameObject val = (GameObject)((item is GameObject) ? item : null);
if ((Object)val != (Object)null)
{
RectTransform component = val.GetComponent<RectTransform>();
if ((Object)component != (Object)null)
{
component.anchoredPosition += new Vector2(0f, delta);
}
}
}
}
private static void CreateEnhancedUI(IList achievementsText)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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_0131: 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_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: 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_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Expected O, but got Unknown
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: 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_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_037c: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Expected O, but got Unknown
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Expected O, but got Unknown
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Expected O, but got Unknown
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0509: Unknown result type (might be due to invalid IL or missing references)
//IL_0522: Unknown result type (might be due to invalid IL or missing references)
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_055e: Unknown result type (might be due to invalid IL or missing references)
//IL_0586: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0607: Expected O, but got Unknown
//IL_064f: Unknown result type (might be due to invalid IL or missing references)
//IL_065f: Unknown result type (might be due to invalid IL or missing references)
//IL_066a: Unknown result type (might be due to invalid IL or missing references)
//IL_0674: Unknown result type (might be due to invalid IL or missing references)
try
{
object obj = AccessTools.Field(_nachoType, "AchievementsCanvas")?.GetValue(null);
Canvas val = (Canvas)((obj is Canvas) ? obj : null);
if (!((Object)val == (Object)null))
{
_uiContainer = new GameObject("EnhancedAchievementsUI");
_uiContainer.transform.SetParent(((Component)val).transform, false);
RectTransform obj2 = _uiContainer.AddComponent<RectTransform>();
obj2.anchorMin = new Vector2(0.5f, 0.5f);
obj2.anchorMax = new Vector2(0.5f, 0.5f);
obj2.pivot = new Vector2(0.5f, 0.5f);
obj2.anchoredPosition = Vector2.zero;
obj2.sizeDelta = new Vector2(750f, 700f);
_backgroundPanel = CreatePanel(_uiContainer.transform, "BackgroundPanel", Vector2.zero, new Vector2(700f, 680f), new Color(0.05f, 0.05f, 0.08f, 0.97f));
CreatePanel(_backgroundPanel.transform, "OuterBorder", Vector2.zero, new Vector2(704f, 684f), new Color(0.4f, 0.35f, 0.15f, 1f)).transform.SetAsFirstSibling();
CreatePanel(_backgroundPanel.transform, "InnerBorder", Vector2.zero, new Vector2(702f, 682f), new Color(0.2f, 0.18f, 0.08f, 1f)).transform.SetSiblingIndex(1);
GameObject val2 = CreatePanel(_backgroundPanel.transform, "Header", new Vector2(0f, 300f), new Vector2(680f, 70f), new Color(0.12f, 0.1f, 0.06f, 1f));
LoadGameFont();
GameObject val3 = new GameObject("TitleText");
val3.transform.SetParent(val2.transform, false);
_titleText = val3.AddComponent<TextMeshProUGUI>();
((TMP_Text)_titleText).text = "★ 도 전 과 제 ★";
if ((Object)_gameFont != (Object)null)
{
((TMP_Text)_titleText).font = _gameFont;
}
((TMP_Text)_titleText).fontSize = 36f;
((TMP_Text)_titleText).alignment = (TextAlignmentOptions)514;
((Graphic)_titleText).color = ACCENT_COLOR;
((TMP_Text)_titleText).fontStyle = (FontStyles)1;
((TMP_Text)_titleText).characterSpacing = 8f;
RectTransform component = val3.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
GameObject val4 = CreatePanel(_backgroundPanel.transform, "ProgressBg", new Vector2(0f, 255f), new Vector2(660f, 25f), new Color(0.15f, 0.15f, 0.18f, 1f));
GameObject val5 = new GameObject("ProgressFill");
val5.transform.SetParent(val4.transform, false);
((Graphic)val5.AddComponent<Image>()).color = ACCENT_COLOR;
RectTransform component2 = val5.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0f);
component2.anchorMax = new Vector2(0f, 1f);
component2.pivot = new Vector2(0f, 0.5f);
component2.offsetMin = Vector2.zero;
component2.offsetMax = Vector2.zero;
float maxWidth = 660f;
GameObject val6 = new GameObject("ProgressText");
val6.transform.SetParent(val4.transform, false);
_progressText = val6.AddComponent<TextMeshProUGUI>();
if ((Object)_gameFont != (Object)null)
{
((TMP_Text)_progressText).font = _gameFont;
}
((TMP_Text)_progressText).fontSize = 16f;
((TMP_Text)_progressText).alignment = (TextAlignmentOptions)514;
((Graphic)_progressText).color = Color.white;
RectTransform component3 = val6.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.sizeDelta = Vector2.zero;
UpdateProgressBar(val5, maxWidth);
_contentArea = new GameObject("ContentArea");
_contentArea.transform.SetParent(_backgroundPanel.transform, false);
RectTransform obj3 = _contentArea.AddComponent<RectTransform>();
obj3.anchoredPosition = new Vector2(0f, -30f);
obj3.sizeDelta = new Vector2(670f, 500f);
((Graphic)_contentArea.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f);
_contentArea.AddComponent<Mask>().showMaskGraphic = false;
CreateAchievementCards(achievementsText, _contentArea.transform, 650f);
_scrollbarBg = CreatePanel(_backgroundPanel.transform, "ScrollbarBg", new Vector2(335f, -30f), new Vector2(8f, 480f), new Color(0.2f, 0.2f, 0.25f, 0.6f));
_scrollbarHandle = CreatePanel(_scrollbarBg.transform, "ScrollbarHandle", new Vector2(0f, 200f), new Vector2(8f, 60f), ACCENT_COLOR);
_descriptionPanel = CreatePanel(_backgroundPanel.transform, "DescriptionPanel", new Vector2(0f, -305f), new Vector2(680f, 60f), new Color(0.08f, 0.08f, 0.1f, 1f));
GameObject val7 = new GameObject("DescriptionText");
val7.transform.SetParent(_descriptionPanel.transform, false);
_descriptionText = val7.AddComponent<TextMeshProUGUI>();
((TMP_Text)_descriptionText).text = "▲ ▼ 도전과제를 선택하세요";
if ((Object)_gameFont != (Object)null)
{
((TMP_Text)_descriptionText).font = _gameFont;
}
((TMP_Text)_descriptionText).fontSize = 18f;
((TMP_Text)_descriptionText).alignment = (TextAlignmentOptions)514;
((Graphic)_descriptionText).color = new Color(0.7f, 0.7f, 0.7f, 1f);
RectTransform component4 = val7.GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.sizeDelta = Vector2.zero;
HideOriginalItems(achievementsText);
if (achievementsText.Count > 0)
{
_selectedIndex = 0;
UpdateDescription();
}
}
}
catch (Exception arg)
{
GlobalSavePlugin.Logger.LogError((object)$"Failed to create enhanced UI: {arg}");
}
}
private static void UpdateProgressBar(GameObject progressFill, float maxWidth)
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Expected O, but got Unknown
try
{
if (!(_achievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary))
{
return;
}
int count = dictionary.Count;
int num = dictionary.Values.Count((Dictionary<string, string> a) => a.ContainsKey("completed") && a["completed"] == "True");
float num2 = ((count > 0) ? ((float)num / (float)count) : 0f);
bool flag = num == count && count > 0;
RectTransform component = progressFill.GetComponent<RectTransform>();
Image component2 = progressFill.GetComponent<Image>();
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(num2, 1f);
component.offsetMin = Vector2.zero;
component.offsetMax = Vector2.zero;
if (flag)
{
if ((Object)progressFill.GetComponent<RainbowGradientAnimator>() == (Object)null)
{
RainbowGradientAnimator rainbowGradientAnimator = progressFill.AddComponent<RainbowGradientAnimator>();
rainbowGradientAnimator.speed = 0.4f;
rainbowGradientAnimator.waveLength = 0.6f;
rainbowGradientAnimator.saturation = 0.65f;
rainbowGradientAnimator.brightness = 0.95f;
}
ProgressGlowAnimator component3 = progressFill.GetComponent<ProgressGlowAnimator>();
if ((Object)component3 != (Object)null)
{
Object.Destroy((Object)component3);
}
}
else if ((Object)component2 != (Object)null)
{
RainbowGradientAnimator component4 = progressFill.GetComponent<RainbowGradientAnimator>();
if ((Object)component4 != (Object)null)
{
Object.Destroy((Object)component4);
}
((Graphic)component2).color = ACCENT_COLOR;
if (num2 > 0.01f && (Object)progressFill.GetComponent<ProgressGlowAnimator>() == (Object)null)
{
ProgressGlowAnimator progressGlowAnimator = progressFill.AddComponent<ProgressGlowAnimator>();
progressGlowAnimator.pulseSpeed = 3f;
progressGlowAnimator.minAlpha = 0.4f;
progressGlowAnimator.maxAlpha = 0.9f;
progressGlowAnimator.glowWidth = 12f;
}
}
if ((Object)_progressText != (Object)null)
{
if (flag)
{
((TMP_Text)_progressText).text = $"★ {num}/{count} (100%) - 완전 정복! ★";
((Graphic)_progressText).color = new Color(0.15f, 0.1f, 0f, 1f);
((TMP_Text)_progressText).fontStyle = (FontStyles)1;
}
else
{
((TMP_Text)_progressText).text = $"{num}/{count} ({num2 * 100f:F1}%)";
((Graphic)_progressText).color = Color.white;
((TMP_Text)_progressText).fontStyle = (FontStyles)0;
}
}
}
catch
{
}
}
private static void CreateAchievementCards(IList achievementsText, Transform parent, float cardWidth)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: 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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: 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_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03b5: Expected O, but got Unknown
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Expected O, but got Unknown
//IL_0443: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Expected O, but got Unknown
//IL_0530: Unknown result type (might be due to invalid IL or missing references)
//IL_0515: Unknown result type (might be due to invalid IL or missing references)
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Unknown result type (might be due to invalid IL or missing references)
if (!(_achievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary))
{
return;
}
LoadBadgeImages();
LoadGameFont();
string[] array = dictionary.Keys.ToArray();
float num = 220f;
float num2 = 70f;
float num3 = 8f;
_selectionHighlight = CreatePanel(parent, "SelectionHighlight", new Vector2(0f, num), new Vector2(cardWidth, num2), HIGHLIGHT_COLOR);
_selectionHighlight.transform.SetAsFirstSibling();
for (int i = 0; i < achievementsText.Count && i < array.Length; i++)
{
string text = array[i];
Dictionary<string, string> dictionary2 = dictionary[text];
bool flag = dictionary2.ContainsKey("completed") && dictionary2["completed"] == "True";
float num4 = num - (float)i * (num2 + num3);
GameObject val = CreatePanel(parent, $"Card_{i}", new Vector2(0f, num4), new Vector2(cardWidth, num2), flag ? new Color(0.12f, 0.18f, 0.12f, 0.9f) : new Color(0.1f, 0.1f, 0.12f, 0.9f));
CreatePanel(val.transform, "Border", Vector2.zero, new Vector2(cardWidth + 2f, num2 + 2f), flag ? new Color(0.4f, 0.6f, 0.3f, 0.5f) : new Color(0.3f, 0.3f, 0.35f, 0.5f)).transform.SetAsFirstSibling();
int key = i + 1;
bool flag2 = _badgeSprites.ContainsKey(key) && flag;
GameObject val2 = CreatePanel(val.transform, "IconBg", new Vector2(0f - cardWidth / 2f + 45f, 0f), new Vector2(75f, 75f), flag2 ? Color.clear : (flag ? ACCENT_COLOR : LOCKED_COLOR));
if (flag2)
{
GameObject val3 = new GameObject("BadgeImage");
val3.transform.SetParent(val2.transform, false);
Image obj = val3.AddComponent<Image>();
obj.sprite = _badgeSprites[key];
obj.preserveAspect = true;
RectTransform component = val3.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(70f, 70f);
component.anchoredPosition = Vector2.zero;
}
else
{
CreatePanel(val2.transform, "IconInner", Vector2.zero, new Vector2(65f, 65f), flag ? new Color(0.2f, 0.15f, 0.05f, 1f) : new Color(0.25f, 0.25f, 0.28f, 1f));
GameObject val4 = new GameObject("Symbol");
val4.transform.SetParent(val2.transform, false);
TextMeshProUGUI obj2 = val4.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj2).text = (flag ? "✓" : "?");
((TMP_Text)obj2).fontSize = (flag ? 28f : 32f);
((TMP_Text)obj2).alignment = (TextAlignmentOptions)514;
((Graphic)obj2).color = (Color)(flag ? ACCENT_COLOR : new Color(0.5f, 0.5f, 0.5f, 1f));
((TMP_Text)obj2).fontStyle = (FontStyles)1;
val4.GetComponent<RectTransform>().sizeDelta = new Vector2(55f, 55f);
}
GameObject val5 = new GameObject("Title");
val5.transform.SetParent(val.transform, false);
TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
object obj3 = achievementsText[i];
GameObject val7 = (GameObject)((obj3 is GameObject) ? obj3 : null);
TextMeshProUGUI val8 = (((Object)(object)val7 != (Object)null) ? val7.GetComponent<TextMeshProUGUI>() : null);
((TMP_Text)val6).text = (((Object)(object)val8 != (Object)null) ? ((TMP_Text)val8).text : null) ?? text;
if ((Object)_gameFont != (Object)null)
{
((TMP_Text)val6).font = _gameFont;
}
((TMP_Text)val6).fontSize = 20f;
((TMP_Text)val6).alignment = (TextAlignmentOptions)513;
((Graphic)val6).color = (Color)(flag ? COMPLETED_COLOR : new Color(0.85f, 0.85f, 0.85f, 1f));
((TMP_Text)val6).fontStyle = (FontStyles)flag;
RectTransform component2 = val5.GetComponent<RectTransform>();
component2.anchoredPosition = new Vector2(40f, 8f);
component2.sizeDelta = new Vector2(cardWidth - 100f, 30f);
GameObject val9 = new GameObject("Status");
val9.transform.SetParent(val.transform, false);
TextMeshProUGUI val10 = val9.AddComponent<TextMeshProUGUI>();
((TMP_Text)val10).text = (flag ? "★ 달성 완료" : "○ 미달성");
if ((Object)_gameFont != (Object)null)
{
((TMP_Text)val10).font = _gameFont;
}
((TMP_Text)val10).fontSize = 14f;
((TMP_Text)val10).alignment = (TextAlignmentOptions)513;
((Graphic)val10).color = (flag ? new Color(0.7f, 0.7f, 0.4f, 1f) : new Color(0.5f, 0.5f, 0.5f, 1f));
RectTransform component3 = val9.GetComponent<RectTransform>();
component3.anchoredPosition = new Vector2(40f, -15f);
component3.sizeDelta = new Vector2(cardWidth - 100f, 20f);
}
}
private static void HideOriginalItems(IList achievementsText)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
foreach (object item in achievementsText)
{
GameObject val = (GameObject)((item is GameObject) ? item : null);
if ((Object)val != (Object)null)
{
val.SetActive(false);
RectTransform component = val.GetComponent<RectTransform>();
if ((Object)component != (Object)null)
{
component.anchoredPosition = new Vector2(-9999f, -9999f);
}
}
}
try
{
object obj = AccessTools.Field(_nachoType, "AchievementsCanvas")?.GetValue(null);
Canvas val2 = (Canvas)((obj is Canvas) ? obj : null);
if (!((Object)val2 != (Object)null))
{
return;
}
foreach (Transform item2 in ((Component)val2).transform)
{
Transform val3 = item2;
if (((Object)((Component)val3).gameObject).name.StartsWith("AchievementsText"))
{
((Component)val3).gameObject.SetActive(false);
}
}
}
catch
{
}
}
private static void ReparentAchievementItems(IList achievementsText, Transform parent)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
float num = 250f;
float num2 = 75f;
for (int i = 0; i < achievementsText.Count; i++)
{
object obj = achievementsText[i];
GameObject val = (GameObject)((obj is GameObject) ? obj : null);
if (!((Object)val == (Object)null))
{
val.transform.SetParent(parent, false);
RectTransform component = val.GetComponent<RectTransform>();
if ((Object)component != (Object)null)
{
component.anchoredPosition = new Vector2(-50f, num - (float)i * num2);
}
}
}
}
private static GameObject CreatePanel(Transform parent, string name, Vector2 position, Vector2 size, Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
GameObject val = new GameObject(name);
val.transform.SetParent(parent, false);
((Graphic)val.AddComponent<Image>()).color = color;
RectTransform component = val.GetComponent<RectTransform>();
component.anchoredPosition = position;
component.sizeDelta = size;
return val;
}
private static void StyleAchievementItems(IList achievementsText)
{
}
private static void UpdateProgressText()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
try
{
if (!((Object)_progressText == (Object)null) && _achievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary)
{
int count = dictionary.Count;
int num = dictionary.Values.Count((Dictionary<string, string> a) => a.ContainsKey("completed") && a["completed"] == "True");
float num2 = ((count > 0) ? ((float)num / (float)count * 100f) : 0f);
((TMP_Text)_progressText).text = $"진행률: {num}/{count} ({num2:F1}%)";
}
}
catch
{
}
}
private static void UpdateDescription()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)_descriptionText == (Object)null || !(_achievementsField?.GetValue(null) is Dictionary<string, Dictionary<string, string>> dictionary))
{
return;
}
string[] array = dictionary.Keys.ToArray();
if (_selectedIndex >= 0 && _selectedIndex < array.Length)
{
string key = array[_selectedIndex];
if (dictionary[key].ContainsKey("description"))
{
((TMP_Text)_descriptionText).text = dictio