Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SocialSystem v1.0.5
SocialSystem.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using SocialSystem.Client; using SocialSystem.Core; using SocialSystem.Integration; using SocialSystem.Localization; using SocialSystem.Networking; using SocialSystem.Server; using SocialSystem.Testing; using SocialSystem.UI; using SocialSystem.UI.Gamepad; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; 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: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SocialSystem")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f8970b2110de918f967c412657c385f198658e63")] [assembly: AssemblyProduct("SocialSystem")] [assembly: AssemblyTitle("SocialSystem")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SocialSystem { [BepInPlugin("M2Valheim.SocialSystem", "SocialSystem", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "M2Valheim.SocialSystem"; public const string PluginName = "SocialSystem"; public const string PluginVersion = "1.0.5"; internal static ManualLogSource Log; private static Harmony _harmony; private void Awake() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; SocialConfig.Bind(((BaseUnityPlugin)this).Config); SocialConfig.InviteFilterChanged += SocialClient.Instance.SendInviteFilter; SocialLocalization.Register(); SocialFeedback.Register(); SocialInput.Register(); SocialWindow.Instance.Register(); PartyWindow.Instance.Register(); PartyHud.Register(); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new DirectMessageCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new ReplyCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new PartyChatCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new FakeCharacterCommand()); _harmony = new Harmony("M2Valheim.SocialSystem"); _harmony.PatchAll(); Log.LogInfo((object)"SocialSystem 1.0.5 loaded."); } private void Update() { SocialRpc.FlushLoopback(); if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { SocialServer.Instance.Tick(Time.deltaTime); } SocialClient.Instance.Tick(Time.unscaledDeltaTime); SocialInput.Update(); SocialPrompts.Tick(); SocialWindow.Instance.Tick(); PartyWindow.Instance.Tick(); PartyHud.Tick(); WindowInput.Tick(); WindowGamepad.Tick(); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch (Exception arg) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)$"Unpatch failed: {arg}"); } } } } internal static class SocialConfig { private static ConfigEntry<int> _maxPartySize; private static ConfigEntry<float> _inviteTimeout; private static ConfigEntry<bool> _sharePartyPositions; private static ConfigEntry<float> _rejoinMinutes; private static ConfigEntry<bool> _listOnlinePlayers; private static ConfigEntry<bool> _showPartyOnMap; private static ConfigEntry<float> _autoAwayMinutes; private static ConfigEntry<bool> _showPartyHud; private static ConfigEntry<float> _partyHudOffsetX; private static ConfigEntry<float> _partyHudOffsetY; private static ConfigEntry<float> _partyHudScale; private static ConfigEntry<bool> _highlightPartyMembers; private static ConfigEntry<InviteFilter> _partyInvitesFrom; public static ConfigEntry<KeyCode> OpenWindowKey { get; private set; } public static ConfigEntry<KeyCode> OpenPartyWindowKey { get; private set; } public static ControllerBinding OpenWindowController { get; private set; } public static ControllerBinding OpenPartyWindowController { get; private set; } public static float AutoAwayMinutes => _autoAwayMinutes?.Value ?? 5f; public static int MaxPartySize => _maxPartySize?.Value ?? 8; public static float InviteTimeoutSeconds => _inviteTimeout?.Value ?? 60f; public static bool SharePartyPositions => _sharePartyPositions?.Value ?? true; public static float RejoinMinutes => _rejoinMinutes?.Value ?? 5f; public static float RejoinSeconds => RejoinMinutes * 60f; public static bool ListOnlinePlayers => _listOnlinePlayers?.Value ?? true; public static bool ShowPartyOnMap => _showPartyOnMap?.Value ?? true; public static bool ShowPartyHud => _showPartyHud?.Value ?? true; public static Vector2 PartyHudOffset => new Vector2(_partyHudOffsetX?.Value ?? 20f, _partyHudOffsetY?.Value ?? 350f); public static float PartyHudScale => _partyHudScale?.Value ?? 1f; public static bool HighlightPartyMembers => _highlightPartyMembers?.Value ?? true; public static InviteFilter PartyInvitesFrom => _partyInvitesFrom?.Value ?? InviteFilter.Everyone; public static event Action InviteFilterChanged; public static void Bind(ConfigFile config) { _maxPartySize = ConfigFileExtensions.BindConfigInOrder<int>(config, "1 - Party", "Max party size", 8, "Maximum number of characters in one party.", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _inviteTimeout = ConfigFileExtensions.BindConfigInOrder<float>(config, "1 - Party", "Invitation timeout", 60f, "Seconds a party invitation stays valid.", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _sharePartyPositions = ConfigFileExtensions.BindConfigInOrder<bool>(config, "1 - Party", "Share positions with party", true, "If true, party members always see each other on the map,\nindependent of the vanilla 'visible to other players' toggle (which still controls visibility for everyone else).", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _rejoinMinutes = ConfigFileExtensions.BindConfigInOrder<float>(config, "1 - Party", "Rejoin time (minutes)", 5f, "Minutes a party member who lost connection keeps their spot. Reconnecting within that time puts them\nstraight back into the party; the spot counts towards the party size. 0 = leave the party immediately.", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _listOnlinePlayers = ConfigFileExtensions.BindConfigInOrder<bool>(config, "1 - Party", "List online players", true, "If true, the dialogs for adding a friend and inviting to the party list the characters who are online,\nso one can be picked instead of typing the name. If false, names have to be typed\n(for servers that do not want to show who is online).", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _showPartyOnMap = ConfigFileExtensions.BindConfigInOrder<bool>(config, "2 - Interface", "Show party members on map", true, "If true, party members shared by the server are shown on your map.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _autoAwayMinutes = ConfigFileExtensions.BindConfigInOrder<float>(config, "2 - Interface", "Auto away after minutes", 5f, "Minutes without keyboard, mouse or controller button input after which 'Online' turns into 'Away'.\nAny input switches back to 'Online'. 0 = never.", false, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); OpenWindowKey = ConfigFileExtensions.BindConfigInOrder<KeyCode>(config, "2 - Interface", "Open social window", (KeyCode)111, "Key that opens and closes the social window.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); OpenPartyWindowKey = ConfigFileExtensions.BindConfigInOrder<KeyCode>(config, "2 - Interface", "Open party window", (KeyCode)112, "Key that opens and closes the party window.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); OpenWindowController = ControllerBinding.Bind(config, "2 - Interface", "Open social window ", "opens and closes the social window", ControllerButton.Y, withBlock: true); OpenPartyWindowController = ControllerBinding.Bind(config, "2 - Interface", "Open party window ", "opens and closes the party window", ControllerButton.None, withBlock: true); _showPartyHud = ConfigFileExtensions.BindConfigInOrder<bool>(config, "2 - Interface", "Show party HUD", true, "If true, the other party members are shown on the left side of the screen (avatar, name, level and health bar).", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _partyHudOffsetX = ConfigFileExtensions.BindConfigInOrder<float>(config, "2 - Interface", "Party HUD offset X", 20f, "Distance of the party HUD from the left screen edge.", false, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1500f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _partyHudOffsetY = ConfigFileExtensions.BindConfigInOrder<float>(config, "2 - Interface", "Party HUD offset Y", 350f, "Position of the party HUD's top edge relative to the vertical screen center (positive = up).", false, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-800f, 800f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _partyHudScale = ConfigFileExtensions.BindConfigInOrder<float>(config, "2 - Interface", "Party HUD scale", 1f, "Size of the party HUD (1 = default). The HUD grows to the right and downwards from its position.", false, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _highlightPartyMembers = ConfigFileExtensions.BindConfigInOrder<bool>(config, "2 - Interface", "Highlight party members", true, "If true, names above party members and their map markers are shown in the party color.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _partyInvitesFrom = ConfigFileExtensions.BindConfigInOrder<InviteFilter>(config, "2 - Interface", "Accept party invites from", InviteFilter.Everyone, "Who may send you party invitations: Everyone, Friends (only friends who have you on their list too) or Nobody.\nInvitations and ready checks are never shown while you are in combat; they appear once the fight is over.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); _partyInvitesFrom.SettingChanged += delegate { SocialConfig.InviteFilterChanged?.Invoke(); }; } } } namespace SocialSystem.UI { internal sealed class AvatarView { private static readonly Color FaceColor = new Color(0.16f, 0.13f, 0.1f, 1f); private readonly GameObject _root; private readonly Image _ring; private readonly Image _face; private readonly Text _initial; private readonly PrestigeBadge _prestige; private AvatarView(GameObject root, Image ring, Image face, Text initial, PrestigeBadge prestige) { _root = root; _ring = ring; _face = face; _initial = initial; _prestige = prestige; } public static AvatarView Create(Transform parent, Vector2 anchor, Vector2 position, float size) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0094: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Avatar", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); SocialUiFactory.Place(val, anchor, position, new Vector2(size, size)); Sprite circle = SocialIcons.Circle; Image ring = SocialUiFactory.CreateImage(val.transform, "Ring", Color.white, SocialUiFactory.Center, Vector2.zero, new Vector2(size, size), circle); Image face = SocialUiFactory.CreateImage(val.transform, "Face", FaceColor, SocialUiFactory.Center, Vector2.zero, new Vector2(size - 6f, size - 6f), circle); Text initial = SocialUiFactory.CreateText(val.transform, "Initial", string.Empty, Mathf.RoundToInt(size * 0.45f), Color.white, (TextAnchor)4, SocialUiFactory.Center, Vector2.zero, new Vector2(size, size)); PrestigeBadge prestige = PrestigeBadge.Create(val.transform, SocialUiFactory.BottomRight, new Vector2(size * 0.18f, (0f - size) * 0.12f), Mathf.Round(size * 0.52f)); return new AvatarView(val, ring, face, initial, prestige); } public void Set(string name, PresenceStatus status, int prestige = 0) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) _initial.text = (string.IsNullOrEmpty(name) ? "?" : name.Substring(0, 1).ToUpperInvariant()); ((Graphic)_ring).color = PresenceDisplay.ColorOf(status); _prestige.Set(prestige); } public Button MakeClickable() { ((Graphic)_ring).raycastTarget = true; Button val = _root.AddComponent<Button>(); ((Selectable)val).targetGraphic = (Graphic)(object)_ring; return val; } } internal static class ChatLog { private const string DirectMessageColor = "#d8a6ff"; private const string PartyColor = "#9fb4ff"; public static void AppendDirectMessage(string partnerName, string text, bool outgoing) { Append("#d8a6ff", outgoing ? "socialsystem_chat_dm_outgoing" : "socialsystem_chat_dm_incoming", partnerName, text, !outgoing); } public static void AppendPartyMessage(string senderName, string text, bool own) { Append("#9fb4ff", "socialsystem_chat_party", senderName, text, !own); } private static void Append(string color, string key, string name, string text, bool revealWindow) { if (!((Object)(object)Chat.instance == (Object)null)) { string text2 = SocialLocalization.Format(key, RichText.Escape(name), RichText.Escape(text)); ((Terminal)Chat.instance).AddString("<color=" + color + ">" + text2 + "</color>"); if (revealWindow && !CombatState.IsInCombat) { Chat.instance.m_hideTimer = 0f; } } } } internal sealed class ConfirmDialog { private readonly DialogFrame _frame; private readonly Text _message; private Action _onConfirm; private Action _onCancel; public bool IsOpen => _frame.IsOpen; private ConfirmDialog(DialogFrame frame, Text message) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown _frame = frame; _message = message; ((UnityEvent)_frame.ConfirmButton.onClick).AddListener(new UnityAction(Confirm)); ((UnityEvent)_frame.CancelButton.onClick).AddListener(new UnityAction(Cancel)); } public static ConfirmDialog Build(Transform windowRoot, float width = 420f) { //IL_0025: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) DialogFrame dialogFrame = DialogFrame.Build(windowRoot, "ConfirmDialog", 230f, width); Text message = SocialUiFactory.CreateText(dialogFrame.Panel, "Message", string.Empty, 18, Color.white, (TextAnchor)4, SocialUiFactory.TopCenter, new Vector2(0f, -58f), new Vector2(width - 50f, 96f)); return new ConfirmDialog(dialogFrame, message); } public void Open(string title, string message, Action onConfirm, Action onCancel = null) { _onConfirm = onConfirm; _onCancel = onCancel; _message.text = message; Localization instance = Localization.instance; _frame.Show(title, instance.Localize("$menu_yes"), instance.Localize("$menu_no")); } public void BindGamepad() { GamepadHints.Bind(_frame.ConfirmButton, "JoyButtonA", null, (KeyCode)0); GamepadHints.Bind(_frame.CancelButton, null, "JoyButtonB", (KeyCode)0); } public void SetGroupActive(bool active) { _frame.SetGroupActive(active); } public void Cancel() { Action onCancel = _onCancel; Close(); onCancel?.Invoke(); } public void Close() { _onConfirm = null; _onCancel = null; _frame.Hide(); } private void Confirm() { Action onConfirm = _onConfirm; Close(); onConfirm?.Invoke(); } } internal readonly struct ContextMenuItem { public readonly string Caption; public readonly Action Action; public readonly bool Enabled; public ContextMenuItem(string caption, Action action, bool enabled = true) { Caption = caption; Action = action; Enabled = enabled; } } internal static class ContextMenuOverlay { [CompilerGenerated] private static class <>O { public static UnityAction <0>__Close; } private const float ItemWidth = 180f; private const float ItemHeight = 32f; private const float Padding = 4f; private static readonly Color PanelColor = new Color(0.08f, 0.06f, 0.04f, 0.96f); private static readonly List<Button> EnabledItems = new List<Button>(); private static GameObject _catcher; private static RectTransform _panel; private static UIGroupHandler _group; public static bool IsOpen => (Object)(object)_catcher != (Object)null && _catcher.activeSelf; public static void Open(PointerEventData eventData, IReadOnlyList<ContextMenuItem> items) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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) if (items.Count == 0 || !EnsureBuilt()) { Close(); return; } SocialUiFactory.ClearChildren((Transform)(object)_panel); EnabledItems.Clear(); for (int i = 0; i < items.Count; i++) { ContextMenuItem item = items[i]; Button val = SocialUiFactory.CreateButton((Transform)(object)_panel, "Item_" + i, item.Caption, SocialUiFactory.TopCenter, new Vector2(0f, -4f - (float)i * 36f), new Vector2(180f, 32f), (UnityAction)delegate { Close(); item.Action?.Invoke(); }); ((Selectable)val).interactable = item.Enabled; if (item.Enabled) { EnabledItems.Add(val); } } Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(188f, (float)items.Count * 36f + 4f); RectTransform val3 = (RectTransform)_catcher.transform; Vector2 topLeft = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(val3, eventData.position, eventData.pressEventCamera, ref topLeft); _panel.sizeDelta = val2; _panel.anchoredPosition = ClampToScreen(val3.rect, topLeft, val2); _catcher.transform.SetAsLastSibling(); _catcher.SetActive(true); SelectFirstItem(); } public static void Close() { if ((Object)(object)_catcher != (Object)null) { _catcher.SetActive(false); } } public static bool Contains(Transform transform) { return (Object)(object)_catcher != (Object)null && transform.IsChildOf(_catcher.transform); } public static void SetGroupActive(bool active) { if ((Object)(object)_group != (Object)null) { _group.SetActive(active); } } private static void SelectFirstItem() { //IL_0013: 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) for (int i = 0; i < EnabledItems.Count; i++) { Button obj = EnabledItems[i]; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)4; ((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)((i > 0) ? EnabledItems[i - 1] : null); ((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)((i < EnabledItems.Count - 1) ? EnabledItems[i + 1] : null); ((Selectable)obj).navigation = navigation; } GameObject val = ((EnabledItems.Count > 0) ? ((Component)EnabledItems[0]).gameObject : null); EnabledItems.Clear(); _group.m_defaultElement = val; if ((Object)(object)val != (Object)null && ZInput.IsGamepadActive() && (Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(val); } } private static bool EnsureBuilt() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f4: Expected O, but got Unknown GameObject customGUIFront = GUIManager.CustomGUIFront; if ((Object)(object)customGUIFront == (Object)null) { return false; } if ((Object)(object)_catcher != (Object)null && (Object)(object)_catcher.transform.parent == (Object)(object)customGUIFront.transform) { return true; } if ((Object)(object)_catcher != (Object)null) { Object.Destroy((Object)(object)_catcher); } Image val = SocialUiFactory.CreateImage(customGUIFront.transform, "SocialSystem_ContextMenu", Color.clear, SocialUiFactory.Center, Vector2.zero, Vector2.zero, null, raycastTarget: true); SocialUiFactory.Stretch(((Graphic)val).rectTransform); Button val2 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val2).transition = (Transition)0; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val2).navigation = navigation; ButtonClickedEvent onClick = val2.onClick; object obj = <>O.<0>__Close; if (obj == null) { UnityAction val3 = Close; <>O.<0>__Close = val3; obj = (object)val3; } ((UnityEvent)onClick).AddListener((UnityAction)obj); _panel = ((Graphic)SocialUiFactory.CreateImage(((Component)val).transform, "Panel", PanelColor, SocialUiFactory.Center, Vector2.zero, Vector2.zero, SocialUiFactory.RoundedPanelSprite, raycastTarget: true)).rectTransform; _panel.pivot = SocialUiFactory.TopLeft; _group = ((Component)val).gameObject.AddComponent<UIGroupHandler>(); _group.m_groupPriority = 7; _group.SetActive(false); _catcher = ((Component)val).gameObject; _catcher.SetActive(false); return true; } private static Vector2 ClampToScreen(Rect screen, Vector2 topLeft, Vector2 size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0034: 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_0054: 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) float num = Mathf.Max(Mathf.Min(topLeft.x, ((Rect)(ref screen)).xMax - size.x), ((Rect)(ref screen)).xMin); float num2 = Mathf.Min(Mathf.Max(topLeft.y, ((Rect)(ref screen)).yMin + size.y), ((Rect)(ref screen)).yMax); return new Vector2(num, num2); } } internal sealed class DialogFrame { public const float DefaultWidth = 420f; private const float ButtonsFromBottom = 64f; private readonly UIGroupHandler _group; public GameObject Root { get; } public Transform Panel { get; } public Text Title { get; } public Button ConfirmButton { get; } public Button CancelButton { get; } public float Width { get; } public bool IsOpen => (Object)(object)Root != (Object)null && Root.activeSelf; private DialogFrame(GameObject root, Transform panel, Text title, Button confirmButton, Button cancelButton, float width, UIGroupHandler group) { _group = group; Root = root; Panel = panel; Title = title; ConfirmButton = confirmButton; CancelButton = cancelButton; Width = width; } public static DialogFrame Build(Transform windowRoot, string name, float height, float width = 420f) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_012e: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)SocialUiFactory.CreateImage(windowRoot, name, new Color(0f, 0f, 0f, 0.6f), SocialUiFactory.Center, Vector2.zero, Vector2.zero, null, raycastTarget: true)).gameObject; SocialUiFactory.Stretch((RectTransform)gameObject.transform); Transform transform = GUIManager.Instance.CreateWoodpanel(gameObject.transform, SocialUiFactory.Center, SocialUiFactory.Center, Vector2.zero, width, height, false).transform; Text title = SocialUiFactory.CreateText(transform, "Title", string.Empty, 22, SocialUiFactory.AccentColor, (TextAnchor)4, SocialUiFactory.TopCenter, new Vector2(0f, -18f), new Vector2(width - 40f, 34f)); float num = 0f - (height - 64f); float num2 = Mathf.Min(164f, (width - 60f) / 2f); float num3 = num2 / 2f + 10f; Button cancelButton = SocialUiFactory.CreateButton(transform, "Cancel", string.Empty, SocialUiFactory.TopCenter, new Vector2(0f - num3, num), new Vector2(num2, 40f)); Button confirmButton = SocialUiFactory.CreateButton(transform, "Confirm", string.Empty, SocialUiFactory.TopCenter, new Vector2(num3, num), new Vector2(num2, 40f)); UIGroupHandler val = gameObject.AddComponent<UIGroupHandler>(); val.m_groupPriority = 6; val.SetActive(false); gameObject.SetActive(false); return new DialogFrame(gameObject, transform, title, confirmButton, cancelButton, width, val); } public void Show(string title, string confirmCaption, string cancelCaption) { Title.text = title; SocialUiFactory.SetCaption(ConfirmButton, confirmCaption); SocialUiFactory.SetCaption(CancelButton, cancelCaption); Root.transform.SetAsLastSibling(); Root.SetActive(true); WindowGamepad.Interrupt(); } public void Hide() { if ((Object)(object)Root != (Object)null && Root.activeSelf) { Root.SetActive(false); WindowGamepad.Interrupt(); } } public void SetHeight(float height) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((RectTransform)Panel).SetSizeWithCurrentAnchors((Axis)1, height); MoveToBottom(ConfirmButton, height); MoveToBottom(CancelButton, height); } public void SetDefaultElement(GameObject element) { if ((Object)(object)_group != (Object)null) { _group.m_defaultElement = element; } } public void SetGroupActive(bool active) { if ((Object)(object)_group != (Object)null) { _group.SetActive(active); } } private static void MoveToBottom(Button button, float panelHeight) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)button).transform; val.anchoredPosition = new Vector2(val.anchoredPosition.x, 0f - (panelHeight - 64f)); } } internal sealed class HealthBar { private const float HealthPerSegment = 25f; private const float SegmentWidth = 32f; private readonly GameObject _root; private readonly GuiBar[] _bars; private readonly float _barWidth; private readonly RectTransform _fallbackFill; private long _playerId; private bool _assigned; private float _naturalWidth; private HealthBar(GameObject root, GuiBar[] bars, float barWidth, RectTransform fallbackFill) { _root = root; _bars = bars; _barWidth = barWidth; _naturalWidth = barWidth; _fallbackFill = fallbackFill; } public static HealthBar Create(Transform parent, Vector2 anchor, Vector2 position, float width, float height) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_013c: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (((Object)(object)Hud.instance != (Object)null) ? Hud.instance.m_healthBarRoot : null); if ((Object)(object)val == (Object)null) { RectTransform val2 = SocialUiFactory.CreateBar(parent, "HealthBar", SocialUiFactory.HealthColor, anchor, position, new Vector2(width, height)); return new HealthBar(((Component)((Transform)val2).parent).gameObject, (GuiBar[])(object)new GuiBar[0], width, val2); } Rect rect = val.rect; float num = Mathf.Max(1f, ((Rect)(ref rect)).height); float num2 = height / num; float num3 = width / num2; GameObject val3 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent, false); ((Object)val3).name = "HealthBar"; val3.SetActive(true); StripBehaviour(val3); RectTransform val4 = (RectTransform)val3.transform; val4.anchorMin = anchor; val4.anchorMax = anchor; val4.pivot = anchor; ((Transform)val4).localRotation = Quaternion.identity; ((Transform)val4).localScale = new Vector3(num2, num2, 1f); val4.sizeDelta = new Vector2(num3, num); val4.anchoredPosition = position; GuiBar[] componentsInChildren = val3.GetComponentsInChildren<GuiBar>(true); GuiBar[] array = componentsInChildren; foreach (GuiBar val5 in array) { ((Transform)val5.m_bar).localScale = Vector3.one; val5.SetWidth(num3); } return new HealthBar(val3, componentsInChildren, num3, null); } public void SetVisible(bool visible) { if (_root.activeSelf != visible) { _root.SetActive(visible); } } public bool Update(long playerId, SocialClient client) { bool flag = playerId == SocialClient.LocalPlayerId; MemberVitals vitals = default(MemberVitals); bool flag2 = (flag || client.GetPresence(playerId).IsOnline) && client.TryGetVitals(playerId, out vitals); bool flag3 = flag2 && !vitals.IsDead; float num = (flag3 ? vitals.HealthFraction : 0f); bool flag4 = !_assigned || _playerId != playerId; _assigned = true; _playerId = playerId; if ((Object)(object)_fallbackFill != (Object)null) { SocialUiFactory.SetBarFill(_fallbackFill, num); return flag3; } if (flag2 && vitals.MaxHealth > 0f) { float num2 = Mathf.Max(1f, Mathf.Ceil(vitals.MaxHealth / 25f * 32f)); if (!Mathf.Approximately(num2, _naturalWidth)) { _naturalWidth = num2; ApplySegmentation(); } } GuiBar[] bars = _bars; foreach (GuiBar val in bars) { if (flag4) { val.m_firstSet = true; val.SetValue(num); val.SetWidth(_naturalWidth); } else { val.SetValue(num); } } return flag3; } private void ApplySegmentation() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) float num = _barWidth / _naturalWidth; GuiBar[] bars = _bars; foreach (GuiBar val in bars) { ((Transform)val.m_bar).localScale = new Vector3(num, 1f, 1f); val.SetWidth(_naturalWidth); } } private static void StripBehaviour(GameObject copy) { Animator[] componentsInChildren = copy.GetComponentsInChildren<Animator>(true); foreach (Animator val in componentsInChildren) { Object.Destroy((Object)(object)val); } TMP_Text[] componentsInChildren2 = copy.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val2 in componentsInChildren2) { ((Behaviour)val2).enabled = false; } CanvasGroup[] componentsInChildren3 = copy.GetComponentsInChildren<CanvasGroup>(true); foreach (CanvasGroup val3 in componentsInChildren3) { val3.alpha = 1f; } Graphic[] componentsInChildren4 = copy.GetComponentsInChildren<Graphic>(true); foreach (Graphic val4 in componentsInChildren4) { val4.raycastTarget = false; } } } internal sealed class NameInputDialog { private const float PlainHeight = 210f; private const float ListTop = -116f; private const float ListSideMargin = 15f; private const float BelowList = 74f; private const int MaxVisibleRows = 4; private readonly DialogFrame _frame; private readonly InputField _input; private readonly ScrollList _list; private readonly float _listWidth; private readonly List<string> _names = new List<string>(); private readonly HashSet<string> _marked = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private readonly GamepadNavigation _navigation = new GamepadNavigation(); private Action<string> _onSubmit; public bool IsOpen => _frame.IsOpen; public bool IsInputFocused => IsOpen && _input.isFocused && !ZInput.IsGamepadActive(); private NameInputDialog(DialogFrame frame, InputField input, ScrollList list, float listWidth) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown _frame = frame; _input = input; _list = list; _listWidth = listWidth; ((UnityEvent)_frame.ConfirmButton.onClick).AddListener(new UnityAction(Submit)); ((UnityEvent)_frame.CancelButton.onClick).AddListener(new UnityAction(Close)); ((UnityEvent<string>)(object)_input.onEndEdit).AddListener((UnityAction<string>)delegate { if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { Submit(); } }); } public static NameInputDialog Build(Transform windowRoot, float width = 420f) { //IL_001e: 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_003e: 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_0072: Unknown result type (might be due to invalid IL or missing references) DialogFrame dialogFrame = DialogFrame.Build(windowRoot, "NameDialog", 210f, width); InputField input = SocialUiFactory.CreateInputField(dialogFrame.Panel, "Name", SocialUiFactory.TopCenter, new Vector2(0f, -66f), new Vector2(width - 60f, 40f)); float num = width - 30f; ScrollList list = SocialUiFactory.CreateScrollList(dialogFrame.Panel, "Players", new Vector2(0f, -116f), new Vector2(num, ListHeight(1))); list.Root.SetActive(false); return new NameInputDialog(dialogFrame, input, list, num); } public void Open(string title, Action<string> onSubmit, Func<string, bool> leaveOut) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) bool listOnlinePlayers = SocialConfig.ListOnlinePlayers; if (listOnlinePlayers || !GamepadTextInput.TryRequest(title, _input.characterLimit, onSubmit)) { _onSubmit = onSubmit; SocialUiFactory.SetPlaceholder(_input, SocialLocalization.T("socialsystem_ui_name_placeholder")); _input.text = string.Empty; _marked.Clear(); _names.Clear(); _list.Root.SetActive(listOnlinePlayers); if (listOnlinePlayers) { OnlinePlayers.Collect(_names, leaveOut); int rows = Mathf.Clamp(_names.Count, 1, 4); SocialUiFactory.Place(_list.Root, SocialUiFactory.TopCenter, new Vector2(0f, -116f), new Vector2(_listWidth, ListHeight(rows))); SocialListRenderer.RenderPlayers(_list.Content, _names, _listWidth - 20f, SetMarked); _list.Content.anchoredPosition = Vector2.zero; _frame.SetHeight(116f + ListHeight(rows) + 74f); } else { _frame.SetHeight(210f); } _frame.Show(title, SocialLocalization.T("socialsystem_ui_send"), SocialLocalization.T("socialsystem_ui_cancel")); LinkRows(listOnlinePlayers); if (!listOnlinePlayers || !ZInput.IsGamepadActive()) { _input.ActivateInputField(); } } } public void Close() { _onSubmit = null; _frame.Hide(); } public void BindGamepad() { GamepadHints.Bind(_frame.ConfirmButton, "JoyButtonX", null, (KeyCode)0); GamepadHints.Bind(_frame.CancelButton, null, "JoyButtonB", (KeyCode)0); } public void UpdateGamepad(bool active) { _frame.SetGroupActive(active); if (active && IsOpen && !((Object)(object)EventSystem.current == (Object)null)) { GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject; if ((Object)(object)currentSelectedGameObject != (Object)null && currentSelectedGameObject.activeInHierarchy && (Object)(object)currentSelectedGameObject.transform.parent == (Object)(object)_list.Content) { _frame.SetDefaultElement(currentSelectedGameObject); } } } private static float ListHeight(int rows) { return (float)rows * 46f + 12f; } private void LinkRows(bool withList) { _navigation.Clear(); Selectable val = (withList ? _navigation.AddRows(_list.Content) : null); _navigation.Apply(); _frame.SetDefaultElement(((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); } private void SetMarked(string name, bool marked) { if (marked) { _marked.Add(name); } else { _marked.Remove(name); } if (!ZInput.IsGamepadActive()) { _input.ActivateInputField(); } } private void Submit() { Action<string> onSubmit = _onSubmit; string text = _input.text; List<string> list = new List<string>(); foreach (string name in _names) { if (_marked.Contains(name)) { list.Add(name); } } if (list.Count == 0 || (!string.IsNullOrWhiteSpace(text) && !_marked.Contains(text.Trim()))) { list.Add(text); } Close(); foreach (string item in list) { onSubmit?.Invoke(item); } } } internal static class PartyHighlight { public static readonly Color PartyColor = new Color(0.62f, 0.71f, 1f); private static readonly Color VanillaPinColor = Color.white; private static Color? _vanillaNameColor; public static void ApplyToEnemyHud(EnemyHud hud) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) PartySnapshot party = SocialClient.Instance.Party; bool flag = SocialConfig.HighlightPartyMembers && party.IsInParty; foreach (HudData value in hud.m_huds.Values) { if ((Object)(object)value.m_name == (Object)null) { continue; } Character character = value.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null) { Color val2 = ((flag && party.Contains(val.GetPlayerID())) ? PartyColor : VanillaNameColor(hud)); if (((Graphic)value.m_name).color != val2) { ((Graphic)value.m_name).color = val2; } } } } public static void ApplyToMinimap(Minimap map) { //IL_0087: 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) //IL_0093: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0108: Unknown result type (might be due to invalid IL or missing references) List<PinData> playerPins = map.m_playerPins; List<PlayerInfo> tempPlayerInfo = map.m_tempPlayerInfo; if (playerPins.Count != tempPlayerInfo.Count) { return; } PartySnapshot party = SocialClient.Instance.Party; bool flag = SocialConfig.HighlightPartyMembers && party.IsInParty; for (int i = 0; i < playerPins.Count; i++) { PinData val = playerPins[i]; if (!((Object)(object)val.m_iconElement == (Object)null)) { Color val2 = ((flag && IsPartyMember(party, tempPlayerInfo[i])) ? PartyColor : VanillaPinColor); if (((Graphic)val.m_iconElement).color != val2) { ((Graphic)val.m_iconElement).color = val2; } PinNameData namePinData = val.m_NamePinData; if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null && ((Graphic)val.m_NamePinData.PinNameText).color != val2) { ((Graphic)val.m_NamePinData.PinNameText).color = val2; } } } } private static bool IsPartyMember(PartySnapshot party, PlayerInfo info) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) long uID = ZNet.GetUID(); foreach (PartyMemberInfo member in party.Members) { if (member.SessionId == uID || !(((ZDOID)(ref info.m_characterID)).IsNone() ? string.Equals(info.m_name, member.Character.Name) : (((ZDOID)(ref info.m_characterID)).UserID == member.SessionId))) { continue; } return true; } return false; } private static Color VanillaNameColor(EnemyHud hud) { //IL_0012: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Color? vanillaNameColor = _vanillaNameColor; if (vanillaNameColor.HasValue) { Color valueOrDefault = vanillaNameColor.GetValueOrDefault(); if (true) { return valueOrDefault; } } object obj; if (!((Object)(object)hud.m_baseHudPlayer != (Object)null)) { obj = null; } else { Transform obj2 = hud.m_baseHudPlayer.transform.Find("Name"); obj = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null); } TextMeshProUGUI val = (TextMeshProUGUI)obj; _vanillaNameColor = (((Object)(object)val != (Object)null) ? ((Graphic)val).color : Color.white); return _vanillaNameColor.Value; } } internal static class PartyHud { private sealed class Frame { public GameObject Root; public PartyMemberView View; } private const float FrameSpacing = 4f; private static readonly List<Frame> Frames = new List<Frame>(); private static readonly List<PartyMemberInfo> Others = new List<PartyMemberInfo>(); private static RectTransform _root; public static void Register() { SocialLocalization.Updated += delegate { foreach (Frame frame in Frames) { frame.View.InvalidateTexts(); } }; } public static void Tick() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) SocialClient instance = SocialClient.Instance; PartySnapshot party = instance.Party; if (!SocialConfig.ShowPartyHud || !party.IsInParty || !((Object)(object)Player.m_localPlayer != (Object)null) || !((Object)(object)Hud.instance != (Object)null)) { if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf) { ((Component)_root).gameObject.SetActive(false); } } else if (EnsureBuilt()) { if (!((Component)_root).gameObject.activeSelf) { ((Component)_root).gameObject.SetActive(true); } _root.anchoredPosition = SocialConfig.PartyHudOffset; ((Transform)_root).localScale = new Vector3(SocialConfig.PartyHudScale, SocialConfig.PartyHudScale, 1f); party.CopyMembersLeaderFirst(Others, SocialClient.LocalPlayerId); EnsureFrameCount(Others.Count); for (int i = 0; i < Others.Count; i++) { PartyMemberInfo member = Others[i]; PartyMemberView view = Frames[i].View; view.Bind(member, party.IsLeader(member.Character.PlayerId), member.Character.Name); view.Tick(instance); } } } public static void Destroy() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)((Component)_root).gameObject); } _root = null; Frames.Clear(); } private static bool EnsureBuilt() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00e8: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)Hud.instance.m_rootObject != (Object)null) ? Hud.instance.m_rootObject.transform : null); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)_root != (Object)null && (Object)(object)((Transform)_root).parent == (Object)(object)val) { return true; } Destroy(); GameObject val2 = new GameObject("SocialSystem_PartyHud", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(val, false); _root = (RectTransform)val2.transform; _root.anchorMin = SocialUiFactory.MiddleLeft; _root.anchorMax = SocialUiFactory.MiddleLeft; _root.pivot = SocialUiFactory.TopLeft; _root.sizeDelta = new Vector2(256f, 0f); return true; } private static void EnsureFrameCount(int count) { while (Frames.Count < count) { Frames.Add(BuildFrame(Frames.Count)); } for (int i = 0; i < Frames.Count; i++) { bool flag = i < count; if (Frames[i].Root.activeSelf != flag) { Frames[i].Root.SetActive(flag); } } } private static Frame BuildFrame(int index) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) GameObject val = new GameObject("Member_" + index, new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)_root, false); SocialUiFactory.Place(val, SocialUiFactory.TopLeft, new Vector2(0f, (float)(-index) * 50f), new Vector2(256f, 46f)); return new Frame { Root = val, View = PartyMemberView.Create(val.transform, outlined: true) }; } } internal static class PartyListRenderer { private const float FreeSlotShade = 0.4f; private static readonly List<PartyMemberInfo> Members = new List<PartyMemberInfo>(); public static void RenderMembers(RectTransform content, PartySnapshot party, List<PartyMemberView> rows, int maxPartySize, Action<CharacterRef> onPromote, Action<CharacterRef> onKick, Action<CharacterRef, PointerEventData> onContextMenu) { SocialUiFactory.ClearChildren((Transform)(object)content); rows.Clear(); if (!party.IsInParty) { SocialListRenderer.AddEmptyRow(content, SocialLocalization.T("socialsystem_ui_no_party_hint"), 92f); SocialUiFactory.RemoveLastRowSeparator(content); return; } long localPlayerId = SocialClient.LocalPlayerId; bool flag = party.IsLeader(localPlayerId); party.CopyMembersLeaderFirst(Members, 0L); foreach (PartyMemberInfo member in Members) { CharacterRef character = member.Character; bool flag2 = character.PlayerId == localPlayerId; long playerId = character.PlayerId; RectTransform val = SocialUiFactory.CreateRow(content, "Member_" + playerId, 46f); PartyMemberView partyMemberView = PartyMemberView.Create((Transform)(object)val, outlined: false); string displayName = (flag2 ? (character.Name + " (" + SocialLocalization.T("socialsystem_ui_you") + ")") : character.Name); partyMemberView.Bind(member, party.IsLeader(character.PlayerId), displayName); GameObject hoverActions = null; if (flag && !flag2) { List<RowAction> list = new List<RowAction>(); if (member.IsConnected) { list.Add(new RowAction(SocialIcons.Promote, SocialLocalization.T("socialsystem_ui_promote"), delegate { onPromote(character); })); } list.Add(new RowAction(SocialIcons.Cross, SocialLocalization.T("socialsystem_ui_kick"), delegate { onKick(character); })); hoverActions = RowActions.Create(val, list.ToArray()); } RowInteraction.Attach(val, hoverActions, delegate(PointerEventData eventData) { onContextMenu(character, eventData); }); rows.Add(partyMemberView); } for (int num = Members.Count; num < maxPartySize; num++) { AddFreeSlot(content, num); } SocialUiFactory.RemoveLastRowSeparator(content); } public static void UpdateRows(List<PartyMemberView> rows, SocialClient client) { for (int i = 0; i < rows.Count; i++) { rows[i].Tick(client); } } private static void AddFreeSlot(RectTransform content, int slot) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SocialUiFactory.CreateRow(content, "Slot_" + slot, 46f); Image component = ((Component)val).GetComponent<Image>(); Color color = ((Graphic)component).color; color.a *= 0.4f; ((Graphic)component).color = color; } } internal sealed class PartyMemberView { public const float Height = 46f; private const float AvatarSize = 32f; private const float TextLeft = 48f; private const float CrownSize = 14f; private const float BarWidth = 170f; private const float BarHeight = 10f; private const float LevelWidth = 50f; private const float ReadySize = 18f; private const float NameRight = 168f; public const float Width = 256f; private static readonly Color InactiveNameColor = new Color(0.6f, 0.6f, 0.6f); private static readonly Color TextOutlineColor = new Color(0f, 0f, 0f, 0.85f); private readonly AvatarView _avatar; private readonly Image _crown; private readonly Text _name; private readonly Text _level; private readonly HealthBar _health; private readonly Text _reservation; private readonly ReadyIndicator _ready; private long _playerId; private string _characterName; private Color _nameColor = Color.white; private bool _connected = true; private float _reservedUntil; private string _avatarName; private PresenceStatus _avatarStatus; private int _avatarPrestige = -1; private int _shownLevel = int.MinValue; private int _shownSeconds = -1; private PartyMemberView(AvatarView avatar, Image crown, Text name, Text level, HealthBar health, Text reservation, ReadyIndicator ready) { //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) _avatar = avatar; _crown = crown; _name = name; _level = level; _health = health; _reservation = reservation; _ready = ready; } public static PartyMemberView Create(Transform parent, bool outlined) { //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_0008: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0048: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) Vector2 middleLeft = SocialUiFactory.MiddleLeft; AvatarView avatar = AvatarView.Create(parent, middleLeft, new Vector2(8f, 0f), 32f); Image val = SocialUiFactory.CreateImage(parent, "Crown", SocialUiFactory.AccentColor, middleLeft, new Vector2(48f, 9f), new Vector2(14f, 14f), SocialIcons.Crown); Text val2 = SocialUiFactory.CreateText(parent, "Name", string.Empty, 15, Color.white, (TextAnchor)3, middleLeft, new Vector2(48f, 9f), new Vector2(120f, 20f)); Text val3 = SocialUiFactory.CreateText(parent, "Level", string.Empty, 13, SocialUiFactory.MutedTextColor, (TextAnchor)5, middleLeft, new Vector2(168f, 9f), new Vector2(50f, 20f)); HealthBar health = HealthBar.Create(parent, middleLeft, new Vector2(48f, -9f), 170f, 10f); Text val4 = SocialUiFactory.CreateText(parent, "Reservation", string.Empty, 13, SocialUiFactory.MutedTextColor, (TextAnchor)3, middleLeft, new Vector2(48f, -9f), new Vector2(170f, 18f)); ReadyIndicator ready = ReadyIndicator.Create(parent, middleLeft, new Vector2(228f, 0f), 18f); ((Component)val).gameObject.SetActive(false); ((Component)val4).gameObject.SetActive(false); if (outlined) { AddOutline(val2); AddOutline(val3); AddOutline(val4); } return new PartyMemberView(avatar, val, val2, val3, health, val4, ready); } public void Bind(PartyMemberInfo member, bool isLeader, string displayName) { //IL_0074: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0146: Unknown result type (might be due to invalid IL or missing references) if (_playerId != member.Character.PlayerId) { _playerId = member.Character.PlayerId; _shownSeconds = -1; } _characterName = member.Character.Name; _reservedUntil = member.ReservedUntil; _name.text = displayName; _nameColor = ((_playerId == SocialClient.LocalPlayerId) ? SocialUiFactory.OwnNameColor : Color.white); if (_connected != member.IsConnected) { _connected = member.IsConnected; _health.SetVisible(_connected); ((Component)_reservation).gameObject.SetActive(!_connected); } if (((Component)_crown).gameObject.activeSelf != isLeader) { ((Component)_crown).gameObject.SetActive(isLeader); float num = (isLeader ? 66f : 48f); RectTransform rectTransform = ((Graphic)_name).rectTransform; rectTransform.anchoredPosition = new Vector2(num, rectTransform.anchoredPosition.y); rectTransform.sizeDelta = new Vector2(168f - num, rectTransform.sizeDelta.y); } } public void InvalidateTexts() { _shownLevel = int.MinValue; _shownSeconds = -1; } public void Tick(SocialClient client) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) PresenceInfo memberPresence = client.GetMemberPresence(_playerId); if (_avatarName != _characterName || _avatarStatus != memberPresence.Status || _avatarPrestige != memberPresence.Prestige) { _avatarName = _characterName; _avatarStatus = memberPresence.Status; _avatarPrestige = memberPresence.Prestige; _avatar.Set(_characterName, memberPresence.Status, memberPresence.Prestige); } if (_shownLevel != memberPresence.Level) { _shownLevel = memberPresence.Level; _level.text = PresenceDisplay.LevelLabel(memberPresence.Level); } bool flag = false; if (_connected) { flag = _health.Update(_playerId, client); } else { UpdateReservation(); } _ready.Update(client, _playerId); ((Graphic)_name).color = (flag ? _nameColor : InactiveNameColor); } private void UpdateReservation() { int num = Mathf.Max(0, Mathf.CeilToInt(_reservedUntil - Time.unscaledTime)); if (num != _shownSeconds) { _shownSeconds = num; _reservation.text = SocialLocalization.Format("socialsystem_ui_disconnected", $"{num / 60}:{num % 60:00}"); } } private static void AddOutline(Text text) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Outline val = ((Component)text).gameObject.AddComponent<Outline>(); ((Shadow)val).effectColor = TextOutlineColor; ((Shadow)val).effectDistance = new Vector2(1f, -1f); } } internal sealed class PartyWindow : WindowController<PartyWindowView> { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__8_0; public static Action<string> <>9__12_0; internal void <Wire>b__8_0() { SocialClient.Instance.StartReadyCheck(); } internal void <OpenInviteDialog>b__12_0(string name) { SocialClient.Instance.InviteToParty(name); } } public static readonly PartyWindow Instance = new PartyWindow(); private readonly List<PartyMemberView> _rows = new List<PartyMemberView>(); private Vector2? _dockedPosition; protected override Vector2 FlyOffset => new Vector2(0f, PartyWindowView.Size.y); private PartyWindow() { } public override void Tick() { if (base.IsOpen) { PartyListRenderer.UpdateRows(_rows, SocialClient.Instance); } } protected override PartyWindowView BuildView(Transform canvas) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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) Vector2 val = WindowDocking.PartyPosition(PartyWindowView.Size); _dockedPosition = val; return PartyWindowView.Build(canvas, val); } protected override void Wire(PartyWindowView view) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown ((UnityEvent)view.CloseButton.onClick).AddListener(new UnityAction(base.Close)); ((UnityEvent)view.InviteButton.onClick).AddListener(new UnityAction(OpenInviteDialog)); ((UnityEvent)view.LeaveButton.onClick).AddListener(new UnityAction(ConfirmLeave)); ButtonClickedEvent onClick = view.ReadyCheckButton.onClick; object obj = <>c.<>9__8_0; if (obj == null) { UnityAction val = delegate { SocialClient.Instance.StartReadyCheck(); }; <>c.<>9__8_0 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } protected override void OnOpening() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) WindowDocking.Dock(base.View.RootRect, ref _dockedPosition, WindowDocking.PartyPosition(PartyWindowView.Size)); } protected override void OnViewDestroyed() { _dockedPosition = null; _rows.Clear(); } protected override Selectable CollectNavigation(GamepadNavigation navigation) { Selectable val = navigation.AddLine((Selectable)base.View.ReadyCheckButton, (Selectable)base.View.LeaveButton, (Selectable)base.View.CloseButton); Selectable val2 = navigation.AddLine((Selectable)base.View.InviteButton); Selectable val3 = navigation.AddRows(base.View.MembersList.Content); if ((Object)(object)val3 != (Object)null) { return val3; } return ((Object)(object)val2 != (Object)null) ? val2 : val; } private void OpenInviteDialog() { base.View.NameDialog.Open(SocialLocalization.T("socialsystem_ui_invite_party_title"), delegate(string name) { SocialClient.Instance.InviteToParty(name); }, IsInOwnParty); } private static bool IsInOwnParty(string name) { foreach (PartyMemberInfo member in SocialClient.Instance.Party.Members) { if (string.Equals(member.Character.Name, name, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private void ConfirmLeave() { base.View.ConfirmDialog.Open(SocialLocalization.T("socialsystem_ui_leave_party"), SocialLocalization.T("socialsystem_ui_leave_party_text"), SocialClient.Instance.LeaveParty); } private void ConfirmPromote(CharacterRef member) { base.View.ConfirmDialog.Open(SocialLocalization.T("socialsystem_ui_promote_title"), SocialLocalization.Format("socialsystem_ui_promote_text", member.Name), delegate { SocialClient.Instance.PromoteInParty(member.PlayerId); }); } private void ConfirmKick(CharacterRef member) { base.View.ConfirmDialog.Open(SocialLocalization.T("socialsystem_ui_kick_title"), SocialLocalization.Format("socialsystem_ui_kick_text", member.Name), delegate { SocialClient.Instance.KickFromParty(member.PlayerId); }); } private void ShowMemberMenu(CharacterRef member, PointerEventData eventData) { SocialClient client = SocialClient.Instance; PartySnapshot party = client.Party; List<ContextMenuItem> list = new List<ContextMenuItem>(); if (member.PlayerId == SocialClient.LocalPlayerId) { if (party.IsInParty) { list.Add(new ContextMenuItem(SocialLocalization.T("socialsystem_ui_leave_party"), ConfirmLeave)); } } else { if (party.IsLeader(SocialClient.LocalPlayerId)) { if (party.IsConnected(member.PlayerId)) { list.Add(new ContextMenuItem(SocialLocalization.T("socialsystem_ui_promote"), delegate { ConfirmPromote(member); })); } list.Add(new ContextMenuItem(SocialLocalization.T("socialsystem_ui_kick"), delegate { ConfirmKick(member); })); } if (client.Friends.Contains(member.PlayerId)) { list.Add(new ContextMenuItem(SocialLocalization.T("socialsystem_ui_message"), delegate { SocialWindow.Instance.OpenConversationWith(member.PlayerId); })); } else { list.Add(new ContextMenuItem(SocialLocalization.T("socialsystem_ui_add_friend_title"), delegate { client.SendFriendRequest(member.Name); })); } } ContextMenuOverlay.Open(eventData, list); } protected override void Refresh() { if (!((Object)(object)base.View?.Root == (Object)null)) { SocialClient instance = SocialClient.Instance; PartySnapshot party = instance.Party; long localPlayerId = SocialClient.LocalPlayerId; int num = ((!party.IsInParty) ? 1 : party.Members.Count); ((Selectable)base.View.InviteButton).interactable = (!party.IsInParty || party.IsLeader(localPlayerId)) && num < SocialConfig.MaxPartySize; ((Selectable)base.View.LeaveButton).interactable = party.IsInParty; ((Selectable)base.View.ReadyCheckButton).interactable = party.IsInParty && party.IsLeader(localPlayerId) && !instance.ReadyCheck.IsActive; PartyListRenderer.RenderMembers(base.View.MembersList.Content, party, _rows, SocialConfig.MaxPartySize, ConfirmPromote, ConfirmKick, ShowMemberMenu); PartyListRenderer.UpdateRows(_rows, instance); InvalidateNavigation(); } } } internal sealed class PartyWindowView : IWindowView { public const float Width = 300f; public const float ContentWidth = 260f; private const float Margin = 20f; private const float HeaderButtonSize = 36f; private const float MembersHeaderTop = -62f; private const float MembersHeaderHeight = 28f; private const float MembersTop = -92f; private const float MembersHeight = 380f; private const float Height = 492f; public static readonly Vector2 Size = new Vector2(300f, 492f); public GameObject Root { get; private set; } public RectTransform RootRect => (RectTransform)Root.transform; public Text Title { get; private set; } public Button CloseButton { get; private set; } public Button LeaveButton { get; private set; } public Button ReadyCheckButton { get; private set; } public Text MembersHeader { get; private set; } public Button InviteButton { get; private set; } public ScrollList MembersList { get; private set; } public NameInputDialog NameDialog { get; private set; } public ConfirmDialog ConfirmDialog { get; private set; } public WindowFlyIn FlyIn { get; private set; } private PartyWindowView() { } public static PartyWindowView Build(Transform parent, Vector2 anchoredPosition) { //IL_000e: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0054: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) PartyWindowView partyWindowView = new PartyWindowView(); partyWindowView.Root = GUIManager.Instance.CreateWoodpanel(parent, SocialUiFactory.BottomRight, SocialUiFactory.BottomRight, Vector2.zero, 300f, 492f, true); ((Object)partyWindowView.Root).name = "SocialSystem_PartyWindow"; SocialUiFactory.PlaceWindow(partyWindowView.Root, SocialUiFactory.BottomRight, Vector2.zero, Size); partyWindowView.RootRect.anchoredPosition = anchoredPosition; partyWindowView.FlyIn = partyWindowView.Root.AddComponent<WindowFlyIn>(); Transform transform = partyWindowView.Root.transform; partyWindowView.Title = SocialUiFactory.CreateText(transform, "Title", string.Empty, 24, SocialUiFactory.AccentColor, (TextAnchor)3, SocialUiFactory.TopLeft, new Vector2(20f, -14f), new Vector2(200f, 36f), SocialUiFactory.HeaderFont); partyWindowView.CloseButton = SocialUiFactory.CreateButton(transform, "Close", "X", SocialUiFactory.TopRight, new Vector2(-14f, -14f), new Vector2(36f, 36f)); partyWindowView.LeaveButton = CreateHeaderIconButton(transform, "Leave", SocialIcons.Leave, 1); partyWindowView.ReadyCheckButton = CreateHeaderIconButton(transform, "ReadyCheck", SocialIcons.Check, 2); partyWindowView.MembersHeader = SocialUiFactory.CreateText(transform, "MembersHeader", string.Empty, 18, SocialUiFactory.AccentColor, (TextAnchor)3, SocialUiFactory.TopCenter, new Vector2(0f, -62f), new Vector2(260f, 28f)); partyWindowView.InviteButton = SocialUiFactory.CreateIconButton(transform, "Invite", SocialIcons.Plus, SocialUiFactory.TopCenter, new Vector2(116f, -62f), 28f); partyWindowView.MembersList = SocialUiFactory.CreateScrollList(transform, "Members", new Vector2(0f, -92f), new Vector2(260f, 380f)); partyWindowView.NameDialog = NameInputDialog.Build(transform, 260f); partyWindowView.ConfirmDialog = ConfirmDialog.Build(transform, 260f); partyWindowView.ApplyStaticLabels(); return partyWindowView; } public void ApplyStaticLabels() { Title.text = SocialLocalization.T("socialsystem_ui_party_title"); MembersHeader.text = SocialLocalization.T("socialsystem_ui_party_members_header"); SocialUiFactory.AddTooltip(((Component)InviteButton).gameObject, SocialLocalization.T("socialsystem_ui_invite_party_title")); SocialUiFactory.AddTooltip(((Component)LeaveButton).gameObject, SocialLocalization.T("socialsystem_ui_leave_party")); SocialUiFactory.AddTooltip(((Component)ReadyCheckButton).gameObject, SocialLocalization.T("socialsystem_ui_ready_check")); } private static Button CreateHeaderIconButton(Transform root, string name, Sprite icon, int slot) { //IL_0008: 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_002f: Unknown result type (might be due to invalid IL or missing references) Button val = SocialUiFactory.CreateButton(root, name, string.Empty, SocialUiFactory.TopRight, new Vector2(-14f - (float)slot * 42f, -14f), new Vector2(36f, 36f)); SocialUiFactory.AddIcon(val, icon, 22f); return val; } } internal static class PresenceDisplay { private const string Separator = " · "; private static readonly Color Online = new Color(0.45f, 0.85f, 0.35f); private static readonly Color Away = new Color(0.95f, 0.72f, 0.25f); private static readonly Color Invisible = new Color(0.55f, 0.66f, 0.82f); private static readonly Color Offline = new Color(0.45f, 0.45f, 0.45f); public static Color ColorOf(PresenceStatus status) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color result = (Color)(status switch { PresenceStatus.Online => Online, PresenceStatus.Away => Away, PresenceStatus.Invisible => Invisible, _ => Offline, }); if (1 == 0) { } return result; } public static string Label(PresenceStatus status) { if (1 == 0) { } string key = status switch { PresenceStatus.Online => "socialsystem_ui_status_online", PresenceStatus.Away => "socialsystem_ui_status_away", PresenceStatus.Invisible => "socialsystem_ui_status_invisible", _ => "socialsystem_ui_status_offline", }; if (1 == 0) { } return SocialLocalization.T(key); } public static string BiomeName(int biomeId) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (biomeId == 0 || Localization.instance == null) { return SocialLocalization.T("socialsystem_ui_location_unknown"); } return Localization.instance.Localize("$biome_" + ((object)(Biome)biomeId/*cast due to .constrained prefix*/).ToString().ToLowerInvariant()); } public static string LevelLabel(int level) { return (level >= 0) ? SocialLocalization.Format("socialsystem_ui_level", level) : string.Empty; } public static string Join(params string[] parts) { return string.Join(" · ", parts.Where((string p) => !string.IsNullOrEmpty(p))); } public static string LevelAndBiome(PresenceInfo presence) { return presence.IsOnline ? Join(LevelLabel(presence.Level), (presence.BiomeId != 0) ? BiomeName(presence.BiomeId) : null) : string.Empty; } public static string Detail(PresenceInfo presence) { return presence.IsOnline ? Join(Label(presence.Status), LevelAndBiome(presence)) : Label(presence.Status); } } internal sealed class PrestigeBadge { private const int ResolveRetryFrames = 120; private static Sprite _starSprite; private static Type _starType; private static float _starPixelsPerUnit; private static bool _starPreserveAspect; private static Material _starMaterial; private static int _nextResolveFrame; private readonly GameObject _root; private readonly Image _star; private readonly Text _rank; private bool _hasStarStyle; private PrestigeBadge(GameObject root, Image star, Text rank) { _root = root; _star = star; _rank = rank; } public static PrestigeBadge Create(Transform parent, Vector2 anchor, Vector2 position, float size) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005c: Unknown result type (might be due to invalid IL or missing references) Image val = SocialUiFactory.CreateImage(parent, "Prestige", SocialUiFactory.AccentColor, anchor, position, new Vector2(size, size), SocialIcons.Circle); Text rank = SocialUiFactory.CreateText(((Component)val).transform, "Rank", string.Empty, Mathf.Max(9, Mathf.RoundToInt(size * 0.55f)), Color.white, (TextAnchor)4, SocialUiFactory.Center, Vector2.zero, new Vector2(size + 8f, size)); PrestigeBadge result = new PrestigeBadge(((Component)val).gameObject, val, rank); ((Component)val).gameObject.SetActive(false); return result; } public void Set(int prestige) { bool flag = prestige > 0; if (flag) { if (!_hasStarStyle) { TryApplyStarStyle(); } string text = prestige.ToString(); if (_rank.text != text) { _rank.text = text; } } if (_root.activeSelf != flag) { _root.SetActive(flag); } } private void TryApplyStarStyle() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (TryResolveStar()) { _star.sprite = _starSprite; _star.type = _starType; _star.pixelsPerUnitMultiplier = _starPixelsPerUnit; _star.preserveAspect = _starPreserveAspect; ((Graphic)_star).material = _starMaterial; ((Graphic)_star).color = Color.white; _hasStarStyle = true; } } private static bool TryResolveStar() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_starSprite != (Object)null) { return true; } if (Time.frameCount < _nextResolveFrame) { return false; } _nextResolveFrame = Time.frameCount + 120; RectTransform val = (((Object)(object)InventoryGui.instance != (Object)null) ? InventoryGui.instance.m_crafting : null); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = ((Transform)val).Find("Level"); if ((Object)(object)val2 == (Object)null) { Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "Level") { val2 = val3; break; } } } Image val4 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponent<Image>() : null); if ((Object)(object)val4 == (Object)null || (Object)(object)val4.sprite == (Object)null) { return false; } _starSprite = val4.sprite; _starType = val4.type; _starPixelsPerUnit = val4.pixelsPerUnitMultiplier; _starPreserveAspect = val4.preserveAspect; _starMaterial = ((Graphic)val4).material; return true; } } internal sealed class Prompt { public string Key { get; } public string Title { get; } public string Text { get; } public Action OnYes { get; } public Action OnNo { get; } public float ExpiresAt { get; } public bool IsExpired => Time.unscaledTime >= ExpiresAt; public Prompt(string key, string title, string text, Action onYes, Action onNo, float timeoutSeconds) { Key = key; Title = title; Text = text; OnYes = onYes; OnNo = onNo; ExpiresAt = Time.unscaledTime + timeoutSeconds; } } internal interface IPromptHost { bool IsAvailable { get; } void ShowPrompt(Prompt prompt); void ClosePrompt(); } internal sealed class ReadyIndicator { public static readonly Color ReadyColor = new Color(0.45f, 0.85f, 0.35f); private static readonly Color NotReadyColor = new Color(0.9f, 0.3f, 0.25f); private static readonly Color PendingColor = new Color(0.95f, 0.78f, 0.3f); private static readonly Color EdgeColor = new Color(0f, 0f, 0f, 0.9f); private readonly GameObject _root; private readonly Image _icon; private readonly Text _pending; private ReadyIndicator(GameObject root, Image icon, Text pending) { _root = root; _icon = icon; _pending = pending; } public static ReadyIndicator Create(Transform parent, Vector2 anchor, Vector2 position, float size) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0086: 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_009e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Ready", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); SocialUiFactory.Place(val, anchor, position, new Vector2(size, size)); Image val2 = SocialUiFactory.CreateImage(val.transform, "Icon", Color.white, SocialUiFactory.Center, Vector2.zero, new Vector2(size, size), SocialIcons.Check); Text val3 = SocialUiFactory.CreateText(val.transform, "Pending", "?", Mathf.RoundToInt(size), PendingColor, (TextAnchor)4, SocialUiFactory.Center, Vector2.zero, new Vector2(size + 6f, size + 4f)); AddEdge(((Component)val2).gameObject); AddEdge(((Component)val3).gameObject); val.SetActive(false); return new ReadyIndicator(val, val2, val3); } public static void AddEdge(GameObject target) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Outline val = target.AddComponent<Outline>(); ((Shadow)val).effectColor = EdgeColor; ((Shadow)val).effectDistance = new Vector2(1.5f, -1.5f); } public void Update(SocialClient client, long playerId) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) ReadyState state; bool flag = client.TryGetReadyState(playerId, out state); if (_root.activeSelf != flag) { _root.SetActive(flag); } if (flag) { bool flag2 = state == ReadyState.Pending; ((Component)_pending).gameObject.SetActive(flag2); ((Component)_icon).gameObject.SetActive(!flag2); if (!flag2) { bool flag3 = state == ReadyState.Ready; _icon.sprite = (flag3 ? SocialIcons.Check : SocialIcons.Cross); ((Graphic)_icon).color = (flag3 ? ReadyColor : NotReadyColor); } } } } internal static class RichText { public static string Escape(string text) { return string.IsNullOrEmpty(text) ? string.Empty : text.Replace("<", "<\u200b"); } } internal readonly struct RowAction { public readonly Sprite Icon; public readonly string Tooltip; public readonly Action OnClick; public readonly bool Enabled; public RowAction(Sprite icon, string tooltip, Action onClick, bool enabled = true) { Icon = icon; Tooltip = tooltip; OnClick = onClick; Enabled = enabled; } } internal static class RowActions { public const float IconSize = 26f; private const float Spacing = 6f; private const float RightMargin = 8f; public static GameObject Create(RectTransform row, IReadOnlyList<RowAction> actions) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00e1: Expected O, but got Unknown GameObject val = new GameObject("Actions", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)row, false); float num = (float)actions.Count * 26f + (float)Math.Max(0, actions.Count - 1) * 6f; SocialUiFactory.Place(val, SocialUiFactory.MiddleRight, new Vector2(-8f, 0f), new Vector2(num, 26f)); for (int i = 0; i < actions.Count; i++) { RowAction action = actions[i]; Button val2 = SocialUiFactory.CreateIconButton(val.transform, "Action_" + i, action.Icon, SocialUiFactory.MiddleLeft, new Vector2((float)i * 32f, 0f), 26f, (UnityAction)delegate { action.OnClick?.Invoke(); }); ((Selectable)val2).interactable = action.Enabled; SocialUiFactory.AddTooltip(((Component)val2).gameObject, action.Tooltip); } return val; } } internal sealed class RowInteraction : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler, ISubmitHandler { private sealed class RowSelectable : Selectable { public override void OnPointerDown(PointerEventData eventData) { } } private const float HoverBlend = 0.45f; private const float MinHoverAlpha = 0.65f; private Image _background; private Color _baseColor; private bool _hovered; private bool _controllerSelected; public GameObject HoverActions { get; private set; } public Action<PointerEventData> RightClick { get; private set; } public Action DoubleClick { get; private set; } public Action Click { get; private set; } public static RowInteraction AttachPick(RectTransform row, Action pick) { RowInteraction rowInteraction = Attach(row, null, null); rowInteraction.Click = pick; return rowInteraction; } public static RowInteraction Attach(RectTransform row, GameObject hoverActions, Action<PointerEventData> rightClick, Action doubleClick = null) { //IL_003e: 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) RowInteraction rowInteraction = ((Component)row).gameObject.AddComponent<RowInteraction>(); rowInteraction._background = ((Component)row).GetComponent<Image>(); if ((Object)(object)rowInteraction._background != (Object)null) { ((Graphic)rowInteraction._background).raycastTarget = true; rowInteraction._baseColor = ((Graphic)rowInteraction._background).color; } rowInteraction.HoverActions = hoverActions; rowInteraction.RightClick = rightClick; rowInteraction.DoubleClick = doubleClick; if ((Object)(object)hoverActions != (Object)null) { hoverActions.SetActive(false); } ((Selectable)((Component)row).gameObject.AddComponent<RowSelectable>()).transition = (Transition)0; return rowInteraction; } public void OnPointerEnter(PointerEventData eventData) { _hovered = true; ApplyHighlight(); } public void OnPointerExit(PointerEventData eventData) { _hovered = false; ApplyHighlight(); } public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((int)eventData.button == 1) { RightClick?.Invoke(eventData); } else if ((int)eventData.button == 0) { if (Click != null) { Click(); } else if (eventData.clickCount == 2) { DoubleClick?.Invoke(); } } } public void OnSubmit(BaseEventData eventData) { if (ZInput.IsGamepadActive()) { Action action = Click ?? DoubleClick; if (action != null) { action(); } else { OpenContextMenu(); } } } public void OpenContextMenu() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (RightClick != null && !((Object)(object)EventSystem.current == (Object)null)) { RectTransform val = (RectTransform)((Component)this).transform; Action<PointerEventData> rightClick = RightClick; PointerEventData val2 = new PointerEventData(EventSystem.current); Rect rect = val.rect; val2.position = Vector2.op_Implicit(((Transform)val).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center))); rightClick(val2); } } public void SetControllerSelected(bool selected) { _controllerSelected = selected; ApplyHighlight(); } private void ApplyHighlight() { //IL_0074: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) bool flag = _hovered || _controllerSelected; if ((Object)(object)_background != (Object)null) { if (flag) { Color color = Color.Lerp(_baseColor, SocialUiFactory.AccentColor, 0.45f); color.a = Mathf.Max(_baseColor.a, 0.65f); ((Graphic)_background).color = color; } else { ((Graphic)_background).color = _baseColor; } } if ((Object)(object)HoverActions != (Object)null && HoverActions.activeSelf != flag) { HoverActions.SetActive(flag); } } } internal static class SocialFeedback { public static void Register() { SocialClient instance = SocialClient.Instance; instance.FriendRequestReceived += delegate(CharacterRef requester) { Notifications.Show("socialsystem_msg_friend_request_received", requester.Name); }; instance.FriendAdded += delegate(CharacterRef friend) { Notifications.Show("socialsystem_msg_friend_added", friend.Name); }; instance.FriendRemovedBy += delegate(CharacterRef former) { Notifications.Show("socialsystem_msg_friend_removed_by", former.Name); }; instance.FriendCameOnline += delegate(CharacterRef friend) { Notifications.Show("socialsystem_msg_friend_online", friend.Name); }; instance.PartyInviteReceived += OnPartyInviteReceived; instance.ReadyCheckStarted += OnReadyCheckStarted; instance.ReadyCheckAnswerObsolete += delegate(int checkId) { SocialPrompts.Cancel(ReadyCheckPromptKey(checkId)); }; instance.PartyChatReceived += delegate(CharacterRef sender, string text, bool own) { ChatLog.AppendPartyMessage(sender.Name, text, own); }; instance.DirectMessageAdded += delegate(CharacterRef partner, string text, bool outgoing) { ChatLog.AppendDirectMessage(partner.Name, text, outgoing); }; } private static void OnPartyInviteReceived(CharacterRef inviter, float timeoutSeconds) { Notifications.Show("socialsystem_msg_party_invite_received", inviter.Name); SocialClient client = SocialClient.Instance; long playerId = inviter.PlayerId; SocialPrompts.Enqueue(new Prompt("invite:" + playerId, SocialLocalization.T("socialsystem_popup_party_invite_title"), SocialLocalization.Format("socialsystem_popup_party_invite_text", inviter.Name), delegate { client.RespondPartyInvite(inviter.PlayerId, accept: true); }, delegate { client.RespondPartyInvite(inviter.PlayerId, accept: false); }, timeoutSeconds)); } private static void OnReadyCheckStarted(ReadyCheckSnapshot check, CharacterRef initiator, float secondsLeft) { long localPlay