using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SOD.Common;
using SOD.Common.Helpers;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CruncherListFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("CruncherListFix")]
[assembly: AssemblyTitle("CruncherListFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CruncherListFix
{
public static class HotelLogin
{
[HarmonyPatch(typeof(ComputerLogin), "OnSetup")]
public static class Scope
{
[HarmonyPrefix]
public static void Prefix(ComputerLogin __instance)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
_loginList = IntPtr.Zero;
try
{
if (Plugin.Cfg.HotelRoomLogin.Value)
{
ComputerOSMultiSelect loginSelection = __instance.loginSelection;
if (!((Object)(object)loginSelection == (Object)null) && RentedByPlayer(((CruncherAppContent)__instance).controller))
{
_loginList = ((Il2CppObjectBase)loginSelection).Pointer;
}
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not check for a rented hotel room: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogWarning(val);
}
}
[HarmonyPostfix]
public static void Postfix()
{
_loginList = IntPtr.Zero;
}
}
[HarmonyPatch(typeof(ComputerOSMultiSelect), "SpawnList")]
public static class AddAccount
{
[HarmonyPrefix]
public static void Prefix(ComputerOSMultiSelect __instance)
{
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_0088: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
if (_loginList == IntPtr.Zero)
{
return;
}
bool flag = default(bool);
try
{
if (((Il2CppObjectBase)__instance).Pointer != _loginList)
{
return;
}
Player instance = Player.Instance;
List<OSMultiOption> allOptions = __instance.allOptions;
if ((Object)(object)instance == (Object)null || allOptions == null)
{
return;
}
Enumerator<OSMultiOption> enumerator = allOptions.GetEnumerator();
while (enumerator.MoveNext())
{
OSMultiOption current = enumerator.Current;
if ((Object)(object)((current != null) ? current.human : null) != (Object)null && ((Actor)current.human).isPlayer)
{
return;
}
}
allOptions.Insert(0, new OSMultiOption
{
text = ((Human)instance).GetInitialledName(),
human = (Human)(object)instance
});
if (Plugin.Cfg.DebugLogging.Value)
{
ManualLogSource log = Plugin.Log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(62, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("added your account to the cruncher in your hotel room (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(allOptions.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" users)");
}
log.LogInfo(val);
}
}
catch (Exception ex)
{
ManualLogSource log2 = Plugin.Log;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(55, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Could not add your account to the hotel room cruncher: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
log2.LogWarning(val2);
}
}
}
[HarmonyPatch(typeof(ComputerLogin), "OnNewUserSelected")]
public static class LogIn
{
[HarmonyPostfix]
public static void Postfix(ComputerLogin __instance)
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
try
{
if (!Plugin.Cfg.HotelRoomLogin.Value)
{
return;
}
ComputerOSMultiSelect loginSelection = __instance.loginSelection;
object obj;
if (loginSelection == null)
{
obj = null;
}
else
{
ComputerOSMultiSelectElement selected = loginSelection.selected;
if (selected == null)
{
obj = null;
}
else
{
OSMultiOption option = selected.option;
obj = ((option != null) ? option.human : null);
}
}
Human val = (Human)obj;
if ((Object)(object)val == (Object)null || !((Actor)val).isPlayer || __instance.inputCodeActive)
{
return;
}
ComputerController controller = ((CruncherAppContent)__instance).controller;
if (!((Object)(object)controller == (Object)null) && RentedByPlayer(controller))
{
Passcode passcode = val.passcode;
List<int> val2 = ((passcode != null) ? passcode.GetDigits() : null);
if (val2 != null && val2.Count > 0)
{
__instance.OnInputCode(val2, 0.1f);
return;
}
controller.SetLoggedIn(val);
controller.OnAppExit();
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(49, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Could not log you in on the hotel room cruncher: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
}
log.LogWarning(val3);
}
}
}
private static IntPtr _loginList = IntPtr.Zero;
internal static bool RentedByPlayer(ComputerController? controller)
{
Player instance = Player.Instance;
GameplayController instance2 = GameplayController.Instance;
object obj;
if (controller == null)
{
obj = null;
}
else
{
InteractableController ic = controller.ic;
if (ic == null)
{
obj = null;
}
else
{
Interactable interactable = ic.interactable;
if (interactable == null)
{
obj = null;
}
else
{
NewNode node = interactable.node;
if (node == null)
{
obj = null;
}
else
{
NewGameLocation gameLocation = node.gameLocation;
obj = ((gameLocation != null) ? gameLocation.thisAsAddress : null);
}
}
}
}
NewAddress val = (NewAddress)obj;
if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || (Object)(object)val == (Object)null)
{
return false;
}
List<HotelGuest> hotelGuests = instance2.hotelGuests;
if (hotelGuests == null)
{
return false;
}
Enumerator<HotelGuest> enumerator = hotelGuests.GetEnumerator();
while (enumerator.MoveNext())
{
HotelGuest current = enumerator.Current;
if (current != null && current.humanID == ((Human)instance).humanID && current.addID == val.id)
{
return true;
}
}
return false;
}
}
public static class ListFix
{
[HarmonyPatch(typeof(VMailApp), "OnSetup")]
public static class MailScope
{
[HarmonyPrefix]
public static void Prefix()
{
_buildingList = true;
}
[HarmonyFinalizer]
public static void Finalizer()
{
_buildingList = false;
}
}
[HarmonyPatch(typeof(ComputerLogin), "OnSetup")]
public static class LoginScope
{
[HarmonyPrefix]
public static void Prefix()
{
_buildingList = true;
}
[HarmonyFinalizer]
public static void Finalizer()
{
_buildingList = false;
}
}
[HarmonyPatch(typeof(ComputerOSMultiSelect), "SpawnList")]
public static class Spawn
{
[HarmonyPrefix]
public static void Prefix(out List<NewAddress>? __state)
{
__state = null;
if (!_buildingList)
{
return;
}
Player instance = Player.Instance;
List<NewAddress> val = ((instance != null) ? instance.apartmentsOwned : null);
if (val != null && val.Count != 0)
{
List<NewAddress> list = new List<NewAddress>();
Enumerator<NewAddress> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
NewAddress current = enumerator.Current;
list.Add(current);
}
val.Clear();
__state = list;
}
}
[HarmonyPostfix]
public static void Postfix(List<NewAddress>? __state)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
if (__state == null)
{
return;
}
Player instance = Player.Instance;
List<NewAddress> val = ((instance != null) ? instance.apartmentsOwned : null);
if (val == null)
{
return;
}
val.Clear();
foreach (NewAddress item in __state)
{
val.Add(item);
}
if (Plugin.Cfg.DebugLogging.Value)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("kept the list whole, restored ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(__state.Count);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" owned apartments");
}
log.LogInfo(val2);
}
}
}
private static bool _buildingList;
}
[BepInPlugin("ekem.cruncherlistfix", "Cruncher List Fix", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
public static ManualLogSource Log { get; private set; }
public static Settings Cfg { get; private set; }
public override void Load()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
Cfg = new Settings(((BasePlugin)this).Config);
new Harmony("ekem.cruncherlistfix").PatchAll();
UnreadMail.Install();
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Cruncher List Fix");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.2.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded.");
}
log.LogInfo(val);
}
}
public class Settings
{
public readonly ConfigEntry<bool> HotelRoomLogin;
public readonly ConfigEntry<bool> UnreadBadge;
public readonly ConfigEntry<bool> DebugLogging;
public Settings(ConfigFile config)
{
HotelRoomLogin = config.Bind<bool>("Fixes", "HotelRoomLogin", true, "Give you an account on the cruncher in a hotel room for as long as you rent it, like at home.");
UnreadBadge = config.Bind<bool>("Mail", "UnreadBadge", true, "Put a small red mark on the VMail icon when you have vmails you haven't opened yet (on any cruncher you're logged in to as yourself). Vmails you already had when you installed this count as read.");
DebugLogging = config.Bind<bool>("Debug", "DebugLogging", false, "Log each time a list on your own cruncher is kept whole or your account is added in a hotel room.");
}
}
public static class PluginInfo
{
public const string Guid = "ekem.cruncherlistfix";
public const string Name = "Cruncher List Fix";
public const string Version = "1.2.0";
}
public static class UnreadMail
{
private sealed class Saved
{
public Dictionary<int, int>? Seen { get; set; }
public bool Seeded { get; set; }
}
[HarmonyPatch(typeof(ComputerOSMultiSelectElement), "Setup")]
public static class ListPatch
{
[HarmonyPostfix]
public static void Postfix(ComputerOSMultiSelectElement __instance)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
try
{
MarkElement(__instance);
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: could not mark a list entry: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
}
[HarmonyPatch(typeof(VMailApp), "SetSelectedVmail")]
public static class ReadPatch
{
[HarmonyPostfix]
public static void Postfix(VMailApp __instance, ComputerOSMultiSelectElement newSelection)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
try
{
MessageThreadSave selectedThread = __instance.selectedThread;
if (selectedThread != null)
{
Seen[selectedThread.threadID] = selectedThread.messages?.Count ?? 0;
}
if ((Object)(object)newSelection != (Object)null)
{
MarkElement(newSelection, forceRead: true);
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: could not mark a vmail read: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
}
[HarmonyPatch(typeof(DesktopApp), "OnSetup")]
public static class BadgePatch
{
[HarmonyPostfix]
public static void Postfix(DesktopApp __instance)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
try
{
Draw(__instance);
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: could not draw the badge: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
}
private const string FileName = "cruncherlistfix_unread.json";
public static Dictionary<int, int> Seen { get; private set; } = new Dictionary<int, int>();
public static bool Seeded { get; set; }
public static void Install()
{
Lib.SaveGame.OnBeforeSave += delegate(object? _, SaveGameArgs e)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
try
{
File.WriteAllText(PathFor(e), JsonSerializer.Serialize(new Saved
{
Seen = Seen,
Seeded = Seeded
}));
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: could not save: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
}
};
Lib.SaveGame.OnAfterLoad += delegate(object? _, SaveGameArgs e)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
Reset();
try
{
string path = PathFor(e);
if (File.Exists(path))
{
Saved? saved = JsonSerializer.Deserialize<Saved>(File.ReadAllText(path));
Seen = saved?.Seen ?? new Dictionary<int, int>();
Seeded = saved?.Seeded ?? false;
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: could not load: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
}
};
Lib.SaveGame.OnBeforeNewGame += delegate
{
Reset();
};
Lib.SaveGame.OnBeforeDelete += delegate(object? _, SaveGameArgs e)
{
try
{
string path = PathFor(e);
if (File.Exists(path))
{
File.Delete(path);
}
}
catch
{
}
};
}
private static string PathFor(SaveGameArgs args)
{
return Lib.SaveGame.GetSaveGameDataPath(args, "cruncherlistfix_unread.json");
}
public static void Reset()
{
Seen = new Dictionary<int, int>();
Seeded = false;
}
private static IEnumerable<MessageThreadSave> Threads(Human h)
{
HashSet<int> seen = new HashSet<int>();
List<MessageThreadSave>[] array = new List<MessageThreadSave>[2] { h.messageThreadFeatures, h.messageThreadCCd };
foreach (List<MessageThreadSave> val in array)
{
if (val == null)
{
continue;
}
Enumerator<MessageThreadSave> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
MessageThreadSave current = enumerator.Current;
if (current != null && seen.Add(current.threadID))
{
yield return current;
}
}
}
}
private static void SeedIfNeeded(Human player)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
if (Seeded)
{
return;
}
Seeded = true;
foreach (MessageThreadSave item in Threads(player))
{
Seen[item.threadID] = item.messages?.Count ?? 0;
}
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unread vmail: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Seen.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" existing threads marked read");
}
log.LogInfo(val);
}
public static int Count(Human player)
{
SeedIfNeeded(player);
return Threads(player).Count((MessageThreadSave t) => IsUnread(t, player));
}
private static bool IsUnread(MessageThreadSave t, Human player)
{
int num = t.messages?.Count ?? 0;
if (num == 0 || (Seen.TryGetValue(t.threadID, out var value) && value >= num))
{
return false;
}
List<int> senders = t.senders;
if (senders != null && senders.Count != 0)
{
return senders[senders.Count - 1] != player.humanID;
}
return true;
}
private static void MarkElement(ComputerOSMultiSelectElement element, bool forceRead = false)
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((element != null) ? element.rect : null) == (Object)null)
{
return;
}
Transform val = ((Transform)element.rect).Find("CLF_Unread");
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)((Component)val).gameObject);
}
OSMultiOption option = element.option;
MessageThreadSave val2 = ((option != null) ? option.msgThread : null);
if (forceRead || val2 == null || !Plugin.Cfg.UnreadBadge.Value)
{
return;
}
ComputerOSMultiSelect multiSelect = element.multiSelect;
object obj;
if (multiSelect == null)
{
obj = null;
}
else
{
ComputerController controller = multiSelect.controller;
obj = ((controller != null) ? controller.loggedInAs : null);
}
Human val3 = (Human)obj;
Player instance = Player.Instance;
if (!((Object)(object)instance == (Object)null) && (!((Object)(object)val3 != (Object)null) || ((Actor)val3).isPlayer))
{
SeedIfNeeded((Human)(object)instance);
if (IsUnread(val2, (Human)(object)instance))
{
Rect rect = element.rect.rect;
float num = ((Rect)(ref rect)).height * 0.2f;
Square(element.rect, new Vector2(1f, 0.72f), new Vector2((0f - num) * 1.2f, 0f), num);
}
}
}
private static void Square(RectTransform parent, Vector2 anchor, Vector2 offset, float side)
{
//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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
GameObject val = new GameObject("CLF_Unread")
{
layer = ((Component)parent).gameObject.layer
};
RectTransform obj = val.AddComponent<RectTransform>();
((Transform)obj).SetParent((Transform)(object)parent, false);
Vector2 anchorMin = (obj.anchorMax = anchor);
obj.anchorMin = anchorMin;
obj.anchoredPosition = offset;
obj.sizeDelta = new Vector2(side, side);
Image obj2 = val.AddComponent<Image>();
((Graphic)obj2).color = new Color(0.78f, 0.1f, 0.14f, 1f);
((Graphic)obj2).raycastTarget = false;
}
private static void Draw(DesktopApp desktop)
{
if (!Plugin.Cfg.UnreadBadge.Value || ((desktop != null) ? desktop.spawnedIcons : null) == null)
{
return;
}
ComputerController controller = ((CruncherAppContent)desktop).controller;
Human val = ((controller != null) ? controller.loggedInAs : null);
if ((Object)(object)val != (Object)null && !((Actor)val).isPlayer)
{
return;
}
Player instance = Player.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
int num = Count((Human)(object)instance);
Enumerator<DesktopIconController> enumerator = desktop.spawnedIcons.GetEnumerator();
while (enumerator.MoveNext())
{
DesktopIconController current = enumerator.Current;
if (!((SoCustomComparison)(object)((current != null) ? current.preset : null) == (SoCustomComparison)null) && !((Object)(object)current.rect == (Object)null) && ((Object)current.preset).name.IndexOf("mail", StringComparison.OrdinalIgnoreCase) >= 0)
{
Transform val2 = ((Transform)current.rect).Find("CLF_Unread");
if ((Object)(object)val2 != (Object)null)
{
Object.Destroy((Object)(object)((Component)val2).gameObject);
}
if (num > 0)
{
Badge(current);
}
}
}
}
private static void Badge(DesktopIconController icon)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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)
Rect rect = icon.rect.rect;
float width = ((Rect)(ref rect)).width;
rect = icon.rect.rect;
float side = Mathf.Min(width, ((Rect)(ref rect)).height) * 0.14f;
Square(icon.rect, new Vector2(0.83f, 0.8f), Vector2.zero, side);
}
}
}