using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ComfyLib;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SoftReferenceableAssets;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ZoneScouter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZoneScouter")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("185751b7-5cae-480a-8e9c-d8ec87ce481f")]
[assembly: AssemblyFileVersion("1.7.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.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 ZoneScouter
{
public static class PluginConfig
{
public enum GridSize
{
ThreeByThree = 3,
FiveByFive = 5
}
public static ConfigEntry<bool> IsModEnabled { get; private set; }
public static ConfigEntry<bool> ShowSectorInfoPanel { get; private set; }
public static ConfigEntry<Vector2> SectorInfoPanelPosition { get; private set; }
public static ConfigEntry<Color> SectorInfoPanelBackgroundColor { get; private set; }
public static ConfigEntry<int> SectorInfoPanelFontSize { get; private set; }
public static ConfigEntry<Color> PositionValueXTextColor { get; private set; }
public static ConfigEntry<Color> PositionValueYTextColor { get; private set; }
public static ConfigEntry<Color> PositionValueZTextColor { get; private set; }
public static ConfigEntry<bool> ShowZDOManagerContent { get; private set; }
public static ConfigEntry<bool> ShowSectorZdoCountGrid { get; private set; }
public static ConfigEntry<GridSize> SectorZdoCountGridSize { get; private set; }
public static ConfigEntry<Color> CellZdoCountBackgroundImageColor { get; private set; }
public static ConfigEntry<int> CellZdoCountTextFontSize { get; private set; }
public static ConfigEntry<Color> CellZdoCountTextColor { get; private set; }
public static ConfigEntry<Color> CellSectorBackgroundImageColor { get; private set; }
public static ConfigEntry<int> CellSectorTextFontSize { get; private set; }
public static ConfigEntry<Color> CellSectorTextColor { get; private set; }
public static ConfigEntry<bool> ShowSectorBoundaries { get; private set; }
public static ConfigEntry<Color> SectorBoundaryColor { get; private set; }
public static ConfigEntry<KeyboardShortcut> ToggleSectorBoundariesShortcut { get; private set; }
public static void BindConfig(ConfigFile config)
{
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_049b: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod.");
IsModEnabled.OnSettingChanged<bool>(SectorInfoPanelController.ToggleSectorInfoPanel);
IsModEnabled.OnSettingChanged<bool>(SectorBoundaries.ToggleSectorBoundaries);
ShowSectorInfoPanel = config.BindInOrder("SectorInfoPanel", "showSectorInfoPanel", defaultValue: true, "Show the SectorInfoPanel on the Hud.");
ShowSectorInfoPanel.OnSettingChanged<bool>(SectorInfoPanelController.ToggleSectorInfoPanel);
SectorInfoPanelPosition = config.BindInOrder<Vector2>("SectorInfoPanel", "sectorInfoPanelPosition", new Vector2(0f, -25f), "SectorInfoPanel position (relative to pivot/anchors).");
SectorInfoPanelPosition.OnSettingChanged(delegate(Vector2 position)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
SectorInfoPanelController.SectorInfoPanel?.RectTransform.Ref<RectTransform>()?.SetPosition(position);
});
SectorInfoPanelBackgroundColor = config.BindInOrder<Color>("SectorInfoPanel", "sectorInfoPanelBackgroundColor", new Color(0f, 0f, 0f, 0.9f), "SectorInfoPanel background color.");
SectorInfoPanelBackgroundColor.OnSettingChanged(delegate(Color color)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
SectorInfoPanelController.SectorInfoPanel?.Background.Ref<Image>()?.SetColor(color);
});
SectorInfoPanelFontSize = config.BindInOrder("SectorInfoPanel.Font", "sectorInfoPanelFontSize", 16, "SectorInfoPanel font size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 64));
SectorInfoPanelFontSize.OnSettingChanged<int>(SetSectorInfoPanelStyle);
PositionValueXTextColor = config.BindInOrder<Color>("SectorInfoPanel.PositionRow", "positionValueXTextColor", new Color(1f, 0.878f, 0.51f), "SectorInfoPanel.PositionRow.X value text color.");
PositionValueXTextColor.OnSettingChanged<Color>(SetSectorInfoPanelStyle);
PositionValueYTextColor = config.BindInOrder<Color>("SectorInfoPanel.PositionRow", "positionValueYTextColor", new Color(0.565f, 0.792f, 0.976f), "SectorInfoPanel.PositionRow.Y value text color.");
PositionValueYTextColor.OnSettingChanged<Color>(SetSectorInfoPanelStyle);
PositionValueZTextColor = config.BindInOrder<Color>("SectorInfoPanel.PositionRow", "positionValueZTextColor", new Color(0.647f, 0.839f, 0.655f), "SectorInfoPanel.PositionRow.Z value text color.");
PositionValueZTextColor.OnSettingChanged<Color>(SetSectorInfoPanelStyle);
ShowZDOManagerContent = config.BindInOrder("SectorInfoPanel.ZDOManagerContent", "showZDOManagerContent", defaultValue: false, "Show SectorInfoPanel.ZDOManager content.");
ShowZDOManagerContent.OnSettingChanged(delegate(bool toggleOn)
{
SectorInfoPanelController.SectorInfoPanel?.ToggleZDOManagerContent(toggleOn);
});
ShowSectorZdoCountGrid = config.BindInOrder("SectorZdoCountGrid", "showSectorZdoCountGrid", defaultValue: false, "Show the SectorZdoCount grid in the SectorInfo panel.");
ShowSectorZdoCountGrid.OnSettingChanged<bool>(SectorInfoPanelController.ToggleSectorZdoCountGrid);
SectorZdoCountGridSize = config.BindInOrder("SectorZdoCountGrid", "sectorZdoCountGridSize", GridSize.ThreeByThree, "Size of the SectorZdoCount grid.");
SectorZdoCountGridSize.OnSettingChanged<GridSize>(SectorInfoPanelController.ToggleSectorZdoCountGrid);
CellZdoCountBackgroundImageColor = config.BindInOrder<Color>("SectorZdoCountGrid", "cellZdoCountBackgroundImageColor", Color.clear, "SectorZdoCountCell.ZdoCount.Background.Image color.");
CellZdoCountBackgroundImageColor.OnSettingChanged<Color>(SetSectorZDOCountGridCellStyle);
CellZdoCountTextFontSize = config.BindInOrder("SectorZdoCountGrid", "cellZdoCountTextFontSize", 16, "SectorZdoCountCell.ZdoCount.Text font size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 64));
CellZdoCountTextFontSize.OnSettingChanged<int>(SetSectorZDOCountGridCellStyle);
CellZdoCountTextColor = config.BindInOrder<Color>("SectorZdoCountGrid", "cellZdoCountTextColor", Color.white, "SectorZdoCountCell.ZdoCount.Text color.");
CellZdoCountTextColor.OnSettingChanged<Color>(SetSectorZDOCountGridCellStyle);
CellSectorBackgroundImageColor = config.BindInOrder<Color>("SectorZdoCountGrid", "cellSectorBackgroundImageColor", new Color(0.5f, 0.5f, 0.5f, 0.5f), "SectorZdoCountCell.Sector.Background.Image color.");
CellSectorBackgroundImageColor.OnSettingChanged<Color>(SetSectorZDOCountGridCellStyle);
CellSectorTextFontSize = config.BindInOrder("SectorZdoCountGrid", "cellSectorTextFontSize", 16, "SectorZdoCountCell.Sector.Text font size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 64));
CellSectorTextFontSize.OnSettingChanged<int>(SetSectorZDOCountGridCellStyle);
CellSectorTextColor = config.BindInOrder<Color>("SectorZdoCountGrid", "cellSectorTextColor", new Color(0.9f, 0.9f, 0.9f, 1f), "SectorZdoCountCell.Sector.Text color.");
CellSectorTextColor.OnSettingChanged<Color>(SetSectorZDOCountGridCellStyle);
ShowSectorBoundaries = config.BindInOrder("SectorBoundary", "showSectorBoundaries", defaultValue: false, "Shows sector boundaries using semi-transparent walls at each boundary.");
ShowSectorBoundaries.OnSettingChanged<bool>(SectorBoundaries.ToggleSectorBoundaries);
SectorBoundaryColor = config.BindInOrder<Color>("SectorBoundary", "sectorBoundaryColor", new Color(1f, 0f, 1f, 1f), "Color to use for the sector boundary walls.");
SectorBoundaryColor.OnSettingChanged((Action<Color>)SectorBoundaries.SetBoundaryColor);
ToggleSectorBoundariesShortcut = config.BindInOrder<KeyboardShortcut>("SectorBoundary", "toggleSectorBoundariesShortcut", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Shortcut to toggle on/off sector boundaries.");
static void SetSectorInfoPanelStyle()
{
SectorInfoPanelController.SectorInfoPanel?.SetPanelStyle();
}
static void SetSectorZDOCountGridCellStyle()
{
SectorInfoPanelController.SectorZdoCountGrid?.SetCellStyle();
}
}
}
public static class SectorBoundaries
{
[CompilerGenerated]
private sealed class <UpdateBoundaryCubeCoroutine>d__9 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private WaitForSeconds <waitInterval>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateBoundaryCubeCoroutine>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<waitInterval>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
if (Object.op_Implicit((Object)(object)ZoneSystem.m_instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
Vector3 position = ((Component)Player.m_localPlayer).transform.position;
Vector3 zonePos = ZoneSystem.GetZonePos(ZoneSystem.GetZone(position));
zonePos.y = position.y;
_boundaryCube.transform.position = zonePos;
}
}
else
{
<>1__state = -1;
<waitInterval>5__2 = new WaitForSeconds(1f);
}
<>2__current = <waitInterval>5__2;
<>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 static readonly Vector2i UnsetSector = new Vector2i(int.MaxValue, int.MaxValue);
private static Coroutine _updateBoundaryCubeCoroutine;
private static Vector2i _lastBoundarySector = UnsetSector;
private static GameObject _boundaryCube;
private static readonly List<MeshRenderer> _boundaryWallRendererCache = new List<MeshRenderer>();
public static void ToggleSectorBoundaries()
{
TearDown();
StartUp();
}
public static void SetBoundaryColor(Color targetColor)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (!PluginConfig.IsModEnabled.Value || !Object.op_Implicit((Object)(object)_boundaryCube))
{
return;
}
foreach (MeshRenderer item in _boundaryWallRendererCache)
{
((Renderer)item).material.SetColor("_Color", targetColor);
}
}
private static void TearDown()
{
//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)
if (_updateBoundaryCubeCoroutine != null && Object.op_Implicit((Object)(object)Hud.m_instance))
{
((MonoBehaviour)Hud.m_instance).StopCoroutine(_updateBoundaryCubeCoroutine);
}
_updateBoundaryCubeCoroutine = null;
_lastBoundarySector = UnsetSector;
if (Object.op_Implicit((Object)(object)_boundaryCube))
{
Object.Destroy((Object)(object)_boundaryCube);
}
_boundaryCube = null;
_boundaryWallRendererCache.Clear();
}
private static void StartUp()
{
if (PluginConfig.IsModEnabled.Value && PluginConfig.ShowSectorBoundaries.Value && Object.op_Implicit((Object)(object)Hud.m_instance))
{
_boundaryCube = CreateBoundaryCube();
_boundaryWallRendererCache.AddRange(_boundaryCube.GetComponentsInChildren<MeshRenderer>());
_updateBoundaryCubeCoroutine = ((MonoBehaviour)Hud.m_instance).StartCoroutine(UpdateBoundaryCubeCoroutine());
}
}
[IteratorStateMachine(typeof(<UpdateBoundaryCubeCoroutine>d__9))]
private static IEnumerator UpdateBoundaryCubeCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateBoundaryCubeCoroutine>d__9(0);
}
private static GameObject CreateBoundaryCube()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0078: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00a7: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Expected O, but got Unknown
//IL_00d7: Expected O, but got Unknown
GameObject val = new GameObject("BoundaryCube");
val.transform.position = Vector3.zero;
CreateBoundaryCubeWall(val, new Vector3(32f, -256f, 0f), new Vector3(0.1f, 1024f, 64f));
CreateBoundaryCubeWall(val, new Vector3(-32f, -256f, 0f), new Vector3(0.1f, 1024f, 64f));
CreateBoundaryCubeWall(val, new Vector3(0f, -256f, 32f), new Vector3(64f, 1024f, 0.1f));
CreateBoundaryCubeWall(val, new Vector3(0f, -256f, -32f), new Vector3(64f, 1024f, 0.1f));
return val;
}
private static GameObject CreateBoundaryCubeWall(GameObject cube, Vector3 position, Vector3 scale)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)obj).name = "BoundaryCube.Wall";
obj.transform.SetParent(cube.transform, false);
obj.transform.localPosition = position;
obj.transform.localScale = scale;
MeshRenderer component = obj.GetComponent<MeshRenderer>();
((Renderer)component).material.SetColor("_Color", PluginConfig.SectorBoundaryColor.Value);
((Renderer)component).material.shader = AssetUtils.DistortionShader;
Object.Destroy((Object)(object)obj.GetComponentInChildren<Collider>());
return obj;
}
}
public static class SectorInfoPanelController
{
[CompilerGenerated]
private sealed class <UpdateSectorInfoPanelCoroutine>d__15 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private WaitForSeconds <waitInterval>5__2;
private Vector3 <lastPosition>5__3;
private Vector2i <lastSector>5__4;
private long <lastZdoCount>5__5;
private uint <lastNextUid>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateSectorInfoPanelCoroutine>d__15(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<waitInterval>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
if (Object.op_Implicit((Object)(object)ZoneSystem.m_instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)SectorInfoPanel?.Panel))
{
uint nextUid = ZDOMan.s_instance.m_nextUid;
if (nextUid != <lastNextUid>5__6)
{
SectorInfoPanel.ZdoManagerNextId.Value.SetText($"{nextUid:D}");
<lastNextUid>5__6 = nextUid;
}
Vector3 position = ((Component)Player.m_localPlayer).transform.position;
if (position != <lastPosition>5__3)
{
<lastPosition>5__3 = position;
SectorInfoPanel.PositionX.Value.SetText($"{position.x:F0}");
SectorInfoPanel.PositionY.Value.SetText($"{position.y:F0}");
SectorInfoPanel.PositionZ.Value.SetText($"{position.z:F0}");
}
Vector2i zone = ZoneSystem.GetZone(position);
long sectorZdoCount = GetSectorZdoCount(zone);
if (!(zone == <lastSector>5__4) || sectorZdoCount != <lastZdoCount>5__5)
{
<lastSector>5__4 = zone;
<lastZdoCount>5__5 = sectorZdoCount;
SectorInfoPanel.SectorXY.Value.SetText($"{zone.x},{zone.y}");
SectorInfoPanel.SectorZdoCount.Value.SetText($"{sectorZdoCount}");
}
}
}
else
{
<>1__state = -1;
<waitInterval>5__2 = new WaitForSeconds(0.25f);
<lastPosition>5__3 = Vector3.positiveInfinity;
<lastSector>5__4 = new Vector2i(int.MinValue, int.MaxValue);
<lastZdoCount>5__5 = long.MaxValue;
<lastNextUid>5__6 = uint.MaxValue;
}
<>2__current = <waitInterval>5__2;
<>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();
}
}
[CompilerGenerated]
private sealed class <UpdateSectorZdoCountGrid>d__16 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private WaitForSeconds <waitInterval>5__2;
private int <size>5__3;
private int <offset>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateSectorZdoCountGrid>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<waitInterval>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!Object.op_Implicit((Object)(object)SectorZdoCountGrid?.Grid))
{
return false;
}
<waitInterval>5__2 = new WaitForSeconds(1f);
<size>5__3 = SectorZdoCountGrid.Size;
<offset>5__4 = Mathf.FloorToInt((float)<size>5__3 / 2f);
break;
case 1:
<>1__state = -1;
break;
case 2:
<>1__state = -1;
break;
}
if (Object.op_Implicit((Object)(object)SectorZdoCountGrid?.Grid))
{
if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
{
<>2__current = <waitInterval>5__2;
<>1__state = 1;
return true;
}
Vector2i zone = ZoneSystem.GetZone(((Component)Player.m_localPlayer).transform.position);
Vector2i val = default(Vector2i);
for (int i = 0; i < <size>5__3; i++)
{
for (int j = 0; j < <size>5__3; j++)
{
((Vector2i)(ref val))..ctor(zone.x + i - <offset>5__4, zone.y - j + <offset>5__4);
SectorZdoCountCell sectorZdoCountCell = SectorZdoCountGrid.Cells[j, i];
sectorZdoCountCell.ZdoCount.SetText($"{GetSectorZdoCount(val)}");
sectorZdoCountCell.Sector.SetText($"{val.x},{val.y}");
}
}
<>2__current = <waitInterval>5__2;
<>1__state = 2;
return true;
}
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 readonly Dictionary<Vector2i, int> SectorToIndexCache = new Dictionary<Vector2i, int>();
private static Coroutine _updateSectorInfoPanelCoroutine;
private static Coroutine _updateSectorZdoCountGridCoroutine;
public static SectorInfoPanel SectorInfoPanel { get; private set; }
public static SectorZdoCountGrid SectorZdoCountGrid { get; private set; }
public static void ToggleSectorInfoPanel()
{
//IL_00a3: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
if (_updateSectorInfoPanelCoroutine != null)
{
((MonoBehaviour)Hud.m_instance.Ref<Hud>()).StopCoroutine(_updateSectorInfoPanelCoroutine);
_updateSectorInfoPanelCoroutine = null;
}
if (Object.op_Implicit((Object)(object)SectorInfoPanel?.Panel))
{
Object.Destroy((Object)(object)SectorInfoPanel.Panel);
SectorInfoPanel = null;
}
if (PluginConfig.IsModEnabled.Value && PluginConfig.ShowSectorInfoPanel.Value && Object.op_Implicit((Object)(object)Hud.m_instance))
{
SectorInfoPanel = new SectorInfoPanel(((Component)Hud.m_instance).transform);
((Transform)SectorInfoPanel.RectTransform.SetAnchorMin(new Vector2(0.5f, 1f)).SetAnchorMax(new Vector2(0.5f, 1f)).SetPivot(new Vector2(0.5f, 1f))
.SetPosition(PluginConfig.SectorInfoPanelPosition.Value)
.SetSizeDelta(new Vector2(200f, 200f))).SetAsFirstSibling();
SectorInfoPanel.PanelDragger.OnPanelEndDrag += OnSectorInfoPanelEndDrag;
SectorInfoPanel.Panel.SetActive(true);
_updateSectorInfoPanelCoroutine = ((MonoBehaviour)Hud.m_instance).StartCoroutine(UpdateSectorInfoPanelCoroutine());
}
ToggleSectorZdoCountGrid();
}
public static void OnSectorInfoPanelEndDrag(object sender, Vector3 position)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
PluginConfig.SectorInfoPanelPosition.Value = Vector2.op_Implicit(position);
}
public static void ToggleSectorZdoCountGrid()
{
if (_updateSectorZdoCountGridCoroutine != null && Object.op_Implicit((Object)(object)Hud.m_instance))
{
((MonoBehaviour)Hud.m_instance).StopCoroutine(_updateSectorZdoCountGridCoroutine);
_updateSectorZdoCountGridCoroutine = null;
}
if (Object.op_Implicit((Object)(object)SectorZdoCountGrid?.Grid))
{
Object.Destroy((Object)(object)SectorZdoCountGrid.Grid);
SectorZdoCountGrid = null;
}
if (PluginConfig.IsModEnabled.Value && PluginConfig.ShowSectorInfoPanel.Value && PluginConfig.ShowSectorZdoCountGrid.Value && Object.op_Implicit((Object)(object)SectorInfoPanel?.Panel))
{
SectorZdoCountGrid = new SectorZdoCountGrid(SectorInfoPanel.Panel.transform, PluginConfig.SectorZdoCountGridSize.Value);
SectorZdoCountGrid.Grid.SetActive(true);
_updateSectorZdoCountGridCoroutine = ((MonoBehaviour)Hud.m_instance).StartCoroutine(UpdateSectorZdoCountGrid());
}
}
private static long GetSectorZdoCount(Vector2i sector)
{
//IL_0005: 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_0020: Unknown result type (might be due to invalid IL or missing references)
if (!SectorToIndexCache.TryGetValue(sector, out var value))
{
value = ZDOMan.s_instance.SectorToIndex(sector);
SectorToIndexCache[sector] = value;
}
if (value < 0)
{
return 0L;
}
return ZDOMan.s_instance.m_objectsBySector[value]?.Count ?? 0;
}
[IteratorStateMachine(typeof(<UpdateSectorInfoPanelCoroutine>d__15))]
private static IEnumerator UpdateSectorInfoPanelCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateSectorInfoPanelCoroutine>d__15(0);
}
[IteratorStateMachine(typeof(<UpdateSectorZdoCountGrid>d__16))]
private static IEnumerator UpdateSectorZdoCountGrid()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateSectorZdoCountGrid>d__16(0);
}
}
public sealed class ButtonCell
{
private static readonly Lazy<ColorBlock> _buttonColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate
{
//IL_0002: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
ColorBlock result = default(ColorBlock);
((ColorBlock)(ref result)).normalColor = new Color(0f, 0f, 0f, 0.3f);
((ColorBlock)(ref result)).highlightedColor = new Color(0.565f, 0.792f, 0.976f, 0.3f);
((ColorBlock)(ref result)).disabledColor = new Color(0.5f, 0.5f, 0.5f, 0.3f);
((ColorBlock)(ref result)).pressedColor = new Color(1f, 0.878f, 0.51f, 0.3f);
((ColorBlock)(ref result)).selectedColor = new Color(0.647f, 0.839f, 0.655f, 0.3f);
((ColorBlock)(ref result)).colorMultiplier = 1f;
((ColorBlock)(ref result)).fadeDuration = 0.1f;
return result;
});
public GameObject Cell { get; private set; }
public Image Background { get; private set; }
public TMP_Text Label { get; private set; }
public Button Button { get; private set; }
public ButtonCell(Transform parentTransform)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
Cell = CreateChildCell(parentTransform);
Background = CreateChildBackground(Cell.transform).GetComponent<Image>();
Label = CreateChildLabel(((Component)Background).transform);
Button = Cell.AddComponent<Button>();
Button.SetNavigationMode<Button>((Mode)0).SetTargetGraphic<Button>((Graphic)(object)Background).SetColors<Button>(_buttonColorBlock.Value);
}
private GameObject CreateChildCell(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<VerticalLayoutGroup>((bool?)false, (bool?)false)
.SetSpacing<VerticalLayoutGroup>(0f)
.SetChildAlignment<VerticalLayoutGroup>((TextAnchor)4);
val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2);
return val;
}
private GameObject CreateChildBackground(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
GameObject val = new GameObject("Background", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<HorizontalLayoutGroup>().SetChildControl<HorizontalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<HorizontalLayoutGroup>((bool?)false, (bool?)false)
.SetPadding<HorizontalLayoutGroup>((int?)4, (int?)4, (int?)2, (int?)2)
.SetChildAlignment<HorizontalLayoutGroup>((TextAnchor)4);
val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(200, 200, 5))
.SetColor(Color.white);
return val;
}
private TMP_Text CreateChildLabel(Transform parentTransform)
{
TMP_Text obj = UIBuilder.CreateTMPLabel(parentTransform);
((Object)obj).name = "Label";
obj.SetAlignment<TMP_Text>((TextAlignmentOptions)514).SetText("Button");
((Component)obj).gameObject.AddComponent<LayoutElement>().SetFlexible(1f);
return obj;
}
}
public sealed class ValueWithLabel
{
public GameObject Row { get; private set; }
public Image Background { get; private set; }
public TMP_Text Value { get; private set; }
public TMP_Text Label { get; private set; }
public ValueWithLabel(Transform parentTransform)
{
Row = CreateChildRow(parentTransform);
Background = Row.GetComponent<Image>();
Value = CreateChildValue(Row.transform);
Label = CreateChildLabel(Row.transform);
}
public ValueWithLabel FitValueToText(string longestText)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
((Component)(object)Value).GetOrAddComponent<LayoutElement>().SetFlexible(1f).SetPreferred(Value.GetPreferredValues(longestText).x);
return this;
}
private GameObject CreateChildRow(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<HorizontalLayoutGroup>().SetChildControl<HorizontalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<HorizontalLayoutGroup>((bool?)false, (bool?)false)
.SetPadding<HorizontalLayoutGroup>((int?)8, (int?)8, (int?)4, (int?)4)
.SetSpacing<HorizontalLayoutGroup>(8f);
val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(200, 200, 5))
.SetColor(new Color(0f, 0f, 0f, 0.1f));
return val;
}
private TMP_Text CreateChildValue(Transform parentTransform)
{
TMP_Text obj = UIBuilder.CreateTMPLabel(parentTransform);
((Object)obj).name = "Value";
obj.SetFontSize<TMP_Text>((float)PluginConfig.SectorInfoPanelFontSize.Value).SetAlignment<TMP_Text>((TextAlignmentOptions)260).SetText("0");
((Component)obj).gameObject.AddComponent<LayoutElement>().SetPreferred(50f);
return obj;
}
private TMP_Text CreateChildLabel(Transform parentTransform)
{
TMP_Text obj = UIBuilder.CreateTMPLabel(parentTransform);
((Object)obj).name = "Label";
obj.SetFontSize<TMP_Text>((float)PluginConfig.SectorInfoPanelFontSize.Value).SetAlignment<TMP_Text>((TextAlignmentOptions)257).SetText("X");
return obj;
}
}
public sealed class SectorInfoPanel
{
public sealed class ContentRow
{
public GameObject Row { get; private set; }
public ContentRow(Transform parentTransform)
{
Row = CreateChildRow(parentTransform);
}
private GameObject CreateChildRow(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0064: Expected O, but got Unknown
GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<HorizontalLayoutGroup>().SetChildControl<HorizontalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<HorizontalLayoutGroup>((bool?)true, (bool?)false)
.SetSpacing<HorizontalLayoutGroup>(6f)
.SetChildAlignment<HorizontalLayoutGroup>((TextAnchor)4);
return val;
}
}
public GameObject Panel { get; private set; }
public RectTransform RectTransform { get; private set; }
public Image Background { get; private set; }
public ContentRow PositionContent { get; private set; }
public ValueWithLabel PositionX { get; private set; }
public ValueWithLabel PositionY { get; private set; }
public ValueWithLabel PositionZ { get; private set; }
public ButtonCell CopyPositionButton { get; private set; }
public ContentRow SectorContent { get; private set; }
public ValueWithLabel SectorXY { get; private set; }
public ValueWithLabel SectorZdoCount { get; private set; }
public ContentRow ZdoManagerContent { get; private set; }
public ValueWithLabel ZdoManagerNextId { get; private set; }
public PanelDragger PanelDragger { get; private set; }
public SectorInfoPanel(Transform parentTransform)
{
Panel = CreatePanel(parentTransform);
RectTransform = Panel.GetComponent<RectTransform>();
Background = Panel.GetComponent<Image>();
PositionContent = new ContentRow(Panel.transform);
PositionX = new ValueWithLabel(PositionContent.Row.transform);
PositionX.Label.SetText("X");
PositionY = new ValueWithLabel(PositionContent.Row.transform);
PositionY.Label.SetText("Y");
PositionZ = new ValueWithLabel(PositionContent.Row.transform);
PositionZ.Label.SetText("Z");
CreateCopyPositionButton();
SectorContent = new ContentRow(Panel.transform);
SectorXY = new ValueWithLabel(SectorContent.Row.transform);
SectorXY.Label.SetText("Sector");
SectorZdoCount = new ValueWithLabel(SectorContent.Row.transform);
SectorZdoCount.Label.SetText("ZDOs");
ZdoManagerContent = new ContentRow(Panel.transform);
ZdoManagerNextId = new ValueWithLabel(ZdoManagerContent.Row.transform);
ZdoManagerNextId.Label.SetText("NextId");
SetPanelStyle();
ToggleZDOManagerContent(PluginConfig.ShowZDOManagerContent.Value);
PanelDragger = Panel.AddComponent<PanelDragger>();
PanelDragger.TargetRectTransform = Panel.GetComponent<RectTransform>();
}
private void CreateCopyPositionButton()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
CopyPositionButton = new ButtonCell(PositionContent.Row.transform);
CopyPositionButton.Cell.AddComponent<LayoutElement>().SetIgnoreLayout(ignoreLayout: true);
CopyPositionButton.Cell.GetComponent<RectTransform>().SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f))
.SetPivot(new Vector2(0f, 0.5f))
.SetPosition(new Vector2(10f, 0f))
.SetSizeDelta(new Vector2(80f, 0f));
CopyPositionButton.Label.text = "Copy";
((UnityEvent)CopyPositionButton.Button.onClick).AddListener(new UnityAction(CopyPositionToClipboard));
}
private void CopyPositionToClipboard()
{
string text2 = (GUIUtility.systemCopyBuffer = (ZInput.GetKey((KeyCode)304, false) ? ("Position (XZY): " + PositionX.Value.text + " " + PositionZ.Value.text + " " + PositionY.Value.text) : ("Position (XYZ): " + PositionX.Value.text + " " + PositionY.Value.text + " " + PositionZ.Value.text)));
((Terminal)Chat.instance).AddString("Copied to clipboard: " + text2);
}
public void ToggleCopyButtons(bool toggleOn)
{
CopyPositionButton.Cell.gameObject.SetActive(toggleOn);
}
public void SetPanelStyle()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: 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_01a6: 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)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
int value = PluginConfig.SectorInfoPanelFontSize.Value;
PositionX.Label.SetFontSize<TMP_Text>((float)value);
PositionX.Value.SetFontSize<TMP_Text>((float)value);
PositionX.Value.SetColor<TMP_Text>(PluginConfig.PositionValueXTextColor.Value);
PositionX.FitValueToText("-00000");
PositionX.Background.SetColor(PluginConfig.PositionValueXTextColor.Value.SetAlpha(0.1f));
PositionY.Label.SetFontSize<TMP_Text>((float)value);
PositionY.Value.SetFontSize<TMP_Text>((float)value);
PositionY.Value.SetColor<TMP_Text>(PluginConfig.PositionValueYTextColor.Value);
PositionY.FitValueToText("-00000");
PositionY.Background.SetColor(PluginConfig.PositionValueYTextColor.Value.SetAlpha(0.1f));
PositionZ.Label.SetFontSize<TMP_Text>((float)value);
PositionZ.Value.SetFontSize<TMP_Text>((float)value);
PositionZ.Value.SetColor<TMP_Text>(PluginConfig.PositionValueZTextColor.Value);
PositionZ.FitValueToText("-00000");
PositionZ.Background.SetColor(PluginConfig.PositionValueZTextColor.Value.SetAlpha(0.1f));
SectorXY.Label.SetFontSize<TMP_Text>((float)value);
SectorXY.Value.SetFontSize<TMP_Text>((float)value);
SectorXY.Value.SetColor<TMP_Text>(PluginConfig.PositionValueXTextColor.Value);
SectorXY.FitValueToText("-123,-123");
SectorXY.Background.SetColor(PluginConfig.PositionValueXTextColor.Value.SetAlpha(0.1f));
SectorZdoCount.Label.SetFontSize<TMP_Text>((float)value);
SectorZdoCount.Value.SetFontSize<TMP_Text>((float)value);
SectorZdoCount.Value.SetColor<TMP_Text>(PluginConfig.PositionValueYTextColor.Value);
SectorZdoCount.FitValueToText("123456");
SectorZdoCount.Background.SetColor(PluginConfig.PositionValueYTextColor.Value.SetAlpha(0.1f));
ZdoManagerNextId.Label.SetFontSize<TMP_Text>((float)value);
ZdoManagerNextId.Value.SetFontSize<TMP_Text>((float)value);
ZdoManagerNextId.Value.SetColor<TMP_Text>(PluginConfig.PositionValueZTextColor.Value);
ZdoManagerNextId.FitValueToText("1234567890");
ZdoManagerNextId.Background.SetColor(PluginConfig.PositionValueZTextColor.Value.SetAlpha(0.1f));
}
public void ToggleZDOManagerContent(bool toggleOn)
{
GameObject row = ZdoManagerContent.Row;
if (row != null)
{
row.SetActive(toggleOn);
}
}
private GameObject CreatePanel(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
GameObject val = new GameObject("SectorInfo.Panel", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<VerticalLayoutGroup>((bool?)true, (bool?)false)
.SetPadding<VerticalLayoutGroup>((int?)6, (int?)6, (int?)6, (int?)6)
.SetSpacing<VerticalLayoutGroup>(6f);
val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateSuperellipse(200, 200, 12f))
.SetColor(PluginConfig.SectorInfoPanelBackgroundColor.Value);
val.AddComponent<CanvasGroup>().SetBlocksRaycasts(blocksRaycasts: true);
return val;
}
}
public sealed class SectorZdoCountCell
{
public GameObject Cell { get; private set; }
public Image ZdoCountBackground { get; private set; }
public TMP_Text ZdoCount { get; private set; }
public Image SectorBackground { get; private set; }
public TMP_Text Sector { get; private set; }
public SectorZdoCountCell(Transform parentTransform)
{
Cell = CreateChildCell(parentTransform);
ZdoCountBackground = CreateChildBackground(Cell.transform).GetComponent<Image>();
ZdoCount = CreateChildLabel(((Component)ZdoCountBackground).transform);
SectorBackground = CreateChildBackground(Cell.transform).GetComponent<Image>();
Sector = CreateChildLabel(((Component)SectorBackground).transform);
SetCellStyle(setPreferredWidth: true);
}
public void SetCellStyle(bool setPreferredWidth = false)
{
//IL_000b: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
ZdoCountBackground.SetColor(PluginConfig.CellZdoCountBackgroundImageColor.Value);
ZdoCount.SetColor<TMP_Text>(PluginConfig.CellZdoCountTextColor.Value);
if (ZdoCount.fontSize != (float)PluginConfig.CellZdoCountTextFontSize.Value || setPreferredWidth)
{
ZdoCount.SetFontSize<TMP_Text>((float)PluginConfig.CellZdoCountTextFontSize.Value);
((Component)ZdoCount).GetComponent<LayoutElement>().SetFlexible(1f).SetPreferred(ZdoCount.GetPreferredValues("12345").x);
}
SectorBackground.SetColor(PluginConfig.CellSectorBackgroundImageColor.Value);
Sector.SetColor<TMP_Text>(PluginConfig.CellSectorTextColor.Value);
if (Sector.fontSize != (float)PluginConfig.CellSectorTextFontSize.Value || setPreferredWidth)
{
Sector.SetFontSize<TMP_Text>((float)PluginConfig.CellSectorTextFontSize.Value);
((Component)Sector).GetComponent<LayoutElement>().SetFlexible(1f).SetPreferred(Sector.GetPreferredValues("-123,-123").x);
}
}
private GameObject CreateChildCell(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<VerticalLayoutGroup>((bool?)false, (bool?)false)
.SetSpacing<VerticalLayoutGroup>(0f)
.SetChildAlignment<VerticalLayoutGroup>((TextAnchor)4);
val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2);
val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(200, 200, 10))
.SetColor(new Color(0f, 0f, 0f, 0.3f));
return val;
}
private GameObject CreateChildBackground(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Expected O, but got Unknown
GameObject val = new GameObject("Background", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<HorizontalLayoutGroup>().SetChildControl<HorizontalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<HorizontalLayoutGroup>((bool?)false, (bool?)false)
.SetPadding<HorizontalLayoutGroup>((int?)4, (int?)4, (int?)2, (int?)2)
.SetChildAlignment<HorizontalLayoutGroup>((TextAnchor)4);
val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(200, 200, 5))
.SetColor(Color.clear);
return val;
}
private TMP_Text CreateChildLabel(Transform parentTransform)
{
TMP_Text obj = UIBuilder.CreateTMPLabel(parentTransform);
((Object)obj).name = "Label";
obj.SetAlignment<TMP_Text>((TextAlignmentOptions)514).SetText("123");
((Component)obj).gameObject.AddComponent<LayoutElement>().SetFlexible(1f);
return obj;
}
}
public sealed class SectorZdoCountGrid
{
private readonly List<SectorZdoCountCell> _cells = new List<SectorZdoCountCell>();
public GameObject Grid { get; private set; }
public int Size { get; private set; }
public GameObject[] Rows { get; private set; }
public SectorZdoCountCell[,] Cells { get; private set; }
public SectorZdoCountGrid(Transform parentTransform, PluginConfig.GridSize gridSize)
{
Size = GetSize(gridSize);
Grid = CreateChildGrid(parentTransform);
Rows = (GameObject[])(object)new GameObject[Size];
Cells = new SectorZdoCountCell[Size, Size];
for (int i = 0; i < Size; i++)
{
GameObject val = CreateSectorZdoCountGridRow(Grid.transform);
for (int j = 0; j < Size; j++)
{
SectorZdoCountCell sectorZdoCountCell = new SectorZdoCountCell(val.transform);
Cells[i, j] = sectorZdoCountCell;
_cells.Add(sectorZdoCountCell);
}
}
}
private static int GetSize(PluginConfig.GridSize gridSize)
{
return gridSize switch
{
PluginConfig.GridSize.ThreeByThree => 3,
PluginConfig.GridSize.FiveByFive => 5,
_ => 1,
};
}
public void SetCellStyle()
{
foreach (SectorZdoCountCell cell in _cells)
{
cell.SetCellStyle();
}
}
private GameObject CreateChildGrid(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0064: Expected O, but got Unknown
GameObject val = new GameObject("Grid", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<VerticalLayoutGroup>((bool?)false, (bool?)false)
.SetChildAlignment<VerticalLayoutGroup>((TextAnchor)4)
.SetSpacing<VerticalLayoutGroup>(6f);
return val;
}
private GameObject CreateSectorZdoCountGridRow(Transform parentTransform)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0064: Expected O, but got Unknown
GameObject val = new GameObject("SectorZdoCountGrid.Row", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<HorizontalLayoutGroup>().SetChildControl<HorizontalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<HorizontalLayoutGroup>((bool?)false, (bool?)false)
.SetChildAlignment<HorizontalLayoutGroup>((TextAnchor)4)
.SetSpacing<HorizontalLayoutGroup>(6f);
return val;
}
}
[HarmonyPatch(typeof(Hud))]
internal static class HudPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void AwakePostfix()
{
if (PluginConfig.IsModEnabled.Value)
{
SectorInfoPanelController.ToggleSectorInfoPanel();
SectorBoundaries.ToggleSectorBoundaries();
}
}
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void UpdatePostfix()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (PluginConfig.IsModEnabled.Value)
{
KeyboardShortcut value = PluginConfig.ToggleSectorBoundariesShortcut.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
PluginConfig.ShowSectorBoundaries.Value = !PluginConfig.ShowSectorBoundaries.Value;
}
}
}
}
[HarmonyPatch(typeof(Menu))]
internal static class MenuPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void StartPostfix(Menu __instance)
{
if (PluginConfig.IsModEnabled.Value)
{
SetupMenu(__instance);
}
}
public static void SetupMenu(Menu menu)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
Image val2 = default(Image);
foreach (Transform item in menu.m_menuDialog)
{
Transform val = item;
if (((Object)val).name.StartsWith("darken", StringComparison.InvariantCulture) && ((Component)val).TryGetComponent<Image>(ref val2))
{
((Graphic)val2).raycastTarget = false;
}
}
}
[HarmonyPostfix]
[HarmonyPatch("Show")]
private static void ShowPostfix()
{
if (PluginConfig.IsModEnabled.Value)
{
SectorInfoPanelController.SectorInfoPanel?.ToggleCopyButtons(toggleOn: true);
}
}
[HarmonyPostfix]
[HarmonyPatch("Hide")]
private static void HidePostfix()
{
if (PluginConfig.IsModEnabled.Value)
{
SectorInfoPanelController.SectorInfoPanel?.ToggleCopyButtons(toggleOn: false);
}
}
}
[BepInPlugin("redseiko.valheim.zonescouter", "ZoneScouter", "1.7.0")]
public sealed class ZoneScouter : BaseUnityPlugin
{
public const string PluginGuid = "redseiko.valheim.zonescouter";
public const string PluginName = "ZoneScouter";
public const string PluginVersion = "1.7.0";
private void Awake()
{
PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.zonescouter");
}
}
}
namespace ComfyLib
{
public static class ConfigFileExtensions
{
internal sealed class ConfigurationManagerAttributes
{
public Action<ConfigEntryBase> CustomDrawer;
public bool? Browsable;
public bool? HideDefaultButton;
public bool? HideSettingName;
public bool? IsAdvanced;
public int? Order;
public bool? ReadOnly;
}
private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();
private static int GetSettingOrder(string section)
{
if (!_sectionToSettingOrder.TryGetValue(section, out var value))
{
value = 0;
}
_sectionToSettingOrder[section] = value - 1;
return value;
}
public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = browsable,
CustomDrawer = null,
HideDefaultButton = hideDefaultButton,
HideSettingName = hideSettingName,
IsAdvanced = isAdvanced,
Order = GetSettingOrder(section),
ReadOnly = readOnly
}
}));
}
public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = browsable,
CustomDrawer = customDrawer,
HideDefaultButton = hideDefaultButton,
HideSettingName = hideSettingName,
IsAdvanced = isAdvanced,
Order = GetSettingOrder(section),
ReadOnly = readOnly
}
}));
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
{
configEntry.SettingChanged += delegate
{
settingChangedHandler();
};
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
{
configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
};
}
public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
{
configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
};
}
}
public static class ComponentExtensions
{
public static T GetOrAddComponent<T>(this Component component) where T : Component
{
T result = default(T);
if (!component.gameObject.TryGetComponent<T>(ref result))
{
return component.gameObject.AddComponent<T>();
}
return result;
}
}
public static class GameObjectExtensions
{
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
{
T result = default(T);
if (!gameObject.TryGetComponent<T>(ref result))
{
return gameObject.AddComponent<T>();
}
return result;
}
}
public static class ObjectExtensions
{
public static T FirstByNameOrThrow<T>(this T[] unityObjects, string name) where T : Object
{
foreach (T val in unityObjects)
{
if (((Object)val).name == name)
{
return val;
}
}
throw new InvalidOperationException($"Could not find Unity object of type {typeof(T)} with name: {name}");
}
public static T Ref<T>(this T unityObject) where T : Object
{
if (!Object.op_Implicit((Object)(object)unityObject))
{
return default(T);
}
return unityObject;
}
public static T SetName<T>(this T unityObject, string name) where T : Object
{
((Object)unityObject).name = name;
return unityObject;
}
}
public sealed class PanelDragger : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler
{
public RectTransform TargetRectTransform;
private Vector2 _lastMousePosition;
public event EventHandler<Vector3> OnPanelEndDrag;
public void OnBeginDrag(PointerEventData eventData)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
_lastMousePosition = eventData.position;
}
public void OnDrag(PointerEventData eventData)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0024: 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_0034: 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_0045: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = eventData.position - _lastMousePosition;
RectTransform targetRectTransform = TargetRectTransform;
((Transform)targetRectTransform).position = ((Transform)targetRectTransform).position + new Vector3(val.x, val.y, 0f);
_lastMousePosition = eventData.position;
}
public void OnEndDrag(PointerEventData eventData)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
this.OnPanelEndDrag?.Invoke(this, Vector2.op_Implicit(TargetRectTransform.anchoredPosition));
}
}
public static class UIBuilder
{
private static readonly Lazy<TextGenerator> CachedTextGenerator = new Lazy<TextGenerator>();
private static readonly Dictionary<string, Sprite> _spriteCache = new Dictionary<string, Sprite>();
private static readonly Color32 ColorWhite = Color32.op_Implicit(Color.white);
private static readonly Color32 ColorClear = Color32.op_Implicit(Color.clear);
public static TMP_Text CreateTMPLabel(Transform parentTransform)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI obj = Object.Instantiate<TextMeshProUGUI>(UnifiedPopup.instance.bodyText, parentTransform);
((Object)obj).name = "Label";
((TMP_Text)obj).enableAutoSizing = false;
((TMP_Text)obj).fontSize = 16f;
((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
((Graphic)obj).color = Color.white;
((TMP_Text)obj).text = string.Empty;
return (TMP_Text)(object)obj;
}
public static GameObject CreateRowSpacer(Transform parentTransform)
{
//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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
GameObject val = new GameObject(((Object)parentTransform).name + ".Spacer", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parentTransform, false);
val.AddComponent<LayoutElement>().SetFlexible(1f);
return val;
}
public static float GetTextPreferredWidth(Text text)
{
return GetTextPreferredWidth(text, text.text);
}
public static float GetTextPreferredWidth(Text text, string value)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
TextGenerator value2 = CachedTextGenerator.Value;
Rect rect = ((Graphic)text).rectTransform.rect;
return value2.GetPreferredWidth(value, text.GetGenerationSettings(((Rect)(ref rect)).size));
}
public static Sprite CreateRoundedCornerSprite(int width, int height, int radius)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_00ad: 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_00b7: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
string text = $"RoundedCorner-{width}w-{height}h-{radius}r";
if (_spriteCache.TryGetValue(text, out var value))
{
return value;
}
Texture2D val = ObjectExtensions.SetName<Texture2D>(new Texture2D(width, height), text).SetWrapMode((TextureWrapMode)1).SetFilterMode((FilterMode)2);
Color32[] array = (Color32[])(object)new Color32[width * height];
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
array[i * width + j] = (IsCornerPixel(i, j, width, height, radius) ? ColorClear : ColorWhite);
}
}
val.SetPixels32(array);
val.Apply();
int k;
for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++)
{
}
int l;
for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++)
{
}
value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)).SetName<Sprite>(text);
_spriteCache[text] = value;
return value;
}
private static bool IsCornerPixel(int x, int y, int w, int h, int rad)
{
if (rad == 0)
{
return false;
}
int num = Math.Min(x, w - x);
int num2 = Math.Min(y, h - y);
if (num == 0 && num2 == 0)
{
return true;
}
if (num > rad || num2 > rad)
{
return false;
}
num = rad - num;
num2 = rad - num2;
return Math.Round(Math.Sqrt(num * num + num2 * num2)) > (double)rad;
}
public static Sprite CreateSuperellipse(int width, int height, float exponent)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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_0153: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: 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_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
string text = $"Superellipse-{width}w-{height}h-{exponent}e";
if (_spriteCache.TryGetValue(text, out var value))
{
return value;
}
Texture2D val = ObjectExtensions.SetName<Texture2D>(new Texture2D(width, height), text).SetWrapMode((TextureWrapMode)1).SetFilterMode((FilterMode)2);
Color32[] array = (Color32[])(object)new Color32[width * height];
int num = width / 2;
int num2 = height / 2;
float num3 = 1f * ((float)width / 2f);
float num4 = 1f * ((float)height / 2f);
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num2; j++)
{
Color32 val2 = Color32.op_Implicit((Mathf.Pow(Mathf.Abs((float)i / num3), exponent) + Mathf.Pow(Mathf.Abs((float)j / num4), exponent) > 1f) ? Color.clear : Color.white);
int x2 = i + num;
int x3 = -i + num - 1;
int y2 = -j + num2 - 1;
int y3 = j + num2;
array[XYToIndex(x2, y3)] = val2;
array[XYToIndex(x2, y2)] = val2;
array[XYToIndex(x3, y2)] = val2;
array[XYToIndex(x3, y3)] = val2;
}
}
val.SetPixels32(array);
val.Apply();
int k;
for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++)
{
}
int l;
for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++)
{
}
value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)).SetName<Sprite>(text);
_spriteCache[text] = value;
return value;
int XYToIndex(int x, int y)
{
return x + y * width;
}
}
}
public static class CanvasGroupExtensions
{
public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha)
{
canvasGroup.alpha = alpha;
return canvasGroup;
}
public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts)
{
canvasGroup.blocksRaycasts = blocksRaycasts;
return canvasGroup;
}
}
public static class ColorExtensions
{
public static Color SetAlpha(this Color color, float alpha)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
color.a = alpha;
return color;
}
}
public static class ContentSizeFitterExtensions
{
public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
fitter.horizontalFit = fitMode;
return fitter;
}
public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
fitter.verticalFit = fitMode;
return fitter;
}
}
public static class GridLayoutGroupExtensions
{
public static GridLayoutGroup SetCellSize(this GridLayoutGroup layoutGroup, Vector2 cellSize)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
layoutGroup.cellSize = cellSize;
return layoutGroup;
}
public static GridLayoutGroup SetConstraint(this GridLayoutGroup layoutGroup, Constraint constraint)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
layoutGroup.constraint = constraint;
return layoutGroup;
}
public static GridLayoutGroup SetConstraintCount(this GridLayoutGroup layoutGroup, int constraintCount)
{
layoutGroup.constraintCount = constraintCount;
return layoutGroup;
}
public static GridLayoutGroup SetStartAxis(this GridLayoutGroup layoutGroup, Axis startAxis)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
layoutGroup.startAxis = startAxis;
return layoutGroup;
}
public static GridLayoutGroup SetStartCorner(this GridLayoutGroup layoutGroup, Corner startCorner)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
layoutGroup.startCorner = startCorner;
return layoutGroup;
}
public static GridLayoutGroup SetSpacing(this GridLayoutGroup layoutGroup, Vector2 spacing)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
layoutGroup.spacing = spacing;
return layoutGroup;
}
}
public static class LayoutGroupExtensions
{
public static T SetChildAlignment<T>(this T layoutGroup, TextAnchor alignment) where T : LayoutGroup
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((LayoutGroup)layoutGroup).childAlignment = alignment;
return layoutGroup;
}
public static T SetChildControl<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
{
if (!width.HasValue && !height.HasValue)
{
throw new ArgumentException("Value for width or height must be provided.");
}
if (width.HasValue)
{
((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value;
}
if (height.HasValue)
{
((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height.Value;
}
return layoutGroup;
}
public static T SetChildForceExpand<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
{
if (!width.HasValue && !height.HasValue)
{
throw new ArgumentException("Value for width or height must be provided.");
}
if (width.HasValue)
{
((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width.Value;
}
if (height.HasValue)
{
((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height.Value;
}
return layoutGroup;
}
public static T SetPadding<T>(this T layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) where T : HorizontalOrVerticalLayoutGroup
{
if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue)
{
throw new ArgumentException("Value for left, right, top or bottom must be provided.");
}
if (left.HasValue)
{
((LayoutGroup)(object)layoutGroup).padding.left = left.Value;
}
if (right.HasValue)
{
((LayoutGroup)(object)layoutGroup).padding.right = right.Value;
}
if (top.HasValue)
{
((LayoutGroup)(object)layoutGroup).padding.top = top.Value;
}
if (bottom.HasValue)
{
((LayoutGroup)(object)layoutGroup).padding.bottom = bottom.Value;
}
return layoutGroup;
}
public static T SetSpacing<T>(this T layoutGroup, float spacing) where T : HorizontalOrVerticalLayoutGroup
{
((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing;
return layoutGroup;
}
}
public static class ImageExtensions
{
public static Image SetColor(this Image image, Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((Graphic)image).color = color;
return image;
}
public static Image SetFillAmount(this Image image, float amount)
{
image.fillAmount = amount;
return image;
}
public static Image SetFillCenter(this Image image, bool fillCenter)
{
image.fillCenter = fillCenter;
return image;
}
public static Image SetFillMethod(this Image image, FillMethod fillMethod)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
image.fillMethod = fillMethod;
return image;
}
public static Image SetFillOrigin(this Image image, OriginHorizontal origin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected I4, but got Unknown
image.fillOrigin = (int)origin;
return image;
}
public static Image SetFillOrigin(this Image image, OriginVertical origin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected I4, but got Unknown
image.fillOrigin = (int)origin;
return image;
}
public static Image SetMaskable(this Image image, bool maskable)
{
((MaskableGraphic)image).maskable = maskable;
return image;
}
public static Image SetMaterial(this Image image, Material material)
{
((Graphic)image).material = material;
return image;
}
public static Image SetPixelsPerUnitMultiplier(this Image image, float pixelsPerUnitMultiplier)
{
image.pixelsPerUnitMultiplier = pixelsPerUnitMultiplier;
return image;
}
public static Image SetPreserveAspect(this Image image, bool preserveAspect)
{
image.preserveAspect = preserveAspect;
return image;
}
public static Image SetRaycastTarget(this Image image, bool raycastTarget)
{
((Graphic)image).raycastTarget = raycastTarget;
return image;
}
public static Image SetSprite(this Image image, Sprite sprite)
{
image.sprite = sprite;
return image;
}
public static Image SetType(this Image image, Type type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
image.type = type;
return image;
}
}
public static class LayoutElementExtensions
{
public static LayoutElement SetFlexible(this LayoutElement layoutElement, float? width = null, float? height = null)
{
if (!width.HasValue && !height.HasValue)
{
throw new ArgumentException("Value for width or height must be provided.");
}
if (width.HasValue)
{
layoutElement.flexibleWidth = width.Value;
}
if (height.HasValue)
{
layoutElement.flexibleHeight = height.Value;
}
return layoutElement;
}
public static LayoutElement SetIgnoreLayout(this LayoutElement layoutElement, bool ignoreLayout)
{
layoutElement.ignoreLayout = ignoreLayout;
return layoutElement;
}
public static LayoutElement SetMinimum(this LayoutElement layoutElement, float? width = null, float? height = null)
{
if (!width.HasValue && !height.HasValue)
{
throw new ArgumentException("Value for width or height must be provided.");
}
if (width.HasValue)
{
layoutElement.minWidth = width.Value;
}
if (height.HasValue)
{
layoutElement.minHeight = height.Value;
}
return layoutElement;
}
public static LayoutElement SetPreferred(this LayoutElement layoutElement, float? width = null, float? height = null)
{
if (!width.HasValue && !height.HasValue)
{
throw new ArgumentException("Value for width or height must be provided.");
}
if (width.HasValue)
{
layoutElement.preferredWidth = width.Value;
}
if (height.HasValue)
{
layoutElement.preferredHeight = height.Value;
}
return layoutElement;
}
}
public static class RectMask2DExtensions
{
public static T SetPadding<T>(this T rectMask, Vector4 padding) where T : RectMask2D
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((RectMask2D)rectMask).padding = padding;
return rectMask;
}
public static T SetSoftness<T>(this T rectMask, Vector2Int softness) where T : RectMask2D
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((RectMask2D)rectMask).softness = softness;
return rectMask;
}
}
public static class RectTransformExtensions
{
public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchorMin = anchorMin;
return rectTransform;
}
public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchorMax = anchorMax;
return rectTransform;
}
public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
rectTransform.pivot = pivot;
return rectTransform;
}
public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
rectTransform.anchoredPosition = position;
return rectTransform;
}
public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
rectTransform.sizeDelta = sizeDelta;
return rectTransform;
}
}
public static class ScrollbarExtensions
{
public static T SetDirection<T>(this T scrollbar, Direction direction) where T : Scrollbar
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Scrollbar)scrollbar).direction = direction;
return scrollbar;
}
public static T SetHandleRect<T>(this T scrollbar, RectTransform handleRect) where T : Scrollbar
{
((Scrollbar)scrollbar).handleRect = handleRect;
return scrollbar;
}
}
public static class SelectableExtensions
{
public static T SetColors<T>(this T selectable, ColorBlock colors) where T : Selectable
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Selectable)selectable).colors = colors;
return selectable;
}
public static T SetImage<T>(this T selectable, Image image) where T : Selectable
{
((Selectable)selectable).image = image;
return selectable;
}
public static T SetInteractable<T>(this T selectable, bool interactable) where T : Selectable
{
((Selectable)selectable).interactable = interactable;
return selectable;
}
public static T SetSpriteState<T>(this T selectable, SpriteState spriteState) where T : Selectable
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Selectable)selectable).spriteState = spriteState;
return selectable;
}
public static T SetTargetGraphic<T>(this T selectable, Graphic graphic) where T : Selectable
{
((Selectable)selectable).targetGraphic = graphic;
return selectable;
}
public static T SetTransition<T>(this T selectable, Transition transition) where T : Selectable
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Selectable)selectable).transition = transition;
return selectable;
}
public static T SetNavigationMode<T>(this T selectable, Mode mode) where T : Selectable
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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)
Navigation navigation = ((Selectable)selectable).navigation;
((Navigation)(ref navigation)).mode = mode;
((Selectable)selectable).navigation = navigation;
return selectable;
}
}
public static class SliderExtensions
{
public static T SetDirection<T>(this T slider, Direction direction) where T : Slider
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Slider)slider).direction = direction;
return slider;
}
public static T SetFillRect<T>(this T slider, RectTransform fillRect) where T : Slider
{
((Slider)slider).fillRect = fillRect;
return slider;
}
public static T SetHandleRect<T>(this T slider, RectTransform handleRect) where T : Slider
{
((Slider)slider).handleRect = handleRect;
return slider;
}
public static T SetMaxValue<T>(this T slider, float maxValue) where T : Slider
{
((Slider)slider).maxValue = maxValue;
return slider;
}
public static T SetMinValue<T>(this T slider, float minValue) where T : Slider
{
((Slider)slider).minValue = minValue;
return slider;
}
public static T SetValue<T>(this T slider, float value) where T : Slider
{
((Slider)slider).value = value;
return slider;
}
public static T SetWholeNumbers<T>(this T slider, bool wholeNumbers) where T : Slider
{
((Slider)slider).wholeNumbers = wholeNumbers;
return slider;
}
}
public static class ScrollRectExtensions
{
public static T SetContent<T>(this T scrollRect, RectTransform content) where T : ScrollRect
{
((ScrollRect)scrollRect).content = content;
return scrollRect;
}
public static T SetHorizontal<T>(this T scrollRect, bool horizontal) where T : ScrollRect
{
((ScrollRect)scrollRect).horizontal = horizontal;
return scrollRect;
}
public static T SetMovementType<T>(this T scrollRect, MovementType movementType) where T : ScrollRect
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((ScrollRect)scrollRect).movementType = movementType;
return scrollRect;
}
public static T SetScrollSensitivity<T>(this T scrollRect, float sensitivity) where T : ScrollRect
{
((ScrollRect)scrollRect).scrollSensitivity = sensitivity;
return scrollRect;
}
public static T SetVertical<T>(this T scrollRect, bool vertical) where T : ScrollRect
{
((ScrollRect)scrollRect).vertical = vertical;
return scrollRect;
}
public static T SetVerticalScrollbar<T>(this T scrollRect, Scrollbar verticalScrollbar) where T : ScrollRect
{
((ScrollRect)scrollRect).verticalScrollbar = verticalScrollbar;
return scrollRect;
}
public static T SetVerticalScrollPosition<T>(this T scrollRect, float position) where T : ScrollRect
{
((ScrollRect)scrollRect).verticalNormalizedPosition = position;
return scrollRect;
}
public static T SetVerticalScrollbarVisibility<T>(this T scrollRect, ScrollbarVisibility visibility) where T : ScrollRect
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((ScrollRect)scrollRect).verticalScrollbarVisibility = visibility;
return scrollRect;
}
public static T SetViewport<T>(this T scrollRect, RectTransform viewport) where T : ScrollRect
{
((ScrollRect)scrollRect).viewport = viewport;
return scrollRect;
}
}
public static class TextMeshProExtensions
{
public static T SetAlignment<T>(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmpText).alignment = alignment;
return tmpText;
}
public static T SetCharacterSpacing<T>(this T tmpText, float characterSpacing) where T : TMP_Text
{
((TMP_Text)tmpText).characterSpacing = characterSpacing;
return tmpText;
}
public static T SetColor<T>(this T tmpText, Color color) where T : TMP_Text
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Graphic)(object)tmpText).color = color;
return tmpText;
}
public static T SetEnableAutoSizing<T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text
{
((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing;
return tmpText;
}
public static T SetFont<T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text
{
((TMP_Text)tmpText).font = font;
return tmpText;
}
public static T SetFontSize<T>(this T tmpText, float fontSize) where T : TMP_Text
{
((TMP_Text)tmpText).fontSize = fontSize;
return tmpText;
}
public static T SetFontMaterial<T>(this T tmpText, Material fontMaterial) where T : TMP_Text
{
((TMP_Text)tmpText).fontMaterial = fontMaterial;
return tmpText;
}
public static T SetLineSpacing<T>(this T tmpText, float lineSpacing) where T : TMP_Text
{
((TMP_Text)tmpText).lineSpacing = lineSpacing;
return tmpText;
}
public static T SetMargin<T>(this T tmpText, Vector4 margin) where T : TMP_Text
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmpText).margin = margin;
return tmpText;
}
public static T SetOverflowMode<T>(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmpText).overflowMode = overflowMode;
return tmpText;
}
public static T SetRichText<T>(this T tmpText, bool richText) where T : TMP_Text
{
((TMP_Text)tmpText).richText = richText;
return tmpText;
}
public static T SetTextWrappingMode<T>(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmpText).textWrappingMode = textWrappingMode;
return tmpText;
}
}
public static class Texture2DExtensions
{
public static Texture2D SetFilterMode(this Texture2D texture, FilterMode filterMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((Texture)texture).filterMode = filterMode;
return texture;
}
public static Texture2D SetWrapMode(this Texture2D texture, TextureWrapMode wrapMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((Texture)texture).wrapMode = wrapMode;
return texture;
}
}
public static class ToggleExtensions
{
public static T SetGraphic<T>(this T toggle, Graphic graphic) where T : Toggle
{
((Toggle)toggle).graphic = graphic;
return toggle;
}
public static T SetToggleTransition<T>(this T toggle, ToggleTransition toggleTransition) where T : Toggle
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
((Toggle)toggle).toggleTransition = toggleTransition;
return toggle;
}
}
public static class UIResources
{
public static readonly ResourceCache<Sprite> SpriteCache = new ResourceCache<Sprite>();
public static readonly ResourceCache<Material> MaterialCache = new ResourceCache<Material>();
public static Sprite GetSprite(string spriteName)
{
return SpriteCache.GetResource(spriteName);
}
public static Material GetMaterial(string materialName)
{
return MaterialCache.GetResource(materialName);
}
}
public sealed class ResourceCache<T> where T : Object
{
private readonly Dictionary<string, T> _cache = new Dictionary<string, T>();
public T GetResource(string resourceName)
{
if (!_cache.TryGetValue(resourceName, out var value))
{
value = Resources.FindObjectsOfTypeAll<T>().FirstByNameOrThrow(resourceName);
_cache[resourceName] = value;
}
return value;
}
}
public static class AssetUtils
{
public static readonly AssetCache<Shader> ShaderCache = new AssetCache<Shader>();
public static Shader StandardShader => ShaderCache.GetAsset("7e6bbee7a32b746cb9396cd890ce7189");
public static Shader DistortionShader => ShaderCache.GetAsset("31ecdd7109334474ab03326b6095f40b");
}
public sealed class AssetCache<T> where T : Object
{
private readonly Dictionary<string, T> _cache = new Dictionary<string, T>();
public T GetAsset(string assetId)
{
//IL_001c: 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)
AssetID val = default(AssetID);
if (!_cache.TryGetValue(assetId, out var value) && AssetID.TryParse(assetId, ref val))
{
SoftReference<T> val2 = default(SoftReference<T>);
val2..ctor(val);
val2.Load();
value = val2.Asset;
_cache[assetId] = value;
}
return value;
}
}
}