using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("REPOJP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("zabuMod")]
[assembly: AssemblyTitle("zabuMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace REPOJP.LockAllCosmetics
{
[BepInPlugin("REPOJP.LockAllCosmetics", "LockAllCosmetics", "4.0.2")]
public class LockAllCosmeticsPlugin : BaseUnityPlugin
{
private enum LockAction
{
None,
LockUnusedCosmetics,
LockAllCosmetics
}
public const string PluginGuid = "REPOJP.LockAllCosmetics";
public const string PluginName = "LockAllCosmetics";
public const string PluginVersion = "4.0.2";
private const KeyCode LockUnusedKey = 290;
private const KeyCode LockAllKey = 291;
private const float ProgressMax = 1f;
private const float ProgressMin = 0f;
private const float ProgressIncreaseStart = 0.13f;
private const float ProgressIncreaseEnd = 0.075f;
private const float ProgressRecoveryPerSecond = 0.3f;
private const float DoublePressWindowSeconds = 1f;
private const float MinimumUiVisibleSeconds = 3f;
private const float SuccessCooldownSeconds = 5f;
private const float FailureCooldownSeconds = 2f;
private const float CompletionMessageSeconds = 3f;
private const float BarWidth = 560f;
private const float BarHeight = 26f;
private const int CanvasSortingOrder = 32000;
private static LockAllCosmeticsPlugin instance;
private GameObject canvasObject = null;
private Image blackOverlayImage = null;
private RectTransform barFillRect = null;
private TextMeshProUGUI titleText = null;
private TextMeshProUGUI hintText = null;
private TextMeshProUGUI subHintText = null;
private TextMeshProUGUI percentText = null;
private LockAction activeAction = LockAction.None;
private float lockProgress = 0f;
private float cooldownUntil = 0f;
private float minimumUiVisibleUntil = 0f;
private float lastF9PressTime = -999f;
private float lastF10PressTime = -999f;
private bool lockSequenceActive = false;
private bool completionMessageActive = false;
private float completionMessageUntil = 0f;
private bool uiCreated = false;
private void Awake()
{
try
{
if ((Object)(object)instance != (Object)null && (Object)(object)instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
instance = this;
((Component)this).transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded LockAllCosmetics 4.0.2. Double-press F9 or F10 within 1 second, then mash the same key.");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failure: Awake\n" + ex));
}
}
private void Update()
{
try
{
UpdateCompletionMessage();
if (!completionMessageActive && !(Time.unscaledTime < cooldownUntil))
{
bool keyDown = Input.GetKeyDown((KeyCode)290);
bool keyDown2 = Input.GetKeyDown((KeyCode)291);
ProcessActivationKey(keyDown, LockAction.LockUnusedCosmetics, ref lastF9PressTime);
ProcessActivationKey(keyDown2, LockAction.LockAllCosmetics, ref lastF10PressTime);
bool flag = (activeAction == LockAction.LockUnusedCosmetics && keyDown) || (activeAction == LockAction.LockAllCosmetics && keyDown2);
if (lockSequenceActive && !flag)
{
RecoverProgress();
}
if (lockSequenceActive)
{
UpdateLockUi();
}
if (lockSequenceActive && lockProgress <= 0f && Time.unscaledTime >= minimumUiVisibleUntil)
{
CancelSequence();
}
if (lockSequenceActive && lockProgress >= 1f)
{
ExecuteActiveAction();
}
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failure: Update\n" + ex));
}
}
private void ProcessActivationKey(bool keyPressed, LockAction action, ref float lastPressTime)
{
if (!keyPressed)
{
return;
}
if (lockSequenceActive)
{
if (activeAction == action)
{
IncreaseProgress();
}
return;
}
float unscaledTime = Time.unscaledTime;
if (unscaledTime - lastPressTime > 1f)
{
lastPressTime = unscaledTime;
return;
}
StartLockSequence(action);
IncreaseProgress();
lastF9PressTime = -999f;
lastF10PressTime = -999f;
}
private void StartLockSequence(LockAction action)
{
activeAction = action;
lockSequenceActive = true;
lockProgress = 0f;
minimumUiVisibleUntil = Time.unscaledTime + 3f;
EnsureLockUi();
UpdateUiTextForAction();
SetLockUiVisible(visible: true);
}
private void IncreaseProgress()
{
float num = Mathf.Clamp01(lockProgress);
float num2 = Mathf.Lerp(0.13f, 0.075f, num);
lockProgress += num2;
if (lockProgress > 1f)
{
lockProgress = 1f;
}
}
private void RecoverProgress()
{
lockProgress -= 0.3f * Time.unscaledDeltaTime;
if (lockProgress < 0f)
{
lockProgress = 0f;
}
}
private void ExecuteActiveAction()
{
if (activeAction == LockAction.LockUnusedCosmetics)
{
ExecuteLockUnusedCosmetics();
}
else if (activeAction == LockAction.LockAllCosmetics)
{
ExecuteLockAllCosmetics();
}
else
{
ResetSequence(2f);
}
}
private void ExecuteLockAllCosmetics()
{
try
{
object staticInstance = GetStaticInstance("MetaManager");
if (!CanExecuteMetaOperation(staticInstance))
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Failure: MetaManager is not ready.");
ResetSequence(2f);
return;
}
if (!InvokeInstanceMethod(staticInstance, "Reset", new object[0]))
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Failure: MetaManager.Reset was not found.");
ResetSequence(2f);
return;
}
ClearCurrentOutfitAndSetWhite(staticInstance);
InvokeInstanceMethod(staticInstance, "Save", new object[0]);
RefreshCosmeticState(staticInstance);
RefreshCurrentCosmeticMenu();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Success: Locked all cosmetics and cleared outfit colors to white.");
ShowCompletionMessage("Lock Complete", "All cosmetics are locked.", "Current outfit was removed. Colors were reset to white.");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failure: ExecuteLockAllCosmetics\n" + ex));
ResetSequence(2f);
}
}
private void ExecuteLockUnusedCosmetics()
{
try
{
object staticInstance = GetStaticInstance("MetaManager");
if (!CanExecuteMetaOperation(staticInstance))
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Failure: MetaManager is not ready.");
ResetSequence(2f);
return;
}
IList instanceListField = GetInstanceListField(staticInstance, "cosmeticUnlocks");
IList instanceListField2 = GetInstanceListField(staticInstance, "cosmeticPresets");
if (instanceListField == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Failure: cosmeticUnlocks field was not found.");
ResetSequence(2f);
return;
}
if (instanceListField2 == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Failure: cosmeticPresets field was not found.");
ResetSequence(2f);
return;
}
HashSet<int> presetCosmeticIndexSet = GetPresetCosmeticIndexSet(instanceListField2);
int count = instanceListField.Count;
int num = RemoveIntegersNotInSet(instanceListField, presetCosmeticIndexSet);
RemoveIntegersNotInSet(GetInstanceListField(staticInstance, "cosmeticHistory"), presetCosmeticIndexSet);
string text = EquipFirstPreset(staticInstance);
RefreshCosmeticState(staticInstance);
InvokeInstanceMethod(staticInstance, "Save", new object[0]);
RefreshCurrentCosmeticMenu();
((BaseUnityPlugin)this).Logger.LogInfo((object)("Success: Locked unused cosmetics. Locked=" + num + ", Kept=" + instanceListField.Count + ", Before=" + count + ", PresetUsed=" + presetCosmeticIndexSet.Count + ", " + text));
ShowCompletionMessage("Lock Complete", "Unused cosmetics are locked.", text + " Locked: " + num);
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failure: ExecuteLockUnusedCosmetics\n" + ex));
ResetSequence(2f);
}
}
private bool CanExecuteMetaOperation(object metaManager)
{
if (metaManager == null)
{
return false;
}
object instanceFieldOrPropertyValue = GetInstanceFieldOrPropertyValue(metaManager, "saveReady");
if (instanceFieldOrPropertyValue is bool && !(bool)instanceFieldOrPropertyValue)
{
return false;
}
return true;
}
private void RefreshCosmeticState(object metaManager)
{
InvokeInstanceMethod(metaManager, "CosmeticPreviewSet", new object[1] { false });
InvokeInstanceMethod(metaManager, "CosmeticPlayerUpdateLocal", new object[2] { true, true });
}
private void RefreshCurrentCosmeticMenu()
{
try
{
object staticInstance = GetStaticInstance("MenuManager");
object instanceFieldOrPropertyValue = GetInstanceFieldOrPropertyValue(staticInstance, "currentMenuPage");
if (instanceFieldOrPropertyValue == null)
{
return;
}
Type type = FindType("MenuPageCosmetics");
if (!(type == null))
{
Component val = null;
Component val2 = (Component)((instanceFieldOrPropertyValue is Component) ? instanceFieldOrPropertyValue : null);
if ((Object)(object)val2 != (Object)null)
{
val = val2.GetComponent(type);
}
GameObject val3 = (GameObject)((instanceFieldOrPropertyValue is GameObject) ? instanceFieldOrPropertyValue : null);
if ((Object)(object)val == (Object)null && (Object)(object)val3 != (Object)null)
{
val = val3.GetComponent(type);
}
if (!((Object)(object)val == (Object)null))
{
InvokeInstanceMethod(val, "RefreshScrollContent", new object[0]);
}
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Failure: RefreshCurrentCosmeticMenu\n" + ex));
}
}
private HashSet<int> GetPresetCosmeticIndexSet(IList cosmeticPresets)
{
HashSet<int> hashSet = new HashSet<int>();
if (cosmeticPresets == null)
{
return hashSet;
}
for (int i = 0; i < cosmeticPresets.Count; i++)
{
if (!(cosmeticPresets[i] is IEnumerable enumerable))
{
continue;
}
foreach (object item in enumerable)
{
if (item is int num && num >= 0)
{
hashSet.Add(num);
}
}
}
return hashSet;
}
private int RemoveIntegersNotInSet(IList list, HashSet<int> keepSet)
{
if (list == null)
{
return 0;
}
int num = 0;
for (int num2 = list.Count - 1; num2 >= 0; num2--)
{
if (list[num2] is int item && !keepSet.Contains(item))
{
list.RemoveAt(num2);
num++;
}
}
return num;
}
private void ClearListField(object target, string fieldName)
{
GetInstanceListField(target, fieldName)?.Clear();
}
private void ClearCurrentOutfitAndSetWhite(object metaManager)
{
ClearListField(metaManager, "cosmeticEquipped");
ClearListField(metaManager, "cosmeticEquippedPreview");
int whiteColorIndex = GetWhiteColorIndex(metaManager);
SetIntArrayValues(GetInstanceFieldOrPropertyValue(metaManager, "colorsEquipped"), whiteColorIndex);
SetIntArrayValues(GetInstanceFieldOrPropertyValue(metaManager, "colorsEquippedPreview"), whiteColorIndex);
SetInstanceFieldOrPropertyValue(metaManager, "cosmeticPreviewEnabled", false);
SetInstanceFieldOrPropertyValue(metaManager, "colorsPreviewEnabled", false);
InvokeInstanceMethod(metaManager, "CosmeticPreviewSet", new object[1] { false });
}
private string EquipFirstPreset(object metaManager)
{
IList instanceListField = GetInstanceListField(metaManager, "cosmeticPresets");
IList instanceListField2 = GetInstanceListField(metaManager, "colorPresets");
IList instanceListField3 = GetInstanceListField(metaManager, "cosmeticEquipped");
if (instanceListField == null || instanceListField.Count == 0 || instanceListField3 == null)
{
ClearCurrentOutfitAndSetWhite(metaManager);
return "Preset 1 was not found. Outfit was cleared.";
}
instanceListField3.Clear();
ClearListField(metaManager, "cosmeticEquippedPreview");
int num = 0;
if (instanceListField[0] is IEnumerable enumerable)
{
foreach (object item in enumerable)
{
if (item is int num2 && num2 >= 0)
{
instanceListField3.Add(num2);
num++;
}
}
}
int num3 = ApplyFirstColorPreset(metaManager, instanceListField2);
SetInstanceFieldOrPropertyValue(metaManager, "cosmeticPreviewEnabled", false);
SetInstanceFieldOrPropertyValue(metaManager, "colorsPreviewEnabled", false);
InvokeInstanceMethod(metaManager, "CosmeticPreviewSet", new object[1] { false });
if (num == 0 && num3 == 0)
{
ClearCurrentOutfitAndSetWhite(metaManager);
return "Preset 1 is empty. Outfit was cleared.";
}
return "Preset 1 was equipped.";
}
private int ApplyFirstColorPreset(object metaManager, IList colorPresets)
{
object instanceFieldOrPropertyValue = GetInstanceFieldOrPropertyValue(metaManager, "colorsEquipped");
int whiteColorIndex = GetWhiteColorIndex(metaManager);
SetIntArrayValues(instanceFieldOrPropertyValue, whiteColorIndex);
SetIntArrayValues(GetInstanceFieldOrPropertyValue(metaManager, "colorsEquippedPreview"), whiteColorIndex);
if (!(instanceFieldOrPropertyValue is Array array) || colorPresets == null || colorPresets.Count == 0)
{
return 0;
}
int num = 0;
if (!(colorPresets[0] is IEnumerable enumerable))
{
return 0;
}
int num2 = 0;
foreach (object item in enumerable)
{
if (num2 >= array.Length)
{
break;
}
if (item is int)
{
array.SetValue((int)item, num2);
num++;
}
num2++;
}
return num;
}
private int GetWhiteColorIndex(object metaManager)
{
IList instanceListField = GetInstanceListField(metaManager, "colors");
if (instanceListField == null)
{
return 0;
}
for (int i = 0; i < instanceListField.Count; i++)
{
object? obj = instanceListField[i];
Object val = (Object)((obj is Object) ? obj : null);
if (!(val == (Object)null))
{
string name = val.name;
if (!string.IsNullOrEmpty(name) && name.IndexOf("white", StringComparison.OrdinalIgnoreCase) >= 0)
{
return i;
}
}
}
return 0;
}
private void SetIntArrayValues(object arrayObject, int value)
{
if (arrayObject is Array array)
{
for (int i = 0; i < array.Length; i++)
{
array.SetValue(value, i);
}
}
}
private void ResetSequence(float cooldownSeconds)
{
activeAction = LockAction.None;
lockProgress = 0f;
lockSequenceActive = false;
minimumUiVisibleUntil = 0f;
cooldownUntil = Time.unscaledTime + cooldownSeconds;
lastF9PressTime = -999f;
lastF10PressTime = -999f;
SetLockUiVisible(visible: false);
}
private void CancelSequence()
{
activeAction = LockAction.None;
lockProgress = 0f;
lockSequenceActive = false;
minimumUiVisibleUntil = 0f;
lastF9PressTime = -999f;
lastF10PressTime = -999f;
SetLockUiVisible(visible: false);
}
private void EnsureLockUi()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: 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_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Expected O, but got Unknown
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: 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_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_0479: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
//IL_04b0: Expected O, but got Unknown
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0518: Unknown result type (might be due to invalid IL or missing references)
//IL_0529: Unknown result type (might be due to invalid IL or missing references)
//IL_053a: Unknown result type (might be due to invalid IL or missing references)
//IL_0555: Unknown result type (might be due to invalid IL or missing references)
//IL_0588: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
if (!uiCreated || !((Object)(object)canvasObject != (Object)null))
{
canvasObject = new GameObject("LockAllCosmeticsCanvas", new Type[4]
{
typeof(RectTransform),
typeof(Canvas),
typeof(CanvasScaler),
typeof(GraphicRaycaster)
});
((Object)canvasObject).hideFlags = (HideFlags)61;
canvasObject.transform.SetParent(((Component)this).transform, false);
Canvas component = canvasObject.GetComponent<Canvas>();
component.renderMode = (RenderMode)0;
component.sortingOrder = 32000;
CanvasScaler component2 = canvasObject.GetComponent<CanvasScaler>();
component2.uiScaleMode = (ScaleMode)1;
component2.referenceResolution = new Vector2(1920f, 1080f);
component2.matchWidthOrHeight = 0.5f;
GraphicRaycaster component3 = canvasObject.GetComponent<GraphicRaycaster>();
((Behaviour)component3).enabled = false;
GameObject val = new GameObject("BlackOverlay", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val.transform.SetParent(canvasObject.transform, false);
RectTransform component4 = val.GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.offsetMin = Vector2.zero;
component4.offsetMax = Vector2.zero;
blackOverlayImage = val.GetComponent<Image>();
((Graphic)blackOverlayImage).raycastTarget = false;
((Graphic)blackOverlayImage).color = new Color(0f, 0f, 0f, 0f);
GameObject val2 = new GameObject("LockPanel", new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(canvasObject.transform, false);
RectTransform component5 = val2.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(0.5f, 0.5f);
component5.anchorMax = new Vector2(0.5f, 0.5f);
component5.pivot = new Vector2(0.5f, 0.5f);
component5.anchoredPosition = Vector2.zero;
component5.sizeDelta = new Vector2(900f, 230f);
titleText = CreateText(val2.transform, "Title", string.Empty, 34f, new Vector2(0f, 70f), new Vector2(900f, 44f));
((Graphic)titleText).color = new Color(1f, 1f, 1f, 1f);
hintText = CreateText(val2.transform, "Hint", string.Empty, 22f, new Vector2(0f, 30f), new Vector2(900f, 36f));
((Graphic)hintText).color = new Color(1f, 1f, 1f, 0.92f);
subHintText = CreateText(val2.transform, "SubHint", string.Empty, 19f, new Vector2(0f, -5f), new Vector2(900f, 32f));
((Graphic)subHintText).color = new Color(1f, 1f, 1f, 0.82f);
GameObject val3 = new GameObject("BarBackground", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val3.transform.SetParent(val2.transform, false);
RectTransform component6 = val3.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0.5f, 0.5f);
component6.anchorMax = new Vector2(0.5f, 0.5f);
component6.pivot = new Vector2(0.5f, 0.5f);
component6.anchoredPosition = new Vector2(0f, -48f);
component6.sizeDelta = new Vector2(560f, 26f);
Image component7 = val3.GetComponent<Image>();
((Graphic)component7).raycastTarget = false;
((Graphic)component7).color = new Color(0f, 0f, 0f, 0.85f);
GameObject val4 = new GameObject("BarFill", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val4.transform.SetParent(val3.transform, false);
barFillRect = val4.GetComponent<RectTransform>();
barFillRect.anchorMin = new Vector2(0f, 0f);
barFillRect.anchorMax = new Vector2(0f, 1f);
barFillRect.pivot = new Vector2(0f, 0.5f);
barFillRect.offsetMin = Vector2.zero;
barFillRect.offsetMax = Vector2.zero;
barFillRect.sizeDelta = new Vector2(0f, 0f);
Image component8 = val4.GetComponent<Image>();
((Graphic)component8).raycastTarget = false;
((Graphic)component8).color = new Color(1f, 0.2f, 0.2f, 1f);
percentText = CreateText(val2.transform, "Percent", "0%", 18f, new Vector2(0f, -88f), new Vector2(900f, 30f));
((Graphic)percentText).color = new Color(1f, 1f, 1f, 0.95f);
uiCreated = true;
SetLockUiVisible(visible: false);
}
}
private TextMeshProUGUI CreateText(Transform parent, string objectName, string text, float fontSize, Vector2 anchoredPosition, Vector2 sizeDelta)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(objectName, new Type[2]
{
typeof(RectTransform),
typeof(TextMeshProUGUI)
});
val.transform.SetParent(parent, false);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0.5f, 0.5f);
component.anchorMax = new Vector2(0.5f, 0.5f);
component.pivot = new Vector2(0.5f, 0.5f);
component.anchoredPosition = anchoredPosition;
component.sizeDelta = sizeDelta;
TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>();
((TMP_Text)component2).text = text;
((TMP_Text)component2).fontSize = fontSize;
((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
((TMP_Text)component2).enableWordWrapping = false;
((Graphic)component2).raycastTarget = false;
return component2;
}
private void UpdateUiTextForAction()
{
if (!((Object)(object)titleText == (Object)null) && !((Object)(object)hintText == (Object)null) && !((Object)(object)subHintText == (Object)null))
{
if (activeAction == LockAction.LockUnusedCosmetics)
{
((TMP_Text)titleText).text = "Lock Unused Cosmetics";
((TMP_Text)hintText).text = "Mash F9 to lock cosmetics not saved in presets. Stop to cancel.";
((TMP_Text)subHintText).text = "Lock all cosmetics: F10";
}
else if (activeAction == LockAction.LockAllCosmetics)
{
((TMP_Text)titleText).text = "Lock All Cosmetics";
((TMP_Text)hintText).text = "Mash F10 to lock all cosmetics. Stop to cancel.";
((TMP_Text)subHintText).text = "Lock unused cosmetics: F9";
}
}
}
private void UpdateLockUi()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
EnsureLockUi();
float num = Mathf.Clamp01(lockProgress);
float num2 = num;
int num3 = Mathf.RoundToInt(num * 100f);
if ((Object)(object)blackOverlayImage != (Object)null)
{
((Graphic)blackOverlayImage).color = new Color(0f, 0f, 0f, num2);
}
if ((Object)(object)barFillRect != (Object)null)
{
barFillRect.sizeDelta = new Vector2(560f * num, 0f);
}
if ((Object)(object)percentText != (Object)null)
{
((TMP_Text)percentText).text = num3 + "%";
}
}
private void ShowCompletionMessage(string title, string message, string detail)
{
activeAction = LockAction.None;
lockSequenceActive = false;
completionMessageActive = true;
completionMessageUntil = Time.unscaledTime + 3f;
cooldownUntil = Time.unscaledTime + 5f;
lockProgress = 1f;
minimumUiVisibleUntil = 0f;
lastF9PressTime = -999f;
lastF10PressTime = -999f;
EnsureLockUi();
if ((Object)(object)titleText != (Object)null)
{
((TMP_Text)titleText).text = title;
}
if ((Object)(object)hintText != (Object)null)
{
((TMP_Text)hintText).text = message;
}
if ((Object)(object)subHintText != (Object)null)
{
((TMP_Text)subHintText).text = detail;
}
SetLockUiVisible(visible: true);
UpdateCompletionUi();
}
private void UpdateCompletionMessage()
{
if (completionMessageActive)
{
if (Time.unscaledTime >= completionMessageUntil)
{
completionMessageActive = false;
SetLockUiVisible(visible: false);
}
else
{
UpdateCompletionUi();
}
}
}
private void UpdateCompletionUi()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
EnsureLockUi();
if ((Object)(object)blackOverlayImage != (Object)null)
{
((Graphic)blackOverlayImage).color = new Color(0f, 0f, 0f, 0.72f);
}
if ((Object)(object)barFillRect != (Object)null)
{
barFillRect.sizeDelta = new Vector2(560f, 0f);
}
if ((Object)(object)percentText != (Object)null)
{
((TMP_Text)percentText).text = "Complete";
}
}
private void SetLockUiVisible(bool visible)
{
if ((Object)(object)canvasObject != (Object)null)
{
canvasObject.SetActive(visible);
}
}
private object GetStaticInstance(string typeName)
{
Type type = FindType(typeName);
if (type == null)
{
return null;
}
FieldInfo field = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
return field.GetValue(null);
}
PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
return property.GetValue(null, null);
}
return null;
}
private IList GetInstanceListField(object target, string fieldName)
{
object instanceFieldOrPropertyValue = GetInstanceFieldOrPropertyValue(target, fieldName);
return instanceFieldOrPropertyValue as IList;
}
private object GetInstanceFieldOrPropertyValue(object target, string memberName)
{
if (target == null)
{
return null;
}
FieldInfo field = target.GetType().GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
return field.GetValue(target);
}
PropertyInfo property = target.GetType().GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
return property.GetValue(target, null);
}
return null;
}
private bool SetInstanceFieldOrPropertyValue(object target, string memberName, object value)
{
if (target == null)
{
return false;
}
FieldInfo field = target.GetType().GetField(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(target, value);
return true;
}
PropertyInfo property = target.GetType().GetProperty(memberName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null && property.CanWrite)
{
property.SetValue(target, value, null);
return true;
}
return false;
}
private bool InvokeInstanceMethod(object target, string methodName, object[] parameters)
{
if (target == null)
{
return false;
}
MethodInfo methodInfo = FindInstanceMethod(target.GetType(), methodName, parameters);
if (methodInfo == null)
{
return false;
}
methodInfo.Invoke(target, parameters);
return true;
}
private MethodInfo FindInstanceMethod(Type type, string methodName, object[] parameters)
{
if (type == null)
{
return null;
}
int num = ((parameters != null) ? parameters.Length : 0);
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (!(methodInfo.Name != methodName))
{
ParameterInfo[] parameters2 = methodInfo.GetParameters();
if (parameters2.Length == num)
{
return methodInfo;
}
}
}
return null;
}
private Type FindType(string typeName)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
for (int i = 0; i < assemblies.Length; i++)
{
Type type = null;
try
{
type = assemblies[i].GetType(typeName, throwOnError: false);
}
catch
{
type = null;
}
if (type != null)
{
return type;
}
}
for (int j = 0; j < assemblies.Length; j++)
{
Type[] array = null;
try
{
array = assemblies[j].GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
array = ex.Types;
}
catch
{
array = null;
}
if (array == null)
{
continue;
}
foreach (Type type2 in array)
{
if (!(type2 == null) && (type2.Name == typeName || type2.FullName == typeName))
{
return type2;
}
}
}
return null;
}
}
}