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 BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: Guid("D181CDA7-EF07-4BBC-B975-2B80FC6BBFAE")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyProduct("GnomingSystem")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("GnomingSystem")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
[Embedded]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
[Embedded]
[CompilerGenerated]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace GnomingSystem
{
public enum RadarCorner
{
TopLeft,
TopRight,
BottomLeft,
BottomRight
}
public static class Cfg
{
public static ConfigEntry<bool> MasterEnabled;
public static ConfigEntry<KeyboardShortcut> ToggleKey;
public static ConfigEntry<RadarCorner> Corner;
public static ConfigEntry<float> Margin;
public static ConfigEntry<float> RadiusPixels;
public static ConfigEntry<float> WorldRange;
public static ConfigEntry<float> Opacity;
public static ConfigEntry<bool> RotateWithCamera;
public static ConfigEntry<bool> ShowSweep;
public static ConfigEntry<bool> ShowDistanceRings;
public static ConfigEntry<bool> ShowCardinals;
public static ConfigEntry<bool> ShowElevation;
public static ConfigEntry<bool> ShowLabels;
public static ConfigEntry<string> BackdropColor;
public static ConfigEntry<string> RingColor;
public static ConfigEntry<string> SweepColor;
public static ConfigEntry<string> SelfColor;
public static ConfigEntry<bool> PlayersEnabled;
public static ConfigEntry<string> PlayersColor;
public static ConfigEntry<bool> PlayerNames;
public static ConfigEntry<bool> HighlightCaptured;
public static ConfigEntry<string> CapturedColor;
public static ConfigEntry<bool> GrandpaEnabled;
public static ConfigEntry<string> GrandpaColor;
public static ConfigEntry<bool> CatEnabled;
public static ConfigEntry<string> CatColor;
public static ConfigEntry<bool> LootEnabled;
public static ConfigEntry<string> LootColor;
public static ConfigEntry<bool> ExitEnabled;
public static ConfigEntry<string> ExitColor;
public static void Init(ConfigFile c)
{
//IL_002e: 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_00ed: Expected O, but got Unknown
MasterEnabled = c.Bind<bool>("General", "Enabled", true, "Master switch for the whole radar.");
ToggleKey = c.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)109, Array.Empty<KeyCode>()), "Key to show/hide the radar in a run.");
Corner = c.Bind<RadarCorner>("General", "Corner", RadarCorner.TopRight, "Screen corner the radar sits in.");
Margin = c.Bind<float>("General", "Margin", 28f, "Pixel gap from the screen edge.");
RadiusPixels = c.Bind<float>("General", "RadiusPixels", 96f, "Radar circle radius in pixels.");
WorldRange = c.Bind<float>("General", "WorldRange", 40f, "World distance mapped to the radar's edge.");
Opacity = c.Bind<float>("General", "Opacity", 0.9f, new ConfigDescription("Overall radar opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
RotateWithCamera = c.Bind<bool>("General", "RotateWithCamera", true, "If true the radar rotates so your facing points up; if false it's world-locked (north up).");
ShowSweep = c.Bind<bool>("Chrome", "Sweep", true, "Animated radar sweep line.");
ShowDistanceRings = c.Bind<bool>("Chrome", "DistanceRings", true, "Faint concentric range rings.");
ShowCardinals = c.Bind<bool>("Chrome", "Compass", true, "Compass ticks and a North marker.");
ShowElevation = c.Bind<bool>("Chrome", "ElevationMarkers", false, "Show up/down markers for targets on other floors.");
ShowLabels = c.Bind<bool>("Chrome", "Labels", false, "Master switch for text labels.");
BackdropColor = c.Bind<string>("Chrome", "BackdropColor", "#0A0E14", "Radar background color (hex).");
RingColor = c.Bind<string>("Chrome", "RingColor", "#CFF5E0", "Outer ring color (hex).");
SweepColor = c.Bind<string>("Chrome", "SweepColor", "#5FE08C", "Sweep color (hex).");
SelfColor = c.Bind<string>("Chrome", "SelfColor", "#FFFFFF", "Your own marker color (hex).");
PlayersEnabled = c.Bind<bool>("Players", "Enabled", true, "Show teammates. (On by default.)");
PlayersColor = c.Bind<string>("Players", "Color", "#5FE08C", "Teammate blip color (hex).");
PlayerNames = c.Bind<bool>("Players", "ShowNames", false, "Label teammate blips with their name (needs Chrome/Labels on).");
HighlightCaptured = c.Bind<bool>("Players", "HighlightCaptured", true, "Color captured gnomes differently and pulse them.");
CapturedColor = c.Bind<string>("Players", "CapturedColor", "#FF3B3B", "Captured teammate color (hex).");
GrandpaEnabled = c.Bind<bool>("Grandpa", "Enabled", false, "Show the old man. (Off by default.)");
GrandpaColor = c.Bind<string>("Grandpa", "Color", "#FF7A2B", "Grandpa blip color (hex).");
CatEnabled = c.Bind<bool>("Cat", "Enabled", false, "Show the cat. (Off by default.)");
CatColor = c.Bind<string>("Cat", "Color", "#FFD34D", "Cat blip color (hex).");
LootEnabled = c.Bind<bool>("Loot", "Enabled", false, "Show stealable items. (Off by default.)");
LootColor = c.Bind<string>("Loot", "Color", "#4BD6FF", "Loot blip color (hex).");
ExitEnabled = c.Bind<bool>("Exits", "Enabled", false, "Show exits / the deposit box. (Off by default.)");
ExitColor = c.Bind<string>("Exits", "Color", "#8FA8FF", "Exit blip color (hex).");
}
public static Color Col(ConfigEntry<string> e, Color fallback)
{
//IL_0012: 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)
Color val = default(Color);
return ColorUtility.TryParseHtmlString(e.Value, ref val) ? val : fallback;
}
}
public struct RadarTarget
{
public Vector3 Position;
public string Label;
public bool Captured;
public RadarTarget(Vector3 pos, string label = null, bool captured = false)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
Position = pos;
Label = label;
Captured = captured;
}
}
public static class GameScanners
{
private static Assembly _gameAsm;
private static bool _asmResolved;
private static Type _tPlayerNetworking;
private static Type _tHumanAILink;
private static Type _tGameProgressionManager;
private static Type _tServerManager;
private static readonly string[] CatTypeNames = new string[6] { "CatAILink", "CatAI", "CatController", "Cat", "CatEntity", "GameEntityAI" };
private static readonly string[] LootTypeNames = new string[8] { "StealableObject", "Stealable", "WorldStealable", "GrabbableItem", "ValuableObject", "LootObject", "WorldObject", "InteractableObject" };
private static readonly string[] ExitTypeNames = new string[8] { "DepositBox", "DepositPoint", "ExtractionPoint", "ExitPoint", "VortexExit", "GnomeDeposit", "DepositInteractable", "ExtractionZone" };
private static Type _tCat;
private static Type _tLoot;
private static Type _tExit;
private static bool _optionalResolved;
private static List<RadarTarget> _cachedLoot = new List<RadarTarget>();
private static float _nextLootScanTime = 0f;
private const float LootScanInterval = 1.5f;
private static void EnsureGameAsm()
{
if (_asmResolved)
{
return;
}
_asmResolved = true;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (assembly.GetName().Name == "Assembly-CSharp")
{
_gameAsm = assembly;
break;
}
}
if (!(_gameAsm == null))
{
_tPlayerNetworking = _gameAsm.GetType("PlayerNetworking");
_tHumanAILink = _gameAsm.GetType("HumanAILink");
_tGameProgressionManager = _gameAsm.GetType("GameProgressionManager");
_tServerManager = _gameAsm.GetType("ServerManager");
}
}
private static void EnsureOptionalTypes()
{
if (!_optionalResolved)
{
_optionalResolved = true;
EnsureGameAsm();
if (!(_gameAsm == null))
{
_tCat = ResolveFirst(CatTypeNames);
_tLoot = ResolveFirst(LootTypeNames);
_tExit = ResolveFirst(ExitTypeNames);
}
}
}
private static Type ResolveFirst(string[] names)
{
foreach (string name in names)
{
Type type = _gameAsm.GetType(name);
if (type != null && typeof(Component).IsAssignableFrom(type))
{
return type;
}
}
Type[] types = _gameAsm.GetTypes();
foreach (Type type2 in types)
{
foreach (string text in names)
{
if (type2.Name == text && typeof(Component).IsAssignableFrom(type2))
{
return type2;
}
}
}
return null;
}
private static object CallStatic(Type t, string method, params object[] args)
{
if (t == null)
{
return null;
}
MethodInfo method2 = t.GetMethod(method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (method2 == null)
{
return null;
}
try
{
return method2.Invoke(null, args);
}
catch
{
return null;
}
}
private static object GetStaticProp(Type t, string name)
{
if (t == null)
{
return null;
}
PropertyInfo property = t.GetProperty(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null)
{
try
{
return property.GetValue(null);
}
catch
{
}
}
FieldInfo field = t.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null)
{
try
{
return field.GetValue(null);
}
catch
{
}
}
return null;
}
private static bool IsLocalPlayerComponent(Component c)
{
if ((Object)(object)c == (Object)null)
{
return false;
}
NetworkObject component = c.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null && component.IsLocalPlayer)
{
return true;
}
try
{
PropertyInfo property = ((object)c).GetType().GetProperty("OwnerClientId", BindingFlags.Instance | BindingFlags.Public);
if (property != null && (Object)(object)NetworkManager.Singleton != (Object)null)
{
ulong num = (ulong)property.GetValue(c);
return num == NetworkManager.Singleton.LocalClientId;
}
}
catch
{
}
return false;
}
private static bool TryGetBool(object obj, params string[] names)
{
if (obj == null)
{
return false;
}
Type type = obj.GetType();
foreach (string name in names)
{
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null && property.PropertyType == typeof(bool))
{
try
{
return (bool)property.GetValue(obj);
}
catch
{
}
}
FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null && field.FieldType == typeof(bool))
{
try
{
return (bool)field.GetValue(obj);
}
catch
{
}
}
}
return false;
}
private static bool HasAnyBool(object obj, params string[] names)
{
if (obj == null)
{
return false;
}
Type type = obj.GetType();
foreach (string name in names)
{
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (property != null && property.PropertyType == typeof(bool))
{
return true;
}
FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field != null && field.FieldType == typeof(bool))
{
return true;
}
}
return false;
}
private static string TryGetName(object obj)
{
if (obj == null)
{
return null;
}
Type type = obj.GetType();
string[] array = new string[4] { "DisplayName", "PlayerName", "Name", "name" };
foreach (string name in array)
{
PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (!(property != null) || !(property.PropertyType == typeof(string)))
{
continue;
}
try
{
string text = (string)property.GetValue(obj);
if (!string.IsNullOrEmpty(text))
{
return text;
}
}
catch
{
}
}
Component val = (Component)((obj is Component) ? obj : null);
if (val != null)
{
return ((Object)val.gameObject).name;
}
return null;
}
public static bool TryGetLocalPlayer(out Vector3 position, out float yawDegrees)
{
//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)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
position = Vector3.zero;
yawDegrees = 0f;
EnsureGameAsm();
try
{
object obj = CallStatic(_tServerManager, "GetLocalPlayer");
Component val = (Component)((obj is Component) ? obj : null);
if ((Object)(object)val != (Object)null)
{
position = val.transform.position;
yawDegrees = val.transform.eulerAngles.y;
return true;
}
}
catch
{
}
try
{
object staticProp = GetStaticProp(_tGameProgressionManager, "AllPlayers");
if (staticProp is IEnumerable enumerable)
{
foreach (object item in enumerable)
{
Component val2 = (Component)((item is Component) ? item : null);
if ((Object)(object)val2 == (Object)null || !IsLocalPlayerComponent(val2))
{
continue;
}
position = val2.transform.position;
yawDegrees = val2.transform.eulerAngles.y;
return true;
}
}
}
catch
{
}
try
{
if (_tPlayerNetworking != null)
{
Object[] array = Object.FindObjectsByType(_tPlayerNetworking, (FindObjectsSortMode)0);
Object[] array2 = array;
foreach (Object val3 in array2)
{
Component val4 = (Component)(object)((val3 is Component) ? val3 : null);
if (!((Object)(object)val4 == (Object)null) && IsLocalPlayerComponent(val4))
{
position = val4.transform.position;
yawDegrees = val4.transform.eulerAngles.y;
return true;
}
}
}
}
catch
{
}
return false;
}
public static List<RadarTarget> ScanPlayers()
{
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
List<RadarTarget> list = new List<RadarTarget>();
EnsureGameAsm();
try
{
Component val = null;
try
{
object obj = CallStatic(_tServerManager, "GetLocalPlayer");
val = (Component)((obj is Component) ? obj : null);
}
catch
{
}
IEnumerable enumerable = null;
object staticProp = GetStaticProp(_tGameProgressionManager, "AllPlayers");
if (staticProp is IEnumerable enumerable2)
{
enumerable = enumerable2;
}
if (enumerable == null && _tPlayerNetworking != null)
{
enumerable = Object.FindObjectsByType(_tPlayerNetworking, (FindObjectsSortMode)0);
}
if (enumerable == null)
{
return list;
}
foreach (object item in enumerable)
{
Component val2 = (Component)((item is Component) ? item : null);
if (!((Object)(object)val2 == (Object)null) && (!((Object)(object)val != (Object)null) || val2 != val) && !IsLocalPlayerComponent(val2))
{
bool captured = TryGetBool(val2, "IsTied", "IsGrabbed", "IsLockedUp", "IsCaptured", "Tied", "Grabbed", "LockedUp", "Captured", "isTied", "isGrabbed", "isLockedUp");
string label = TryGetName(val2);
list.Add(new RadarTarget(val2.transform.position, label, captured));
}
}
}
catch (Exception ex)
{
if ((Object)(object)Plugin.Instance != (Object)null)
{
Plugin.Instance.Logger.LogWarning((object)("[Radar] ScanPlayers: " + ex.Message));
}
}
return list;
}
public static List<RadarTarget> ScanGrandpa()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
List<RadarTarget> list = new List<RadarTarget>();
EnsureGameAsm();
try
{
if (_tHumanAILink != null)
{
Object[] array = Object.FindObjectsByType(_tHumanAILink, (FindObjectsSortMode)0);
Object[] array2 = array;
foreach (Object val in array2)
{
Component val2 = (Component)(object)((val is Component) ? val : null);
if ((Object)(object)val2 != (Object)null)
{
list.Add(new RadarTarget(val2.transform.position, "Grandpa"));
}
}
}
}
catch (Exception ex)
{
if ((Object)(object)Plugin.Instance != (Object)null)
{
Plugin.Instance.Logger.LogWarning((object)("[Radar] ScanGrandpa: " + ex.Message));
}
}
return list;
}
public static List<RadarTarget> ScanCat()
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
List<RadarTarget> list = new List<RadarTarget>();
EnsureOptionalTypes();
try
{
if (_tCat != null)
{
Object[] array = Object.FindObjectsByType(_tCat, (FindObjectsSortMode)0);
Object[] array2 = array;
foreach (Object val in array2)
{
Component val2 = (Component)(object)((val is Component) ? val : null);
if ((Object)(object)val2 == (Object)null)
{
continue;
}
if (_tCat.Name == "GameEntityAI")
{
string name = ((Object)val2.gameObject).name;
if (name == null || name.IndexOf("Cat", StringComparison.OrdinalIgnoreCase) < 0)
{
continue;
}
}
list.Add(new RadarTarget(val2.transform.position, "Cat"));
}
}
}
catch (Exception ex)
{
if ((Object)(object)Plugin.Instance != (Object)null)
{
Plugin.Instance.Logger.LogWarning((object)("[Radar] ScanCat: " + ex.Message));
}
}
return list;
}
public static List<RadarTarget> ScanLoot()
{
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
if (Time.time < _nextLootScanTime)
{
return _cachedLoot;
}
_nextLootScanTime = Time.time + 1.5f;
_cachedLoot.Clear();
EnsureOptionalTypes();
try
{
if (_tLoot != null)
{
Object[] array = Object.FindObjectsByType(_tLoot, (FindObjectsSortMode)0);
Object[] array2 = array;
foreach (Object val in array2)
{
Component val2 = (Component)(object)((val is Component) ? val : null);
if (!((Object)(object)val2 == (Object)null))
{
bool flag = true;
if (HasAnyBool(val2, "IsStealable", "IsValuable", "CanSteal", "Stealable"))
{
flag = TryGetBool(val2, "IsStealable", "IsValuable", "CanSteal", "Stealable");
}
if (TryGetBool(val2, "IsCarried", "InInventory", "IsHeld", "IsPickedUp"))
{
flag = false;
}
if (flag)
{
string label = TryGetName(val2);
_cachedLoot.Add(new RadarTarget(val2.transform.position, label));
}
}
}
}
}
catch (Exception ex)
{
if ((Object)(object)Plugin.Instance != (Object)null)
{
Plugin.Instance.Logger.LogWarning((object)("[Radar] ScanLoot: " + ex.Message));
}
}
return _cachedLoot;
}
public static List<RadarTarget> ScanExits()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
List<RadarTarget> list = new List<RadarTarget>();
EnsureOptionalTypes();
try
{
if (_tExit != null)
{
Object[] array = Object.FindObjectsByType(_tExit, (FindObjectsSortMode)0);
Object[] array2 = array;
foreach (Object val in array2)
{
Component val2 = (Component)(object)((val is Component) ? val : null);
if ((Object)(object)val2 != (Object)null)
{
list.Add(new RadarTarget(val2.transform.position, "Deposit"));
}
}
}
}
catch (Exception ex)
{
if ((Object)(object)Plugin.Instance != (Object)null)
{
Plugin.Instance.Logger.LogWarning((object)("[Radar] ScanExits: " + ex.Message));
}
}
return list;
}
}
[BepInPlugin("com.odinplus.gnomingsystem", "GnomingSystem", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance { get; private set; }
public ManualLogSource Logger => ((BaseUnityPlugin)this).Logger;
private void Awake()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
Instance = this;
Cfg.Init(((BaseUnityPlugin)this).Config);
GameObject val = new GameObject("GnomingSystemManager");
val.AddComponent<RadarHud>();
Object.DontDestroyOnLoad((Object)(object)val);
((BaseUnityPlugin)this).Logger.LogInfo((object)"GnomingSystem (Gnome Positioning System) loaded.");
}
}
internal class RadarLayer
{
public string Name;
public Func<bool> Enabled;
public Func<Color> Color;
public Func<List<RadarTarget>> Scan;
public bool IsPlayers;
public bool HideOffRange;
}
public class RadarHud : MonoBehaviour
{
private static readonly Color DefGreen = new Color(0.37f, 0.88f, 0.55f);
private static readonly Color DefAmber = new Color(1f, 0.48f, 0.17f);
private static readonly Color DefYellow = new Color(1f, 0.83f, 0.3f);
private static readonly Color DefCyan = new Color(0.29f, 0.84f, 1f);
private static readonly Color DefBlue = new Color(0.56f, 0.66f, 1f);
private static readonly Color DefRed = new Color(1f, 0.23f, 0.23f);
private List<RadarLayer> _layers;
private bool _visible = true;
private GUIStyle _label;
private GUIStyle _north;
private void Start()
{
_layers = new List<RadarLayer>
{
new RadarLayer
{
Name = "Players",
IsPlayers = true,
Enabled = () => Cfg.PlayersEnabled.Value,
Color = () => Cfg.Col(Cfg.PlayersColor, DefGreen),
Scan = GameScanners.ScanPlayers
},
new RadarLayer
{
Name = "Grandpa",
Enabled = () => Cfg.GrandpaEnabled.Value,
Color = () => Cfg.Col(Cfg.GrandpaColor, DefAmber),
Scan = GameScanners.ScanGrandpa
},
new RadarLayer
{
Name = "Cat",
Enabled = () => Cfg.CatEnabled.Value,
Color = () => Cfg.Col(Cfg.CatColor, DefYellow),
Scan = GameScanners.ScanCat
},
new RadarLayer
{
Name = "Loot",
HideOffRange = true,
Enabled = () => Cfg.LootEnabled.Value,
Color = () => Cfg.Col(Cfg.LootColor, DefCyan),
Scan = GameScanners.ScanLoot
},
new RadarLayer
{
Name = "Exits",
Enabled = () => Cfg.ExitEnabled.Value,
Color = () => Cfg.Col(Cfg.ExitColor, DefBlue),
Scan = GameScanners.ScanExits
}
};
}
private void Update()
{
//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)
KeyboardShortcut value = Cfg.ToggleKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
_visible = !_visible;
}
}
private void OnGUI()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_0074: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_00da: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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_0199: 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_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_040c: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03be: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: 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_0440: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_052a: 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_0559: Unknown result type (might be due to invalid IL or missing references)
//IL_0560: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0502: Unknown result type (might be due to invalid IL or missing references)
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0512: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Unknown result type (might be due to invalid IL or missing references)
//IL_0590: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059e: Unknown result type (might be due to invalid IL or missing references)
//IL_0601: Unknown result type (might be due to invalid IL or missing references)
//IL_0604: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Unknown result type (might be due to invalid IL or missing references)
//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
if (!Cfg.MasterEnabled.Value || !_visible)
{
return;
}
RadarTextures.EnsureBuilt();
EnsureStyles();
float value = Cfg.RadiusPixels.Value;
float value2 = Cfg.Opacity.Value;
Vector2 val = ComputeCenter(value);
DrawTex(RadarTextures.Backdrop, Square(val, value), WithA(Cfg.Col(Cfg.BackdropColor, new Color(0.04f, 0.055f, 0.08f)), value2));
if (Cfg.ShowDistanceRings.Value)
{
Color col = WithA(Cfg.Col(Cfg.RingColor, Color.white), 0.14f * value2);
DrawTex(RadarTextures.ThinRing, Square(val, value * 0.66f), col);
DrawTex(RadarTextures.ThinRing, Square(val, value * 0.33f), col);
}
Vector3 position;
float yawDegrees;
bool flag = GameScanners.TryGetLocalPlayer(out position, out yawDegrees);
if (!flag && (Object)(object)Camera.main != (Object)null)
{
position = ((Component)Camera.main).transform.position;
yawDegrees = ((Component)Camera.main).transform.eulerAngles.y;
flag = true;
}
if (Cfg.ShowSweep.Value)
{
float angle = Time.time * 75f % 360f;
DrawTexRot(RadarTextures.Sweep, Square(val, value), WithA(Cfg.Col(Cfg.SweepColor, DefGreen), value2), angle, val);
}
DrawTex(RadarTextures.Ring, Square(val, value), WithA(Cfg.Col(Cfg.RingColor, Color.white), value2));
if (Cfg.ShowCardinals.Value)
{
DrawCompass(val, value, yawDegrees, value2);
}
float angle2 = (Cfg.RotateWithCamera.Value ? 0f : yawDegrees);
DrawTexRot(RadarTextures.Chevron, CenteredRect(val, 15f), WithA(Cfg.Col(Cfg.SelfColor, Color.white), value2), angle2, val);
if (!flag)
{
return;
}
float num = value / Mathf.Max(1f, Cfg.WorldRange.Value);
float num2 = 1f + 0.12f * Mathf.Sin(Time.time * 4f);
float num3 = 1f + 0.28f * Mathf.Sin(Time.time * 7f);
Vector2 val6 = default(Vector2);
Vector2 val8 = default(Vector2);
foreach (RadarLayer layer in _layers)
{
if (!layer.Enabled())
{
continue;
}
Color val2 = layer.Color();
foreach (RadarTarget item in layer.Scan())
{
bool flag2 = layer.IsPlayers && item.Captured && Cfg.HighlightCaptured.Value;
Color val3 = (flag2 ? Cfg.Col(Cfg.CapturedColor, DefRed) : val2);
Vector3 val4 = item.Position - position;
float num4 = (Cfg.RotateWithCamera.Value ? yawDegrees : 0f) * ((float)Math.PI / 180f);
float num5 = Mathf.Sin(num4);
float num6 = Mathf.Cos(num4);
float num7 = val4.x * num6 - val4.z * num5;
float num8 = val4.x * num5 + val4.z * num6;
Vector2 val5 = new Vector2(num7, num8) * num;
bool flag3 = ((Vector2)(ref val5)).magnitude > value;
if (flag3)
{
if (layer.HideOffRange)
{
continue;
}
val5 = ((Vector2)(ref val5)).normalized * value;
}
((Vector2)(ref val6))..ctor(val.x + val5.x, val.y - val5.y);
if (flag3)
{
Vector2 val7 = val6 - val;
Vector2 normalized = ((Vector2)(ref val7)).normalized;
float angle3 = Mathf.Atan2(normalized.x, 0f - normalized.y) * 57.29578f;
DrawTexRot(RadarTextures.Chevron, CenteredRect(val6, flag2 ? 15f : 12f), WithA(val3, value2), angle3, val6);
continue;
}
float num9 = 7f;
if (layer.Name == "Loot")
{
float size = 8f;
DrawTex(RadarTextures.SquareBlip, CenteredRect(val6, size), WithA(val3, value2));
}
else
{
float num10 = (flag2 ? num3 : num2);
float size2 = (flag2 ? 26f : 20f) * num10;
num9 = (flag2 ? 9f : 7f);
DrawTex(RadarTextures.GlowDot, CenteredRect(val6, size2), WithA(val3, 0.55f * value2));
DrawTex(RadarTextures.CoreDot, CenteredRect(val6, num9), WithA(Color.Lerp(val3, Color.white, 0.35f), value2));
}
if (Cfg.ShowElevation.Value && Mathf.Abs(val4.y) > 1.5f)
{
bool flag4 = val4.y > 0f;
((Vector2)(ref val8))..ctor(val6.x, val6.y + (flag4 ? (0f - num9 - 6f) : (num9 + 6f)));
DrawTexRot(RadarTextures.Chevron, CenteredRect(val8, 9f), WithA(val3, 0.9f * value2), flag4 ? 0f : 180f, val8);
}
if (Cfg.ShowLabels.Value && layer.IsPlayers && Cfg.PlayerNames.Value && !string.IsNullOrEmpty(item.Label))
{
_label.normal.textColor = WithA(val3, value2);
GUI.Label(new Rect(val6.x + 8f, val6.y - 9f, 120f, 18f), item.Label, _label);
}
}
}
}
private void DrawCompass(Vector2 center, float radius, float yaw, float op)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
float num = (Cfg.RotateWithCamera.Value ? (0f - yaw) : 0f);
Color col = WithA(Cfg.Col(Cfg.RingColor, Color.white), 0.5f * op);
for (int i = 0; i < 4; i++)
{
float angle = num + (float)i * 90f;
DrawTexRot(RadarTextures.Tick, new Rect(center.x - 4f, center.y - radius, 8f, 12f), col, angle, center);
}
Vector2 val = Rotate(new Vector2(0f, -1f), num);
Vector2 val2 = center + val * (radius - 15f);
_north.normal.textColor = WithA(Cfg.Col(Cfg.RingColor, Color.white), op);
GUI.Label(new Rect(val2.x - 8f, val2.y - 9f, 16f, 18f), "N", _north);
}
private Vector2 ComputeCenter(float r)
{
//IL_0037: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_0085: Unknown result type (might be due to invalid IL or missing references)
float value = Cfg.Margin.Value;
return (Vector2)(Cfg.Corner.Value switch
{
RadarCorner.TopLeft => new Vector2(r + value, r + value),
RadarCorner.BottomLeft => new Vector2(r + value, (float)Screen.height - r - value),
RadarCorner.BottomRight => new Vector2((float)Screen.width - r - value, (float)Screen.height - r - value),
_ => new Vector2((float)Screen.width - r - value, r + value),
});
}
private static Rect Square(Vector2 c, float r)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
return new Rect(c.x - r, c.y - r, r * 2f, r * 2f);
}
private static Rect CenteredRect(Vector2 c, float size)
{
//IL_0000: 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_001e: Unknown result type (might be due to invalid IL or missing references)
return new Rect(c.x - size / 2f, c.y - size / 2f, size, size);
}
private static Color WithA(Color c, float a)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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 Color(c.r, c.g, c.b, a);
}
private static Vector2 Rotate(Vector2 v, float deg)
{
//IL_0017: 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_0028: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
float num = deg * ((float)Math.PI / 180f);
float num2 = Mathf.Cos(num);
float num3 = Mathf.Sin(num);
return new Vector2(v.x * num2 - v.y * num3, v.x * num3 + v.y * num2);
}
private static void DrawTex(Texture2D tex, Rect rect, Color col)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_0018: Unknown result type (might be due to invalid IL or missing references)
Color color = GUI.color;
GUI.color = col;
GUI.DrawTexture(rect, (Texture)(object)tex, (ScaleMode)0, true);
GUI.color = color;
}
private static void DrawTexRot(Texture2D tex, Rect rect, Color col, float angle, Vector2 pivot)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
Matrix4x4 matrix = GUI.matrix;
GUIUtility.RotateAroundPivot(angle, pivot);
DrawTex(tex, rect, col);
GUI.matrix = matrix;
}
private void EnsureStyles()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
if (_label == null)
{
_label = new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)3
};
_north = new GUIStyle(GUI.skin.label)
{
fontSize = 13,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
}
}
}
public static class RadarTextures
{
public static Texture2D Backdrop;
public static Texture2D Ring;
public static Texture2D ThinRing;
public static Texture2D GlowDot;
public static Texture2D CoreDot;
public static Texture2D Chevron;
public static Texture2D Tick;
public static Texture2D Sweep;
public static Texture2D SquareBlip;
private static bool _built;
public static void EnsureBuilt()
{
if (!_built)
{
_built = true;
Backdrop = BuildBackdrop(256);
Ring = BuildRing(256, 1f, 0.955f);
ThinRing = BuildRing(256, 1f, 0.985f);
GlowDot = BuildGlow(64, 2.2f);
CoreDot = BuildDisc(28);
Chevron = BuildChevron(48);
Tick = BuildTick(32);
Sweep = BuildSweep(256, 78f);
SquareBlip = BuildSquare(28);
}
}
private static float Cover(float signedInside)
{
return Mathf.Clamp01(signedInside + 0.5f);
}
private static Texture2D New(int s)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
return new Texture2D(s, s, (TextureFormat)4, false)
{
filterMode = (FilterMode)1,
wrapMode = (TextureWrapMode)1
};
}
private static Texture2D BuildDisc(int s)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
float num = (float)s / 2f - 1f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)s / 2f, (float)s / 2f);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), val2);
val.SetPixel(j, i, new Color(1f, 1f, 1f, Cover(num - num2)));
}
}
val.Apply();
return val;
}
private static Texture2D BuildGlow(int s, float falloff)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
float num = (float)s / 2f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)s / 2f, (float)s / 2f);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), val2);
float num3 = Mathf.Pow(Mathf.Clamp01(1f - num2 / num), falloff);
val.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
}
}
val.Apply();
return val;
}
private static Texture2D BuildRing(int s, float outerFrac, float innerFrac)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
float num = (float)s / 2f - 1f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)s / 2f, (float)s / 2f);
float num2 = num * outerFrac;
float num3 = num * innerFrac;
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
float num4 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), val2);
float num5 = Mathf.Min(Cover(num2 - num4), Cover(num4 - num3));
val.SetPixel(j, i, new Color(1f, 1f, 1f, num5));
}
}
val.Apply();
return val;
}
private static Texture2D BuildBackdrop(int s)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
float num = (float)s / 2f - 1f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)s / 2f, (float)s / 2f);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
float num2 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), val2);
float num3 = Cover(num - num2);
float num4 = Mathf.Lerp(0.78f, 1f, 1f - Mathf.Clamp01(num2 / num));
val.SetPixel(j, i, new Color(1f, 1f, 1f, num3 * num4));
}
}
val.Apply();
return val;
}
private static Texture2D BuildChevron(int s)
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
Vector2 a = default(Vector2);
((Vector2)(ref a))..ctor(0.5f * (float)s, 0.9f * (float)s);
Vector2 b = default(Vector2);
((Vector2)(ref b))..ctor(0.16f * (float)s, 0.12f * (float)s);
Vector2 c = default(Vector2);
((Vector2)(ref c))..ctor(0.84f * (float)s, 0.12f * (float)s);
Vector2 p = default(Vector2);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
float num = 0f;
for (int k = 0; k < 2; k++)
{
for (int l = 0; l < 2; l++)
{
((Vector2)(ref p))..ctor((float)j + 0.25f + (float)l * 0.5f, (float)i + 0.25f + (float)k * 0.5f);
if (InTriangle(p, a, b, c))
{
num += 0.25f;
}
}
}
val.SetPixel(j, i, new Color(1f, 1f, 1f, num));
}
}
val.Apply();
return val;
}
private static Texture2D BuildTick(int s)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
bool flag = (float)j >= (float)s * 0.42f && (float)j <= (float)s * 0.58f;
bool flag2 = (float)i >= (float)s * 0.55f && (float)i <= (float)s * 0.95f;
val.SetPixel(j, i, new Color(1f, 1f, 1f, (flag && flag2) ? 1f : 0f));
}
}
val.Apply();
return val;
}
private static Texture2D BuildSweep(int s, float arcDeg)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_0131: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
float num = (float)s / 2f - 1f;
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)s / 2f, (float)s / 2f);
Vector2 val3 = default(Vector2);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
((Vector2)(ref val3))..ctor((float)j + 0.5f, (float)i + 0.5f);
float num2 = Vector2.Distance(val3, val2);
if (num2 > num)
{
val.SetPixel(j, i, Color.clear);
continue;
}
float num3 = Mathf.Atan2(val3.y - val2.y, val3.x - val2.x) * 57.29578f;
if (num3 < 0f)
{
num3 += 360f;
}
float num4 = (360f - num3) % 360f;
float num5 = ((num4 <= arcDeg) ? Mathf.Pow(1f - num4 / arcDeg, 1.5f) : 0f);
float num6 = Mathf.Lerp(0.2f, 1f, num2 / num);
val.SetPixel(j, i, new Color(1f, 1f, 1f, num5 * num6 * 0.5f * Cover(num - num2)));
}
}
val.Apply();
return val;
}
private static bool InTriangle(Vector2 p, Vector2 a, Vector2 b, Vector2 c)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: 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_000b: 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_0013: 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_0015: Unknown result type (might be due to invalid IL or missing references)
float num = Sign(p, a, b);
float num2 = Sign(p, b, c);
float num3 = Sign(p, c, a);
bool flag = num < 0f || num2 < 0f || num3 < 0f;
bool flag2 = num > 0f || num2 > 0f || num3 > 0f;
return !(flag && flag2);
}
private static float Sign(Vector2 p1, Vector2 p2, Vector2 p3)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0021: 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_002e: Unknown result type (might be due to invalid IL or missing references)
return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
}
private static Texture2D BuildSquare(int s)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = New(s);
for (int i = 0; i < s; i++)
{
for (int j = 0; j < s; j++)
{
val.SetPixel(j, i, Color.white);
}
}
val.Apply();
return val;
}
}
}