Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of SmallCornerMap v4.0.1
Mods\Small_Corner_Map.Mono.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using FishNet.Object; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using ScheduleOne.DevUtilities; using ScheduleOne.GameTime; using ScheduleOne.Map; using ScheduleOne.PlayerScripts; using ScheduleOne.UI.Phone.Map; using ScheduleOne.Vehicles; using Small_Corner_Map; using Small_Corner_Map.Helpers; using Small_Corner_Map.Main; using Small_Corner_Map.PoIManagers; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Small Corner Map", "4.0.0", "winzaar", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Small_Corner_Map")] [assembly: AssemblyConfiguration("Mono")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f79f69612a4f593701b8d337c73761dbc5d611f4")] [assembly: AssemblyProduct("Small_Corner_Map")] [assembly: AssemblyTitle("Small_Corner_Map")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Small_Corner_Map { public class Core : MelonMod { [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] private class Player_EnterVehicle_Patch { private static void Postfix(LandVehicle __instance) { MinimapManager.Instance.OnPlayerEnterVehicle(__instance); } } [HarmonyPatch(typeof(LandVehicle), "ExitVehicle")] private class Player_ExitVehicle_Patch { private static void Postfix(LandVehicle __instance) { MinimapManager.Instance.OnPlayerExitVehicle(__instance); } } private static Core Instance { get; set; } public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); Instance = this; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { ((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName); if (sceneName == "Main") { MelonLogger.Msg("GameplayScene loaded, initializing Small Corner Map..."); MinimapManager.Instance.Initialize(); return; } MinimapManager.Instance.Cleanup(); Object.Destroy((Object)(object)((Component)MinimapManager.Instance).gameObject); GameObject val = GameObject.Find("MinimapCanvas"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } } namespace Small_Corner_Map.PoIManagers { [RegisterTypeInIl2Cpp] public class PlayerMarkerView : MonoBehaviour { [CompilerGenerated] private sealed class <InitializePlayerMarkerIcon>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerMarkerView <>4__this; private GameObject <mapObject>5__1; private Transform <playerPoI>5__2; private Transform <realIcon>5__3; private Transform <mapAppDirectionIndicator>5__4; private Image <mapAppImage>5__5; private Image <ourDirectionImage>5__6; private RectTransform <mapAppRect>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializePlayerMarkerIcon>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <mapObject>5__1 = null; <playerPoI>5__2 = null; <realIcon>5__3 = null; <mapAppDirectionIndicator>5__4 = null; <mapAppImage>5__5 = null; <ourDirectionImage>5__6 = null; <mapAppRect>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_018e: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <mapObject>5__1 = null; break; case 1: <>1__state = -1; break; } if ((Object)(object)<mapObject>5__1 == (Object)null) { <mapObject>5__1 = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content"); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <playerPoI>5__2 = <mapObject>5__1.transform.Find("PlayerPoI(Clone)"); Transform obj = <playerPoI>5__2; <realIcon>5__3 = ((obj != null) ? obj.Find("IconContainer") : null); if ((Object)(object)<realIcon>5__3 != (Object)null) { <>4__this.ReplaceWithRealPlayerIcon(((Component)<realIcon>5__3).gameObject); <mapAppDirectionIndicator>5__4 = <realIcon>5__3.Find("Image"); if ((Object)(object)<mapAppDirectionIndicator>5__4 != (Object)null) { <mapAppImage>5__5 = ((Component)<mapAppDirectionIndicator>5__4).GetComponent<Image>(); if ((Object)(object)<mapAppImage>5__5 != (Object)null && (Object)(object)<mapAppImage>5__5.sprite != (Object)null && (Object)(object)<>4__this._directionIndicator != (Object)null) { <ourDirectionImage>5__6 = ((Component)<>4__this._directionIndicator).GetComponent<Image>(); if ((Object)(object)<ourDirectionImage>5__6 != (Object)null) { <ourDirectionImage>5__6.sprite = <mapAppImage>5__5.sprite; ((Graphic)<ourDirectionImage>5__6).color = Color.white; <mapAppRect>5__7 = ((Component)<mapAppDirectionIndicator>5__4).GetComponent<RectTransform>(); if ((Object)(object)<mapAppRect>5__7 != (Object)null) { <>4__this._directionIndicator.sizeDelta = <mapAppRect>5__7.sizeDelta; } <mapAppRect>5__7 = null; } <ourDirectionImage>5__6 = null; } <mapAppImage>5__5 = null; } <mapAppDirectionIndicator>5__4 = null; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Image _playerMarkerImage; private RectTransform _playerMarkerRect; private Transform _playerTransform; private RectTransform _directionIndicator; private GameObject _markerGO; private GameObject _originalPlayerIconPrefab; private bool _showingVehicleIcon; private readonly Color _markerColor = new Color(0.2f, 0.6f, 1f, 1f); private float _worldScaleFactor; private float _minimapPlayerCenterXOffset; private float _minimapPlayerCenterYOffset; private float _currentZoomLevel; public void UpdateZoomLevel(float newZoomLevel) { _currentZoomLevel = newZoomLevel; } public void UpdateMinimapPlayerCenterXOffset(float newOffsetX) { _minimapPlayerCenterXOffset = newOffsetX; } public void UpdateMinimapPlayerCenterYOffset(float newOffsetY) { _minimapPlayerCenterYOffset = newOffsetY; } public void Initialize(Transform parent, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) _playerTransform = ((Component)Player.Local).transform; _worldScaleFactor = worldScaleFactor; _minimapPlayerCenterXOffset = minimapPlayerCenterXOffset; _minimapPlayerCenterYOffset = minimapPlayerCenterYOffset; _currentZoomLevel = currentZoomLevel; _markerGO = new GameObject("PlayerMarker"); _markerGO.transform.SetParent(parent, false); _playerMarkerRect = _markerGO.AddComponent<RectTransform>(); _playerMarkerRect.sizeDelta = new Vector2(10f, 10f); _playerMarkerRect.anchorMin = new Vector2(0.5f, 0.5f); _playerMarkerRect.anchorMax = new Vector2(0.5f, 0.5f); _playerMarkerRect.pivot = new Vector2(0.5f, 0.5f); _playerMarkerRect.anchoredPosition = Vector2.zero; _playerMarkerImage = _markerGO.AddComponent<Image>(); _playerMarkerImage.sprite = Utils.CreateCircleSprite(20, _markerColor, 2, 2); ((Graphic)_playerMarkerImage).color = _markerColor; _markerGO.transform.SetAsLastSibling(); _markerGO.SetActive(true); MelonCoroutines.Start(InitializePlayerMarkerIcon()); } private void Update() { if ((Object)(object)Player.Local == (Object)null || (Object)(object)this == (Object)null || (Object)(object)((Component)this).gameObject == (Object)null || !((Component)this).gameObject.activeInHierarchy) { return; } try { if (Player.Local.IsInVehicle) { NetworkObject currentVehicle = Player.Local.CurrentVehicle; _playerTransform = ((currentVehicle != null) ? ((Component)currentVehicle).transform : null); } else { _playerTransform = ((Component)Player.Local).transform; } if ((Object)(object)_playerTransform != (Object)null) { UpdateDirectionIndicator(); } } catch (Exception ex) { MelonLogger.Warning("[PlayerMarkerView] Exception in Update: " + ex.Message); } } public void ReplaceWithRealPlayerIcon(GameObject realIconPrefab) { if (!((Object)(object)realIconPrefab == (Object)null)) { _originalPlayerIconPrefab = realIconPrefab; ReplaceWithIcon(realIconPrefab, 0.5f, isVehicle: false); } } private void ReplaceWithIcon(GameObject iconPrefab, float scale, bool isVehicle) { //IL_0064: 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) if (!((Object)(object)_markerGO == (Object)null)) { Transform parent = _markerGO.transform.parent; GameObject val = Object.Instantiate<GameObject>(iconPrefab, parent, false); ((Object)val).name = (isVehicle ? "PlayerVehicleMarker" : "PlayerMarker"); RectTransform component = val.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchoredPosition = _playerMarkerRect.anchoredPosition; ((Transform)component).localScale = new Vector3(scale, scale, scale); } Transform val2 = val.transform.Find("Image"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } if ((Object)(object)_directionIndicator != (Object)null) { ((Transform)_directionIndicator).SetParent(val.transform, false); ((Transform)_directionIndicator).SetAsLastSibling(); } Object.Destroy((Object)(object)_markerGO); _markerGO = val; _playerMarkerRect = component; _markerGO.transform.SetAsLastSibling(); _showingVehicleIcon = isVehicle; } } private void UpdateDirectionIndicator() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if ((Object)(object)_markerGO == (Object)null || (Object)(object)_playerTransform == (Object)null) { return; } if ((Object)(object)_directionIndicator == (Object)null) { Transform val = _markerGO.transform.Find("DirectionIndicator"); if ((Object)(object)val != (Object)null) { _directionIndicator = (RectTransform)val; } else { _directionIndicator = CreateDirectionIndicator(_markerGO, Color.white); } } _directionIndicator.pivot = new Vector2(0.5f, 0.5f); float num = 10f; Quaternion rotation = _playerTransform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; float num2 = (90f - y) * (MathF.PI / 180f); float num3 = num * MinimapCoordinateSystem.WorldToUIScale(_worldScaleFactor, _currentZoomLevel); Vector2 anchoredPosition = default(Vector2); ((Vector2)(ref anchoredPosition))..ctor(num3 * Mathf.Cos(num2), num3 * Mathf.Sin(num2)); _directionIndicator.anchoredPosition = anchoredPosition; float num4 = 90f - y; ((Transform)_directionIndicator).localRotation = Quaternion.Euler(0f, 0f, num4); } [IteratorStateMachine(typeof(<InitializePlayerMarkerIcon>d__20))] private IEnumerator InitializePlayerMarkerIcon() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializePlayerMarkerIcon>d__20(0) { <>4__this = this }; } private RectTransform CreateDirectionIndicator(GameObject parent, Color indicatorColor, float size = 6f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DirectionIndicator"); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.sizeDelta = new Vector2(size, size); val2.pivot = new Vector2(0.5f, 0.5f); Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = indicatorColor; return val2; } } [RegisterTypeInIl2Cpp] public class PoIMarkerView : MonoBehaviour { private RectTransform _thisRect; private RectTransform _poiMarkerRect; private RectTransform _sourceRect; private Vector2 _phoneMapPosition; private string poiName; private string _markerType; private float worldScaleFactor; private float currentZoomLevel; private bool _isDynamic; private bool _isCircleMode; private RectTransform _mapImageRT; private Vector2 _mapPosition; private static readonly HashSet<string> clampedMarkerTypes = new HashSet<string> { "QuestPoI(Clone)", "DeaddropPoI_Red(Clone)", "ContractPoI(Clone)" }; public void Initialize(RectTransform poiTransform, Vector2 phoneMapPosition, float worldScale, float zoom, bool isDynamic, string markerType, RectTransform mapImageRT, bool isCircle) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) _sourceRect = poiTransform; _phoneMapPosition = phoneMapPosition; poiName = ((Object)poiTransform).name; _markerType = markerType; worldScaleFactor = worldScale; currentZoomLevel = zoom; _isDynamic = isDynamic; _mapImageRT = mapImageRT; _isCircleMode = isCircle; _thisRect = ((Component)this).gameObject.GetComponent<RectTransform>(); if ((Object)(object)_thisRect == (Object)null) { MelonLogger.Error("PoIMarkerView (" + poiName + "): RectTransform not found! This should not happen."); return; } _thisRect.anchorMin = new Vector2(0.5f, 0.5f); _thisRect.anchorMax = new Vector2(0.5f, 0.5f); _thisRect.pivot = new Vector2(0.5f, 0.5f); GameObject val = Object.Instantiate<GameObject>(((Component)poiTransform).gameObject, ((Component)this).transform, false); ((Object)val).name = "PoIContent_" + poiName; LayoutElement component = val.GetComponent<LayoutElement>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } _poiMarkerRect = val.GetComponent<RectTransform>(); if ((Object)(object)_poiMarkerRect == (Object)null) { MelonLogger.Error("PoIMarkerView (" + poiName + "): Cloned GameObject does not have a RectTransform!"); Object.Destroy((Object)(object)((Component)this).gameObject); return; } _poiMarkerRect.anchorMin = new Vector2(0.5f, 0.5f); _poiMarkerRect.anchorMax = new Vector2(0.5f, 0.5f); _poiMarkerRect.pivot = new Vector2(0.5f, 0.5f); _poiMarkerRect.anchoredPosition = Vector2.zero; ((Transform)_poiMarkerRect).localScale = new Vector3(0.5f, 0.5f, 0.5f); val.SetActive(true); Vector2 val2 = _phoneMapPosition * 0.25f; _mapPosition = new Vector2(val2.x + 2f, val2.y - 3f); _thisRect.anchoredPosition = _mapPosition; } public void SetShape(bool isCircle) { _isCircleMode = isCircle; } public void UpdateZoomLevel(float newZoomLevel) { currentZoomLevel = newZoomLevel; } public void UpdatePosition(Vector2 newPhoneMapPosition) { //IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_thisRect == (Object)null)) { _phoneMapPosition = newPhoneMapPosition; Vector2 val = _phoneMapPosition * 0.25f; _mapPosition = new Vector2(val.x + 2f, val.y - 3f); } } public void UpdatePositionFromWorld(Vector3 worldPos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_thisRect == (Object)null)) { Vector3 worldPos2 = worldPos + new Vector3(-10f, 0f, 6f); _mapPosition = MinimapCoordinateSystem.WorldToMapSpace(worldPos2, worldScaleFactor, currentZoomLevel); } } private void Update() { //IL_0028: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00de: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009e: 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_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_thisRect == (Object)null || (Object)(object)_mapImageRT == (Object)null) { return; } Vector2 anchoredPosition = _mapPosition; if (clampedMarkerTypes.Contains(_markerType)) { Vector2 val = _mapPosition + _mapImageRT.anchoredPosition; if (_isCircleMode) { float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude > MinimapState.MinimapRadius) { Vector2 val2 = ((Vector2)(ref val)).normalized * MinimapState.MinimapRadius; anchoredPosition = val2 - _mapImageRT.anchoredPosition; } } else { float minimapRadius = MinimapState.MinimapRadius; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Clamp(val.x, 0f - minimapRadius, minimapRadius), Mathf.Clamp(val.y, 0f - minimapRadius, minimapRadius)); if (val3 != val) { anchoredPosition = val3 - _mapImageRT.anchoredPosition; } } } _thisRect.anchoredPosition = anchoredPosition; } } [RegisterTypeInIl2Cpp] public class MapMarkerManager : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass18_0 { public Dictionary<string, RectTransform> currentChildren; internal bool <UpdatePoIMarkersCoroutine>b__0(KeyValuePair<string, PoIMarkerView> marker) { return !currentChildren.ContainsKey(marker.Key); } } [CompilerGenerated] private sealed class <UpdatePoIMarkersCoroutine>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MapMarkerManager <>4__this; private WaitForSeconds <waitInterval>5__1; private <>c__DisplayClass18_0 <>8__2; private RectTransform[] <allChildren>5__3; private List<KeyValuePair<string, PoIMarkerView>> <childrenToRemove>5__4; private RectTransform[] <>s__5; private int <>s__6; private RectTransform <rt>5__7; private string <key>5__8; private List<KeyValuePair<string, PoIMarkerView>>.Enumerator <>s__9; private KeyValuePair<string, PoIMarkerView> <kvp>5__10; private Dictionary<string, RectTransform>.Enumerator <>s__11; private KeyValuePair<string, RectTransform> <kvp>5__12; private RectTransform <child>5__13; private GameObject <poiMarkerViewGO>5__14; private RectTransform <rect>5__15; private PoIMarkerView <poiMarkerView>5__16; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UpdatePoIMarkersCoroutine>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <waitInterval>5__1 = null; <>8__2 = null; <allChildren>5__3 = null; <childrenToRemove>5__4 = null; <>s__5 = null; <rt>5__7 = null; <key>5__8 = null; <>s__9 = default(List<KeyValuePair<string, PoIMarkerView>>.Enumerator); <kvp>5__10 = default(KeyValuePair<string, PoIMarkerView>); <>s__11 = default(Dictionary<string, RectTransform>.Enumerator); <kvp>5__12 = default(KeyValuePair<string, RectTransform>); <child>5__13 = null; <poiMarkerViewGO>5__14 = null; <rect>5__15 = null; <poiMarkerView>5__16 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_0384: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <waitInterval>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; if ((Object)(object)PlayerSingleton<MapApp>.Instance == (Object)null || (Object)(object)PlayerSingleton<MapApp>.Instance.PoIContainer == (Object)null) { break; } <allChildren>5__3 = ((Component)PlayerSingleton<MapApp>.Instance.PoIContainer).GetComponentsInChildren<RectTransform>(false); <>8__2.currentChildren = new Dictionary<string, RectTransform>(); <>s__5 = <allChildren>5__3; for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++) { <rt>5__7 = <>s__5[<>s__6]; if (((Component)<rt>5__7).gameObject.activeSelf && <>4__this.allowList.Contains(((Object)((Component)<rt>5__7).gameObject).name)) { <key>5__8 = <>4__this.GetGeneratedPoIKey(<rt>5__7); <>8__2.currentChildren[<key>5__8] = <rt>5__7; <key>5__8 = null; } <rt>5__7 = null; } <>s__5 = null; <childrenToRemove>5__4 = <>4__this.poiMarkers.Where((KeyValuePair<string, PoIMarkerView> marker) => !<>8__2.currentChildren.ContainsKey(marker.Key)).ToList(); <childrenToRemove>5__4.RemoveAll((KeyValuePair<string, PoIMarkerView> kvp) => <>4__this.poiMarkerKeyMap.ContainsValue(kvp.Key)); <>s__9 = <childrenToRemove>5__4.GetEnumerator(); try { while (<>s__9.MoveNext()) { <kvp>5__10 = <>s__9.Current; if ((Object)(object)<kvp>5__10.Value != (Object)null && (Object)(object)((Component)<kvp>5__10.Value).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)<kvp>5__10.Value).gameObject); } <>4__this.poiMarkers.Remove(<kvp>5__10.Key); <kvp>5__10 = default(KeyValuePair<string, PoIMarkerView>); } } finally { ((IDisposable)<>s__9).Dispose(); } <>s__9 = default(List<KeyValuePair<string, PoIMarkerView>>.Enumerator); <>s__11 = <>8__2.currentChildren.GetEnumerator(); try { while (<>s__11.MoveNext()) { <kvp>5__12 = <>s__11.Current; if (!<>4__this.poiMarkers.ContainsKey(<kvp>5__12.Key) && !<>4__this.poiMarkerKeyMap.ContainsValue(<kvp>5__12.Key)) { <child>5__13 = <kvp>5__12.Value; <poiMarkerViewGO>5__14 = new GameObject("PoIMarkerView_" + ((Object)<child>5__13).name); <rect>5__15 = <poiMarkerViewGO>5__14.AddComponent<RectTransform>(); ((Transform)<rect>5__15).SetParent((Transform)(object)<>4__this.mapImageRT, false); <poiMarkerView>5__16 = <poiMarkerViewGO>5__14.AddComponent<PoIMarkerView>(); <poiMarkerView>5__16.Initialize(<child>5__13, <child>5__13.anchoredPosition, <>4__this.worldScaleFactor, <>4__this.currentZoomLevel, isDynamic: false, ((Object)((Component)<child>5__13).gameObject).name, <>4__this.mapImageRT, <>4__this._isCircleMode); if (<kvp>5__12.Key.Contains("OwnedVehiclePoI(Clone)")) { <>4__this.poiMarkerKeyMap[<kvp>5__12.Key] = <kvp>5__12.Key; } <>4__this.poiMarkers[<kvp>5__12.Key] = <poiMarkerView>5__16; <child>5__13 = null; <poiMarkerViewGO>5__14 = null; <rect>5__15 = null; <poiMarkerView>5__16 = null; <kvp>5__12 = default(KeyValuePair<string, RectTransform>); } } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(Dictionary<string, RectTransform>.Enumerator); <>8__2 = null; <allChildren>5__3 = null; <childrenToRemove>5__4 = null; break; } <>8__2 = new <>c__DisplayClass18_0(); <>2__current = <waitInterval>5__1; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Dictionary<string, string> poiMarkerKeyMap = new Dictionary<string, string>(); private Dictionary<string, PoIMarkerView> poiMarkers = new Dictionary<string, PoIMarkerView>(); private RectTransform mapImageRT; private float worldScaleFactor; private float currentZoomLevel; private bool _isCircleMode; private bool _isTrackingVehicles; private string _vehiclePoIKey; private object _updateCoroutine; private float minimapPlayerCenterXOffset; private float minimapPlayerCenterYOffset; private HashSet<string> allowList = new HashSet<string> { "QuestPoI(Clone)", "DeaddropPoI_Red(Clone)" }; public void Initialize(RectTransform mapImage, float worldScale, float zoom, bool trackProperties, bool trackContracts, bool trackVehicles, bool isCircle, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { mapImageRT = mapImage; worldScaleFactor = worldScale; currentZoomLevel = zoom; _isCircleMode = isCircle; _isTrackingVehicles = trackVehicles; this.minimapPlayerCenterXOffset = minimapPlayerCenterXOffset; this.minimapPlayerCenterYOffset = minimapPlayerCenterYOffset; if (trackProperties) { allowList.Add("PropertyPoI(Clone)"); } if (trackContracts) { allowList.Add("ContractPoI(Clone)"); } if (trackVehicles) { allowList.Add("OwnedVehiclePoI(Clone)"); ((MonoBehaviour)this).InvokeRepeating("UpdateVehicleMarkers", 0f, 1f); } } public void UpdateZoomLevel(float newZoomLevel) { currentZoomLevel = newZoomLevel; foreach (KeyValuePair<string, PoIMarkerView> poiMarker in poiMarkers) { poiMarker.Value.UpdateZoomLevel(newZoomLevel); } } public void UpdateMinimapShape(bool isCircle) { _isCircleMode = isCircle; foreach (KeyValuePair<string, PoIMarkerView> poiMarker in poiMarkers) { poiMarker.Value.SetShape(isCircle); } } private void OnEnable() { if (_updateCoroutine == null) { _updateCoroutine = MelonCoroutines.Start(UpdatePoIMarkersCoroutine()); } } private void OnDisable() { if (_updateCoroutine != null) { MelonCoroutines.Stop(_updateCoroutine); _updateCoroutine = null; } } private string GetGeneratedPoIKey(RectTransform rt) { //IL_0033: 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) if ((Object)(object)rt == (Object)null || (Object)(object)((Component)rt).gameObject == (Object)null) { return null; } return $"{((Object)((Component)rt).gameObject).name}_{Mathf.RoundToInt(rt.anchoredPosition.x)}_{Mathf.RoundToInt(rt.anchoredPosition.y)}"; } [IteratorStateMachine(typeof(<UpdatePoIMarkersCoroutine>d__18))] private IEnumerator UpdatePoIMarkersCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UpdatePoIMarkersCoroutine>d__18(0) { <>4__this = this }; } public void OnTrackPropertiesChanged(bool isTracking) { if (isTracking) { allowList.Add("PropertyPoI(Clone)"); } else { allowList.Remove("PropertyPoI(Clone)"); } } public void OnTrackContractsChanged(bool isTracking) { if (isTracking) { allowList.Add("ContractPoI(Clone)"); } else { allowList.Remove("ContractPoI(Clone)"); } } public void OnTrackVehiclesChanged(bool isTracking) { _isTrackingVehicles = isTracking; if (isTracking) { allowList.Add("OwnedVehiclePoI(Clone)"); foreach (KeyValuePair<string, PoIMarkerView> item in poiMarkers.Where((KeyValuePair<string, PoIMarkerView> entry) => entry.Key.Contains("OwnedVehiclePoI(Clone)")).ToList()) { ((Component)item.Value).gameObject.SetActive(true); } ((MonoBehaviour)this).InvokeRepeating("UpdateVehicleMarkers", 0f, 1f); return; } ((MonoBehaviour)this).CancelInvoke("UpdateVehicleMarkers"); foreach (KeyValuePair<string, PoIMarkerView> item2 in poiMarkers.Where((KeyValuePair<string, PoIMarkerView> entry) => entry.Key.Contains("OwnedVehiclePoI(Clone)")).ToList()) { ((Component)item2.Value).gameObject.SetActive(false); } allowList.Remove("OwnedVehiclePoI(Clone)"); } public void OnPlayerEnterVehicle(LandVehicle vehicle) { if (!_isTrackingVehicles) { return; } object obj; if (vehicle == null) { obj = null; } else { POI pOI = vehicle.POI; obj = ((pOI != null) ? pOI.UI : null); } if (!((Object)obj == (Object)null)) { _vehiclePoIKey = GetGeneratedPoIKey(vehicle.POI.UI); if (!string.IsNullOrEmpty(_vehiclePoIKey) && poiMarkers.TryGetValue(_vehiclePoIKey, out var value) && (Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(false); } } } public void OnPlayerExitVehicle(LandVehicle vehicle) { if (_isTrackingVehicles && !string.IsNullOrEmpty(_vehiclePoIKey)) { if (poiMarkers.TryGetValue(_vehiclePoIKey, out var value) && (Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(true); } _vehiclePoIKey = null; } } private void UpdateVehicleMarkers() { //IL_0151: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)NetworkSingleton<VehicleManager>.Instance == (Object)null || NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles == null || (Object)(object)this == (Object)null || (Object)(object)((Component)this).gameObject == (Object)null || !((Component)this).gameObject.activeInHierarchy) { return; } try { foreach (LandVehicle playerOwnedVehicle in NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles) { if ((Object)(object)playerOwnedVehicle == (Object)null || (Object)(object)playerOwnedVehicle.POI == (Object)null || (Object)(object)playerOwnedVehicle.POI.UI == (Object)null || (Object)(object)((Component)playerOwnedVehicle).transform == (Object)null) { continue; } string generatedPoIKey = GetGeneratedPoIKey(playerOwnedVehicle.POI.UI); if (string.IsNullOrEmpty(generatedPoIKey)) { continue; } foreach (string key in poiMarkers.Keys) { if (key.StartsWith("OwnedVehiclePoI(Clone)_")) { } } if (poiMarkers.TryGetValue(generatedPoIKey, out var value) && (Object)(object)value != (Object)null) { value.UpdatePositionFromWorld(((Component)playerOwnedVehicle).transform.position); } } } catch (Exception ex) { MelonLogger.Warning("[MapMarkerManager] Exception in UpdateVehicleMarkers: " + ex.Message); } } } } namespace Small_Corner_Map.Main { [RegisterTypeInIl2Cpp] public class MinimapManager : MonoBehaviour { [CompilerGenerated] private sealed class <InitializeWhenReady>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MinimapManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeWhenReady>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)Player.Local == (Object)null) { <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)<>4__this._minimapView == (Object)null) { MelonLogger.Warning("MinimapView was destroyed during initialization. Aborting."); return false; } MelonLogger.Msg("Player object found, initializing MinimapView."); <>4__this._minimapView.Initialize(Player.Local, <>4__this._mapPreferences.MinimapEnabled.Value, <>4__this._mapPreferences.MinimapScaleFactor, <>4__this._mapPreferences.ShowSquareMinimap.Value, <>4__this._mapPreferences.ShowGameTime.Value, 1f, 1.22f, 13f, -4.25f, <>4__this._mapPreferences.TrackProperties.Value, <>4__this._mapPreferences.TrackContracts.Value, <>4__this._mapPreferences.TrackVehicles.Value, <>4__this._mapPreferences.MinimapPositionX.Value, <>4__this._mapPreferences.MinimapPositionY.Value); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.MinimapEnabled.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnMinimapEnabledChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.IncreaseSize.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnIncreaseSizeChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.ShowSquareMinimap.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnShowSquareMinimapChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.ShowGameTime.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnShowGameTimeChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackProperties.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackPropertiesChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackContracts.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackContractsChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackVehicles.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackVehiclesChanged, 0, false); ((MelonEventBase<LemonAction<float, float>>)(object)<>4__this._mapPreferences.MinimapPositionX.OnEntryValueChanged).Subscribe((LemonAction<float, float>)<>4__this.OnMinimapPositionXChanged, 0, false); ((MelonEventBase<LemonAction<float, float>>)(object)<>4__this._mapPreferences.MinimapPositionY.OnEntryValueChanged).Subscribe((LemonAction<float, float>)<>4__this.OnMinimapPositionYChanged, 0, false); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static MinimapManager _instance; private MinimapView _minimapView; private MapPreferences _mapPreferences; public static MinimapManager Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("MinimapManager").AddComponent<MinimapManager>(); Object.DontDestroyOnLoad((Object)(object)((Component)_instance).gameObject); } return _instance; } } public void Initialize() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_minimapView != (Object)null) { MelonLogger.Msg("MinimapManager is already initialized. Skipping."); return; } MelonLogger.Msg("MinimapManager initializing."); _mapPreferences = new MapPreferences(); _mapPreferences.LoadPreferences(); _minimapView = new GameObject("MinimapView").AddComponent<MinimapView>(); ((Component)_minimapView).transform.SetParent(((Component)this).transform); MelonCoroutines.Start(InitializeWhenReady()); } public void Cleanup() { MelonLogger.Msg("MinimapManager cleaning up."); UnsubscribeEvents(); if ((Object)(object)_minimapView != (Object)null) { Object.Destroy((Object)(object)((Component)_minimapView).gameObject); _minimapView = null; } _instance = null; } public void OnPlayerEnterVehicle(LandVehicle vehicle) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.HandlePlayerEnterVehicle(vehicle); } } public void OnPlayerExitVehicle(LandVehicle vehicle) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.HandlePlayerExitVehicle(vehicle); } } [IteratorStateMachine(typeof(<InitializeWhenReady>d__9))] private IEnumerator InitializeWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeWhenReady>d__9(0) { <>4__this = this }; } private void OnDestroy() { UnsubscribeEvents(); } private void UnsubscribeEvents() { if (_mapPreferences != null) { ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.MinimapEnabled.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnMinimapEnabledChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.IncreaseSize.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnIncreaseSizeChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.ShowSquareMinimap.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnShowSquareMinimapChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.ShowGameTime.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnShowGameTimeChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackProperties.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackPropertiesChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackContracts.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackContractsChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackVehicles.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackVehiclesChanged); ((MelonEventBase<LemonAction<float, float>>)(object)_mapPreferences.MinimapPositionX.OnEntryValueChanged).Unsubscribe((LemonAction<float, float>)OnMinimapPositionXChanged); ((MelonEventBase<LemonAction<float, float>>)(object)_mapPreferences.MinimapPositionY.OnEntryValueChanged).Unsubscribe((LemonAction<float, float>)OnMinimapPositionYChanged); } } private void OnMinimapEnabledChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.ToggleMinimapVisibility(newValue); } } private void OnIncreaseSizeChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapUISize(_mapPreferences.MinimapScaleFactor); } } private void OnShowSquareMinimapChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapShape(newValue); } } private void OnMapZoomLevelChanged(float oldValue, float newValue) { _minimapView.UpdateMapMovementScale(newValue); } private void OnMinimapPlayerOffsetXChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPlayerCenterXOffset(newValue); } } private void OnMinimapPlayerOffsetYChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPlayerCenterYOffset(newValue); } } private void OnShowGameTimeChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateTimeDisplayVisibility(newValue); } } private void OnTrackPropertiesChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdatePropertyTracking(newValue); } } private void OnTrackContractsChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateContractTracking(newValue); } } private void OnTrackVehiclesChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateVehicleTracking(newValue); } } private void OnMinimapPositionXChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPosition(newValue, _mapPreferences.MinimapPositionY.Value); } } private void OnMinimapPositionYChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPosition(_mapPreferences.MinimapPositionX.Value, newValue); } } public void OnMinimapPositionChanged(float x, float y) { if (_mapPreferences != null) { _mapPreferences.MinimapPositionX.Value = x; _mapPreferences.MinimapPositionY.Value = y; } } } [RegisterTypeInIl2Cpp] public class MinimapView : MonoBehaviour { private GameObject canvasGo; private GameObject mapImageGo; private Image mapImage; private Image maskImage; private Mask mask; private Image borderImage; private PlayerMarkerView playerMarkerView; private MapMarkerManager mapMarkerManager; private TimeDisplayView timeDisplayView; private Transform playerTransform; private Sprite circleSprite; private Sprite squareSprite; private float worldScaleFactor; private float minimapPlayerCenterXOffset; private float minimapPlayerCenterYOffset; private float currentZoomLevel; private RectTransform mapImageRT; private RectTransform containerRT; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown mapImageGo = new GameObject("MapImage"); mapImageRT = mapImageGo.AddComponent<RectTransform>(); } public void Initialize(Player player, bool minimapEnabled, float minimapScaleFactor, bool showSquareMinimap, bool showGameTime, float scaleFactor, float mapZoomLevel, float playerCenterXOffset, float playerCenterYOffset, bool trackProperties, bool trackContracts, bool trackVehicles, float positionX, float positionY) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) MelonLogger.Msg("MinimapView initializing."); playerTransform = ((Component)player).transform; worldScaleFactor = scaleFactor; minimapPlayerCenterXOffset = playerCenterXOffset; minimapPlayerCenterYOffset = playerCenterYOffset; currentZoomLevel = mapZoomLevel; MinimapState.UpdateState(!showSquareMinimap, minimapScaleFactor); if (!Object.op_Implicit((Object)(object)circleSprite)) { circleSprite = Utils.CreateCircleSprite(256, Color.grey, 2, 2); } if (!Object.op_Implicit((Object)(object)squareSprite)) { squareSprite = Utils.CreateRoundedSquareSprite(150, 3f, Color.grey); } if (minimapEnabled) { CreateMinimapUI(player, minimapScaleFactor, showGameTime, trackProperties, trackContracts, trackVehicles, !showSquareMinimap, positionX, positionY); LoadMapSprite(); SetStyle(!showSquareMinimap); } ToggleMinimapVisibility(minimapEnabled); } public void ToggleMinimapVisibility(bool isVisible) { if ((Object)(object)canvasGo != (Object)null) { canvasGo.SetActive(isVisible); } } public void UpdateMinimapUISize(float newScaleFactor) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)canvasGo != (Object)null) { RectTransform component = ((Component)canvasGo.transform.Find("MinimapContainer")).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.sizeDelta = new Vector2(150f * newScaleFactor, 150f * newScaleFactor); MinimapState.UpdateState(MinimapState.IsCircleMode, newScaleFactor); } } } public void UpdateMinimapShape(bool isSquare) { bool flag = !isSquare; SetStyle(flag); MinimapState.UpdateState(flag, MinimapState.ScaleFactor); if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.UpdateMinimapShape(flag); } } public void UpdateMapMovementScale(float newZoomLevel) { currentZoomLevel = newZoomLevel; if ((Object)(object)playerMarkerView != (Object)null) { playerMarkerView.UpdateZoomLevel(newZoomLevel); } if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.UpdateZoomLevel(newZoomLevel); } } public void UpdateMinimapPlayerCenterXOffset(float newOffsetX) { minimapPlayerCenterXOffset = newOffsetX; } public void UpdateMinimapPlayerCenterYOffset(float newOffsetY) { minimapPlayerCenterYOffset = newOffsetY; } public void UpdateTimeDisplayVisibility(bool isVisible) { if ((Object)(object)timeDisplayView != (Object)null) { timeDisplayView.ToggleVisibility(isVisible); } } public void UpdateVehicleTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackVehiclesChanged(isVisible); } } public void UpdatePropertyTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackPropertiesChanged(isVisible); } } public void UpdateContractTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackContractsChanged(isVisible); } } public void HandlePlayerEnterVehicle(LandVehicle vehicle) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnPlayerEnterVehicle(vehicle); } } public void HandlePlayerExitVehicle(LandVehicle vehicle) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnPlayerExitVehicle(vehicle); } } private void CreateMinimapUI(Player player, float minimapScaleFactor, bool showGameTime, bool trackProperties, bool trackContracts, bool trackVehicles, bool isCircle, float positionX, float positionY) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00b2: 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_00e8: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01be: Expected O, but got Unknown //IL_01dd: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) canvasGo = new GameObject("MinimapCanvas"); Canvas val = canvasGo.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 999; CanvasScaler val2 = canvasGo.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); canvasGo.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)canvasGo); GameObject val3 = new GameObject("MinimapContainer"); val3.transform.SetParent(canvasGo.transform, false); containerRT = val3.AddComponent<RectTransform>(); containerRT.anchorMin = new Vector2(1f, 1f); containerRT.anchorMax = new Vector2(1f, 1f); containerRT.pivot = new Vector2(1f, 1f); containerRT.anchoredPosition = new Vector2(positionX, positionY); containerRT.sizeDelta = new Vector2(150f * minimapScaleFactor, 150f * minimapScaleFactor); GameObject val4 = new GameObject("MinimapBorder"); val4.transform.SetParent((Transform)(object)containerRT, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = new Vector2(-2f, -2f); val5.offsetMax = new Vector2(2f, 2f); borderImage = val4.AddComponent<Image>(); ((Graphic)borderImage).color = Color.black; GameObject val6 = new GameObject("MinimapMask"); val6.transform.SetParent((Transform)(object)containerRT, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.sizeDelta = Vector2.zero; maskImage = val6.AddComponent<Image>(); ((Graphic)maskImage).color = Color.white; mask = val6.AddComponent<Mask>(); mask.showMaskGraphic = false; mapImageGo.transform.SetParent((Transform)(object)val7, false); mapImageRT.anchorMin = new Vector2(0.5f, 0.5f); mapImageRT.anchorMax = new Vector2(0.5f, 0.5f); mapImageRT.pivot = new Vector2(0.5f, 0.5f); mapImageRT.sizeDelta = new Vector2(500f, 500f); mapImage = mapImageGo.AddComponent<Image>(); ((Graphic)mapImage).color = Color.white; playerMarkerView = new GameObject("PlayerMarkerView").AddComponent<PlayerMarkerView>(); ((Component)playerMarkerView).transform.SetParent((Transform)(object)containerRT, false); playerMarkerView.Initialize(((Component)containerRT).transform, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); mapMarkerManager = new GameObject("PropertyPoIManager").AddComponent<MapMarkerManager>(); ((Component)mapMarkerManager).transform.SetParent((Transform)(object)containerRT, false); mapMarkerManager.Initialize(mapImageRT, worldScaleFactor, currentZoomLevel, trackProperties, trackContracts, trackVehicles, isCircle, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); timeDisplayView = new GameObject("TimeDisplayView").AddComponent<TimeDisplayView>(); ((Component)timeDisplayView).transform.SetParent((Transform)(object)containerRT, false); timeDisplayView.Initialize(containerRT, showGameTime); } private void LoadMapSprite() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0090: 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) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("Small_Corner_Map.Assets.Map_Full.png"); if (stream == null) { MelonLogger.Error("MinimapView: Failed to get manifest resource stream for Small_Corner_Map.Assets.Map_Full.png. Available resources: " + string.Join(", ", executingAssembly.GetManifestResourceNames())); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, (int)stream.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); mapImage.sprite = sprite; } else { MelonLogger.Error("MinimapView: Failed to load image data into texture from embedded resource Small_Corner_Map.Assets.Map_Full.png"); } } catch (Exception ex) { MelonLogger.Error("MinimapView: Error loading map sprite: " + ex.Message); } } public void SetStyle(bool useCircle) { if (!((Object)(object)maskImage == (Object)null) && !((Object)(object)borderImage == (Object)null)) { Sprite sprite = (useCircle ? circleSprite : squareSprite); maskImage.sprite = sprite; borderImage.sprite = sprite; } } private void Update() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)playerTransform) && Object.op_Implicit((Object)(object)mapImageGo)) { if (Player.Local.IsInVehicle) { playerTransform = ((Component)Player.Local.CurrentVehicle).transform; } else { playerTransform = ((Component)Player.Local).transform; } Vector2 mapContentPosition = MinimapCoordinateSystem.GetMapContentPosition(playerTransform.position, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); mapImageRT.anchoredPosition = mapContentPosition; } } public void UpdateMinimapPosition(float positionX, float positionY) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)containerRT != (Object)null) { containerRT.anchoredPosition = new Vector2(positionX, positionY); } } } [RegisterTypeInIl2Cpp] public class TimeDisplayView : MonoBehaviour { private Text timeText; private GameObject timeDisplayGo; private bool showGameTime; private const int Width = 110; private const int Height = 55; public void ToggleVisibility(bool isVisible) { showGameTime = isVisible; if ((Object)(object)timeDisplayGo != (Object)null) { timeDisplayGo.SetActive(isVisible); } } public void Initialize(RectTransform parent, bool initialShowGameTime) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) showGameTime = initialShowGameTime; timeDisplayGo = new GameObject("TimeDisplay"); timeDisplayGo.transform.SetParent((Transform)(object)parent, false); RectTransform val = timeDisplayGo.AddComponent<RectTransform>(); Image val2 = timeDisplayGo.AddComponent<Image>(); val2.sprite = Utils.CreateRoundedRectSprite(110, 55, 10f, new Color(0f, 0f, 0f, 0.5f)); val2.type = (Type)1; val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 0f); val.pivot = new Vector2(0.5f, 1f); val.anchoredPosition = new Vector2(0f, -10f); val.sizeDelta = new Vector2(110f, 55f); GameObject val3 = new GameObject("TimeText"); val3.transform.SetParent((Transform)(object)val, false); timeText = val3.AddComponent<Text>(); timeText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); timeText.fontSize = 14; timeText.alignment = (TextAnchor)4; ((Graphic)timeText).color = Color.white; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; timeDisplayGo.SetActive(showGameTime); } private void Update() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (showGameTime && NetworkSingleton<TimeManager>.InstanceExists && Object.op_Implicit((Object)(object)timeText)) { int currentTime = NetworkSingleton<TimeManager>.Instance.CurrentTime; EDay currentDay = NetworkSingleton<TimeManager>.Instance.CurrentDay; if (Object.op_Implicit((Object)(object)timeText)) { timeText.text = ((object)(EDay)(ref currentDay)).ToString() + "\n" + TimeManager.Get12HourTime((float)currentTime, true); } } } } } namespace Small_Corner_Map.Helpers { internal static class Constants { public const string ModVersion = "4.0.0"; public const string ModName = "Small Corner Map"; public const string ModAuthor = "winzaar"; public const string GameName = "Schedule I"; public const string GameDeveloper = "TVGS"; public const bool DisableDebug = true; public const string MapPreferencesCategoryIdentifier = "SmallCornerMapSettings"; public const float BaseWorldToUIScaleFactor = 1f; public const float MinimapDefaultMapMovementScale = 1.22f; public const float InitialMapImageScale = 0.0825f; public const float MinimapDefaultPlayerOffsetX = 13f; public const float MinimapDefaultPlayerOffsetY = -4.25f; public const int MinimapCircleDrawingResolution = 256; public const int PlayerMarkerCircleDrawingResolution = 20; public const float MarkerXOffset = 14f; public const float MarkerZOffset = -3.5f; public const float MinimapImageOffsetX = 0f; public const float MinimapImageOffsetY = 0f; public const string MinimapImagePath = "Small_Corner_Map.Assets.Map_Full.png"; public const float BaseMinimapSize = 150f; public const float BaseMapContentSize = 500f; public const float MinimapCornerOffset = -20f; public const float MinimapSizeMultiplier = 1.5f; public const float ContractMarkerSize = 8f; public const float ContractMarkerScale = 0.4f; public const float PropertyMarkerSize = 5f; public const float PropertyMarkerScale = 0.4f; public const float RedMarkerSize = 5f; public const float PlayerMarkerSize = 10f; public const float DirectionIndicatorSize = 6f; public const float DirectionIndicatorDistance = 10f; public const float MinimapBorderThickness = 2f; public const float MinimapBorderR = 0.13f; public const float MinimapBorderG = 0.13f; public const float MinimapBorderB = 0.13f; public const float MinimapBorderA = 1f; public const int MinimapBorderFeather = 2; public const int MinimapCircleResolutionMultiplier = 2; public const int MinimapMaskFeather = 2; public const int MinimapMaskDiameterOffset = 2; public const int DefaultGridSize = 20; public const int CanvasSortOrder = 9999; public const float CanvasReferenceWidth = 1920f; public const float CanvasReferenceHeight = 1080f; public const float MapContentLerpSpeed = 10f; public const float PlayerMarkerOffsetX = 11.2f; public const float PlayerMarkerOffsetZ = -2.7f; public const float TimeDisplayWidth = 100f; public const float TimeDisplayHeight = 50f; public const float TimeDisplayOffsetY = -20f; public const float TimeBackgroundR = 0.2f; public const float TimeBackgroundG = 0.2f; public const float TimeBackgroundB = 0.2f; public const float TimeBackgroundA = 0.5f; public const float PlayerMarkerR = 0.2f; public const float PlayerMarkerG = 0.6f; public const float PlayerMarkerB = 1f; public const float PlayerMarkerA = 1f; public const float PlayerIconReplacementScale = 0.5f; public const float SceneIntegrationInitialDelay = 2f; public const float SceneIntegrationRetryDelay = 0.5f; public const int SceneIntegrationMaxAttempts = 30; public const string GameplayMenuPath = "GameplayMenu"; public const string MapAppPath = "GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content"; public static readonly string DeadDropQuestName = "Collect Dead Drop"; public static readonly string ContractQuestName = "Deal for"; public const float VehicleMarkerFadeDuration = 0.15f; public const int CompassTickCount = 16; public const float CompassRingPadding = 6f; public const float CompassRingThickness = 20f; public const int CompassLetterFontSize = 12; public const float CompassLetterColorR = 1f; public const float CompassLetterColorG = 1f; public const float CompassLetterColorB = 1f; public const float CompassLetterColorA = 0.9f; public const float CompassTickColorR = 1f; public const float CompassTickColorG = 1f; public const float CompassTickColorB = 1f; public const float CompassTickColorA = 0.75f; public const float CompassTickMajorScale = 1f; public const float CompassTickMinorScale = 0.6f; public const float CompassTickWidth = 2f; public const float CompassTickHeight = 8f; public const float CompassRingExtraThickness = 2f; public const string CompassPreferenceKey = "ShowCompass"; public const float CompassLetterRadialOffset = 4f; public const float CompassTickInset = 2f; public const int CompassBorderThickness = 2; public const float CompassBorderColorR = 0.13f; public const float CompassBorderColorG = 0.13f; public const float CompassBorderColorB = 0.13f; public const float CompassBorderColorA = 0.9f; public const float CompassVisibilityBuffer = 4f; public const float CompassBackgroundColorR = 0.8f; public const float CompassBackgroundColorG = 0.8f; public const float CompassBackgroundColorB = 0.8f; public const float CompassBackgroundColorA = 0.3f; public const float CompassDefaultIconSize = 15f; public const float CompassContractIconSize = 20f; } public class Utils { internal static void RecursiveFind(Transform current, string targetName, List<Transform> result) { if (((Object)current).name == targetName) { result.Add(current); } for (int i = 0; i < current.childCount; i++) { RecursiveFind(current.GetChild(i), targetName, result); } } public static Sprite CreateSquareSprite(int size, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001d: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[size * size]; for (int i = 0; i < array.Length; i++) { array[i] = color; } val.SetPixels(array); val.Apply(); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, (float)size, (float)size); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); float num = 100f; Sprite val4 = Sprite.Create(val, val2, val3, num); ((Object)val4).name = "Minimap_SquareSprite"; return val4; } public static Sprite CreateCircleSprite(int diameter, Color color, int resolutionMultiplier = 1, int featherWidth = 0, bool featherInside = true) { //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_0017: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_00a4: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) int num = diameter * resolutionMultiplier; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false) { filterMode = (FilterMode)1 }; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { val.SetPixel(j, i, val2); } } float num2 = (float)num / 2f; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(num2, num2); int num3 = Mathf.Max(0, featherWidth * resolutionMultiplier); for (int k = 0; k < num; k++) { for (int l = 0; l < num; l++) { float num4 = Vector2.Distance(new Vector2((float)l, (float)k), val3); float num5 = 0f; if (featherInside) { if (!(num4 <= num2)) { continue; } num5 = color.a; if (num3 > 0) { float num6 = num2 - num4; if (num6 <= (float)num3) { num5 *= Mathf.Clamp01(num6 / (float)num3); } } val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } else if (num4 <= num2) { num5 = color.a; val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } else if (num4 > num2 && num4 <= num2 + (float)num3) { float num7 = num4 - num2; num5 = color.a * Mathf.Clamp01(1f - num7 / (float)num3); val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), (float)resolutionMultiplier); } public static Sprite CreateRoundedSquareSprite(int size, float cornerRadius, Color color, int resolutionMultiplier = 2) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) int num = size * resolutionMultiplier; float num2 = cornerRadius * (float)resolutionMultiplier; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[num * num]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { int num3 = i * num + j; array[num3] = color; if ((float)j < num2 && (float)i < num2) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) > num2) { array[num3] = val2; } } else if ((float)j > (float)num - num2 - 1f && (float)i < num2) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, num2)) > num2) { array[num3] = val2; } } else if ((float)j < num2 && (float)i > (float)num - num2 - 1f) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, (float)num - num2 - 1f)) > num2) { array[num3] = val2; } } else if ((float)j > (float)num - num2 - 1f && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, (float)num - num2 - 1f)) > num2) { array[num3] = val2; } } } val.SetPixels(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f * (float)resolutionMultiplier); } public static Sprite CreateRoundedRectSprite(int width, int height, float cornerRadius, Color color, int resolutionMultiplier = 2) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) int num = width * resolutionMultiplier; int num2 = height * resolutionMultiplier; float num3 = cornerRadius * (float)resolutionMultiplier; Texture2D val = new Texture2D(num, num2, (TextureFormat)5, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[num * num2]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { int num4 = i * num + j; array[num4] = color; if ((float)j < num3 && (float)i < num3) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num3, num3)) > num3) { array[num4] = val2; } } else if ((float)j > (float)num - num3 - 1f && (float)i < num3) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num3 - 1f, num3)) > num3) { array[num4] = val2; } } else if ((float)j < num3 && (float)i > (float)num2 - num3 - 1f) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num3, (float)num2 - num3 - 1f)) > num3) { array[num4] = val2; } } else if ((float)j > (float)num - num3 - 1f && (float)i > (float)num2 - num3 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num3 - 1f, (float)num2 - num3 - 1f)) > num3) { array[num4] = val2; } } } val.SetPixels(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f), 100f * (float)resolutionMultiplier); } } public class MapPreferences { private const string CategoryDisplayName = "Small Corner Map Settings"; private const string MinimapEnabledKey = "01_MinimapEnabled"; private const string MinimapEnabledDisplayName = "Enable Minimap"; private const bool MinimapEnabledDefault = true; private const string ShowGameTimeKey = "03_ShowGameTime"; private const string ShowGameTimeDisplayName = "Show Current Game Time"; private const bool ShowGameTimeDefault = true; private const string IncreaseSizeKey = "02_IncreaseMapSize"; private const string IncreaseSizeDisplayName = "Increase Minimap Size"; private const bool IncreaseSizeDefault = false; private const string ContractTrackingKey = "04_TrackContracts"; private const string ContractTrackingDisplayName = "Track Active Contracts on Minimap"; private const bool ContractTrackingDefault = true; private const string PropertyTrackingKey = "05_TrackProperties"; private const string PropertyTrackingDisplayName = "Track Owned Properties on Minimap"; private const bool PropertyTrackingDefault = true; private const string VehicleTrackingKey = "06_TrackVehicles"; private const string VehicleTrackingDisplayName = "Track Owned Vehicles on Minimap"; private const bool VehicleTrackingDefault = true; private const string MinimapPositionXKey = "07_MinimapPositionX"; private const string MinimapPositionXDisplayName = "Change Minimap Position: X Coordinate"; private const float MinimapPositionXDefault = -20f; private const string MinimapPositionYKey = "08_MinimapPositionY"; private const string MinimapPositionYDisplayName = "Change Minimap Position: Y Coordinate"; private const float MinimapPositionYDefault = -20f; private readonly float defaultScaleFactor = 1f; private readonly float increasedScaleFactor = 1.5f; public MelonPreferences_Category SettingsCategory { get; set; } public MelonPreferences_Entry<bool> MinimapEnabled { get; private set; } public MelonPreferences_Entry<bool> ShowGameTime { get; private set; } public MelonPreferences_Entry<bool> IncreaseSize { get; private set; } public MelonPreferences_Entry<bool> TrackContracts { get; private set; } public MelonPreferences_Entry<bool> TrackProperties { get; private set; } public MelonPreferences_Entry<bool> TrackVehicles { get; private set; } public MelonPreferences_Entry<float> MinimapPositionX { get; private set; } public MelonPreferences_Entry<float> MinimapPositionY { get; private set; } public MelonPreferences_Entry<bool> ShowSquareMinimap { get; private set; } public float MinimapScaleFactor => IncreaseSize.Value ? increasedScaleFactor : defaultScaleFactor; public void LoadPreferences() { CreateDefaultEntries(); SettingsCategory = MelonPreferences.GetCategory("SmallCornerMapSettings"); MinimapEnabled = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "01_MinimapEnabled"); ShowGameTime = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "03_ShowGameTime"); IncreaseSize = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "02_IncreaseMapSize"); TrackContracts = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "04_TrackContracts"); TrackProperties = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "05_TrackProperties"); TrackVehicles = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "06_TrackVehicles"); ShowSquareMinimap = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "ShowSquareMinimap"); MinimapPositionX = MelonPreferences.GetEntry<float>("SmallCornerMapSettings", "07_MinimapPositionX"); MinimapPositionY = MelonPreferences.GetEntry<float>("SmallCornerMapSettings", "08_MinimapPositionY"); } private void CreateDefaultEntries() { if (MelonPreferences.GetCategory("SmallCornerMapSettings") == null) { SettingsCategory = MelonPreferences.CreateCategory("SmallCornerMapSettings", "Small Corner Map Settings"); MinimapEnabled = SettingsCategory.CreateEntry<bool>("01_MinimapEnabled", true, "Enable Minimap", (string)null, false, false, (ValueValidator)null, (string)null); ShowGameTime = SettingsCategory.CreateEntry<bool>("03_ShowGameTime", true, "Show Current Game Time", (string)null, false, false, (ValueValidator)null, (string)null); IncreaseSize = SettingsCategory.CreateEntry<bool>("02_IncreaseMapSize", false, "Increase Minimap Size", (string)null, false, false, (ValueValidator)null, (string)null); TrackContracts = SettingsCategory.CreateEntry<bool>("04_TrackContracts", true, "Track Active Contracts on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); TrackProperties = SettingsCategory.CreateEntry<bool>("05_TrackProperties", true, "Track Owned Properties on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); TrackVehicles = SettingsCategory.CreateEntry<bool>("06_TrackVehicles", true, "Track Owned Vehicles on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); ShowSquareMinimap = SettingsCategory.CreateEntry<bool>("ShowSquareMinimap", false, "Enable Square Minimap", (string)null, false, false, (ValueValidator)null, (string)null); MinimapPositionX = SettingsCategory.CreateEntry<float>("07_MinimapPositionX", -20f, "Change Minimap Position: X Coordinate", (string)null, false, false, (ValueValidator)null, (string)null); MinimapPositionY = SettingsCategory.CreateEntry<float>("08_MinimapPositionY", -20f, "Change Minimap Position: Y Coordinate", (string)null, false, false, (ValueValidator)null, (string)null); } } } public static class MinimapCoordinateSystem { public static float WorldToUIScale(float worldScaleFactor, float currentZoomLevel) { return worldScaleFactor * currentZoomLevel; } public static Vector2 WorldToMapSpace(Vector3 worldPos, float worldScaleFactor, float currentZoomLevel) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0021: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); return new Vector2(worldPos.x * num, worldPos.z * num); } public static Vector2 GetMapContentPosition(Vector3 playerWorldPos, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0009: 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_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); float num2 = (0f - playerWorldPos.x) * num + minimapPlayerCenterXOffset; float num3 = (0f - playerWorldPos.z) * num + minimapPlayerCenterYOffset; return new Vector2(num2, num3); } public static Vector2 WorldToMarkerPosition(Vector3 poiWorldPos, Vector3 playerWorldPos, float worldScaleFactor, float currentZoomLevel) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); float num2 = (poiWorldPos.x - playerWorldPos.x) * num; float num3 = (poiWorldPos.z - playerWorldPos.z) * num; return new Vector2(num2, num3); } public static Vector2 GetMapImageOffset() { //IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references) return new Vector2(0f, 0f); } public static string GetDebugInfo(Vector3 worldPos, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Vector2 val = WorldToMapSpace(worldPos, worldScaleFactor, currentZoomLevel); Vector2 mapContentPosition = GetMapContentPosition(worldPos, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); Vector2 val2 = WorldToMarkerPosition(worldPos, worldPos, worldScaleFactor, currentZoomLevel); return $"World: {worldPos}\n" + $"Map Space: {val}\n" + $"Content Pos: {mapContentPosition}\n" + $"Marker Pos (relative to self as player): {val2}\n" + $"Scale: {WorldToUIScale(worldScaleFactor, currentZoomLevel)}x"; } public static Vector2 ClampToCircle(Vector2 markerPosition, float minimapRadius) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector2)(ref markerPosition)).magnitude; if (magnitude > minimapRadius) { return ((Vector2)(ref markerPosition)).normalized * minimapRadius; } return markerPosition; } public static Vector2 ClampToSquare(Vector2 markerPosition, float minimapHalfSize) { //IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(markerPosition.x, 0f - minimapHalfSize, minimapHalfSize); float num2 = Mathf.Clamp(markerPosition.y, 0f - minimapHalfSize, minimapHalfSize); return new Vector2(num, num2); } public static bool IsOutsideBounds(Vector2 markerPosition, float minimapRadius, bool isCircle) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (isCircle) { return ((Vector2)(ref markerPosition)).magnitude > minimapRadius; } return Mathf.Abs(markerPosition.x) > minimapRadius || Mathf.Abs(markerPosition.y) > minimapRadius; } } public static class MinimapState { public static bool IsCircleMode { get; set; } = true; public static float MinimapRadius { get; set; } = 75f; public static float ScaleFactor { get; set; } = 1f; public static void UpdateState(bool isCircle, float scaleFactor) { IsCircleMode = isCircle; ScaleFactor = scaleFactor; MinimapRadius = 75f * scaleFactor; } } }
Mods\Small_Corner_Map.Il2cpp.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using HarmonyLib; using Il2CppFishNet.Object; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.UI.Phone.Map; using Il2CppScheduleOne.Vehicles; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using Small_Corner_Map; using Small_Corner_Map.Helpers; using Small_Corner_Map.Main; using Small_Corner_Map.PoIManagers; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Small Corner Map", "4.0.0", "winzaar", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Small_Corner_Map")] [assembly: AssemblyConfiguration("IL2CPP")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f79f69612a4f593701b8d337c73761dbc5d611f4")] [assembly: AssemblyProduct("Small_Corner_Map")] [assembly: AssemblyTitle("Small_Corner_Map")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Small_Corner_Map { public class Core : MelonMod { [HarmonyPatch(typeof(LandVehicle), "EnterVehicle")] private class Player_EnterVehicle_Patch { private static void Postfix(LandVehicle __instance) { MinimapManager.Instance.OnPlayerEnterVehicle(__instance); } } [HarmonyPatch(typeof(LandVehicle), "ExitVehicle")] private class Player_ExitVehicle_Patch { private static void Postfix(LandVehicle __instance) { MinimapManager.Instance.OnPlayerExitVehicle(__instance); } } private static Core Instance { get; set; } public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); Instance = this; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { ((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName); if (sceneName == "Main") { MelonLogger.Msg("GameplayScene loaded, initializing Small Corner Map..."); MinimapManager.Instance.Initialize(); return; } MinimapManager.Instance.Cleanup(); Object.Destroy((Object)(object)((Component)MinimapManager.Instance).gameObject); GameObject val = GameObject.Find("MinimapCanvas"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } } namespace Small_Corner_Map.PoIManagers { [RegisterTypeInIl2Cpp] public class PlayerMarkerView : MonoBehaviour { [CompilerGenerated] private sealed class <InitializePlayerMarkerIcon>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerMarkerView <>4__this; private GameObject <mapObject>5__1; private Transform <playerPoI>5__2; private Transform <realIcon>5__3; private Transform <mapAppDirectionIndicator>5__4; private Image <mapAppImage>5__5; private Image <ourDirectionImage>5__6; private RectTransform <mapAppRect>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializePlayerMarkerIcon>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <mapObject>5__1 = null; <playerPoI>5__2 = null; <realIcon>5__3 = null; <mapAppDirectionIndicator>5__4 = null; <mapAppImage>5__5 = null; <ourDirectionImage>5__6 = null; <mapAppRect>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_018e: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <mapObject>5__1 = null; break; case 1: <>1__state = -1; break; } if ((Object)(object)<mapObject>5__1 == (Object)null) { <mapObject>5__1 = GameObject.Find("GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content"); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <playerPoI>5__2 = <mapObject>5__1.transform.Find("PlayerPoI(Clone)"); Transform obj = <playerPoI>5__2; <realIcon>5__3 = ((obj != null) ? obj.Find("IconContainer") : null); if ((Object)(object)<realIcon>5__3 != (Object)null) { <>4__this.ReplaceWithRealPlayerIcon(((Component)<realIcon>5__3).gameObject); <mapAppDirectionIndicator>5__4 = <realIcon>5__3.Find("Image"); if ((Object)(object)<mapAppDirectionIndicator>5__4 != (Object)null) { <mapAppImage>5__5 = ((Component)<mapAppDirectionIndicator>5__4).GetComponent<Image>(); if ((Object)(object)<mapAppImage>5__5 != (Object)null && (Object)(object)<mapAppImage>5__5.sprite != (Object)null && (Object)(object)<>4__this._directionIndicator != (Object)null) { <ourDirectionImage>5__6 = ((Component)<>4__this._directionIndicator).GetComponent<Image>(); if ((Object)(object)<ourDirectionImage>5__6 != (Object)null) { <ourDirectionImage>5__6.sprite = <mapAppImage>5__5.sprite; ((Graphic)<ourDirectionImage>5__6).color = Color.white; <mapAppRect>5__7 = ((Component)<mapAppDirectionIndicator>5__4).GetComponent<RectTransform>(); if ((Object)(object)<mapAppRect>5__7 != (Object)null) { <>4__this._directionIndicator.sizeDelta = <mapAppRect>5__7.sizeDelta; } <mapAppRect>5__7 = null; } <ourDirectionImage>5__6 = null; } <mapAppImage>5__5 = null; } <mapAppDirectionIndicator>5__4 = null; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Image _playerMarkerImage; private RectTransform _playerMarkerRect; private Transform _playerTransform; private RectTransform _directionIndicator; private GameObject _markerGO; private GameObject _originalPlayerIconPrefab; private bool _showingVehicleIcon; private readonly Color _markerColor = new Color(0.2f, 0.6f, 1f, 1f); private float _worldScaleFactor; private float _minimapPlayerCenterXOffset; private float _minimapPlayerCenterYOffset; private float _currentZoomLevel; public void UpdateZoomLevel(float newZoomLevel) { _currentZoomLevel = newZoomLevel; } public void UpdateMinimapPlayerCenterXOffset(float newOffsetX) { _minimapPlayerCenterXOffset = newOffsetX; } public void UpdateMinimapPlayerCenterYOffset(float newOffsetY) { _minimapPlayerCenterYOffset = newOffsetY; } public void Initialize(Transform parent, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) _playerTransform = ((Component)Player.Local).transform; _worldScaleFactor = worldScaleFactor; _minimapPlayerCenterXOffset = minimapPlayerCenterXOffset; _minimapPlayerCenterYOffset = minimapPlayerCenterYOffset; _currentZoomLevel = currentZoomLevel; _markerGO = new GameObject("PlayerMarker"); _markerGO.transform.SetParent(parent, false); _playerMarkerRect = _markerGO.AddComponent<RectTransform>(); _playerMarkerRect.sizeDelta = new Vector2(10f, 10f); _playerMarkerRect.anchorMin = new Vector2(0.5f, 0.5f); _playerMarkerRect.anchorMax = new Vector2(0.5f, 0.5f); _playerMarkerRect.pivot = new Vector2(0.5f, 0.5f); _playerMarkerRect.anchoredPosition = Vector2.zero; _playerMarkerImage = _markerGO.AddComponent<Image>(); _playerMarkerImage.sprite = Utils.CreateCircleSprite(20, _markerColor, 2, 2); ((Graphic)_playerMarkerImage).color = _markerColor; _markerGO.transform.SetAsLastSibling(); _markerGO.SetActive(true); MelonCoroutines.Start(InitializePlayerMarkerIcon()); } private void Update() { if ((Object)(object)Player.Local == (Object)null || (Object)(object)this == (Object)null || (Object)(object)((Component)this).gameObject == (Object)null || !((Component)this).gameObject.activeInHierarchy) { return; } try { if (Player.Local.IsInVehicle) { NetworkObject currentVehicle = Player.Local.CurrentVehicle; _playerTransform = ((currentVehicle != null) ? ((Component)currentVehicle).transform : null); } else { _playerTransform = ((Component)Player.Local).transform; } if ((Object)(object)_playerTransform != (Object)null) { UpdateDirectionIndicator(); } } catch (Exception ex) { MelonLogger.Warning("[PlayerMarkerView] Exception in Update: " + ex.Message); } } public void ReplaceWithRealPlayerIcon(GameObject realIconPrefab) { if (!((Object)(object)realIconPrefab == (Object)null)) { _originalPlayerIconPrefab = realIconPrefab; ReplaceWithIcon(realIconPrefab, 0.5f, isVehicle: false); } } private void ReplaceWithIcon(GameObject iconPrefab, float scale, bool isVehicle) { //IL_0064: 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) if (!((Object)(object)_markerGO == (Object)null)) { Transform parent = _markerGO.transform.parent; GameObject val = Object.Instantiate<GameObject>(iconPrefab, parent, false); ((Object)val).name = (isVehicle ? "PlayerVehicleMarker" : "PlayerMarker"); RectTransform component = val.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchoredPosition = _playerMarkerRect.anchoredPosition; ((Transform)component).localScale = new Vector3(scale, scale, scale); } Transform val2 = val.transform.Find("Image"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } if ((Object)(object)_directionIndicator != (Object)null) { ((Transform)_directionIndicator).SetParent(val.transform, false); ((Transform)_directionIndicator).SetAsLastSibling(); } Object.Destroy((Object)(object)_markerGO); _markerGO = val; _playerMarkerRect = component; _markerGO.transform.SetAsLastSibling(); _showingVehicleIcon = isVehicle; } } private void UpdateDirectionIndicator() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if ((Object)(object)_markerGO == (Object)null || (Object)(object)_playerTransform == (Object)null) { return; } if ((Object)(object)_directionIndicator == (Object)null) { Transform val = _markerGO.transform.Find("DirectionIndicator"); if ((Object)(object)val != (Object)null) { _directionIndicator = (RectTransform)val; } else { _directionIndicator = CreateDirectionIndicator(_markerGO, Color.white); } } _directionIndicator.pivot = new Vector2(0.5f, 0.5f); float num = 10f; Quaternion rotation = _playerTransform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; float num2 = (90f - y) * ((float)Math.PI / 180f); float num3 = num * MinimapCoordinateSystem.WorldToUIScale(_worldScaleFactor, _currentZoomLevel); Vector2 anchoredPosition = default(Vector2); ((Vector2)(ref anchoredPosition))..ctor(num3 * Mathf.Cos(num2), num3 * Mathf.Sin(num2)); _directionIndicator.anchoredPosition = anchoredPosition; float num4 = 90f - y; ((Transform)_directionIndicator).localRotation = Quaternion.Euler(0f, 0f, num4); } [IteratorStateMachine(typeof(<InitializePlayerMarkerIcon>d__20))] private IEnumerator InitializePlayerMarkerIcon() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializePlayerMarkerIcon>d__20(0) { <>4__this = this }; } private RectTransform CreateDirectionIndicator(GameObject parent, Color indicatorColor, float size = 6f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DirectionIndicator"); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.sizeDelta = new Vector2(size, size); val2.pivot = new Vector2(0.5f, 0.5f); Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = indicatorColor; return val2; } } [RegisterTypeInIl2Cpp] public class PoIMarkerView : MonoBehaviour { private RectTransform _thisRect; private RectTransform _poiMarkerRect; private RectTransform _sourceRect; private Vector2 _phoneMapPosition; private string poiName; private string _markerType; private float worldScaleFactor; private float currentZoomLevel; private bool _isDynamic; private bool _isCircleMode; private RectTransform _mapImageRT; private Vector2 _mapPosition; private static readonly HashSet<string> clampedMarkerTypes = new HashSet<string> { "QuestPoI(Clone)", "DeaddropPoI_Red(Clone)", "ContractPoI(Clone)" }; public void Initialize(RectTransform poiTransform, Vector2 phoneMapPosition, float worldScale, float zoom, bool isDynamic, string markerType, RectTransform mapImageRT, bool isCircle) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) _sourceRect = poiTransform; _phoneMapPosition = phoneMapPosition; poiName = ((Object)poiTransform).name; _markerType = markerType; worldScaleFactor = worldScale; currentZoomLevel = zoom; _isDynamic = isDynamic; _mapImageRT = mapImageRT; _isCircleMode = isCircle; _thisRect = ((Component)this).gameObject.GetComponent<RectTransform>(); if ((Object)(object)_thisRect == (Object)null) { MelonLogger.Error("PoIMarkerView (" + poiName + "): RectTransform not found! This should not happen."); return; } _thisRect.anchorMin = new Vector2(0.5f, 0.5f); _thisRect.anchorMax = new Vector2(0.5f, 0.5f); _thisRect.pivot = new Vector2(0.5f, 0.5f); GameObject val = Object.Instantiate<GameObject>(((Component)poiTransform).gameObject, ((Component)this).transform, false); ((Object)val).name = "PoIContent_" + poiName; LayoutElement component = val.GetComponent<LayoutElement>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } _poiMarkerRect = val.GetComponent<RectTransform>(); if ((Object)(object)_poiMarkerRect == (Object)null) { MelonLogger.Error("PoIMarkerView (" + poiName + "): Cloned GameObject does not have a RectTransform!"); Object.Destroy((Object)(object)((Component)this).gameObject); return; } _poiMarkerRect.anchorMin = new Vector2(0.5f, 0.5f); _poiMarkerRect.anchorMax = new Vector2(0.5f, 0.5f); _poiMarkerRect.pivot = new Vector2(0.5f, 0.5f); _poiMarkerRect.anchoredPosition = Vector2.zero; ((Transform)_poiMarkerRect).localScale = new Vector3(0.5f, 0.5f, 0.5f); val.SetActive(true); Vector2 val2 = _phoneMapPosition * 0.25f; _mapPosition = new Vector2(val2.x + 2f, val2.y - 3f); _thisRect.anchoredPosition = _mapPosition; } public void SetShape(bool isCircle) { _isCircleMode = isCircle; } public void UpdateZoomLevel(float newZoomLevel) { currentZoomLevel = newZoomLevel; } public void UpdatePosition(Vector2 newPhoneMapPosition) { //IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_thisRect == (Object)null)) { _phoneMapPosition = newPhoneMapPosition; Vector2 val = _phoneMapPosition * 0.25f; _mapPosition = new Vector2(val.x + 2f, val.y - 3f); } } public void UpdatePositionFromWorld(Vector3 worldPos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_thisRect == (Object)null)) { Vector3 worldPos2 = worldPos + new Vector3(-10f, 0f, 6f); _mapPosition = MinimapCoordinateSystem.WorldToMapSpace(worldPos2, worldScaleFactor, currentZoomLevel); } } private void Update() { //IL_0028: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00de: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009e: 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_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_thisRect == (Object)null || (Object)(object)_mapImageRT == (Object)null) { return; } Vector2 anchoredPosition = _mapPosition; if (clampedMarkerTypes.Contains(_markerType)) { Vector2 val = _mapPosition + _mapImageRT.anchoredPosition; if (_isCircleMode) { float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude > MinimapState.MinimapRadius) { Vector2 val2 = ((Vector2)(ref val)).normalized * MinimapState.MinimapRadius; anchoredPosition = val2 - _mapImageRT.anchoredPosition; } } else { float minimapRadius = MinimapState.MinimapRadius; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(Mathf.Clamp(val.x, 0f - minimapRadius, minimapRadius), Mathf.Clamp(val.y, 0f - minimapRadius, minimapRadius)); if (val3 != val) { anchoredPosition = val3 - _mapImageRT.anchoredPosition; } } } _thisRect.anchoredPosition = anchoredPosition; } } [RegisterTypeInIl2Cpp] public class MapMarkerManager : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass18_0 { public Dictionary<string, RectTransform> currentChildren; internal bool <UpdatePoIMarkersCoroutine>b__0(KeyValuePair<string, PoIMarkerView> marker) { return !currentChildren.ContainsKey(marker.Key); } } [CompilerGenerated] private sealed class <UpdatePoIMarkersCoroutine>d__18 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MapMarkerManager <>4__this; private WaitForSeconds <waitInterval>5__1; private <>c__DisplayClass18_0 <>8__2; private Il2CppArrayBase<RectTransform> <allChildren>5__3; private List<KeyValuePair<string, PoIMarkerView>> <childrenToRemove>5__4; private IEnumerator<RectTransform> <>s__5; private RectTransform <rt>5__6; private string <key>5__7; private List<KeyValuePair<string, PoIMarkerView>>.Enumerator <>s__8; private KeyValuePair<string, PoIMarkerView> <kvp>5__9; private Dictionary<string, RectTransform>.Enumerator <>s__10; private KeyValuePair<string, RectTransform> <kvp>5__11; private RectTransform <child>5__12; private GameObject <poiMarkerViewGO>5__13; private RectTransform <rect>5__14; private PoIMarkerView <poiMarkerView>5__15; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UpdatePoIMarkersCoroutine>d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <waitInterval>5__1 = null; <>8__2 = null; <allChildren>5__3 = null; <childrenToRemove>5__4 = null; <>s__5 = null; <rt>5__6 = null; <key>5__7 = null; <>s__8 = default(List<KeyValuePair<string, PoIMarkerView>>.Enumerator); <kvp>5__9 = default(KeyValuePair<string, PoIMarkerView>); <>s__10 = default(Dictionary<string, RectTransform>.Enumerator); <kvp>5__11 = default(KeyValuePair<string, RectTransform>); <child>5__12 = null; <poiMarkerViewGO>5__13 = null; <rect>5__14 = null; <poiMarkerView>5__15 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_0386: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <waitInterval>5__1 = new WaitForSeconds(1f); break; case 1: <>1__state = -1; if ((Object)(object)PlayerSingleton<MapApp>.Instance == (Object)null || (Object)(object)PlayerSingleton<MapApp>.Instance.PoIContainer == (Object)null) { break; } <allChildren>5__3 = ((Component)PlayerSingleton<MapApp>.Instance.PoIContainer).GetComponentsInChildren<RectTransform>(false); <>8__2.currentChildren = new Dictionary<string, RectTransform>(); <>s__5 = <allChildren>5__3.GetEnumerator(); try { while (<>s__5.MoveNext()) { <rt>5__6 = <>s__5.Current; if (((Component)<rt>5__6).gameObject.activeSelf && <>4__this.allowList.Contains(((Object)((Component)<rt>5__6).gameObject).name)) { <key>5__7 = <>4__this.GetGeneratedPoIKey(<rt>5__6); <>8__2.currentChildren[<key>5__7] = <rt>5__6; <key>5__7 = null; } <rt>5__6 = null; } } finally { if (<>s__5 != null) { <>s__5.Dispose(); } } <>s__5 = null; <childrenToRemove>5__4 = <>4__this.poiMarkers.Where((KeyValuePair<string, PoIMarkerView> marker) => !<>8__2.currentChildren.ContainsKey(marker.Key)).ToList(); <childrenToRemove>5__4.RemoveAll((KeyValuePair<string, PoIMarkerView> kvp) => <>4__this.poiMarkerKeyMap.ContainsValue(kvp.Key)); <>s__8 = <childrenToRemove>5__4.GetEnumerator(); try { while (<>s__8.MoveNext()) { <kvp>5__9 = <>s__8.Current; if ((Object)(object)<kvp>5__9.Value != (Object)null && (Object)(object)((Component)<kvp>5__9.Value).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)<kvp>5__9.Value).gameObject); } <>4__this.poiMarkers.Remove(<kvp>5__9.Key); <kvp>5__9 = default(KeyValuePair<string, PoIMarkerView>); } } finally { ((IDisposable)<>s__8).Dispose(); } <>s__8 = default(List<KeyValuePair<string, PoIMarkerView>>.Enumerator); <>s__10 = <>8__2.currentChildren.GetEnumerator(); try { while (<>s__10.MoveNext()) { <kvp>5__11 = <>s__10.Current; if (!<>4__this.poiMarkers.ContainsKey(<kvp>5__11.Key) && !<>4__this.poiMarkerKeyMap.ContainsValue(<kvp>5__11.Key)) { <child>5__12 = <kvp>5__11.Value; <poiMarkerViewGO>5__13 = new GameObject("PoIMarkerView_" + ((Object)<child>5__12).name); <rect>5__14 = <poiMarkerViewGO>5__13.AddComponent<RectTransform>(); ((Transform)<rect>5__14).SetParent((Transform)(object)<>4__this.mapImageRT, false); <poiMarkerView>5__15 = <poiMarkerViewGO>5__13.AddComponent<PoIMarkerView>(); <poiMarkerView>5__15.Initialize(<child>5__12, <child>5__12.anchoredPosition, <>4__this.worldScaleFactor, <>4__this.currentZoomLevel, isDynamic: false, ((Object)((Component)<child>5__12).gameObject).name, <>4__this.mapImageRT, <>4__this._isCircleMode); if (<kvp>5__11.Key.Contains("OwnedVehiclePoI(Clone)")) { <>4__this.poiMarkerKeyMap[<kvp>5__11.Key] = <kvp>5__11.Key; } <>4__this.poiMarkers[<kvp>5__11.Key] = <poiMarkerView>5__15; <child>5__12 = null; <poiMarkerViewGO>5__13 = null; <rect>5__14 = null; <poiMarkerView>5__15 = null; <kvp>5__11 = default(KeyValuePair<string, RectTransform>); } } } finally { ((IDisposable)<>s__10).Dispose(); } <>s__10 = default(Dictionary<string, RectTransform>.Enumerator); <>8__2 = null; <allChildren>5__3 = null; <childrenToRemove>5__4 = null; break; } <>8__2 = new <>c__DisplayClass18_0(); <>2__current = <waitInterval>5__1; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Dictionary<string, string> poiMarkerKeyMap = new Dictionary<string, string>(); private Dictionary<string, PoIMarkerView> poiMarkers = new Dictionary<string, PoIMarkerView>(); private RectTransform mapImageRT; private float worldScaleFactor; private float currentZoomLevel; private bool _isCircleMode; private bool _isTrackingVehicles; private string _vehiclePoIKey; private object _updateCoroutine; private float minimapPlayerCenterXOffset; private float minimapPlayerCenterYOffset; private HashSet<string> allowList = new HashSet<string> { "QuestPoI(Clone)", "DeaddropPoI_Red(Clone)" }; public void Initialize(RectTransform mapImage, float worldScale, float zoom, bool trackProperties, bool trackContracts, bool trackVehicles, bool isCircle, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { mapImageRT = mapImage; worldScaleFactor = worldScale; currentZoomLevel = zoom; _isCircleMode = isCircle; _isTrackingVehicles = trackVehicles; this.minimapPlayerCenterXOffset = minimapPlayerCenterXOffset; this.minimapPlayerCenterYOffset = minimapPlayerCenterYOffset; if (trackProperties) { allowList.Add("PropertyPoI(Clone)"); } if (trackContracts) { allowList.Add("ContractPoI(Clone)"); } if (trackVehicles) { allowList.Add("OwnedVehiclePoI(Clone)"); ((MonoBehaviour)this).InvokeRepeating("UpdateVehicleMarkers", 0f, 1f); } } public void UpdateZoomLevel(float newZoomLevel) { currentZoomLevel = newZoomLevel; foreach (KeyValuePair<string, PoIMarkerView> poiMarker in poiMarkers) { poiMarker.Value.UpdateZoomLevel(newZoomLevel); } } public void UpdateMinimapShape(bool isCircle) { _isCircleMode = isCircle; foreach (KeyValuePair<string, PoIMarkerView> poiMarker in poiMarkers) { poiMarker.Value.SetShape(isCircle); } } private void OnEnable() { if (_updateCoroutine == null) { _updateCoroutine = MelonCoroutines.Start(UpdatePoIMarkersCoroutine()); } } private void OnDisable() { if (_updateCoroutine != null) { MelonCoroutines.Stop(_updateCoroutine); _updateCoroutine = null; } } private string GetGeneratedPoIKey(RectTransform rt) { //IL_004e: 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) if ((Object)(object)rt == (Object)null || (Object)(object)((Component)rt).gameObject == (Object)null) { return null; } return $"{((Object)((Component)rt).gameObject).name}_{Mathf.RoundToInt(rt.anchoredPosition.x)}_{Mathf.RoundToInt(rt.anchoredPosition.y)}"; } [IteratorStateMachine(typeof(<UpdatePoIMarkersCoroutine>d__18))] private IEnumerator UpdatePoIMarkersCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UpdatePoIMarkersCoroutine>d__18(0) { <>4__this = this }; } public void OnTrackPropertiesChanged(bool isTracking) { if (isTracking) { allowList.Add("PropertyPoI(Clone)"); } else { allowList.Remove("PropertyPoI(Clone)"); } } public void OnTrackContractsChanged(bool isTracking) { if (isTracking) { allowList.Add("ContractPoI(Clone)"); } else { allowList.Remove("ContractPoI(Clone)"); } } public void OnTrackVehiclesChanged(bool isTracking) { _isTrackingVehicles = isTracking; if (isTracking) { allowList.Add("OwnedVehiclePoI(Clone)"); foreach (KeyValuePair<string, PoIMarkerView> item in poiMarkers.Where((KeyValuePair<string, PoIMarkerView> entry) => entry.Key.Contains("OwnedVehiclePoI(Clone)")).ToList()) { ((Component)item.Value).gameObject.SetActive(true); } ((MonoBehaviour)this).InvokeRepeating("UpdateVehicleMarkers", 0f, 1f); return; } ((MonoBehaviour)this).CancelInvoke("UpdateVehicleMarkers"); foreach (KeyValuePair<string, PoIMarkerView> item2 in poiMarkers.Where((KeyValuePair<string, PoIMarkerView> entry) => entry.Key.Contains("OwnedVehiclePoI(Clone)")).ToList()) { ((Component)item2.Value).gameObject.SetActive(false); } allowList.Remove("OwnedVehiclePoI(Clone)"); } public void OnPlayerEnterVehicle(LandVehicle vehicle) { if (!_isTrackingVehicles) { return; } object obj; if (vehicle == null) { obj = null; } else { POI pOI = vehicle.POI; obj = ((pOI != null) ? pOI.UI : null); } if (!((Object)obj == (Object)null)) { _vehiclePoIKey = GetGeneratedPoIKey(vehicle.POI.UI); if (!string.IsNullOrEmpty(_vehiclePoIKey) && poiMarkers.TryGetValue(_vehiclePoIKey, out var value) && (Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(false); } } } public void OnPlayerExitVehicle(LandVehicle vehicle) { if (_isTrackingVehicles && !string.IsNullOrEmpty(_vehiclePoIKey)) { if (poiMarkers.TryGetValue(_vehiclePoIKey, out var value) && (Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(true); } _vehiclePoIKey = null; } } private void UpdateVehicleMarkers() { //IL_0150: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)NetworkSingleton<VehicleManager>.Instance == (Object)null || NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles == null || (Object)(object)this == (Object)null || (Object)(object)((Component)this).gameObject == (Object)null || !((Component)this).gameObject.activeInHierarchy) { return; } try { Enumerator<LandVehicle> enumerator = NetworkSingleton<VehicleManager>.Instance.PlayerOwnedVehicles.GetEnumerator(); while (enumerator.MoveNext()) { LandVehicle current = enumerator.Current; if ((Object)(object)current == (Object)null || (Object)(object)current.POI == (Object)null || (Object)(object)current.POI.UI == (Object)null || (Object)(object)((Component)current).transform == (Object)null) { continue; } string generatedPoIKey = GetGeneratedPoIKey(current.POI.UI); if (string.IsNullOrEmpty(generatedPoIKey)) { continue; } foreach (string key in poiMarkers.Keys) { if (key.StartsWith("OwnedVehiclePoI(Clone)_")) { } } if (poiMarkers.TryGetValue(generatedPoIKey, out var value) && (Object)(object)value != (Object)null) { value.UpdatePositionFromWorld(((Component)current).transform.position); } } } catch (Exception ex) { MelonLogger.Warning("[MapMarkerManager] Exception in UpdateVehicleMarkers: " + ex.Message); } } } } namespace Small_Corner_Map.Main { [RegisterTypeInIl2Cpp] public class MinimapManager : MonoBehaviour { [CompilerGenerated] private sealed class <InitializeWhenReady>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MinimapManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeWhenReady>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if ((Object)(object)Player.Local == (Object)null) { <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)<>4__this._minimapView == (Object)null) { MelonLogger.Warning("MinimapView was destroyed during initialization. Aborting."); return false; } MelonLogger.Msg("Player object found, initializing MinimapView."); <>4__this._minimapView.Initialize(Player.Local, <>4__this._mapPreferences.MinimapEnabled.Value, <>4__this._mapPreferences.MinimapScaleFactor, <>4__this._mapPreferences.ShowSquareMinimap.Value, <>4__this._mapPreferences.ShowGameTime.Value, 1f, 1.22f, 13f, -4.25f, <>4__this._mapPreferences.TrackProperties.Value, <>4__this._mapPreferences.TrackContracts.Value, <>4__this._mapPreferences.TrackVehicles.Value, <>4__this._mapPreferences.MinimapPositionX.Value, <>4__this._mapPreferences.MinimapPositionY.Value); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.MinimapEnabled.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnMinimapEnabledChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.IncreaseSize.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnIncreaseSizeChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.ShowSquareMinimap.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnShowSquareMinimapChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.ShowGameTime.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnShowGameTimeChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackProperties.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackPropertiesChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackContracts.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackContractsChanged, 0, false); ((MelonEventBase<LemonAction<bool, bool>>)(object)<>4__this._mapPreferences.TrackVehicles.OnEntryValueChanged).Subscribe((LemonAction<bool, bool>)<>4__this.OnTrackVehiclesChanged, 0, false); ((MelonEventBase<LemonAction<float, float>>)(object)<>4__this._mapPreferences.MinimapPositionX.OnEntryValueChanged).Subscribe((LemonAction<float, float>)<>4__this.OnMinimapPositionXChanged, 0, false); ((MelonEventBase<LemonAction<float, float>>)(object)<>4__this._mapPreferences.MinimapPositionY.OnEntryValueChanged).Subscribe((LemonAction<float, float>)<>4__this.OnMinimapPositionYChanged, 0, false); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static MinimapManager _instance; private MinimapView _minimapView; private MapPreferences _mapPreferences; public static MinimapManager Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance == (Object)null) { _instance = new GameObject("MinimapManager").AddComponent<MinimapManager>(); Object.DontDestroyOnLoad((Object)(object)((Component)_instance).gameObject); } return _instance; } } public void Initialize() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_minimapView != (Object)null) { MelonLogger.Msg("MinimapManager is already initialized. Skipping."); return; } MelonLogger.Msg("MinimapManager initializing."); _mapPreferences = new MapPreferences(); _mapPreferences.LoadPreferences(); _minimapView = new GameObject("MinimapView").AddComponent<MinimapView>(); ((Component)_minimapView).transform.SetParent(((Component)this).transform); MelonCoroutines.Start(InitializeWhenReady()); } public void Cleanup() { MelonLogger.Msg("MinimapManager cleaning up."); UnsubscribeEvents(); if ((Object)(object)_minimapView != (Object)null) { Object.Destroy((Object)(object)((Component)_minimapView).gameObject); _minimapView = null; } _instance = null; } public void OnPlayerEnterVehicle(LandVehicle vehicle) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.HandlePlayerEnterVehicle(vehicle); } } public void OnPlayerExitVehicle(LandVehicle vehicle) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.HandlePlayerExitVehicle(vehicle); } } [IteratorStateMachine(typeof(<InitializeWhenReady>d__9))] private IEnumerator InitializeWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeWhenReady>d__9(0) { <>4__this = this }; } private void OnDestroy() { UnsubscribeEvents(); } private void UnsubscribeEvents() { if (_mapPreferences != null) { ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.MinimapEnabled.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnMinimapEnabledChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.IncreaseSize.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnIncreaseSizeChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.ShowSquareMinimap.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnShowSquareMinimapChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.ShowGameTime.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnShowGameTimeChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackProperties.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackPropertiesChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackContracts.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackContractsChanged); ((MelonEventBase<LemonAction<bool, bool>>)(object)_mapPreferences.TrackVehicles.OnEntryValueChanged).Unsubscribe((LemonAction<bool, bool>)OnTrackVehiclesChanged); ((MelonEventBase<LemonAction<float, float>>)(object)_mapPreferences.MinimapPositionX.OnEntryValueChanged).Unsubscribe((LemonAction<float, float>)OnMinimapPositionXChanged); ((MelonEventBase<LemonAction<float, float>>)(object)_mapPreferences.MinimapPositionY.OnEntryValueChanged).Unsubscribe((LemonAction<float, float>)OnMinimapPositionYChanged); } } private void OnMinimapEnabledChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.ToggleMinimapVisibility(newValue); } } private void OnIncreaseSizeChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapUISize(_mapPreferences.MinimapScaleFactor); } } private void OnShowSquareMinimapChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapShape(newValue); } } private void OnMapZoomLevelChanged(float oldValue, float newValue) { _minimapView.UpdateMapMovementScale(newValue); } private void OnMinimapPlayerOffsetXChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPlayerCenterXOffset(newValue); } } private void OnMinimapPlayerOffsetYChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPlayerCenterYOffset(newValue); } } private void OnShowGameTimeChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateTimeDisplayVisibility(newValue); } } private void OnTrackPropertiesChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdatePropertyTracking(newValue); } } private void OnTrackContractsChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateContractTracking(newValue); } } private void OnTrackVehiclesChanged(bool oldValue, bool newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateVehicleTracking(newValue); } } private void OnMinimapPositionXChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPosition(newValue, _mapPreferences.MinimapPositionY.Value); } } private void OnMinimapPositionYChanged(float oldValue, float newValue) { if ((Object)(object)_minimapView != (Object)null) { _minimapView.UpdateMinimapPosition(_mapPreferences.MinimapPositionX.Value, newValue); } } public void OnMinimapPositionChanged(float x, float y) { if (_mapPreferences != null) { _mapPreferences.MinimapPositionX.Value = x; _mapPreferences.MinimapPositionY.Value = y; } } } [RegisterTypeInIl2Cpp] public class MinimapView : MonoBehaviour { private GameObject canvasGo; private GameObject mapImageGo; private Image mapImage; private Image maskImage; private Mask mask; private Image borderImage; private PlayerMarkerView playerMarkerView; private MapMarkerManager mapMarkerManager; private TimeDisplayView timeDisplayView; private Transform playerTransform; private Sprite circleSprite; private Sprite squareSprite; private float worldScaleFactor; private float minimapPlayerCenterXOffset; private float minimapPlayerCenterYOffset; private float currentZoomLevel; private RectTransform mapImageRT; private RectTransform containerRT; private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown mapImageGo = new GameObject("MapImage"); mapImageRT = mapImageGo.AddComponent<RectTransform>(); } public void Initialize(Player player, bool minimapEnabled, float minimapScaleFactor, bool showSquareMinimap, bool showGameTime, float scaleFactor, float mapZoomLevel, float playerCenterXOffset, float playerCenterYOffset, bool trackProperties, bool trackContracts, bool trackVehicles, float positionX, float positionY) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) MelonLogger.Msg("MinimapView initializing."); playerTransform = ((Component)player).transform; worldScaleFactor = scaleFactor; minimapPlayerCenterXOffset = playerCenterXOffset; minimapPlayerCenterYOffset = playerCenterYOffset; currentZoomLevel = mapZoomLevel; MinimapState.UpdateState(!showSquareMinimap, minimapScaleFactor); if (!Object.op_Implicit((Object)(object)circleSprite)) { circleSprite = Utils.CreateCircleSprite(256, Color.grey, 2, 2); } if (!Object.op_Implicit((Object)(object)squareSprite)) { squareSprite = Utils.CreateRoundedSquareSprite(150, 3f, Color.grey); } if (minimapEnabled) { CreateMinimapUI(player, minimapScaleFactor, showGameTime, trackProperties, trackContracts, trackVehicles, !showSquareMinimap, positionX, positionY); LoadMapSprite(); SetStyle(!showSquareMinimap); } ToggleMinimapVisibility(minimapEnabled); } public void ToggleMinimapVisibility(bool isVisible) { if ((Object)(object)canvasGo != (Object)null) { canvasGo.SetActive(isVisible); } } public void UpdateMinimapUISize(float newScaleFactor) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)canvasGo != (Object)null) { RectTransform component = ((Component)canvasGo.transform.Find("MinimapContainer")).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.sizeDelta = new Vector2(150f * newScaleFactor, 150f * newScaleFactor); MinimapState.UpdateState(MinimapState.IsCircleMode, newScaleFactor); } } } public void UpdateMinimapShape(bool isSquare) { bool flag = !isSquare; SetStyle(flag); MinimapState.UpdateState(flag, MinimapState.ScaleFactor); if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.UpdateMinimapShape(flag); } } public void UpdateMapMovementScale(float newZoomLevel) { currentZoomLevel = newZoomLevel; if ((Object)(object)playerMarkerView != (Object)null) { playerMarkerView.UpdateZoomLevel(newZoomLevel); } if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.UpdateZoomLevel(newZoomLevel); } } public void UpdateMinimapPlayerCenterXOffset(float newOffsetX) { minimapPlayerCenterXOffset = newOffsetX; } public void UpdateMinimapPlayerCenterYOffset(float newOffsetY) { minimapPlayerCenterYOffset = newOffsetY; } public void UpdateTimeDisplayVisibility(bool isVisible) { if ((Object)(object)timeDisplayView != (Object)null) { timeDisplayView.ToggleVisibility(isVisible); } } public void UpdateVehicleTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackVehiclesChanged(isVisible); } } public void UpdatePropertyTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackPropertiesChanged(isVisible); } } public void UpdateContractTracking(bool isVisible) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnTrackContractsChanged(isVisible); } } public void HandlePlayerEnterVehicle(LandVehicle vehicle) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnPlayerEnterVehicle(vehicle); } } public void HandlePlayerExitVehicle(LandVehicle vehicle) { if ((Object)(object)mapMarkerManager != (Object)null) { mapMarkerManager.OnPlayerExitVehicle(vehicle); } } private void CreateMinimapUI(Player player, float minimapScaleFactor, bool showGameTime, bool trackProperties, bool trackContracts, bool trackVehicles, bool isCircle, float positionX, float positionY) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00b2: 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_00e8: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01be: Expected O, but got Unknown //IL_01dd: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) canvasGo = new GameObject("MinimapCanvas"); Canvas val = canvasGo.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 999; CanvasScaler val2 = canvasGo.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); canvasGo.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)canvasGo); GameObject val3 = new GameObject("MinimapContainer"); val3.transform.SetParent(canvasGo.transform, false); containerRT = val3.AddComponent<RectTransform>(); containerRT.anchorMin = new Vector2(1f, 1f); containerRT.anchorMax = new Vector2(1f, 1f); containerRT.pivot = new Vector2(1f, 1f); containerRT.anchoredPosition = new Vector2(positionX, positionY); containerRT.sizeDelta = new Vector2(150f * minimapScaleFactor, 150f * minimapScaleFactor); GameObject val4 = new GameObject("MinimapBorder"); val4.transform.SetParent((Transform)(object)containerRT, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = new Vector2(-2f, -2f); val5.offsetMax = new Vector2(2f, 2f); borderImage = val4.AddComponent<Image>(); ((Graphic)borderImage).color = Color.black; GameObject val6 = new GameObject("MinimapMask"); val6.transform.SetParent((Transform)(object)containerRT, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.sizeDelta = Vector2.zero; maskImage = val6.AddComponent<Image>(); ((Graphic)maskImage).color = Color.white; mask = val6.AddComponent<Mask>(); mask.showMaskGraphic = false; mapImageGo.transform.SetParent((Transform)(object)val7, false); mapImageRT.anchorMin = new Vector2(0.5f, 0.5f); mapImageRT.anchorMax = new Vector2(0.5f, 0.5f); mapImageRT.pivot = new Vector2(0.5f, 0.5f); mapImageRT.sizeDelta = new Vector2(500f, 500f); mapImage = mapImageGo.AddComponent<Image>(); ((Graphic)mapImage).color = Color.white; playerMarkerView = new GameObject("PlayerMarkerView").AddComponent<PlayerMarkerView>(); ((Component)playerMarkerView).transform.SetParent((Transform)(object)containerRT, false); playerMarkerView.Initialize(((Component)containerRT).transform, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); mapMarkerManager = new GameObject("PropertyPoIManager").AddComponent<MapMarkerManager>(); ((Component)mapMarkerManager).transform.SetParent((Transform)(object)containerRT, false); mapMarkerManager.Initialize(mapImageRT, worldScaleFactor, currentZoomLevel, trackProperties, trackContracts, trackVehicles, isCircle, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); timeDisplayView = new GameObject("TimeDisplayView").AddComponent<TimeDisplayView>(); ((Component)timeDisplayView).transform.SetParent((Transform)(object)containerRT, false); timeDisplayView.Initialize(containerRT, showGameTime); } private void LoadMapSprite() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0095: 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) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("Small_Corner_Map.Assets.Map_Full.png"); if (stream == null) { MelonLogger.Error("MinimapView: Failed to get manifest resource stream for Small_Corner_Map.Assets.Map_Full.png. Available resources: " + string.Join(", ", executingAssembly.GetManifestResourceNames())); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, (int)stream.Length); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array))) { Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); mapImage.sprite = sprite; } else { MelonLogger.Error("MinimapView: Failed to load image data into texture from embedded resource Small_Corner_Map.Assets.Map_Full.png"); } } catch (Exception ex) { MelonLogger.Error("MinimapView: Error loading map sprite: " + ex.Message); } } public void SetStyle(bool useCircle) { if (!((Object)(object)maskImage == (Object)null) && !((Object)(object)borderImage == (Object)null)) { Sprite sprite = (useCircle ? circleSprite : squareSprite); maskImage.sprite = sprite; borderImage.sprite = sprite; } } private void Update() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)playerTransform) && Object.op_Implicit((Object)(object)mapImageGo)) { if (Player.Local.IsInVehicle) { playerTransform = ((Component)Player.Local.CurrentVehicle).transform; } else { playerTransform = ((Component)Player.Local).transform; } Vector2 mapContentPosition = MinimapCoordinateSystem.GetMapContentPosition(playerTransform.position, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); mapImageRT.anchoredPosition = mapContentPosition; } } public void UpdateMinimapPosition(float positionX, float positionY) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)containerRT != (Object)null) { containerRT.anchoredPosition = new Vector2(positionX, positionY); } } } [RegisterTypeInIl2Cpp] public class TimeDisplayView : MonoBehaviour { private Text timeText; private GameObject timeDisplayGo; private bool showGameTime; private const int Width = 110; private const int Height = 55; public void ToggleVisibility(bool isVisible) { showGameTime = isVisible; if ((Object)(object)timeDisplayGo != (Object)null) { timeDisplayGo.SetActive(isVisible); } } public void Initialize(RectTransform parent, bool initialShowGameTime) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) showGameTime = initialShowGameTime; timeDisplayGo = new GameObject("TimeDisplay"); timeDisplayGo.transform.SetParent((Transform)(object)parent, false); RectTransform val = timeDisplayGo.AddComponent<RectTransform>(); Image val2 = timeDisplayGo.AddComponent<Image>(); val2.sprite = Utils.CreateRoundedRectSprite(110, 55, 10f, new Color(0f, 0f, 0f, 0.5f)); val2.type = (Type)1; val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 0f); val.pivot = new Vector2(0.5f, 1f); val.anchoredPosition = new Vector2(0f, -10f); val.sizeDelta = new Vector2(110f, 55f); GameObject val3 = new GameObject("TimeText"); val3.transform.SetParent((Transform)(object)val, false); timeText = val3.AddComponent<Text>(); timeText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); timeText.fontSize = 14; timeText.alignment = (TextAnchor)4; ((Graphic)timeText).color = Color.white; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; timeDisplayGo.SetActive(showGameTime); } private void Update() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (showGameTime && NetworkSingleton<TimeManager>.InstanceExists && Object.op_Implicit((Object)(object)timeText)) { int currentTime = NetworkSingleton<TimeManager>.Instance.CurrentTime; EDay currentDay = NetworkSingleton<TimeManager>.Instance.CurrentDay; if (Object.op_Implicit((Object)(object)timeText)) { timeText.text = ((object)(EDay)(ref currentDay)).ToString() + "\n" + TimeManager.Get12HourTime((float)currentTime, true); } } } } } namespace Small_Corner_Map.Helpers { internal static class Constants { public const string ModVersion = "4.0.0"; public const string ModName = "Small Corner Map"; public const string ModAuthor = "winzaar"; public const string GameName = "Schedule I"; public const string GameDeveloper = "TVGS"; public const bool DisableDebug = true; public const string MapPreferencesCategoryIdentifier = "SmallCornerMapSettings"; public const float BaseWorldToUIScaleFactor = 1f; public const float MinimapDefaultMapMovementScale = 1.22f; public const float InitialMapImageScale = 0.0825f; public const float MinimapDefaultPlayerOffsetX = 13f; public const float MinimapDefaultPlayerOffsetY = -4.25f; public const int MinimapCircleDrawingResolution = 256; public const int PlayerMarkerCircleDrawingResolution = 20; public const float MarkerXOffset = 14f; public const float MarkerZOffset = -3.5f; public const float MinimapImageOffsetX = 0f; public const float MinimapImageOffsetY = 0f; public const string MinimapImagePath = "Small_Corner_Map.Assets.Map_Full.png"; public const float BaseMinimapSize = 150f; public const float BaseMapContentSize = 500f; public const float MinimapCornerOffset = -20f; public const float MinimapSizeMultiplier = 1.5f; public const float ContractMarkerSize = 8f; public const float ContractMarkerScale = 0.4f; public const float PropertyMarkerSize = 5f; public const float PropertyMarkerScale = 0.4f; public const float RedMarkerSize = 5f; public const float PlayerMarkerSize = 10f; public const float DirectionIndicatorSize = 6f; public const float DirectionIndicatorDistance = 10f; public const float MinimapBorderThickness = 2f; public const float MinimapBorderR = 0.13f; public const float MinimapBorderG = 0.13f; public const float MinimapBorderB = 0.13f; public const float MinimapBorderA = 1f; public const int MinimapBorderFeather = 2; public const int MinimapCircleResolutionMultiplier = 2; public const int MinimapMaskFeather = 2; public const int MinimapMaskDiameterOffset = 2; public const int DefaultGridSize = 20; public const int CanvasSortOrder = 9999; public const float CanvasReferenceWidth = 1920f; public const float CanvasReferenceHeight = 1080f; public const float MapContentLerpSpeed = 10f; public const float PlayerMarkerOffsetX = 11.2f; public const float PlayerMarkerOffsetZ = -2.7f; public const float TimeDisplayWidth = 100f; public const float TimeDisplayHeight = 50f; public const float TimeDisplayOffsetY = -20f; public const float TimeBackgroundR = 0.2f; public const float TimeBackgroundG = 0.2f; public const float TimeBackgroundB = 0.2f; public const float TimeBackgroundA = 0.5f; public const float PlayerMarkerR = 0.2f; public const float PlayerMarkerG = 0.6f; public const float PlayerMarkerB = 1f; public const float PlayerMarkerA = 1f; public const float PlayerIconReplacementScale = 0.5f; public const float SceneIntegrationInitialDelay = 2f; public const float SceneIntegrationRetryDelay = 0.5f; public const int SceneIntegrationMaxAttempts = 30; public const string GameplayMenuPath = "GameplayMenu"; public const string MapAppPath = "GameplayMenu/Phone/phone/AppsCanvas/MapApp/Container/Scroll View/Viewport/Content"; public static readonly string DeadDropQuestName = "Collect Dead Drop"; public static readonly string ContractQuestName = "Deal for"; public const float VehicleMarkerFadeDuration = 0.15f; public const int CompassTickCount = 16; public const float CompassRingPadding = 6f; public const float CompassRingThickness = 20f; public const int CompassLetterFontSize = 12; public const float CompassLetterColorR = 1f; public const float CompassLetterColorG = 1f; public const float CompassLetterColorB = 1f; public const float CompassLetterColorA = 0.9f; public const float CompassTickColorR = 1f; public const float CompassTickColorG = 1f; public const float CompassTickColorB = 1f; public const float CompassTickColorA = 0.75f; public const float CompassTickMajorScale = 1f; public const float CompassTickMinorScale = 0.6f; public const float CompassTickWidth = 2f; public const float CompassTickHeight = 8f; public const float CompassRingExtraThickness = 2f; public const string CompassPreferenceKey = "ShowCompass"; public const float CompassLetterRadialOffset = 4f; public const float CompassTickInset = 2f; public const int CompassBorderThickness = 2; public const float CompassBorderColorR = 0.13f; public const float CompassBorderColorG = 0.13f; public const float CompassBorderColorB = 0.13f; public const float CompassBorderColorA = 0.9f; public const float CompassVisibilityBuffer = 4f; public const float CompassBackgroundColorR = 0.8f; public const float CompassBackgroundColorG = 0.8f; public const float CompassBackgroundColorB = 0.8f; public const float CompassBackgroundColorA = 0.3f; public const float CompassDefaultIconSize = 15f; public const float CompassContractIconSize = 20f; } public class Utils { internal static void RecursiveFind(Transform current, string targetName, List<Transform> result) { if (((Object)current).name == targetName) { result.Add(current); } for (int i = 0; i < current.childCount; i++) { RecursiveFind(current.GetChild(i), targetName, result); } } public static Sprite CreateSquareSprite(int size, Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001d: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[size * size]; for (int i = 0; i < array.Length; i++) { array[i] = color; } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, (float)size, (float)size); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); float num = 100f; Sprite val4 = Sprite.Create(val, val2, val3, num); ((Object)val4).name = "Minimap_SquareSprite"; return val4; } public static Sprite CreateCircleSprite(int diameter, Color color, int resolutionMultiplier = 1, int featherWidth = 0, bool featherInside = true) { //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_0017: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_00a4: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) int num = diameter * resolutionMultiplier; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false) { filterMode = (FilterMode)1 }; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { val.SetPixel(j, i, val2); } } float num2 = (float)num / 2f; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(num2, num2); int num3 = Mathf.Max(0, featherWidth * resolutionMultiplier); for (int k = 0; k < num; k++) { for (int l = 0; l < num; l++) { float num4 = Vector2.Distance(new Vector2((float)l, (float)k), val3); float num5 = 0f; if (featherInside) { if (!(num4 <= num2)) { continue; } num5 = color.a; if (num3 > 0) { float num6 = num2 - num4; if (num6 <= (float)num3) { num5 *= Mathf.Clamp01(num6 / (float)num3); } } val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } else if (num4 <= num2) { num5 = color.a; val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } else if (num4 > num2 && num4 <= num2 + (float)num3) { float num7 = num4 - num2; num5 = color.a * Mathf.Clamp01(1f - num7 / (float)num3); val.SetPixel(l, k, new Color(color.r, color.g, color.b, num5)); } } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), (float)resolutionMultiplier); } public static Sprite CreateRoundedSquareSprite(int size, float cornerRadius, Color color, int resolutionMultiplier = 2) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) int num = size * resolutionMultiplier; float num2 = cornerRadius * (float)resolutionMultiplier; Texture2D val = new Texture2D(num, num, (TextureFormat)5, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[num * num]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { int num3 = i * num + j; array[num3] = color; if ((float)j < num2 && (float)i < num2) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num2)) > num2) { array[num3] = val2; } } else if ((float)j > (float)num - num2 - 1f && (float)i < num2) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, num2)) > num2) { array[num3] = val2; } } else if ((float)j < num2 && (float)i > (float)num - num2 - 1f) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, (float)num - num2 - 1f)) > num2) { array[num3] = val2; } } else if ((float)j > (float)num - num2 - 1f && (float)i > (float)num - num2 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num2 - 1f, (float)num - num2 - 1f)) > num2) { array[num3] = val2; } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f * (float)resolutionMultiplier); } public static Sprite CreateRoundedRectSprite(int width, int height, float cornerRadius, Color color, int resolutionMultiplier = 2) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) int num = width * resolutionMultiplier; int num2 = height * resolutionMultiplier; float num3 = cornerRadius * (float)resolutionMultiplier; Texture2D val = new Texture2D(num, num2, (TextureFormat)5, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; Color[] array = (Color[])(object)new Color[num * num2]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 0f); for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { int num4 = i * num + j; array[num4] = color; if ((float)j < num3 && (float)i < num3) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num3, num3)) > num3) { array[num4] = val2; } } else if ((float)j > (float)num - num3 - 1f && (float)i < num3) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num3 - 1f, num3)) > num3) { array[num4] = val2; } } else if ((float)j < num3 && (float)i > (float)num2 - num3 - 1f) { if (Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num3, (float)num2 - num3 - 1f)) > num3) { array[num4] = val2; } } else if ((float)j > (float)num - num3 - 1f && (float)i > (float)num2 - num3 - 1f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2((float)num - num3 - 1f, (float)num2 - num3 - 1f)) > num3) { array[num4] = val2; } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), new Vector2(0.5f, 0.5f), 100f * (float)resolutionMultiplier); } } public class MapPreferences { private const string CategoryDisplayName = "Small Corner Map Settings"; private const string MinimapEnabledKey = "01_MinimapEnabled"; private const string MinimapEnabledDisplayName = "Enable Minimap"; private const bool MinimapEnabledDefault = true; private const string ShowGameTimeKey = "03_ShowGameTime"; private const string ShowGameTimeDisplayName = "Show Current Game Time"; private const bool ShowGameTimeDefault = true; private const string IncreaseSizeKey = "02_IncreaseMapSize"; private const string IncreaseSizeDisplayName = "Increase Minimap Size"; private const bool IncreaseSizeDefault = false; private const string ContractTrackingKey = "04_TrackContracts"; private const string ContractTrackingDisplayName = "Track Active Contracts on Minimap"; private const bool ContractTrackingDefault = true; private const string PropertyTrackingKey = "05_TrackProperties"; private const string PropertyTrackingDisplayName = "Track Owned Properties on Minimap"; private const bool PropertyTrackingDefault = true; private const string VehicleTrackingKey = "06_TrackVehicles"; private const string VehicleTrackingDisplayName = "Track Owned Vehicles on Minimap"; private const bool VehicleTrackingDefault = true; private const string MinimapPositionXKey = "07_MinimapPositionX"; private const string MinimapPositionXDisplayName = "Change Minimap Position: X Coordinate"; private const float MinimapPositionXDefault = -20f; private const string MinimapPositionYKey = "08_MinimapPositionY"; private const string MinimapPositionYDisplayName = "Change Minimap Position: Y Coordinate"; private const float MinimapPositionYDefault = -20f; private readonly float defaultScaleFactor = 1f; private readonly float increasedScaleFactor = 1.5f; public MelonPreferences_Category SettingsCategory { get; set; } public MelonPreferences_Entry<bool> MinimapEnabled { get; private set; } public MelonPreferences_Entry<bool> ShowGameTime { get; private set; } public MelonPreferences_Entry<bool> IncreaseSize { get; private set; } public MelonPreferences_Entry<bool> TrackContracts { get; private set; } public MelonPreferences_Entry<bool> TrackProperties { get; private set; } public MelonPreferences_Entry<bool> TrackVehicles { get; private set; } public MelonPreferences_Entry<float> MinimapPositionX { get; private set; } public MelonPreferences_Entry<float> MinimapPositionY { get; private set; } public MelonPreferences_Entry<bool> ShowSquareMinimap { get; private set; } public float MinimapScaleFactor => IncreaseSize.Value ? increasedScaleFactor : defaultScaleFactor; public void LoadPreferences() { CreateDefaultEntries(); SettingsCategory = MelonPreferences.GetCategory("SmallCornerMapSettings"); MinimapEnabled = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "01_MinimapEnabled"); ShowGameTime = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "03_ShowGameTime"); IncreaseSize = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "02_IncreaseMapSize"); TrackContracts = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "04_TrackContracts"); TrackProperties = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "05_TrackProperties"); TrackVehicles = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "06_TrackVehicles"); ShowSquareMinimap = MelonPreferences.GetEntry<bool>("SmallCornerMapSettings", "ShowSquareMinimap"); MinimapPositionX = MelonPreferences.GetEntry<float>("SmallCornerMapSettings", "07_MinimapPositionX"); MinimapPositionY = MelonPreferences.GetEntry<float>("SmallCornerMapSettings", "08_MinimapPositionY"); } private void CreateDefaultEntries() { if (MelonPreferences.GetCategory("SmallCornerMapSettings") == null) { SettingsCategory = MelonPreferences.CreateCategory("SmallCornerMapSettings", "Small Corner Map Settings"); MinimapEnabled = SettingsCategory.CreateEntry<bool>("01_MinimapEnabled", true, "Enable Minimap", (string)null, false, false, (ValueValidator)null, (string)null); ShowGameTime = SettingsCategory.CreateEntry<bool>("03_ShowGameTime", true, "Show Current Game Time", (string)null, false, false, (ValueValidator)null, (string)null); IncreaseSize = SettingsCategory.CreateEntry<bool>("02_IncreaseMapSize", false, "Increase Minimap Size", (string)null, false, false, (ValueValidator)null, (string)null); TrackContracts = SettingsCategory.CreateEntry<bool>("04_TrackContracts", true, "Track Active Contracts on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); TrackProperties = SettingsCategory.CreateEntry<bool>("05_TrackProperties", true, "Track Owned Properties on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); TrackVehicles = SettingsCategory.CreateEntry<bool>("06_TrackVehicles", true, "Track Owned Vehicles on Minimap", (string)null, false, false, (ValueValidator)null, (string)null); ShowSquareMinimap = SettingsCategory.CreateEntry<bool>("ShowSquareMinimap", false, "Enable Square Minimap", (string)null, false, false, (ValueValidator)null, (string)null); MinimapPositionX = SettingsCategory.CreateEntry<float>("07_MinimapPositionX", -20f, "Change Minimap Position: X Coordinate", (string)null, false, false, (ValueValidator)null, (string)null); MinimapPositionY = SettingsCategory.CreateEntry<float>("08_MinimapPositionY", -20f, "Change Minimap Position: Y Coordinate", (string)null, false, false, (ValueValidator)null, (string)null); } } } public static class MinimapCoordinateSystem { public static float WorldToUIScale(float worldScaleFactor, float currentZoomLevel) { return worldScaleFactor * currentZoomLevel; } public static Vector2 WorldToMapSpace(Vector3 worldPos, float worldScaleFactor, float currentZoomLevel) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0021: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); return new Vector2(worldPos.x * num, worldPos.z * num); } public static Vector2 GetMapContentPosition(Vector3 playerWorldPos, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0009: 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_0024: 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_002c: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); float num2 = (0f - playerWorldPos.x) * num + minimapPlayerCenterXOffset; float num3 = (0f - playerWorldPos.z) * num + minimapPlayerCenterYOffset; return new Vector2(num2, num3); } public static Vector2 WorldToMarkerPosition(Vector3 poiWorldPos, Vector3 playerWorldPos, float worldScaleFactor, float currentZoomLevel) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = WorldToUIScale(worldScaleFactor, currentZoomLevel); float num2 = (poiWorldPos.x - playerWorldPos.x) * num; float num3 = (poiWorldPos.z - playerWorldPos.z) * num; return new Vector2(num2, num3); } public static Vector2 GetMapImageOffset() { //IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references) return new Vector2(0f, 0f); } public static string GetDebugInfo(Vector3 worldPos, float worldScaleFactor, float currentZoomLevel, float minimapPlayerCenterXOffset, float minimapPlayerCenterYOffset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) Vector2 value = WorldToMapSpace(worldPos, worldScaleFactor, currentZoomLevel); Vector2 mapContentPosition = GetMapContentPosition(worldPos, worldScaleFactor, currentZoomLevel, minimapPlayerCenterXOffset, minimapPlayerCenterYOffset); Vector2 value2 = WorldToMarkerPosition(worldPos, worldPos, worldScaleFactor, currentZoomLevel); return $"World: {worldPos}\nMap Space: {value}\nContent Pos: {mapContentPosition}\nMarker Pos (relative to self as player): {value2}\nScale: {WorldToUIScale(worldScaleFactor, currentZoomLevel)}x"; } public static Vector2 ClampToCircle(Vector2 markerPosition, float minimapRadius) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector2)(ref markerPosition)).magnitude; if (magnitude > minimapRadius) { return ((Vector2)(ref markerPosition)).normalized * minimapRadius; } return markerPosition; } public static Vector2 ClampToSquare(Vector2 markerPosition, float minimapHalfSize) { //IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(markerPosition.x, 0f - minimapHalfSize, minimapHalfSize); float num2 = Mathf.Clamp(markerPosition.y, 0f - minimapHalfSize, minimapHalfSize); return new Vector2(num, num2); } public static bool IsOutsideBounds(Vector2 markerPosition, float minimapRadius, bool isCircle) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (isCircle) { return ((Vector2)(ref markerPosition)).magnitude > minimapRadius; } return Mathf.Abs(markerPosition.x) > minimapRadius || Mathf.Abs(markerPosition.y) > minimapRadius; } } public static class MinimapState { public static bool IsCircleMode { get; set; } = true; public static float MinimapRadius { get; set; } = 75f; public static float ScaleFactor { get; set; } = 1f; public static void UpdateState(bool isCircle, float scaleFactor) { IsCircleMode = isCircle; ScaleFactor = scaleFactor; MinimapRadius = 75f * scaleFactor; } } }