using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("my.pahsiv.MySilentBlast")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("my.pahsiv.MySilentBlast")]
[assembly: AssemblyTitle("MySilentBlast")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace MySilentBlast
{
public class DynamiteWarningIndicator : MonoBehaviour
{
private GameObject _sphereObject;
private MeshRenderer _meshRenderer;
private List<LineRenderer> _lineRenderers = new List<LineRenderer>();
private MaterialPropertyBlock _propertyBlock;
private float _fuseTime;
private float _startingFuseTime;
private GameObject _uiIndicator;
public void Initialize(float startingFuseTime)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
_startingFuseTime = startingFuseTime;
_fuseTime = startingFuseTime;
if (Plugin.SCREENSPACEUI.Value)
{
CreateUIIndicator();
}
if (Plugin.MODE.Value == Plugin.Mode.Wireframe)
{
CreateSphere();
UpdateColor();
}
else
{
_propertyBlock = new MaterialPropertyBlock();
CreateSphere();
}
}
private void CreateSphere()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
float value = Plugin.EXPLOSION_RADIUS.Value;
if (Plugin.MODE.Value == Plugin.Mode.Wireframe)
{
_sphereObject = new GameObject("DynamiteWarningIndicator_Sphere");
_sphereObject.transform.position = ((Component)this).transform.position;
GenerateSphereLines();
return;
}
_sphereObject = new GameObject("DynamiteWarningIndicator_Sphere");
_sphereObject.transform.position = ((Component)this).transform.position;
MeshFilter val = _sphereObject.AddComponent<MeshFilter>();
val.mesh = TransparentSphereGenerator.GenerateTransparentSphere(value);
_meshRenderer = _sphereObject.AddComponent<MeshRenderer>();
((Renderer)_meshRenderer).material = CreateTransparentMaterial();
((Renderer)_meshRenderer).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)_meshRenderer).receiveShadows = false;
((Renderer)_meshRenderer).material.SetColor("_Color", Color.green);
UpdateColor();
}
private Material CreateTransparentMaterial()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
float value = Plugin.ALPHA.Value;
Material val = new Material(Shader.Find("Sprites/Default"));
val.color = new Color(0f, 1f, 0f, value);
return val;
}
private void GenerateSphereLines()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
int value = Plugin.SEGMENTS.Value;
float value2 = Plugin.EXPLOSION_RADIUS.Value;
int num = value / 2;
for (int i = 0; i < num; i++)
{
float num2 = value2 * Mathf.Cos(MathF.PI * (float)i / (float)(num - 1));
float num3 = value2 * Mathf.Sin(MathF.PI * (float)i / (float)(num - 1));
List<Vector3> list = new List<Vector3>();
for (int j = 0; j <= value; j++)
{
float num4 = MathF.PI * 2f * (float)j / (float)value;
float num5 = num3 * Mathf.Cos(num4);
float num6 = num3 * Mathf.Sin(num4);
list.Add(new Vector3(num5, num2, num6));
}
CreateLineRenderer(list);
}
for (int k = 0; k < value / 2; k++)
{
float num7 = MathF.PI * 2f * (float)k / (float)(value / 2);
List<Vector3> list2 = new List<Vector3>();
for (int l = 0; l <= value; l++)
{
float num8 = MathF.PI * (float)l / (float)value;
float num9 = value2 * Mathf.Sin(num8) * Mathf.Cos(num7);
float num10 = value2 * Mathf.Cos(num8);
float num11 = value2 * Mathf.Sin(num8) * Mathf.Sin(num7);
list2.Add(new Vector3(num9, num10, num11));
}
CreateLineRenderer(list2);
}
}
private LineRenderer CreateLineRenderer(List<Vector3> points)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
float value = Plugin.LINE_WIDTH.Value;
GameObject val = new GameObject("SphereLineRenderer");
val.transform.SetParent(_sphereObject.transform);
val.transform.localPosition = Vector3.zero;
LineRenderer val2 = val.AddComponent<LineRenderer>();
((Renderer)val2).material = CreateLineRendererMaterial();
val2.startWidth = value;
val2.endWidth = value;
((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)val2).receiveShadows = false;
val2.useWorldSpace = false;
val2.positionCount = points.Count;
val2.SetPositions(points.ToArray());
_lineRenderers.Add(val2);
return val2;
}
private Material CreateLineRendererMaterial()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
return new Material(Shader.Find("Sprites/Default"));
}
public void UpdateFuse(float fuseTime)
{
//IL_0023: 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_003d: Unknown result type (might be due to invalid IL or missing references)
float value = Plugin.MAX_DISPLAY_DISTANCE.Value;
_fuseTime = fuseTime;
_sphereObject.transform.position = ((Component)this).transform.position;
float num = Vector3.Distance(((Component)this).transform.position, Character.localCharacter.Center);
bool flag = num <= value;
_sphereObject.SetActive(flag);
if (flag)
{
UpdateColor();
}
}
private void UpdateColor()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
float value = Plugin.ALPHA.Value;
float num = Mathf.Clamp01(_fuseTime / _startingFuseTime);
Color val = Color.Lerp(Color.red, Color.green, num);
val.a = value;
if (Plugin.MODE.Value == Plugin.Mode.Wireframe)
{
foreach (LineRenderer lineRenderer in _lineRenderers)
{
lineRenderer.startColor = val;
lineRenderer.endColor = val;
}
return;
}
((Renderer)_meshRenderer).GetPropertyBlock(_propertyBlock);
_propertyBlock.SetColor("_Color", val);
((Renderer)_meshRenderer).SetPropertyBlock(_propertyBlock);
}
private void CreateUIIndicator()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
_uiIndicator = new GameObject("DynamiteUIIndicator");
Canvas val = _uiIndicator.AddComponent<Canvas>();
val.renderMode = (RenderMode)0;
val.sortingOrder = 9999;
CanvasScaler val2 = _uiIndicator.AddComponent<CanvasScaler>();
val2.uiScaleMode = (ScaleMode)1;
val2.referenceResolution = new Vector2(1920f, 1080f);
_uiIndicator.AddComponent<GraphicRaycaster>();
GameObject val3 = new GameObject("DynamiteIcon");
val3.transform.SetParent(_uiIndicator.transform);
Image val4 = val3.AddComponent<Image>();
Texture2D dynamiteTexture = GetDynamiteTexture();
val4.sprite = Sprite.Create(dynamiteTexture, new Rect(0f, 0f, (float)((Texture)dynamiteTexture).width, (float)((Texture)dynamiteTexture).height), Vector2.one * 0.5f);
RectTransform component = val3.GetComponent<RectTransform>();
component.sizeDelta = new Vector2(64f, 64f);
ScreenSpaceIndicator screenSpaceIndicator = val3.AddComponent<ScreenSpaceIndicator>();
screenSpaceIndicator.dynamite = ((Component)this).GetComponent<Dynamite>();
}
public Texture2D GetDynamiteTexture()
{
return Plugin.UIIndicator;
}
public void DestroyIndicator()
{
if ((Object)(object)_sphereObject != (Object)null)
{
Object.Destroy((Object)(object)_sphereObject);
}
if ((Object)(object)_uiIndicator != (Object)null)
{
Object.Destroy((Object)(object)_uiIndicator);
}
Object.Destroy((Object)(object)this);
}
private void OnDestroy()
{
if ((Object)(object)_sphereObject != (Object)null)
{
Object.Destroy((Object)(object)_sphereObject);
}
if ((Object)(object)_uiIndicator != (Object)null)
{
Object.Destroy((Object)(object)_uiIndicator);
}
}
}
internal class DynamitePatch
{
[HarmonyPatch(typeof(Dynamite), "Update")]
public class DynamiteUpdate_Patch
{
private static void Postfix(Dynamite __instance)
{
if (Plugin.activated && ((ItemComponent)__instance).GetData<BoolItemData>((DataEntryKey)3).Value)
{
DynamiteWarningIndicator dynamiteWarningIndicator = ((Component)__instance).GetComponent<DynamiteWarningIndicator>();
if ((Object)(object)dynamiteWarningIndicator == (Object)null)
{
dynamiteWarningIndicator = ((Component)__instance).gameObject.AddComponent<DynamiteWarningIndicator>();
dynamiteWarningIndicator.Initialize(__instance.startingFuseTime);
}
dynamiteWarningIndicator.UpdateFuse(__instance.fuseTime);
}
}
}
[HarmonyPatch(typeof(Dynamite), "RPC_Explode")]
public class Patch_Dynamite_RPC_Explode
{
public static bool Prefix(Dynamite __instance, ref PhotonMessageInfo info)
{
((Component)__instance).GetComponent<DynamiteWarningIndicator>()?.DestroyIndicator();
return true;
}
}
}
[BepInPlugin("my.pahsiv.MySilentBlast", "MySilentBlast", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
public enum Mode
{
SphereAura,
Wireframe
}
public static ConfigEntry<KeyCode> TOGGLE;
public static ConfigEntry<float> EXPLOSION_RADIUS;
public static ConfigEntry<float> ALPHA;
public static ConfigEntry<Mode> MODE;
public static ConfigEntry<int> SEGMENTS;
public static ConfigEntry<float> LINE_WIDTH;
public static ConfigEntry<float> MAX_DISPLAY_DISTANCE;
public static bool activated = true;
private static InputAction? ToggleAction;
public static Texture2D UIIndicator = null;
public static ConfigEntry<bool> SCREENSPACEUI;
public static ConfigEntry<float> UI_MIN_SIZE;
public static ConfigEntry<float> UI_MAX_SIZE;
public static ConfigEntry<float> UI_ALPHA;
public const string Id = "my.pahsiv.MySilentBlast";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "MySilentBlast";
public static string Version => "0.1.0";
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Expected O, but got Unknown
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Expected O, but got Unknown
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("my.pahsiv.MySilentBlast");
val.PatchAll();
VerifyPatch(val);
TOGGLE = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Activation Key", (KeyCode)92, (ConfigDescription)null);
EXPLOSION_RADIUS = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Dynamite Explosion Radius", 11.5f, new ConfigDescription("Dynamite Explosion Radius", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
ALPHA = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Sphere / Wireframe Transparency", 0.4f, new ConfigDescription("Transparency for Sphere / Wireframe", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
MODE = ((BaseUnityPlugin)this).Config.Bind<Mode>("General", "Display Mode", Mode.SphereAura, "SphereAura / Wireframe");
SEGMENTS = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Wireframe Segments", 28, new ConfigDescription("Wireframe Segments", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 36), Array.Empty<object>()));
LINE_WIDTH = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Wireframe Line Width", 0.2f, new ConfigDescription("Wireframe Line Width", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
MAX_DISPLAY_DISTANCE = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Display Distance", 20f, new ConfigDescription("Maximum Display Distance", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 40f), Array.Empty<object>()));
SCREENSPACEUI = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Screen-Space Indicator", true, (ConfigDescription)null);
UI_MIN_SIZE = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Indicator Size", 15f, new ConfigDescription("Minimum Indicator Size", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 256f), Array.Empty<object>()));
UI_MAX_SIZE = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Indicator Size", 128f, new ConfigDescription("Maximum Indicator Size", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 256f), Array.Empty<object>()));
UI_ALPHA = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Indicator Transparency", 0.8f, new ConfigDescription("Transparency for Indicator", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
TOGGLE.SettingChanged += TOGGLE_SettingChanged;
InitializeToggleAction();
UIIndicator = ((DatabaseAsset<ItemDatabase, Item>)(object)SingletonAsset<ItemDatabase>.Instance).Objects[76].UIData.icon;
Log.LogMessage((object)(" Plugin " + Name + " " + Version + " is loaded!"));
}
private void TOGGLE_SettingChanged(object sender, EventArgs e)
{
InitializeToggleAction();
}
private void InitializeToggleAction()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
if (ToggleAction != null)
{
ToggleAction.Disable();
ToggleAction.Dispose();
}
string text = ConvertKeyCodeToInputPath(TOGGLE.Value);
ToggleAction = new InputAction("ToggleDisplay", (InputActionType)1, text, (string)null, (string)null, (string)null);
ToggleAction.performed += ToggleAction_performed;
ToggleAction.Enable();
}
public static void Notification(string message, string color = "FFFFFF", bool sound = false)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
PlayerConnectionLog val = Object.FindFirstObjectByType<PlayerConnectionLog>();
if ((Object)(object)val == (Object)null)
{
return;
}
string text = "<color=#" + color + ">" + message + "</color>";
MethodInfo method = typeof(PlayerConnectionLog).GetMethod("AddMessage", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(val, new object[1] { text });
if ((Object)(object)val.sfxJoin != (Object)null && sound)
{
val.sfxJoin.Play(default(Vector3));
}
}
else
{
Debug.LogWarning((object)"AddMessage method not found.");
}
}
public static string AddColor(string text, string color)
{
return "<color=#" + color + ">" + text + "</color>";
}
private void ToggleAction_performed(CallbackContext obj)
{
//IL_002c: 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)
activated = !activated;
string text = (activated ? "Enable" : "Disable");
Notification(Name + " | " + AddColor(text, ColorUtility.ToHtmlStringRGB(Color.yellow)), ColorUtility.ToHtmlStringRGB(Color.white));
}
private string ConvertKeyCodeToInputPath(KeyCode keyCode)
{
string text = ((object)(KeyCode)(ref keyCode)).ToString();
if (text.StartsWith("Keypad"))
{
text = text.Replace("Keypad", "numpad");
}
return "<Keyboard>/" + text.ToLower();
}
private void VerifyPatch(Harmony harmony)
{
IEnumerable<MethodBase> patchedMethods = harmony.GetPatchedMethods();
Log.LogMessage((object)$" Total patched methods: {patchedMethods.Count()}");
foreach (MethodBase item in patchedMethods)
{
Log.LogMessage((object)(" Patched: " + item.DeclaringType?.Name + "." + item.Name));
}
}
}
public class ScreenSpaceIndicator : MonoBehaviour
{
public Dynamite dynamite;
private Camera mainCamera;
private RectTransform rectTransform;
private Image image;
private void Start()
{
mainCamera = Camera.main;
rectTransform = ((Component)this).GetComponent<RectTransform>();
image = ((Component)this).GetComponent<Image>();
}
private void LateUpdate()
{
//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_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_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_004d: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: 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_0115: 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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)mainCamera == (Object)null || (Object)(object)dynamite == (Object)null)
{
return;
}
Vector3 val = mainCamera.WorldToScreenPoint(((Component)dynamite).transform.position + Vector3.up * 1f);
if (val.z < 0f || val.x < 0f || val.x > (float)Screen.width || val.y < 0f || val.y > (float)Screen.height)
{
((Graphic)image).color = new Color(((Graphic)image).color.r, ((Graphic)image).color.g, ((Graphic)image).color.b, 0f);
return;
}
float num = Vector3.Distance(((Component)mainCamera).transform.position, ((Component)dynamite).transform.position);
if (num > Plugin.MAX_DISPLAY_DISTANCE.Value)
{
((Graphic)image).color = new Color(((Graphic)image).color.r, ((Graphic)image).color.g, ((Graphic)image).color.b, 0f);
return;
}
float num2 = Mathf.Lerp(Plugin.UI_MAX_SIZE.Value, Plugin.UI_MIN_SIZE.Value, Mathf.Clamp01(num / Plugin.MAX_DISPLAY_DISTANCE.Value));
rectTransform.sizeDelta = new Vector2(num2, num2);
((Graphic)image).color = new Color(((Graphic)image).color.r, ((Graphic)image).color.g, ((Graphic)image).color.b, Plugin.UI_ALPHA.Value);
((Transform)rectTransform).position = val;
}
}
public static class TransparentSphereGenerator
{
public static Mesh GenerateTransparentSphere(float radius, int segments = 16)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
Mesh val = new Mesh();
((Object)val).name = "TransparentSphere";
List<Vector3> list = new List<Vector3>();
List<int> list2 = new List<int>();
for (int i = 0; i <= segments; i++)
{
float num = MathF.PI * (float)i / (float)segments;
for (int j = 0; j <= segments; j++)
{
float num2 = MathF.PI * 2f * (float)j / (float)segments;
float num3 = radius * Mathf.Sin(num) * Mathf.Cos(num2);
float num4 = radius * Mathf.Cos(num);
float num5 = radius * Mathf.Sin(num) * Mathf.Sin(num2);
list.Add(new Vector3(num3, num4, num5));
}
}
for (int k = 0; k < segments; k++)
{
for (int l = 0; l < segments; l++)
{
int num6 = k * (segments + 1) + l;
int item = num6 + 1;
int num7 = num6 + segments + 1;
int item2 = num7 + 1;
list2.Add(num6);
list2.Add(item2);
list2.Add(num7);
list2.Add(num6);
list2.Add(item);
list2.Add(item2);
}
}
val.vertices = list.ToArray();
val.triangles = list2.ToArray();
val.RecalculateNormals();
val.RecalculateBounds();
return val;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}