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 PingMaker v1.2.0
PingMaker.dll
Decompiled 12 hours 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.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PingMaker.Configuration; using PingMaker.Core; using PingMaker.Network; using PingMaker.UI; using PingMaker.Visuals; using Splatform; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PingMaker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+7b562fb5af2c7a323055e05d656470ea16ae2898")] [assembly: AssemblyProduct("PingMaker")] [assembly: AssemblyTitle("PingMaker")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/UncleBugDev/PingMaker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PingMaker { [BepInPlugin("com.author.pingmaker", "PingMaker", "1.2.0")] public class PingMakerPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Game), "Start")] private static class GameStartPatch { private static void Postfix() { try { NetworkSync.RegisterRPC(); PingManagerUI.EnsureExists(); if ((Object)(object)PingManagerUI.Instance != (Object)null) { RadialMenu.EnsureExists(((Component)PingManagerUI.Instance).transform); } PingSettingsGUI.EnsureExists(); PingController.EnsureExists(); Log.LogInfo((object)"[PingMaker] Системы UI, настроек, ввода и сетевой синхронизации запущены."); } catch (Exception arg) { Log.LogError((object)string.Format("[{0}] Ошибка при инициализации в Game.Start: {1}", "PingMaker", arg)); } } } [HarmonyPatch(typeof(Game), "OnDestroy")] private static class GameDestroyPatch { private static void Prefix() { NetworkSync.Reset(); } } [HarmonyPatch(typeof(Player), "SetControls")] private static class SuppressAltAttackOnPingPatch { private static void Prefix(ref bool secondaryAttack, ref bool secondaryAttackHold) { if ((Object)(object)PingController.Instance != (Object)null && PingController.Instance.IsSuppressingAltAttack) { secondaryAttack = false; secondaryAttackHold = false; } } } [HarmonyPatch(typeof(PlayerController), "TakeInput")] private static class SuppressPlayerInputWhenSettingsOpenPatch { private static void Postfix(ref bool __result) { if (PingSettingsGUI.IsOpen) { __result = false; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] private static class GameCameraUpdateMouseCapturePatch { private static bool Prefix() { if (PingSettingsGUI.IsOpen) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); return false; } return true; } } [HarmonyPatch(typeof(Minimap), "UpdatePins")] private static class MinimapUpdatePinsPatch { private static void Postfix() { PingManagerUI.Instance?.UpdateMapPinsColor(); if ((Object)(object)Minimap.instance != (Object)null) { PlayerMapTracker.UpdateMinimap(Minimap.instance); } } } [HarmonyPatch(typeof(Minimap), "UpdatePlayerMarker")] private static class MinimapUpdatePlayerMarkerPatch { private static void Postfix() { if ((Object)(object)Minimap.instance != (Object)null) { PlayerMapTracker.UpdateLocalPlayer(Minimap.instance); } } } public const string ModGUID = "com.author.pingmaker"; public const string ModName = "PingMaker"; public const string ModVersion = "1.2.0"; private Harmony _harmony; public static PingMakerPlugin Instance { get; private set; } public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Instance = this; ModConfig.Init(((BaseUnityPlugin)this).Config); _harmony = new Harmony("com.author.pingmaker"); _harmony.PatchAll(); Log.LogInfo((object)"[PingMaker] Мод v1.2.0 успешно инициализирован."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace PingMaker.Visuals { public class CreatureHighlighter : MonoBehaviour { private Character m_character; private Color m_baseColor; private float m_duration; private float m_elapsed; private bool m_isInitialized; private static readonly int s_emissionColor = ShaderProps._EmissionColor; private static readonly int s_mainColor = ShaderProps._Color; public static void ApplyHighlight(Character character, Color color, float duration) { //IL_003d: 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) if (!((Object)(object)character == (Object)null) && !((Object)(object)((Component)character).gameObject == (Object)null)) { CreatureHighlighter component = ((Component)character).GetComponent<CreatureHighlighter>(); if ((Object)(object)component != (Object)null) { component.Refresh(color, duration); } else { ((Component)character).gameObject.AddComponent<CreatureHighlighter>().Initialize(character, color, duration); } } } private void Initialize(Character character, Color color, float duration) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0069: Unknown result type (might be due to invalid IL or missing references) m_character = character; m_baseColor = color; m_duration = ((duration > 0f) ? duration : 18f); m_elapsed = 0f; m_isInitialized = true; Character character2 = m_character; character2.m_onDeath = (Action)Delegate.Combine(character2.m_onDeath, new Action(OnDeath)); ApplyMaterialProperties(m_baseColor * 0.28f); } public void Refresh(Color newColor, float duration) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0034: Unknown result type (might be due to invalid IL or missing references) m_baseColor = newColor; m_duration = ((duration > 0f) ? duration : 18f); m_elapsed = 0f; ApplyMaterialProperties(m_baseColor * 0.28f); } private void OnDeath() { Object.Destroy((Object)(object)this); } private void Update() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00c1: Unknown result type (might be due to invalid IL or missing references) if (!m_isInitialized || (Object)(object)m_character == (Object)null) { Object.Destroy((Object)(object)this); return; } if (m_character.IsDead() || (Object)(object)((Component)m_character).gameObject == (Object)null) { Object.Destroy((Object)(object)this); return; } m_elapsed += Time.deltaTime; if (m_elapsed >= m_duration) { Object.Destroy((Object)(object)this); return; } float num = 1f; float num2 = m_duration - m_elapsed; if (num2 < 2f) { num = Mathf.Clamp01(num2 / 2f); } float num3 = 0.28f + 0.08f * Mathf.Sin(Time.time * 4f); Color emission = m_baseColor * (num3 * num); ApplyMaterialProperties(emission); } private void ApplyMaterialProperties(Color emission) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_character == (Object)null) && !((Object)(object)((Component)m_character).gameObject == (Object)null) && (Object)(object)MaterialMan.instance != (Object)null) { MaterialMan.instance.SetValue<Color>(((Component)m_character).gameObject, s_emissionColor, emission, false); } } private void OnDestroy() { if ((Object)(object)m_character != (Object)null) { Character character = m_character; character.m_onDeath = (Action)Delegate.Remove(character.m_onDeath, new Action(OnDeath)); if ((Object)(object)((Component)m_character).gameObject != (Object)null && (Object)(object)MaterialMan.instance != (Object)null) { MaterialMan.instance.ResetValue(((Component)m_character).gameObject, s_emissionColor); } } } } public class PingMarker3D : MonoBehaviour { private PingPackageData m_data; private Transform? m_trackedTransform; private Character? m_targetCharacter; private Vector3 m_staticWorldPos; private float m_duration; private float m_elapsed; private RectTransform m_rect; private CanvasGroup m_canvasGroup; private Image m_laserHazeImage; private RectTransform m_laserHazeRect; private Image m_laserPointImage; private RectTransform m_laserPointRect; private RectTransform? m_creatureRingRect; private Image? m_creatureRingImage; private RectTransform? m_creatureArrowRect; private Image? m_creatureArrowImage; private Image m_arrowImage; private RectTransform m_arrowRect; private Text m_playerText; private Text m_distanceText; private Text m_titleText; public PingPackageData Data => m_data; public string SenderName => m_data.SenderName; public PinData? MapPin { get; set; } public void Setup(PingPackageData data, Transform? trackedTarget = null, PinData? mapPin = null, Character? targetCharacter = null) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0091: 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) m_data = data; m_trackedTransform = trackedTarget; m_staticWorldPos = data.WorldPosition; m_duration = ((data.Duration > 0f) ? data.Duration : 20f); m_elapsed = 0f; MapPin = mapPin; m_targetCharacter = targetCharacter; if ((Object)(object)m_targetCharacter != (Object)null) { Character? targetCharacter2 = m_targetCharacter; targetCharacter2.m_onDeath = (Action)Delegate.Combine(targetCharacter2.m_onDeath, new Action(OnTargetDied)); } else if (data.TargetCreatureZDOID != ZDOID.None && (Object)(object)ZNetScene.instance != (Object)null) { GameObject val = ZNetScene.instance.FindInstance(data.TargetCreatureZDOID); if ((Object)(object)val != (Object)null) { m_targetCharacter = val.GetComponent<Character>(); if ((Object)(object)m_targetCharacter != (Object)null) { Character? targetCharacter3 = m_targetCharacter; targetCharacter3.m_onDeath = (Action)Delegate.Combine(targetCharacter3.m_onDeath, new Action(OnTargetDied)); } } } BuildUI(); } private void OnTargetDied() { Object.Destroy((Object)(object)((Component)this).gameObject); } private void BuildUI() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00af: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Expected O, but got Unknown //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Expected O, but got Unknown //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Expected O, but got Unknown //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07a6: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) m_rect = ((Component)this).gameObject.AddComponent<RectTransform>(); m_rect.sizeDelta = new Vector2(100f, 100f); m_rect.pivot = new Vector2(0.5f, 0.5f); m_canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>(); GameObject val = new GameObject("LaserHaze", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); m_laserHazeRect = val.GetComponent<RectTransform>(); m_laserHazeRect.sizeDelta = new Vector2(72f, 72f); m_laserHazeRect.anchoredPosition = Vector2.zero; m_laserHazeImage = val.GetComponent<Image>(); m_laserHazeImage.sprite = ProceduralIcons.GetLaserHazeSprite(); Color pingColor = m_data.PingColor; pingColor.a = 0.65f; ((Graphic)m_laserHazeImage).color = pingColor; ((Graphic)m_laserHazeImage).raycastTarget = false; GameObject val2 = new GameObject("LaserPoint", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(((Component)this).transform, false); m_laserPointRect = val2.GetComponent<RectTransform>(); m_laserPointRect.sizeDelta = new Vector2(26f, 26f); m_laserPointRect.anchoredPosition = Vector2.zero; m_laserPointImage = val2.GetComponent<Image>(); m_laserPointImage.sprite = ProceduralIcons.GetLaserPointSprite(); ((Graphic)m_laserPointImage).color = m_data.PingColor; ((Graphic)m_laserPointImage).raycastTarget = false; if (m_data.Category == PingCategory.Creature && ModConfig.TargetReticleMode.Value != 2) { GameObject val3 = new GameObject("CreatureRing", new Type[2] { typeof(RectTransform), typeof(Image) }); val3.transform.SetParent(((Component)this).transform, false); m_creatureRingRect = val3.GetComponent<RectTransform>(); m_creatureRingRect.sizeDelta = new Vector2(62f, 62f); m_creatureRingRect.anchoredPosition = Vector2.zero; m_creatureRingImage = val3.GetComponent<Image>(); m_creatureRingImage.sprite = ProceduralIcons.GetLockonCircleSprite(); ((Graphic)m_creatureRingImage).color = m_data.PingColor; ((Graphic)m_creatureRingImage).raycastTarget = false; GameObject val4 = new GameObject("CreatureArrow", new Type[2] { typeof(RectTransform), typeof(Image) }); val4.transform.SetParent(((Component)this).transform, false); m_creatureArrowRect = val4.GetComponent<RectTransform>(); m_creatureArrowRect.sizeDelta = new Vector2(24f, 24f); if (ModConfig.ReticleArrowStyle.Value == 0) { m_creatureArrowRect.anchoredPosition = new Vector2(36f, 36f); ((Transform)m_creatureArrowRect).localRotation = Quaternion.Euler(0f, 0f, -45f); } else { m_creatureArrowRect.anchoredPosition = new Vector2(0f, 44f); ((Transform)m_creatureArrowRect).localRotation = Quaternion.identity; } m_creatureArrowImage = val4.GetComponent<Image>(); m_creatureArrowImage.sprite = ProceduralIcons.GetLockonArrowSprite(); ((Graphic)m_creatureArrowImage).color = m_data.PingColor; ((Graphic)m_creatureArrowImage).raycastTarget = false; } GameObject val5 = new GameObject("Arrow", new Type[2] { typeof(RectTransform), typeof(Image) }); val5.transform.SetParent(((Component)this).transform, false); m_arrowRect = val5.GetComponent<RectTransform>(); m_arrowRect.sizeDelta = new Vector2(24f, 24f); m_arrowRect.anchoredPosition = new Vector2(0f, 32f); m_arrowImage = val5.GetComponent<Image>(); m_arrowImage.sprite = ProceduralIcons.GetPointerArrowSprite(); ((Graphic)m_arrowImage).color = m_data.PingColor; val5.SetActive(false); Font font = Font.CreateDynamicFontFromOSFont("Arial", 14); if (ModConfig.ShowPlayerName.Value && !string.IsNullOrEmpty(m_data.SenderName)) { GameObject val6 = new GameObject("PlayerText", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val6.transform.SetParent(((Component)this).transform, false); RectTransform component = val6.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(180f, 22f); component.anchoredPosition = new Vector2(0f, 30f); m_playerText = val6.GetComponent<Text>(); m_playerText.font = font; m_playerText.fontSize = 13; m_playerText.fontStyle = (FontStyle)1; m_playerText.alignment = (TextAnchor)4; m_playerText.text = m_data.SenderName; ((Graphic)m_playerText).color = m_data.PingColor; Outline component2 = val6.GetComponent<Outline>(); ((Shadow)component2).effectColor = new Color(0f, 0f, 0f, 0.9f); ((Shadow)component2).effectDistance = new Vector2(1f, -1f); } if (!string.IsNullOrEmpty(m_data.TargetName)) { GameObject val7 = new GameObject("TitleText", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val7.transform.SetParent(((Component)this).transform, false); RectTransform component3 = val7.GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(200f, 22f); component3.anchoredPosition = new Vector2(0f, 46f); m_titleText = val7.GetComponent<Text>(); m_titleText.font = font; m_titleText.fontSize = 12; m_titleText.fontStyle = (FontStyle)1; m_titleText.alignment = (TextAnchor)4; string text = ((m_data.TargetLevel > 1) ? $" (★{m_data.TargetLevel - 1})" : ""); m_titleText.text = m_data.TargetName + text; ((Graphic)m_titleText).color = Color.white; Outline component4 = val7.GetComponent<Outline>(); ((Shadow)component4).effectColor = new Color(0.8f, 0.1f, 0.1f, 0.95f); ((Shadow)component4).effectDistance = new Vector2(1f, -1f); } if (ModConfig.ShowDistance.Value) { GameObject val8 = new GameObject("DistanceText", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val8.transform.SetParent(((Component)this).transform, false); RectTransform component5 = val8.GetComponent<RectTransform>(); component5.sizeDelta = new Vector2(140f, 20f); component5.anchoredPosition = new Vector2(0f, -28f); m_distanceText = val8.GetComponent<Text>(); m_distanceText.font = font; m_distanceText.fontSize = 12; m_distanceText.fontStyle = (FontStyle)1; m_distanceText.alignment = (TextAnchor)4; m_distanceText.text = "[0m]"; ((Graphic)m_distanceText).color = Color.white; Outline component6 = val8.GetComponent<Outline>(); ((Shadow)component6).effectColor = new Color(0f, 0f, 0f, 0.9f); ((Shadow)component6).effectDistance = new Vector2(1f, -1f); } } private void Update() { //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_026c: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_targetCharacter != (Object)null) { if (m_targetCharacter.IsDead() || (Object)(object)((Component)m_targetCharacter).gameObject == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } } else if (m_data.TargetCreatureZDOID != ZDOID.None && (Object)(object)ZNetScene.instance != (Object)null) { GameObject val = ZNetScene.instance.FindInstance(m_data.TargetCreatureZDOID); if ((Object)(object)val != (Object)null) { m_targetCharacter = val.GetComponent<Character>(); if ((Object)(object)m_targetCharacter != (Object)null) { m_trackedTransform = ((Component)m_targetCharacter).transform; Character? targetCharacter = m_targetCharacter; targetCharacter.m_onDeath = (Action)Delegate.Combine(targetCharacter.m_onDeath, new Action(OnTargetDied)); if (m_targetCharacter.IsDead()) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } } } } m_elapsed += Time.deltaTime; if (m_elapsed >= m_duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num = m_duration - m_elapsed; if (num < 2f && (Object)(object)m_canvasGroup != (Object)null) { m_canvasGroup.alpha = Mathf.Clamp01(num / 2f); } Camera mainCamera = Utils.GetMainCamera(); if ((Object)(object)mainCamera == (Object)null) { return; } Vector3 val2; if (!((Object)(object)m_targetCharacter != (Object)null) || !((Object)(object)((Component)m_targetCharacter).gameObject != (Object)null)) { val2 = ((!((Object)(object)m_trackedTransform != (Object)null)) ? m_staticWorldPos : (m_trackedTransform.position + Vector3.up * 0.8f)); } else { try { val2 = m_targetCharacter.GetCenterPoint() + Vector3.up * 0.2f; } catch { val2 = ((Component)m_targetCharacter).transform.position + Vector3.up * 1.2f; } } float num2 = Vector3.Distance(((Component)mainCamera).transform.position, val2); if ((Object)(object)m_distanceText != (Object)null) { m_distanceText.text = $"[{Mathf.RoundToInt(num2)}m]"; } Vector3 val3 = mainCamera.WorldToScreenPoint(val2); bool num3 = val3.z <= 0f; if (num3) { val3.x = 0f - val3.x; val3.y = 0f - val3.y; } float num4 = Screen.width; float num5 = Screen.height; float num6 = 50f * ModConfig.MarkerScale.Value; Vector2 val6 = default(Vector2); if ((num3 || val3.x < num6 || val3.x > num4 - num6 || val3.y < num6 || val3.y > num5 - num6) && ModConfig.ShowOffscreenArrow.Value) { Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(num4 * 0.5f, num5 * 0.5f); Vector2 val5 = new Vector2(val3.x, val3.y) - val4; if (((Vector2)(ref val5)).sqrMagnitude < 0.001f) { val5 = Vector2.up; } ((Vector2)(ref val5)).Normalize(); float num7 = num4 * 0.5f - num6; float num8 = num5 * 0.5f - num6; float num9 = Mathf.Abs(num7 / val5.x); float num10 = Mathf.Abs(num8 / val5.y); float num11 = Mathf.Min(num9, num10); val6 = val4 + val5 * num11; if ((Object)(object)m_arrowImage != (Object)null && (Object)(object)m_arrowRect != (Object)null) { ((Component)m_arrowImage).gameObject.SetActive(true); float num12 = Mathf.Atan2(val5.y, val5.x) * 57.29578f - 90f; ((Transform)m_arrowRect).localRotation = Quaternion.Euler(0f, 0f, num12); m_arrowRect.anchoredPosition = val5 * 30f; } if ((Object)(object)m_playerText != (Object)null) { ((Component)m_playerText).gameObject.SetActive(false); } if ((Object)(object)m_titleText != (Object)null) { ((Component)m_titleText).gameObject.SetActive(false); } } else { ((Vector2)(ref val6))..ctor(Mathf.Clamp(val3.x, num6, num4 - num6), Mathf.Clamp(val3.y, num6, num5 - num6)); if ((Object)(object)m_arrowImage != (Object)null) { ((Component)m_arrowImage).gameObject.SetActive(false); } if ((Object)(object)m_playerText != (Object)null) { ((Component)m_playerText).gameObject.SetActive(true); } if ((Object)(object)m_titleText != (Object)null) { ((Component)m_titleText).gameObject.SetActive(true); } } ((Transform)m_rect).position = Vector2.op_Implicit(val6); float num13 = 1f + 0.07f * Mathf.Sin(Time.time * 5f); float num14 = ModConfig.MarkerScale.Value * num13; ((Transform)m_rect).localScale = new Vector3(num14, num14, 1f); if ((Object)(object)m_laserHazeRect != (Object)null) { float num15 = 1f + 0.15f * Mathf.Sin(Time.time * 4f); ((Transform)m_laserHazeRect).localScale = new Vector3(num15, num15, 1f); } if ((Object)(object)m_creatureRingRect != (Object)null) { ((Transform)m_creatureRingRect).Rotate(0f, 0f, -20f * Time.deltaTime); } if ((Object)(object)m_creatureArrowRect != (Object)null) { float num16 = Mathf.Sin(Time.time * 8f) * 3f; if (ModConfig.ReticleArrowStyle.Value == 0) { m_creatureArrowRect.anchoredPosition = new Vector2(36f + num16 * 0.707f, 36f + num16 * 0.707f); ((Transform)m_creatureArrowRect).localRotation = Quaternion.Euler(0f, 0f, -45f); } else { m_creatureArrowRect.anchoredPosition = new Vector2(0f, 44f + num16); ((Transform)m_creatureArrowRect).localRotation = Quaternion.identity; } } } private void OnDestroy() { if ((Object)(object)m_targetCharacter != (Object)null) { Character? targetCharacter = m_targetCharacter; targetCharacter.m_onDeath = (Action)Delegate.Remove(targetCharacter.m_onDeath, new Action(OnTargetDied)); m_targetCharacter = null; } if (MapPin != null && (Object)(object)Minimap.instance != (Object)null) { Minimap.instance.RemovePin(MapPin); MapPin = null; } } } public static class PlayerMapTracker { private static readonly Dictionary<string, Vector3> s_lastPlayerPositions = new Dictionary<string, Vector3>(StringComparer.OrdinalIgnoreCase); private static readonly FieldRef<Minimap, List<PinData>> s_playerPinsRef = AccessTools.FieldRefAccess<Minimap, List<PinData>>("m_playerPins"); public static void UpdateMinimap(Minimap map) { if (!((Object)(object)map == (Object)null) && ModConfig.ColorizeMapPlayers.Value) { UpdateLocalPlayer(map); UpdateOtherPlayers(map); } } public static void UpdateLocalPlayer(Minimap map) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) if ((Object)(object)map == (Object)null || !ModConfig.ColorizeMapPlayers.Value) { return; } Color activeColor = PlayerColors.GetActiveColor(); if ((Object)(object)map.m_smallMarker != (Object)null) { Image[] componentsInChildren = ((Component)map.m_smallMarker).GetComponentsInChildren<Image>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Graphic)componentsInChildren[i]).color = activeColor; } } if ((Object)(object)map.m_largeMarker != (Object)null) { Image[] componentsInChildren2 = ((Component)map.m_largeMarker).GetComponentsInChildren<Image>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { ((Graphic)componentsInChildren2[j]).color = activeColor; } } } private static void UpdateOtherPlayers(Minimap map) { //IL_005c: 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_009a: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) List<PinData> list; try { list = s_playerPinsRef.Invoke(map); } catch { return; } if (list == null || list.Count == 0) { return; } Sprite playerArrowMarkerSprite = ProceduralIcons.GetPlayerArrowMarkerSprite(); List<Player> allPlayers = Player.GetAllPlayers(); for (int i = 0; i < list.Count; i++) { PinData val = list[i]; if (val == null || string.IsNullOrEmpty(val.m_name)) { continue; } Color playerColor = NetworkSync.GetPlayerColor(val.m_name); if ((Object)(object)val.m_iconElement != (Object)null) { if ((Object)(object)val.m_iconElement.sprite != (Object)(object)playerArrowMarkerSprite) { val.m_iconElement.sprite = playerArrowMarkerSprite; } ((Graphic)val.m_iconElement).color = playerColor; } PinNameData namePinData = val.m_NamePinData; if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null) { ((Graphic)val.m_NamePinData.PinNameText).color = playerColor; } if (!((Object)(object)val.m_uiElement != (Object)null)) { continue; } Player val2 = null; if (allPlayers != null) { for (int j = 0; j < allPlayers.Count; j++) { if ((Object)(object)allPlayers[j] != (Object)null && allPlayers[j].GetPlayerName() == val.m_name) { val2 = allPlayers[j]; break; } } } Vector3 value; if ((Object)(object)val2 != (Object)null) { float y = ((Component)val2).transform.eulerAngles.y; ((Transform)val.m_uiElement).rotation = Quaternion.Euler(0f, 0f, 0f - y); } else if (s_lastPlayerPositions.TryGetValue(val.m_name, out value)) { Vector3 val3 = val.m_pos - value; if (((Vector3)(ref val3)).sqrMagnitude > 0.04f) { float num = Mathf.Atan2(val3.x, val3.z) * 57.29578f; ((Transform)val.m_uiElement).rotation = Quaternion.Euler(0f, 0f, 0f - num); } } s_lastPlayerPositions[val.m_name] = val.m_pos; } } } public static class PlayerNameColorizer { [HarmonyPatch(typeof(EnemyHud), "UpdateHuds")] public static class EnemyHud_UpdateHuds_Patch { private static readonly FieldInfo s_hudsField = AccessTools.Field(typeof(EnemyHud), "m_huds"); private static readonly FieldInfo s_nameField = AccessTools.Field(AccessTools.Inner(typeof(EnemyHud), "HudData"), "m_name"); public static void Postfix(EnemyHud __instance) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (s_hudsField == null || s_nameField == null || (Object)(object)__instance == (Object)null || !(s_hudsField.GetValue(__instance) is IDictionary dictionary)) { return; } foreach (DictionaryEntry item in dictionary) { object key = item.Key; Character val = (Character)((key is Character) ? key : null); if (val == null || !val.IsPlayer()) { continue; } object value = item.Value; if (value != null) { object? value2 = s_nameField.GetValue(value); TextMeshProUGUI val2 = (TextMeshProUGUI)((value2 is TextMeshProUGUI) ? value2 : null); if ((Object)(object)val2 != (Object)null) { Color playerColor = NetworkSync.GetPlayerColor(val.GetHoverName()); ((Graphic)val2).color = playerColor; } } } } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] public static class Hud_UpdateCrosshair_Patch { public static void Postfix(Hud __instance, Player player) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_hoverName == (Object)null || (Object)(object)player == (Object)null) { return; } GameObject hoverObject = ((Humanoid)player).GetHoverObject(); if ((Object)(object)hoverObject != (Object)null) { Player componentInParent = hoverObject.GetComponentInParent<Player>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)player) { Color playerColor = NetworkSync.GetPlayerColor(componentInParent.GetPlayerName()); ((Graphic)__instance.m_hoverName).color = playerColor; return; } } ((Graphic)__instance.m_hoverName).color = Color.white; } } } } namespace PingMaker.UI { public class PingManagerUI : MonoBehaviour { private Canvas m_canvas; private CanvasScaler m_scaler; private readonly List<PingMarker3D> m_activeMarkers = new List<PingMarker3D>(); private static AudioClip? s_pingAudioClip; public static PingManagerUI? Instance { get; private set; } public static void EnsureExists() { //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_001e: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("PingMaker_UI_Root"); Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<PingManagerUI>(); } } private void Awake() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) Instance = this; m_canvas = ((Component)this).gameObject.AddComponent<Canvas>(); m_canvas.renderMode = (RenderMode)0; m_canvas.sortingOrder = 450; m_scaler = ((Component)this).gameObject.AddComponent<CanvasScaler>(); m_scaler.uiScaleMode = (ScaleMode)1; m_scaler.referenceResolution = new Vector2(1920f, 1080f); m_scaler.matchWidthOrHeight = 0.5f; ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); TargetLockonReticle.EnsureExists(((Component)this).transform); } public void SpawnPing(PingPackageData data) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //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_0073: 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_011a: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) CleanupPlayerPings(data.SenderName, ModConfig.MaxActivePingsPerPlayer.Value - 1); GameObject val = new GameObject($"PingMarker_{data.SenderName}_{Time.time}"); val.transform.SetParent(((Component)this).transform, false); Transform trackedTarget = null; Character val2 = null; if (data.TargetCreatureZDOID != ZDOID.None && (Object)(object)ZNetScene.instance != (Object)null) { GameObject val3 = ZNetScene.instance.FindInstance(data.TargetCreatureZDOID); if ((Object)(object)val3 != (Object)null) { val2 = val3.GetComponent<Character>(); if ((Object)(object)val2 != (Object)null) { trackedTarget = ((Component)val2).transform; CreatureHighlighter.ApplyHighlight(val2, data.PingColor, ModConfig.CreatureHighlightDuration.Value); } } } PinData val4 = null; if (ModConfig.SyncToMinimap.Value && (Object)(object)Minimap.instance != (Object)null) { try { string text = ((!string.IsNullOrEmpty(data.TargetName)) ? (data.SenderName + " (" + data.TargetName + ")") : (data.SenderName + ": Пинг")); val4 = Minimap.instance.AddPin(data.WorldPosition, (PinType)12, text, false, false, 0L, default(PlatformUserID)); if (val4 != null) { val4.m_animate = true; val4.m_doubleSize = true; Sprite sprite = (val4.m_icon = ProceduralIcons.GetWhiteMapPingSprite()); if ((Object)(object)val4.m_iconElement != (Object)null) { val4.m_iconElement.sprite = sprite; ((Graphic)val4.m_iconElement).color = data.PingColor; } } } catch (Exception ex) { PingMakerPlugin.Log.LogWarning((object)("[PingMaker] Ошибка создания метки на карте: " + ex.Message)); } } PingMarker3D pingMarker3D = val.AddComponent<PingMarker3D>(); pingMarker3D.Setup(data, trackedTarget, val4, val2); m_activeMarkers.Add(pingMarker3D); PlayPingAudio(); } public void UpdateMapPinsColor() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) Sprite whiteMapPingSprite = ProceduralIcons.GetWhiteMapPingSprite(); for (int i = 0; i < m_activeMarkers.Count; i++) { PingMarker3D pingMarker3D = m_activeMarkers[i]; if (!((Object)(object)pingMarker3D != (Object)null) || pingMarker3D.MapPin == null) { continue; } if ((Object)(object)pingMarker3D.MapPin.m_icon != (Object)(object)whiteMapPingSprite) { pingMarker3D.MapPin.m_icon = whiteMapPingSprite; } if ((Object)(object)pingMarker3D.MapPin.m_iconElement != (Object)null) { if ((Object)(object)pingMarker3D.MapPin.m_iconElement.sprite != (Object)(object)whiteMapPingSprite) { pingMarker3D.MapPin.m_iconElement.sprite = whiteMapPingSprite; } ((Graphic)pingMarker3D.MapPin.m_iconElement).color = pingMarker3D.Data.PingColor; } PinNameData namePinData = pingMarker3D.MapPin.m_NamePinData; if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null) { ((Graphic)pingMarker3D.MapPin.m_NamePinData.PinNameText).color = pingMarker3D.Data.PingColor; } } } private void CleanupPlayerPings(string senderName, int maxAllowed) { if (maxAllowed < 0) { maxAllowed = 0; } List<PingMarker3D> list = new List<PingMarker3D>(); for (int num = m_activeMarkers.Count - 1; num >= 0; num--) { if ((Object)(object)m_activeMarkers[num] == (Object)null) { m_activeMarkers.RemoveAt(num); } else if (m_activeMarkers[num].SenderName == senderName) { list.Add(m_activeMarkers[num]); } } while (list.Count > maxAllowed) { PingMarker3D pingMarker3D = list[list.Count - 1]; list.RemoveAt(list.Count - 1); m_activeMarkers.Remove(pingMarker3D); if ((Object)(object)pingMarker3D != (Object)null) { Object.Destroy((Object)(object)((Component)pingMarker3D).gameObject); } } } private void PlayPingAudio() { //IL_0046: 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_004b: 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) if (ModConfig.AudioVolume.Value <= 0.01f) { return; } try { if ((Object)(object)s_pingAudioClip == (Object)null) { s_pingAudioClip = CreateProceduralPingClip(); } Camera mainCamera = Utils.GetMainCamera(); Vector3 val = (((Object)(object)mainCamera != (Object)null) ? ((Component)mainCamera).transform.position : Vector3.zero); AudioSource.PlayClipAtPoint(s_pingAudioClip, val, ModConfig.AudioVolume.Value); } catch { } } private static AudioClip CreateProceduralPingClip() { int num = 5292; float[] array = new float[num]; for (int i = 0; i < num; i++) { float num2 = (float)i / 44100f; float num3 = Mathf.Exp((0f - num2) * 22f); float num4 = Mathf.Sin(6206.3423f * num2) * 0.6f + Mathf.Sin(MathF.PI * 2637f * num2) * 0.4f; array[i] = num4 * num3; } AudioClip obj = AudioClip.Create("PingMaker_Chime", num, 1, 44100, false); obj.SetData(array, 0); return obj; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } public class PingSettingsGUI : MonoBehaviour { private bool m_isOpen; private bool m_isRebinding; private Rect m_windowRect; private Font? m_valheimFont; private GUIStyle? m_windowStyle; private GUIStyle? m_headerStyle; private GUIStyle? m_buttonStyle; private GUIStyle? m_rebindButtonStyle; private GUIStyle? m_previewBoxStyle; private GUIStyle? m_labelStyle; private GUIStyle? m_toggleStyle; private GUIStyle? m_saveButtonStyle; public static PingSettingsGUI? Instance { get; private set; } public static bool IsOpen { get { if ((Object)(object)Instance != (Object)null) { return Instance.m_isOpen; } return false; } } public static void EnsureExists() { //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_001e: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("PingMaker_SettingsGUI"); Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<PingSettingsGUI>(); } } private void Awake() { //IL_0031: 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) Instance = this; float num = 520f; float num2 = 680f; m_windowRect = new Rect(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2); } private void Update() { //IL_0005: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_0080: 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) if (Input.GetKeyDown(ModConfig.SettingsKey.Value)) { Toggle(); } else if (m_isOpen && Input.GetKeyDown((KeyCode)27)) { Close(); } if (m_isOpen) { ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } if (!m_isRebinding) { return; } KeyCode[] array = (KeyCode[])Enum.GetValues(typeof(KeyCode)); foreach (KeyCode val in array) { if (!Input.GetKeyDown(val) || (int)val == 0) { continue; } if ((int)val != 27) { ModConfig.PingKey.Value = val; ModConfig.Save(); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)1, "[PingMaker] Клавиша пинга назначена на: <b>" + FormatKeyCodeName(val) + "</b>", 0, (Sprite)null, false); } } m_isRebinding = false; break; } } public void Toggle() { if (m_isOpen) { Close(); } else { Open(); } } public void Open() { //IL_0039: 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) m_isOpen = true; m_isRebinding = false; float num = 520f; float num2 = 680f; m_windowRect = new Rect(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2); ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); } public void Close() { m_isOpen = false; m_isRebinding = false; if ((Object)(object)Player.m_localPlayer != (Object)null && !Menu.IsVisible() && !InventoryGui.IsVisible() && !Minimap.IsOpen()) { ZCursor.LockState = (CursorLockMode)1; ZCursor.Hide(); } ModConfig.Save(); } private void OnGUI() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_004b: Expected O, but got Unknown //IL_0046: 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) if (m_isOpen) { InitStyles(); GUI.color = Color.white; GUI.backgroundColor = Color.white; m_windowRect = GUI.Window(984321, m_windowRect, new WindowFunction(DrawWindowContents), "ᚱ • НАСТРОЙКИ PINGMAKER • ᛉ", m_windowStyle); } } private void DrawWindowContents(int windowID) { //IL_00a1: 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_0586: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.Label("<color=#D8CFBE>« Личные метки, подсветка и трекеры карты »</color>", m_labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label(" ᚠ 1. КЛАВИША БЫСТРОГО ПИНГА", m_headerStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Текущая клавиша:", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); string obj = (m_isRebinding ? ">>> ᛉ НАЖМИТЕ КНОПКУ МЫШИ / КЛАВИАТУРЫ ᛉ <<<" : ("[ ᚱ " + FormatKeyCodeName(ModConfig.PingKey.Value) + " ᚱ ]")); GUIStyle val = (m_isRebinding ? m_rebindButtonStyle : m_buttonStyle); if (GUILayout.Button(obj, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { m_isRebinding = !m_isRebinding; } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.Label(" ᛟ 2. ЛИЧНЫЙ ЦВЕТ ВИКИНГА (МЕТКИ И КАРТА)", m_headerStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(4f); int value = ModConfig.ActiveColorIndex.Value; PlayerColorDefinition colorById = PlayerColors.GetColorById(value); GUILayout.BeginVertical(m_previewBoxStyle, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Предпросмотр:", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) }); string text = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerName() : "Викинг"); string text2 = ColorUtility.ToHtmlStringRGB(colorById.Color); GUILayout.Label("<color=#" + text2 + "><b>● " + text + " [" + colorById.Name + "] [24m]</b> — ваша стрелка на карте</color>", m_labelStyle, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(6f); DrawColorPaletteGrid(value); GUILayout.Space(10f); GUILayout.Label(" ᛏ 3. ПАРАМЕТРЫ ОТОБРАЖЕНИЯ", m_headerStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label($"Длительность 3D-метки: <color=#E5B85C><b>{Mathf.RoundToInt(ModConfig.PingDuration.Value)} сек</b></color>", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); ModConfig.PingDuration.Value = GUILayout.HorizontalSlider(ModConfig.PingDuration.Value, 5f, 60f, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label($"Подсветка монстров: <color=#E5B85C><b>{Mathf.RoundToInt(ModConfig.CreatureHighlightDuration.Value)} сек</b></color>", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); ModConfig.CreatureHighlightDuration.Value = GUILayout.HorizontalSlider(ModConfig.CreatureHighlightDuration.Value, 5f, 30f, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.Space(4f); ModConfig.ShowDistance.Value = GUILayout.Toggle(ModConfig.ShowDistance.Value, " Отображать дистанцию до цели [Xm]", m_toggleStyle, Array.Empty<GUILayoutOption>()); ModConfig.ShowOffscreenArrow.Value = GUILayout.Toggle(ModConfig.ShowOffscreenArrow.Value, " Отображать стрелку на краю экрана, если метка вне обзора", m_toggleStyle, Array.Empty<GUILayoutOption>()); ModConfig.SyncToMinimap.Value = GUILayout.Toggle(ModConfig.SyncToMinimap.Value, " Дублировать пинг временной отметкой на миникарте", m_toggleStyle, Array.Empty<GUILayoutOption>()); ModConfig.ColorizeMapPlayers.Value = GUILayout.Toggle(ModConfig.ColorizeMapPlayers.Value, " Окрашивать стрелки направления игроков на карте в их личный цвет", m_toggleStyle, Array.Empty<GUILayoutOption>()); ModConfig.EnableRadialColorMenu.Value = GUILayout.Toggle(ModConfig.EnableRadialColorMenu.Value, " Круговое радиальное меню цвета при удержании", m_toggleStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Режим прицела захвата:", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); if (GUILayout.Button("[ " + ModConfig.TargetReticleMode.Value switch { 1 => "Только при метке на существо", 2 => "Только при наведении прицела", _ => "При наведении и метке (Стандарт)", } + " ]", m_buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.TargetReticleMode.Value = (ModConfig.TargetReticleMode.Value + 1) % 3; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Стиль стрелки захвата:", m_labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); string text3 = ((ModConfig.ReticleArrowStyle.Value == 0) ? "↘ Диагональная (по умолчанию)" : "↓ Сверху"); if (GUILayout.Button("[ " + text3 + " ]", m_buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ReticleArrowStyle.Value = ((ModConfig.ReticleArrowStyle.Value == 0) ? 1 : 0); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("ᛉ СОХРАНИТЬ И ЗАКРЫТЬ (Esc / ') ᛉ", m_saveButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { Close(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 28f)); } private void DrawColorPaletteGrid(int activeIdx) { PlayerColorDefinition[] palette = PlayerColors.Palette; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int i = 0; i < 4; i++) { DrawSingleColorButton(palette[i], i == activeIdx); } GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int j = 4; j < 8; j++) { DrawSingleColorButton(palette[j], j == activeIdx); } GUILayout.EndHorizontal(); } private void DrawSingleColorButton(PlayerColorDefinition def, bool isActive) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) Color backgroundColor = GUI.backgroundColor; Color contentColor = GUI.contentColor; GUI.backgroundColor = def.Color; GUI.contentColor = ((def.Id == 0 || def.Id == 7 || def.Id == 6) ? Color.black : Color.white); if (GUILayout.Button(isActive ? ("✓ " + def.Name) : def.Name, m_buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { ModConfig.ActiveColorIndex.Value = def.Id; ModConfig.CustomPlayerColor.Value = def.Color; ModConfig.Save(); NetworkSync.BroadcastLocalPlayerColor(); if ((Object)(object)Minimap.instance != (Object)null) { PlayerMapTracker.UpdateLocalPlayer(Minimap.instance); } if ((Object)(object)Player.m_localPlayer != (Object)null) { string text = ColorUtility.ToHtmlStringRGB(def.Color); ((Character)Player.m_localPlayer).Message((MessageType)1, "[PingMaker] Выбран личный цвет: <color=#" + text + "><b>" + def.Name + "</b></color>", 0, (Sprite)null, false); } } GUI.backgroundColor = backgroundColor; GUI.contentColor = contentColor; } private unsafe string FormatKeyCodeName(KeyCode kc) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000a: 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_0032: Expected I4, but got Unknown if ((int)kc != 39) { if ((int)kc != 96) { return (kc - 323) switch { 0 => "Левая кнопка мыши (ЛКМ)", 1 => "Правая кнопка мыши (ПКМ)", 2 => "Колёсико мыши (СКМ)", 3 => "Боковая кнопка мыши 3", 4 => "Боковая кнопка мыши 4", 5 => "Боковая кнопка мыши 5", 6 => "Боковая кнопка мыши 6", _ => ((object)(*(KeyCode*)(&kc))/*cast due to .constrained prefix*/).ToString(), }; } return "~ (русская ё)"; } return "' (русская э)"; } private void InitStyles() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown //IL_0356: Expected O, but got Unknown //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Expected O, but got Unknown //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Expected O, but got Unknown if ((Object)(object)m_valheimFont == (Object)null) { Font[] array = Resources.FindObjectsOfTypeAll<Font>(); foreach (Font val in array) { if ((Object)(object)val != (Object)null && (((Object)val).name.Contains("Averia") || ((Object)val).name.Contains("Norse") || ((Object)val).name.Contains("Valheim"))) { m_valheimFont = val; break; } } } if (m_windowStyle == null) { GUIStyle val2 = new GUIStyle(GUI.skin.window); val2.normal.background = ProceduralIcons.GetVikingWindowTexture(); val2.normal.textColor = new Color(0.95f, 0.8f, 0.45f, 1f); val2.onNormal.background = ProceduralIcons.GetVikingWindowTexture(); val2.onNormal.textColor = new Color(0.95f, 0.8f, 0.45f, 1f); val2.border = new RectOffset(14, 14, 14, 14); val2.padding = new RectOffset(16, 16, 20, 16); val2.font = m_valheimFont; val2.fontStyle = (FontStyle)1; val2.fontSize = 15; val2.alignment = (TextAnchor)1; m_windowStyle = val2; } if (m_headerStyle == null) { GUIStyle val3 = new GUIStyle(GUI.skin.label); val3.normal.background = ProceduralIcons.GetVikingBannerTexture(); val3.normal.textColor = new Color(1f, 0.88f, 0.52f, 1f); val3.border = new RectOffset(6, 6, 6, 6); val3.padding = new RectOffset(10, 10, 5, 5); val3.font = m_valheimFont; val3.fontStyle = (FontStyle)1; val3.fontSize = 12; val3.alignment = (TextAnchor)3; m_headerStyle = val3; } if (m_buttonStyle == null) { GUIStyle val4 = new GUIStyle(GUI.skin.button); val4.normal.background = ProceduralIcons.GetVikingButtonTexture(hover: false, active: false); val4.normal.textColor = new Color(0.92f, 0.88f, 0.82f, 1f); val4.hover.background = ProceduralIcons.GetVikingButtonTexture(hover: true, active: false); val4.hover.textColor = new Color(1f, 0.95f, 0.6f, 1f); val4.active.background = ProceduralIcons.GetVikingButtonTexture(hover: false, active: true); val4.active.textColor = Color.white; val4.border = new RectOffset(8, 8, 8, 8); val4.font = m_valheimFont; val4.fontStyle = (FontStyle)1; val4.fontSize = 12; val4.alignment = (TextAnchor)4; m_buttonStyle = val4; } if (m_rebindButtonStyle == null) { GUIStyle val5 = new GUIStyle(m_buttonStyle); val5.normal.background = ProceduralIcons.GetVikingButtonTexture(hover: true, active: false); val5.normal.textColor = new Color(1f, 0.9f, 0.2f, 1f); val5.fontStyle = (FontStyle)1; m_rebindButtonStyle = val5; } if (m_previewBoxStyle == null) { GUIStyle val6 = new GUIStyle(GUI.skin.box); val6.normal.background = ProceduralIcons.GetVikingPreviewBoxTexture(); val6.border = new RectOffset(6, 6, 6, 6); val6.padding = new RectOffset(10, 10, 6, 6); m_previewBoxStyle = val6; } if (m_labelStyle == null) { GUIStyle val7 = new GUIStyle(GUI.skin.label) { richText = true, font = m_valheimFont, fontSize = 12 }; val7.normal.textColor = new Color(0.9f, 0.85f, 0.78f, 1f); val7.alignment = (TextAnchor)3; m_labelStyle = val7; } if (m_toggleStyle == null) { GUIStyle val8 = new GUIStyle(GUI.skin.toggle) { font = m_valheimFont, fontSize = 12 }; val8.normal.textColor = new Color(0.88f, 0.84f, 0.78f, 1f); m_toggleStyle = val8; } if (m_saveButtonStyle == null) { GUIStyle val9 = new GUIStyle(m_buttonStyle) { fontSize = 13, fontStyle = (FontStyle)1 }; val9.normal.textColor = new Color(0.95f, 0.85f, 0.45f, 1f); val9.hover.textColor = new Color(1f, 1f, 0.7f, 1f); m_saveButtonStyle = val9; } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } public class RadialMenu : MonoBehaviour { private class ColorSectorItem { public int Index; public PlayerColorDefinition Definition; public RectTransform Rect; public Image CircleImage; public Image CheckmarkImage; public Vector2 Direction; } private bool m_isOpen; private Vector2 m_centerPos; private int m_hoveredIndex = -1; private GameObject m_menuRoot; private CanvasGroup m_canvasGroup; private Text m_centerTitle; private Text m_centerPlayerName; private Text m_centerColorLabel; private readonly List<ColorSectorItem> m_sectors = new List<ColorSectorItem>(); public static RadialMenu? Instance { get; private set; } public bool IsOpen => m_isOpen; public static void EnsureExists(Transform parent) { //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) if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("PingMaker_RadialMenu"); val.transform.SetParent(parent, false); Instance = val.AddComponent<RadialMenu>(); } } private void Awake() { Instance = this; BuildUI(); Hide(); } private void BuildUI() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Expected O, but got Unknown //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) m_menuRoot = new GameObject("ColorMenuContainer", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); m_menuRoot.transform.SetParent(((Component)this).transform, false); RectTransform component = m_menuRoot.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(400f, 400f); component.anchoredPosition = Vector2.zero; m_canvasGroup = m_menuRoot.GetComponent<CanvasGroup>(); GameObject val = new GameObject("OuterRing", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(m_menuRoot.transform, false); val.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 300f); val.GetComponent<Image>().sprite = ProceduralIcons.GetColorPaletteRingSprite(); Font font = Font.CreateDynamicFontFromOSFont("Arial", 14); GameObject val2 = new GameObject("CenterDisplay", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(m_menuRoot.transform, false); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(160f, 120f); component2.anchoredPosition = Vector2.zero; GameObject val3 = new GameObject("Title", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val3.transform.SetParent(val2.transform, false); RectTransform component3 = val3.GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(160f, 18f); component3.anchoredPosition = new Vector2(0f, 26f); m_centerTitle = val3.GetComponent<Text>(); m_centerTitle.font = font; m_centerTitle.fontSize = 11; m_centerTitle.fontStyle = (FontStyle)0; m_centerTitle.alignment = (TextAnchor)4; m_centerTitle.text = "ЛИЧНЫЙ ЦВЕТ"; ((Graphic)m_centerTitle).color = new Color(0.8f, 0.85f, 0.9f, 0.8f); ((Shadow)val3.GetComponent<Outline>()).effectColor = Color.black; GameObject val4 = new GameObject("PlayerName", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val4.transform.SetParent(val2.transform, false); RectTransform component4 = val4.GetComponent<RectTransform>(); component4.sizeDelta = new Vector2(160f, 24f); component4.anchoredPosition = new Vector2(0f, 4f); m_centerPlayerName = val4.GetComponent<Text>(); m_centerPlayerName.font = font; m_centerPlayerName.fontSize = 15; m_centerPlayerName.fontStyle = (FontStyle)1; m_centerPlayerName.alignment = (TextAnchor)4; m_centerPlayerName.text = "Викинг"; ((Graphic)m_centerPlayerName).color = Color.yellow; ((Shadow)val4.GetComponent<Outline>()).effectColor = Color.black; GameObject val5 = new GameObject("ColorName", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val5.transform.SetParent(val2.transform, false); RectTransform component5 = val5.GetComponent<RectTransform>(); component5.sizeDelta = new Vector2(160f, 20f); component5.anchoredPosition = new Vector2(0f, -20f); m_centerColorLabel = val5.GetComponent<Text>(); m_centerColorLabel.font = font; m_centerColorLabel.fontSize = 12; m_centerColorLabel.fontStyle = (FontStyle)1; m_centerColorLabel.alignment = (TextAnchor)4; m_centerColorLabel.text = "Жёлтый"; ((Graphic)m_centerColorLabel).color = Color.white; ((Shadow)val5.GetComponent<Outline>()).effectColor = Color.black; float num = 105f; int num2 = PlayerColors.Palette.Length; float num3 = 360f / (float)num2; Sprite colorCircleSprite = ProceduralIcons.GetColorCircleSprite(); Sprite checkmarkSprite = ProceduralIcons.GetCheckmarkSprite(); Vector2 val6 = default(Vector2); for (int i = 0; i < num2; i++) { PlayerColorDefinition definition = PlayerColors.Palette[i]; float num4 = (90f - (float)i * num3) * (MathF.PI / 180f); ((Vector2)(ref val6))..ctor(Mathf.Cos(num4), Mathf.Sin(num4)); Vector2 anchoredPosition = val6 * num; GameObject val7 = new GameObject("Color_" + definition.Name, new Type[2] { typeof(RectTransform), typeof(Image) }); val7.transform.SetParent(m_menuRoot.transform, false); RectTransform component6 = val7.GetComponent<RectTransform>(); component6.sizeDelta = new Vector2(46f, 46f); component6.anchoredPosition = anchoredPosition; Image component7 = val7.GetComponent<Image>(); component7.sprite = colorCircleSprite; ((Graphic)component7).color = definition.Color; GameObject val8 = new GameObject("Checkmark", new Type[2] { typeof(RectTransform), typeof(Image) }); val8.transform.SetParent(val7.transform, false); RectTransform component8 = val8.GetComponent<RectTransform>(); component8.sizeDelta = new Vector2(26f, 26f); component8.anchoredPosition = Vector2.zero; Image component9 = val8.GetComponent<Image>(); component9.sprite = checkmarkSprite; ((Graphic)component9).color = Color.black; val8.SetActive(false); ColorSectorItem item = new ColorSectorItem { Index = i, Definition = definition, Rect = component6, CircleImage = component7, CheckmarkImage = component9, Direction = val6 }; m_sectors.Add(item); } } public void Open(Vector2 screenCenter) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_002a: Unknown result type (might be due to invalid IL or missing references) m_isOpen = true; m_centerPos = screenCenter; m_hoveredIndex = ModConfig.ActiveColorIndex.Value; ((Transform)m_menuRoot.GetComponent<RectTransform>()).position = Vector2.op_Implicit(screenCenter); if ((Object)(object)Player.m_localPlayer != (Object)null) { m_centerPlayerName.text = Player.m_localPlayer.GetPlayerName(); } m_menuRoot.SetActive(true); m_canvasGroup.alpha = 1f; RefreshCheckmarks(); UpdateHover(m_hoveredIndex); } public void Hide() { m_isOpen = false; if ((Object)(object)m_menuRoot != (Object)null) { m_menuRoot.SetActive(false); } } public void ConfirmSelection() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (m_hoveredIndex >= 0 && m_hoveredIndex < m_sectors.Count) { PlayerColorDefinition definition = m_sectors[m_hoveredIndex].Definition; ModConfig.ActiveColorIndex.Value = definition.Id; ModConfig.CustomPlayerColor.Value = definition.Color; ((BaseUnityPlugin)PingMakerPlugin.Instance).Config.Save(); if ((Object)(object)Player.m_localPlayer != (Object)null) { string text = ColorUtility.ToHtmlStringRGB(definition.Color); ((Character)Player.m_localPlayer).Message((MessageType)1, "<color=#" + text + ">[PingMaker]</color> Ваш личный цвет пинга: <color=#" + text + "><b>" + definition.Name + "</b></color>", 0, (Sprite)null, false); } PingMakerPlugin.Log.LogInfo((object)$"[PingMaker] Выбран личный цвет: {definition.Name} ({definition.Color})"); } Hide(); } public Color GetActiveChosenColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return PlayerColors.GetActiveColor(); } private void RefreshCheckmarks() { int value = ModConfig.ActiveColorIndex.Value; for (int i = 0; i < m_sectors.Count; i++) { bool active = m_sectors[i].Index == value; ((Component)m_sectors[i].CheckmarkImage).gameObject.SetActive(active); } } private void Update() { //IL_0009: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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_0033: Unknown result type (might be due to invalid IL or missing references) if (!m_isOpen) { return; } Vector2 val = Vector2.op_Implicit(Input.mousePosition) - m_centerPos; if (((Vector2)(ref val)).magnitude > 22f) { float num = Mathf.Atan2(val.y, val.x) * 57.29578f; float num2 = (90f - num + 360f) % 360f; float num3 = 360f / (float)m_sectors.Count; int num4 = Mathf.FloorToInt((num2 + num3 * 0.5f) / num3) % m_sectors.Count; if (num4 != m_hoveredIndex) { UpdateHover(num4); } } } private void UpdateHover(int index) { //IL_0040: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) m_hoveredIndex = index; for (int i = 0; i < m_sectors.Count; i++) { ColorSectorItem colorSectorItem = m_sectors[i]; if (i == index) { ((Transform)colorSectorItem.Rect).localScale = Vector3.one * 1.35f; } else { ((Transform)colorSectorItem.Rect).localScale = Vector3.one; } } if (index >= 0 && index < m_sectors.Count) { ColorSectorItem colorSectorItem2 = m_sectors[index]; m_centerColorLabel.text = colorSectorItem2.Definition.Name; ((Graphic)m_centerColorLabel).color = colorSectorItem2.Definition.Color; ((Graphic)m_centerPlayerName).color = colorSectorItem2.Definition.Color; } } } public class TargetLockonReticle : MonoBehaviour { private RectTransform m_rect; private CanvasGroup m_canvasGroup; private RectTransform m_circleRect; private Image m_circleImage; private RectTransform m_arrowRect; private Image m_arrowImage; private RectTransform m_textRect; private Text m_nameText; private Character? m_currentTarget; private float m_targetAlpha; private float m_currentAlpha; public static TargetLockonReticle? Instance { get; private set; } public static void EnsureExists(Transform parentCanvas) { //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) if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("PingMaker_LockonReticle"); val.transform.SetParent(parentCanvas, false); Instance = val.AddComponent<TargetLockonReticle>(); } } private void Awake() { Instance = this; BuildUI(); } private void BuildUI() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) m_rect = ((Component)this).gameObject.AddComponent<RectTransform>(); m_rect.sizeDelta = new Vector2(120f, 120f); m_rect.pivot = new Vector2(0.5f, 0.5f); m_canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>(); m_canvasGroup.alpha = 0f; m_canvasGroup.blocksRaycasts = false; m_canvasGroup.interactable = false; GameObject val = new GameObject("Circle", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(((Component)this).transform, false); m_circleRect = val.GetComponent<RectTransform>(); m_circleRect.sizeDelta = new Vector2(74f, 74f); m_circleRect.anchoredPosition = Vector2.zero; m_circleImage = val.GetComponent<Image>(); m_circleImage.sprite = ProceduralIcons.GetLockonCircleSprite(); ((Graphic)m_circleImage).raycastTarget = false; GameObject val2 = new GameObject("Arrow", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(((Component)this).transform, false); m_arrowRect = val2.GetComponent<RectTransform>(); m_arrowRect.sizeDelta = new Vector2(28f, 28f); if (ModConfig.ReticleArrowStyle.Value == 0) { m_arrowRect.anchoredPosition = new Vector2(38f, 38f); ((Transform)m_arrowRect).localRotation = Quaternion.Euler(0f, 0f, -45f); } else { m_arrowRect.anchoredPosition = new Vector2(0f, 48f); ((Transform)m_arrowRect).localRotation = Quaternion.identity; } m_arrowImage = val2.GetComponent<Image>(); m_arrowImage.sprite = ProceduralIcons.GetLockonArrowSprite(); ((Graphic)m_arrowImage).raycastTarget = false; Font font = Font.CreateDynamicFontFromOSFont("Arial", 14); GameObject val3 = new GameObject("TargetName", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val3.transform.SetParent(((Component)this).transform, false); m_textRect = val3.GetComponent<RectTransform>(); m_textRect.sizeDelta = new Vector2(220f, 22f); m_textRect.anchoredPosition = new Vector2(0f, 72f); m_nameText = val3.GetComponent<Text>(); m_nameText.font = font; m_nameText.fontSize = 13; m_nameText.fontStyle = (FontStyle)1; m_nameText.alignment = (TextAnchor)4; ((Graphic)m_nameText).color = Color.white; ((Graphic)m_nameText).raycastTarget = false; Outline component = val3.GetComponent<Outline>(); ((Shadow)component).effectColor = new Color(0f, 0f, 0f, 0.95f); ((Shadow)component).effectDistance = new Vector2(1f, -1f); } public void SetTarget(Character? character) { if ((Object)(object)character == (Object)null || character.IsDead() || (Object)(object)((Component)character).gameObject == (Object)null) { m_currentTarget = null; m_targetAlpha = 0f; return; } m_currentTarget = character; m_targetAlpha = 1f; string hoverName = character.GetHoverName(); int level = character.GetLevel(); string text = ((level > 1) ? $" (★{level - 1})" : ""); m_nameText.text = hoverName + text; } private void Update() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) m_currentAlpha = Mathf.MoveTowards(m_currentAlpha, m_targetAlpha, Time.deltaTime * 8f); m_canvasGroup.alpha = m_currentAlpha; if (m_currentAlpha <= 0.001f || (Object)(object)m_currentTarget == (Object)null) { return; } if (m_currentTarget.IsDead() || (Object)(object)((Component)m_currentTarget).gameObject == (Object)null) { m_currentTarget = null; m_targetAlpha = 0f; return; } Camera mainCamera = Utils.GetMainCamera(); if ((Object)(object)mainCamera == (Object)null) { return; } Vector3 centerPoint = m_currentTarget.GetCenterPoint(); Vector3 val = mainCamera.WorldToScreenPoint(centerPoint); if (val.z <= 0.1f) { m_canvasGroup.alpha = 0f; return; } ((Transform)m_rect).position = Vector2.op_Implicit(new Vector2(val.x, val.y)); Color activeColor = PlayerColors.GetActiveColor(); ((Graphic)m_circleImage).color = activeColor; ((Graphic)m_arrowImage).color = activeColor; ((Transform)m_circleRect).Rotate(0f, 0f, -25f * Time.deltaTime); float num = Mathf.Sin(Time.time * 8f) * 4f; if (ModConfig.ReticleArrowStyle.Value == 0) { m_arrowRect.anchoredPosition = new Vector2(38f + num * 0.707f, 38f + num * 0.707f); ((Transform)m_arrowRect).localRotation = Quaternion.Euler(0f, 0f, -45f); } else { m_arrowRect.anchoredPosition = new Vector2(0f, 48f + num); ((Transform)m_arrowRect).localRotation = Quaternion.identity; } } } } namespace PingMaker.Network { public static class NetworkSync { public const string RPC_PING_NAME = "PingMaker_WorldPing"; public const string RPC_SYNC_COLOR = "PingMaker_SyncColor"; public const string RPC_REQUEST_COLORS = "PingMaker_RequestColors"; private static bool s_isRegistered; public static readonly Dictionary<string, Color> PlayerColorsMap = new Dictionary<string, Color>(StringComparer.OrdinalIgnoreCase); public static void RegisterRPC() { if (ZRoutedRpc.instance == null) { PingMakerPlugin.Log.LogWarning((object)"[PingMaker] Невозможно зарегистрировать RPC: ZRoutedRpc.instance == null"); } else if (!s_isRegistered) { ZRoutedRpc.instance.Register<ZPackage>("PingMaker_WorldPing", (Action<long, ZPackage>)RPC_PingMaker_WorldPing); ZRoutedRpc.instance.Register<string, int>("PingMaker_SyncColor", (Action<long, string, int>)RPC_PingMaker_SyncColor); ZRoutedRpc.instance.Register("PingMaker_RequestColors", (Action<long>)RPC_PingMaker_RequestColors); s_isRegistered = true; PingMakerPlugin.Log.LogInfo((object)"[PingMaker] Сетевые RPC зарегистрированы (PingMaker_WorldPing, PingMaker_SyncColor, PingMaker_RequestColors)."); RequestAllPlayerColors(); BroadcastLocalPlayerColor(); } } public static void SendPing(PingPackageData data) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(data.SenderName)) { PlayerColorsMap[data.SenderName] = data.PingColor; } if (ZRoutedRpc.instance == null) { HandleIncomingPing(data); return; } ZPackage val = data.ToZPackage(); ZRoutedRpc.instance.InvokeRoutedRPC(0L, "PingMaker_WorldPing", new object[1] { val }); } public static