using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnemyHPBar;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using MonoMod.ModInterop;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SSEnemyHPBar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+6aa38b5ae125a5dce016158f38aa93c51eba0b52")]
[assembly: AssemblyProduct("SSEnemyHPBar")]
[assembly: AssemblyTitle("SSEnemyHPBar")]
[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 EnemyHPBar
{
public sealed class Settings
{
public float fgScale = 1f;
public float bgScale = 1f;
public float mgScale = 1f;
public float olScale = 1f;
public float bossfgScale = 1f;
public float bossbgScale = 1f;
public float bossolScale = 1f;
}
}
namespace SSEnemyHPBar
{
public class BossHPBar : MonoBehaviour
{
private GameObject bg_go;
private GameObject fg_go;
private GameObject ol_go;
private CanvasRenderer bg_cr;
private CanvasRenderer fg_cr;
private CanvasRenderer ol_cr;
private readonly float bossbgScale = SSEnemyHPBarPlugin.ConfigSettings.bossbgScale;
private readonly float bossfgScale = SSEnemyHPBarPlugin.ConfigSettings.bossfgScale;
private readonly float bossolScale = SSEnemyHPBarPlugin.ConfigSettings.bossolScale;
public Image health_bar;
public float maxHP;
public int position;
public Vector2 screenScale;
public HealthManager hm;
public Vector2 objectPos;
public void Awake()
{
//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_0077: 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_0088: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: 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_0181: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Creating Boss HP Bar for " + ((Object)this).name));
Camera mainCamera = GameCameras.instance.mainCamera;
screenScale = new Vector2((float)mainCamera.pixelWidth / 1280f, (float)mainCamera.pixelHeight / 720f);
bg_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.bossCanvas, SSEnemyHPBarPlugin.bossbg, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.bossbg.texture).width, (float)((Texture)SSEnemyHPBarPlugin.bossbg.texture).height), screenScale * bossbgScale), new Vector2(0f, 32f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f)));
fg_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.bossCanvas, SSEnemyHPBarPlugin.bossfg, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.bossfg.texture).width, (float)((Texture)SSEnemyHPBarPlugin.bossfg.texture).height), screenScale * bossfgScale), new Vector2(0f, 32f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f)));
ol_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.bossCanvas, SSEnemyHPBarPlugin.bossol, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.bossol.texture).width, (float)((Texture)SSEnemyHPBarPlugin.bossol.texture).height), screenScale * bossolScale), new Vector2(0f, 32f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f)));
bg_cr = bg_go.GetComponent<CanvasRenderer>();
fg_cr = fg_go.GetComponent<CanvasRenderer>();
ol_cr = ol_go.GetComponent<CanvasRenderer>();
objectPos = Vector2.op_Implicit(fg_go.transform.position);
health_bar = fg_go.GetComponent<Image>();
health_bar.type = (Type)3;
health_bar.fillMethod = (FillMethod)0;
health_bar.preserveAspect = false;
bg_go.GetComponent<Image>().preserveAspect = false;
ol_go.GetComponent<Image>().preserveAspect = false;
hm = ((Component)this).gameObject.GetComponent<HealthManager>();
SetHPBarAlpha(0f);
maxHP = hm.hp;
}
private void SetHPBarAlpha(float alpha)
{
if (alpha <= 0f)
{
SSEnemyHPBarPlugin.ActiveBosses.Remove(((Component)this).gameObject);
}
else if (!SSEnemyHPBarPlugin.ActiveBosses.Contains(((Component)this).gameObject))
{
SSEnemyHPBarPlugin.ActiveBosses.Add(((Component)this).gameObject);
}
bg_cr.SetAlpha(alpha);
fg_cr.SetAlpha(alpha);
ol_cr.SetAlpha(alpha);
}
private void DestroyHPBar()
{
Object.Destroy((Object)(object)fg_go);
Object.Destroy((Object)(object)bg_go);
Object.Destroy((Object)(object)ol_go);
Object.Destroy((Object)(object)health_bar);
}
private void MoveHPBar(Vector2 position)
{
//IL_000c: 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_0023: 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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
fg_go.transform.position = Vector2.op_Implicit(position);
bg_go.transform.position = Vector2.op_Implicit(position);
ol_go.transform.position = Vector2.op_Implicit(position);
}
private void OnDestroy()
{
SetHPBarAlpha(0f);
DestroyHPBar();
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Destroyed enemy " + ((Object)((Component)this).gameObject).name));
}
private void OnDisable()
{
SetHPBarAlpha(0f);
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Disabled enemy " + ((Object)((Component)this).gameObject).name));
}
private void FixedUpdate()
{
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Invalid comparison between Unknown and I4
position = SSEnemyHPBarPlugin.ActiveBosses.IndexOf(((Component)this).gameObject) + 1;
SSEnemyHPBarPlugin.Logger.LogMessage((object)$"Enemy {((Object)this).name}: currHP {hm.hp}, maxHP {maxHP}");
health_bar.fillAmount = (float)hm.hp / maxHP;
if (health_bar.fillAmount < 1f && health_bar.fillAmount > 0f)
{
float hPBarAlpha = (((int)GameManager.instance.GameState == 5) ? 0.5f : 1f);
SetHPBarAlpha(hPBarAlpha);
}
if (((Object)((Component)this).gameObject).name == "New Game Object" && hm.hp <= 0)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
SSEnemyHPBarPlugin.Logger.LogDebug((object)"Placeholder killed");
}
if ((float)hm.hp <= 0f && !hm.hasSpecialDeath)
{
SetHPBarAlpha(0f);
}
}
private void LateUpdate()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
position = SSEnemyHPBarPlugin.ActiveBosses.IndexOf(((Component)this).gameObject);
MoveHPBar(new Vector2(objectPos.x, objectPos.y + (float)position * 30f));
}
}
[PublicAPI]
public static class CanvasUtil
{
public class RectData
{
public Vector2 AnchorMax;
public Vector2 AnchorMin;
public Vector2 AnchorPivot;
public Vector2 AnchorPosition;
public Vector2 RectSizeDelta;
public RectData(Vector2 sizeDelta, Vector2 anchorPosition)
: this(sizeDelta, anchorPosition, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f))
{
}//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
public RectData(Vector2 sizeDelta, Vector2 anchorPosition, Vector2 min, Vector2 max)
: this(sizeDelta, anchorPosition, min, max, new Vector2(0.5f, 0.5f))
{
}//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_0004: 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)
public RectData(Vector2 sizeDelta, Vector2 anchorPosition, Vector2 min, Vector2 max, Vector2 pivot)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0018: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
RectSizeDelta = sizeDelta;
AnchorPosition = anchorPosition;
AnchorMin = min;
AnchorMax = max;
AnchorPivot = pivot;
}
}
[CompilerGenerated]
private sealed class <FadeInCanvasGroup>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CanvasGroup cg;
private float <loopFailsafe>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeInCanvasGroup>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<loopFailsafe>5__1 = 0f;
cg.alpha = 0f;
((Component)cg).gameObject.SetActive(true);
goto IL_00f1;
case 1:
<>1__state = -1;
goto IL_00f1;
case 2:
{
<>1__state = -1;
return false;
}
IL_00f1:
if (cg.alpha < 1f)
{
CanvasGroup obj = cg;
obj.alpha += Time.unscaledDeltaTime * 3.2f;
<loopFailsafe>5__1 += Time.unscaledDeltaTime;
if (cg.alpha >= 0.95f)
{
cg.alpha = 1f;
}
else if (!(<loopFailsafe>5__1 >= 2f))
{
<>2__current = null;
<>1__state = 1;
return true;
}
}
cg.alpha = 1f;
cg.interactable = true;
((Component)cg).gameObject.SetActive(true);
<>2__current = null;
<>1__state = 2;
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 <FadeOutCanvasGroup>d__24 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CanvasGroup cg;
private float <loopFailsafe>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FadeOutCanvasGroup>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<loopFailsafe>5__1 = 0f;
cg.interactable = false;
goto IL_00c7;
case 1:
<>1__state = -1;
goto IL_00c7;
case 2:
{
<>1__state = -1;
return false;
}
IL_00c7:
if (cg.alpha > 0.05f)
{
CanvasGroup obj = cg;
obj.alpha -= Time.unscaledDeltaTime * 3.2f;
<loopFailsafe>5__1 += Time.unscaledDeltaTime;
if (!(cg.alpha <= 0.05f) && !(<loopFailsafe>5__1 >= 2f))
{
<>2__current = null;
<>1__state = 1;
return true;
}
}
cg.alpha = 0f;
((Component)cg).gameObject.SetActive(false);
<>2__current = null;
<>1__state = 2;
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 Font _trajanBold;
private static Font _trajanNormal;
private static readonly Dictionary<string, Font> Fonts = new Dictionary<string, Font>();
public static Font TrajanBold
{
get
{
if (!Object.op_Implicit((Object)(object)_trajanBold))
{
CreateFonts();
}
return _trajanBold;
}
}
public static Font TrajanNormal
{
get
{
if (!Object.op_Implicit((Object)(object)_trajanNormal))
{
CreateFonts();
}
return _trajanNormal;
}
}
private static void CreateFonts()
{
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Bold")
{
_trajanBold = val;
}
if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Regular")
{
_trajanNormal = val;
}
}
}
public static Font GetFont(string fontName)
{
if (Fonts.ContainsKey(fontName))
{
return Fonts[fontName];
}
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if ((Object)(object)val != (Object)null && ((Object)val).name == fontName)
{
Fonts.Add(fontName, val);
break;
}
}
return Fonts.ContainsKey(fontName) ? Fonts[fontName] : null;
}
public static Sprite NullSprite(byte[] data = null)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0038: 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)
Texture2D val = new Texture2D(1, 1);
if (data == null)
{
data = new byte[4];
}
val.LoadRawTextureData(data);
val.Apply();
return Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), Vector2.zero);
}
public static Sprite CreateSprite(byte[] data, int x, int y, int width, int height)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//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)
Texture2D val = new Texture2D(1, 1);
ImageConversion.LoadImage(val, data);
((Texture)val).anisoLevel = 0;
return Sprite.Create(val, new Rect((float)x, (float)y, (float)width, (float)height), Vector2.zero);
}
public static GameObject CreateBasePanel(GameObject parent, RectData rd)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
if ((Object)(object)parent != (Object)null)
{
val.transform.SetParent(parent.transform);
val.transform.localScale = new Vector3(1f, 1f, 1f);
}
val.AddComponent<CanvasRenderer>();
AddRectTransform(val, rd);
return val;
}
public static void AddRectTransform(GameObject go, RectData rd)
{
//IL_000a: 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_0024: 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: Unknown result type (might be due to invalid IL or missing references)
RectTransform val = go.AddComponent<RectTransform>();
val.anchorMax = rd.AnchorMax;
val.anchorMin = rd.AnchorMin;
val.pivot = rd.AnchorPivot;
val.sizeDelta = rd.RectSizeDelta;
val.anchoredPosition = rd.AnchorPosition;
}
public static GameObject CreateCanvas(RenderMode renderMode, int referencePixelsPerUnit)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateCanvas(renderMode);
val.GetComponent<CanvasScaler>().referencePixelsPerUnit = referencePixelsPerUnit;
return val;
}
public static GameObject CreateCanvas(RenderMode renderMode, Vector2 size)
{
//IL_0001: 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)
GameObject val = CreateCanvas(renderMode);
val.GetComponent<CanvasScaler>().referenceResolution = size;
return val;
}
private static GameObject CreateCanvas(RenderMode renderMode)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
val.AddComponent<Canvas>().renderMode = renderMode;
CanvasScaler val2 = val.AddComponent<CanvasScaler>();
val2.uiScaleMode = (ScaleMode)1;
val.AddComponent<GraphicRaycaster>();
val.AddComponent<CanvasGroup>();
return val;
}
public static GameObject CreateTextPanel(GameObject parent, string text, int fontSize, TextAnchor textAnchor, RectData rectData, Font font)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
GameObject val = CreateBasePanel(parent, rectData);
Text val2 = val.AddComponent<Text>();
val2.font = font;
val2.text = text;
val2.supportRichText = true;
val2.fontSize = fontSize;
val2.alignment = textAnchor;
return val;
}
public static GameObject CreateTextPanel(GameObject parent, string text, int fontSize, TextAnchor textAnchor, RectData rectData, bool bold = true)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
return CreateTextPanel(parent, text, fontSize, textAnchor, rectData, bold ? TrajanBold : TrajanNormal);
}
public static GameObject CreateImagePanel(GameObject parent, Sprite sprite, RectData rectData)
{
GameObject val = CreateBasePanel(parent, rectData);
Image val2 = val.AddComponent<Image>();
val2.sprite = sprite;
val2.preserveAspect = true;
val2.useSpriteMesh = true;
return val;
}
public static GameObject CreateButton(GameObject parent, Action<int> action, int id, Sprite spr, string text, int fontSize, TextAnchor textAnchor, RectData rectData, bool bold = true, params Sprite[] extraSprites)
{
//IL_0023: 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_0064: Expected O, but got Unknown
//IL_0085: 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_00b1: 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)
Action<int> action2 = action;
GameObject val = CreateBasePanel(parent, rectData);
CreateTextPanel(val, text, fontSize, textAnchor, rectData, bold);
Image val2 = val.AddComponent<Image>();
val2.sprite = spr;
Button val3 = val.AddComponent<Button>();
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
{
action2(id);
});
if (extraSprites.Length == 3)
{
((Selectable)val3).transition = (Transition)2;
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
SpriteState val4 = default(SpriteState);
((SpriteState)(ref val4)).highlightedSprite = extraSprites[0];
((SpriteState)(ref val4)).pressedSprite = extraSprites[1];
((SpriteState)(ref val4)).disabledSprite = extraSprites[2];
SpriteState spriteState = val4;
((Selectable)val3).spriteState = spriteState;
}
else
{
((Selectable)val3).transition = (Transition)0;
}
return val;
}
public static GameObject CreateToggle(GameObject parent, Action<bool> action, Sprite boxBgSprite, Sprite boxFgSprite, string text, int fontSize, TextAnchor textAnchor, RectData rectData, bool bold = true, bool isOn = false)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
Action<bool> action2 = action;
GameObject val = CreateBasePanel(parent, rectData);
GameObject val2 = CreateImagePanel(val, boxBgSprite, rectData);
GameObject val3 = CreateImagePanel(val2, boxFgSprite, rectData);
Toggle val4 = val.AddComponent<Toggle>();
val4.isOn = isOn;
((Selectable)val4).targetGraphic = (Graphic)(object)val2.GetComponent<Image>();
val4.graphic = (Graphic)(object)val3.GetComponent<Image>();
((Selectable)val4).transition = (Transition)1;
ColorBlock val5 = default(ColorBlock);
((ColorBlock)(ref val5)).normalColor = new Color(1f, 1f, 1f, 1f);
((ColorBlock)(ref val5)).highlightedColor = new Color(1f, 1f, 1f, 1f);
((ColorBlock)(ref val5)).pressedColor = new Color(0.8f, 0.8f, 0.8f, 1f);
((ColorBlock)(ref val5)).disabledColor = new Color(0.8f, 0.8f, 0.8f, 0.5f);
((ColorBlock)(ref val5)).fadeDuration = 0.1f;
ColorBlock colors = val5;
((Selectable)val4).colors = colors;
((UnityEvent<bool>)(object)val4.onValueChanged).AddListener((UnityAction<bool>)delegate(bool b)
{
action2(b);
});
ToggleGroup component = parent.GetComponent<ToggleGroup>();
if ((Object)(object)component != (Object)null)
{
val4.group = component;
}
return val;
}
public static GameObject CreateToggleGroup()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0012: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject();
AddRectTransform(val, new RectData(new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f)));
val.AddComponent<ToggleGroup>();
return val;
}
public static GameObject CreateRectMask2DPanel(GameObject parent, RectData rectData)
{
GameObject val = CreateBasePanel(parent, rectData);
val.AddComponent<RectMask2D>();
return val;
}
[IteratorStateMachine(typeof(<FadeInCanvasGroup>d__23))]
public static IEnumerator FadeInCanvasGroup(CanvasGroup cg)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeInCanvasGroup>d__23(0)
{
cg = cg
};
}
[IteratorStateMachine(typeof(<FadeOutCanvasGroup>d__24))]
public static IEnumerator FadeOutCanvasGroup(CanvasGroup cg)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FadeOutCanvasGroup>d__24(0)
{
cg = cg
};
}
}
public class HPBar : MonoBehaviour
{
private GameObject bg_go;
private GameObject mg_go;
private GameObject fg_go;
private GameObject ol_go;
private CanvasRenderer bg_cr;
private CanvasRenderer fg_cr;
private CanvasRenderer mg_cr;
private CanvasRenderer ol_cr;
private readonly float bgScale = SSEnemyHPBarPlugin.ConfigSettings.bgScale;
private readonly float fgScale = SSEnemyHPBarPlugin.ConfigSettings.fgScale;
private readonly float olScale = SSEnemyHPBarPlugin.ConfigSettings.olScale;
private readonly float mgScale = SSEnemyHPBarPlugin.ConfigSettings.mgScale;
public Image health_bar;
public Image hpbg;
public float currHP;
public float maxHP;
public int oldHP;
public HealthManager hm;
public Vector2 objectPos;
public Vector2 screenScale;
public void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: 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_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Creating HP Bar for " + ((Object)this).name));
Camera mainCamera = GameCameras.instance.mainCamera;
screenScale = new Vector2((float)mainCamera.pixelWidth / 1280f * 0.025f, (float)mainCamera.pixelHeight / 720f * 0.025f);
bg_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.canvas, SSEnemyHPBarPlugin.bg, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.bg.texture).width, (float)((Texture)SSEnemyHPBarPlugin.bg.texture).height), screenScale * bgScale), new Vector2(0f, 32f)));
mg_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.canvas, SSEnemyHPBarPlugin.mg, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.mg.texture).width, (float)((Texture)SSEnemyHPBarPlugin.mg.texture).height), screenScale * mgScale), new Vector2(0f, 32f)));
fg_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.canvas, SSEnemyHPBarPlugin.fg, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.fg.texture).width, (float)((Texture)SSEnemyHPBarPlugin.fg.texture).height), screenScale * fgScale), new Vector2(0f, 32f)));
ol_go = CanvasUtil.CreateImagePanel(SSEnemyHPBarPlugin.canvas, SSEnemyHPBarPlugin.ol, new CanvasUtil.RectData(Vector2.Scale(new Vector2((float)((Texture)SSEnemyHPBarPlugin.ol.texture).width, (float)((Texture)SSEnemyHPBarPlugin.ol.texture).height), screenScale * olScale), new Vector2(0f, 32f)));
bg_cr = bg_go.GetComponent<CanvasRenderer>();
fg_cr = fg_go.GetComponent<CanvasRenderer>();
mg_cr = mg_go.GetComponent<CanvasRenderer>();
ol_cr = ol_go.GetComponent<CanvasRenderer>();
hpbg = mg_go.GetComponent<Image>();
hpbg.type = (Type)3;
hpbg.fillMethod = (FillMethod)0;
hpbg.preserveAspect = false;
health_bar = fg_go.GetComponent<Image>();
health_bar.type = (Type)3;
health_bar.fillMethod = (FillMethod)0;
health_bar.preserveAspect = false;
bg_go.GetComponent<Image>().preserveAspect = false;
ol_go.GetComponent<Image>().preserveAspect = false;
hm = ((Component)this).gameObject.GetComponent<HealthManager>();
SetHPBarAlpha(0f);
maxHP = hm.hp;
currHP = hm.hp;
}
private void SetHPBarAlpha(float alpha)
{
bg_cr.SetAlpha(alpha);
fg_cr.SetAlpha(alpha);
mg_cr.SetAlpha(alpha);
ol_cr.SetAlpha(alpha);
}
private void DestroyHPBar()
{
Object.Destroy((Object)(object)fg_go);
Object.Destroy((Object)(object)bg_go);
Object.Destroy((Object)(object)mg_go);
Object.Destroy((Object)(object)ol_go);
Object.Destroy((Object)(object)hpbg);
Object.Destroy((Object)(object)health_bar);
}
private void MoveHPBar(Vector2 position)
{
//IL_000c: 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_0023: 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_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
fg_go.transform.position = Vector2.op_Implicit(position);
mg_go.transform.position = Vector2.op_Implicit(position);
bg_go.transform.position = Vector2.op_Implicit(position);
ol_go.transform.position = Vector2.op_Implicit(position);
}
private void OnDestroy()
{
SetHPBarAlpha(0f);
DestroyHPBar();
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Destroyed enemy " + ((Object)this).name));
}
private void OnDisable()
{
SetHPBarAlpha(0f);
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Disabled enemy " + ((Object)this).name));
}
private void FixedUpdate()
{
if (currHP > (float)hm.hp)
{
currHP -= 1f;
}
else
{
currHP = hm.hp;
}
SSEnemyHPBarPlugin.Logger.LogMessage((object)$"Enemy {((Object)this).name}: currHP {hm.hp}, maxHP {maxHP}");
health_bar.fillAmount = (float)hm.hp / maxHP;
hpbg.fillAmount = currHP / maxHP;
if (health_bar.fillAmount < 1f)
{
SetHPBarAlpha(1f);
}
if (((Object)((Component)this).gameObject).name == "New Game Object" && currHP <= 0f)
{
SSEnemyHPBarPlugin.Logger.LogDebug((object)"Placeholder killed");
Object.Destroy((Object)(object)((Component)this).gameObject);
}
if (currHP <= 0f)
{
SetHPBarAlpha(0f);
}
oldHP = hm.hp;
}
private void LateUpdate()
{
//IL_0008: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//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_0026: 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)
objectPos = Vector2.op_Implicit(((Component)this).transform.position + Vector3.up * 1.5f);
MoveHPBar(objectPos);
}
}
public static class GOUtil
{
public static T GetAddComponent<T>(this GameObject go) where T : Component
{
T val = go.GetComponent<T>();
if ((Object)(object)val == (Object)null)
{
val = go.AddComponent<T>();
}
return val;
}
}
internal sealed class DisableHPBar : MonoBehaviour
{
}
internal sealed class BossMarker : MonoBehaviour
{
public bool isBoss = true;
}
[ModExportName("SSEnemyHPBarPlugin")]
public static class EnemyHPBarExport
{
public static void DisableHPBar(GameObject go)
{
HPBar component = go.GetComponent<HPBar>();
if (component != null)
{
Object.Destroy((Object)(object)component);
}
BossHPBar component2 = go.GetComponent<BossHPBar>();
if (component2 != null)
{
Object.Destroy((Object)(object)component2);
}
go.GetAddComponent<DisableHPBar>();
}
public static void EnableHPBar(GameObject go)
{
DisableHPBar component = go.GetComponent<DisableHPBar>();
if (component != null)
{
Object.Destroy((Object)(object)component);
}
HealthManager component2 = go.GetComponent<HealthManager>();
((Behaviour)component2).enabled = false;
((Behaviour)component2).enabled = true;
}
public static void RefreshHPBar(GameObject go)
{
DisableHPBar(go);
EnableHPBar(go);
}
public static void MarkAsBoss(GameObject go)
{
go.GetAddComponent<BossMarker>().isBoss = true;
RefreshHPBar(go);
}
public static void MarkAsNonBoss(GameObject go)
{
go.GetAddComponent<BossMarker>().isBoss = false;
RefreshHPBar(go);
}
}
internal static class Patches
{
[HarmonyPatch]
public static class EnemyDeathPatch
{
private static MethodBase TargetMethod()
{
Type[] array = new Type[9]
{
typeof(float?),
typeof(AttackTypes),
typeof(NailElements),
typeof(GameObject),
typeof(float),
typeof(bool),
typeof(Action<Transform>),
typeof(bool).MakeByRefType(),
typeof(GameObject).MakeByRefType()
};
return AccessTools.Method(typeof(EnemyDeathEffects), "ReceiveDeathEvent", array, (Type[])null);
}
private static bool Prefix(EnemyDeathEffects __instance)
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
//IL_00c8: 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_005f: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Enemy " + ((Object)((Component)__instance).gameObject).name + " dead"));
if ((Object)(object)((Component)__instance).gameObject.GetComponent<HPBar>() != (Object)null)
{
if (((Component)__instance).gameObject.GetComponent<HPBar>().oldHP == 0)
{
GameObject val = new GameObject();
val.transform.position = ((Component)__instance).gameObject.transform.position;
HealthManager val2 = val.AddComponent<HealthManager>();
HPBar hPBar = val.AddComponent<HPBar>();
hPBar.currHP = 18f;
hPBar.maxHP = 18f;
val2.hp = 0;
}
else
{
GameObject val3 = new GameObject();
val3.transform.position = ((Component)__instance).gameObject.transform.position;
HealthManager val4 = val3.AddComponent<HealthManager>();
HPBar hPBar2 = val3.AddComponent<HPBar>();
val3.AddComponent<EnemyDeathEffects>();
hPBar2.currHP = ((Component)__instance).gameObject.GetComponent<HPBar>().oldHP;
hPBar2.maxHP = ((Component)__instance).gameObject.GetComponent<HPBar>().maxHP;
val4.hp = 0;
}
}
return true;
}
}
[HarmonyPatch(typeof(HealthManager), "OnEnable")]
[HarmonyPostfix]
public static void OnEnableEnemy(HealthManager __instance)
{
GameObject gameObject = ((Component)__instance).gameObject;
if ((Object)(object)gameObject.GetComponent<DisableHPBar>() != (Object)null)
{
return;
}
HealthManager component = gameObject.GetComponent<HealthManager>();
if ((Object)(object)component == (Object)null)
{
return;
}
EnemyDeathEffects component2 = gameObject.GetComponent<EnemyDeathEffects>();
bool flag = component.hp >= 200;
BossMarker component3 = gameObject.GetComponent<BossMarker>();
if (component3 != null)
{
flag = component3.isBoss;
}
if (!flag)
{
HPBar component4 = ((Component)component).gameObject.GetComponent<HPBar>();
if (!((Object)(object)component4 != (Object)null) && component.hp < 7000 && !component.isDead)
{
((Component)component).gameObject.AddComponent<HPBar>();
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Added HP bar to " + ((Object)gameObject).name));
}
}
else
{
BossHPBar component5 = ((Component)component).gameObject.GetComponent<BossHPBar>();
if (!((Object)(object)component5 != (Object)null) && component.hp < 7000 && !component.isDead)
{
((Component)component).gameObject.AddComponent<BossHPBar>();
SSEnemyHPBarPlugin.Logger.LogDebug((object)("Added Boss HP bar to " + ((Object)gameObject).name));
}
}
}
}
internal sealed class ResourceLoader : MonoBehaviour
{
private static byte[] GetImage(string name)
{
SSEnemyHPBarPlugin.CompleteImage(Path.Combine(SSEnemyHPBarPlugin.DATA_DIR));
return File.ReadAllBytes(Path.Combine(SSEnemyHPBarPlugin.DATA_DIR, name));
}
public static byte[] GetBackgroundImage()
{
return GetImage("bg.png");
}
public static byte[] GetForegroundImage()
{
return GetImage("fg.png");
}
public static byte[] GetMiddlegroundImage()
{
return GetImage("mg.png");
}
public static byte[] GetOutlineImage()
{
return GetImage("ol.png");
}
public static byte[] GetBossBackgroundImage()
{
return GetImage("bossbg.png");
}
public static byte[] GetBossForegroundImage()
{
return GetImage("bossfg.png");
}
public static byte[] GetBossOutlineImage()
{
return GetImage("bossol.png");
}
}
[BepInPlugin("io.github.ygsbzr.ssenemyhpbar", "SSEnemyHPBar", "0.1.0")]
public class SSEnemyHPBarPlugin : BaseUnityPlugin
{
[CompilerGenerated]
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private static ManualLogSource <Logger>k__BackingField;
public static GameObject canvas;
public static GameObject bossCanvas;
private static GameObject spriteLoader;
public static List<GameObject> ActiveBosses;
public const string HPBAR_BG = "bg.png";
public const string HPBAR_FG = "fg.png";
public const string HPBAR_MG = "mg.png";
public const string HPBAR_OL = "ol.png";
public const string HPBAR_BOSSOL = "bossol.png";
public const string HPBAR_BOSSFG = "bossfg.png";
public const string HPBAR_BOSSBG = "bossbg.png";
public const string SPRITE_FOLDER = "CustomHPBar";
public static Sprite bg;
public static Sprite mg;
public static Sprite fg;
public static Sprite ol;
public static Sprite bossbg;
public static Sprite bossfg;
public static Sprite bossol;
public static readonly string DATA_DIR = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "CustomHPBar");
public const string Id = "io.github.ygsbzr.ssenemyhpbar";
internal static ManualLogSource Logger
{
get
{
return <Logger>k__BackingField ?? throw new InvalidOperationException("instance not present");
}
[CompilerGenerated]
private set
{
<Logger>k__BackingField = value;
}
}
public static Settings ConfigSettings { get; } = new Settings();
public static string Name => "SSEnemyHPBar";
public static string Version => "0.1.0";
private void Awake()
{
if (!Directory.Exists(DATA_DIR))
{
Directory.CreateDirectory(DATA_DIR);
}
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)("Plugin " + Name + " (io.github.ygsbzr.ssenemyhpbar) has loaded!"));
Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
}
private void Start()
{
//IL_0037: 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)
DefineConfig();
CompleteImage(DATA_DIR);
LoadLoader();
SceneManager.sceneLoaded += ChangeScene;
canvas = CanvasUtil.CreateCanvas((RenderMode)2, new Vector2(1920f, 1080f));
bossCanvas = CanvasUtil.CreateCanvas((RenderMode)0, new Vector2(1920f, 1080f));
canvas.GetComponent<Canvas>().sortingOrder = 1;
bossCanvas.GetComponent<Canvas>().sortingOrder = 1;
bossol = HPBarCreateSprite(ResourceLoader.GetBossOutlineImage());
bossbg = HPBarCreateSprite(ResourceLoader.GetBossBackgroundImage());
bossfg = HPBarCreateSprite(ResourceLoader.GetBossForegroundImage());
ol = HPBarCreateSprite(ResourceLoader.GetOutlineImage());
fg = HPBarCreateSprite(ResourceLoader.GetForegroundImage());
mg = HPBarCreateSprite(ResourceLoader.GetMiddlegroundImage());
bg = HPBarCreateSprite(ResourceLoader.GetBackgroundImage());
Object.DontDestroyOnLoad((Object)(object)canvas);
Object.DontDestroyOnLoad((Object)(object)bossCanvas);
}
private void ChangeScene(Scene arg0, LoadSceneMode arg1)
{
ActiveBosses = new List<GameObject>();
}
public static void CompleteImage(string skinpath)
{
foreach (string item in from t in Assembly.GetExecutingAssembly().GetManifestResourceNames()
where t.EndsWith("png")
select t)
{
string path = item.Replace("SSEnemyHPBar.Resources.", "");
string path2 = Path.Combine(skinpath, path);
if (File.Exists(path2))
{
continue;
}
using FileStream destination = File.Create(path2);
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(item);
stream.CopyTo(destination);
}
}
public void LoadLoader()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
if ((Object)(object)spriteLoader == (Object)null)
{
spriteLoader = new GameObject();
spriteLoader.AddComponent<ResourceLoader>();
}
}
public static Sprite HPBarCreateSprite(byte[] data)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(1, 1);
ImageConversion.LoadImage(val, data);
((Texture)val).anisoLevel = 0;
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
}
private void DefineConfig()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0030: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_0096: Expected O, but got Unknown
//IL_00dd: 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_00fc: Expected O, but got Unknown
//IL_00fc: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
//IL_0162: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Expected O, but got Unknown
//IL_01c8: Expected O, but got Unknown
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Expected O, but got Unknown
//IL_0231: Expected O, but got Unknown
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Expected O, but got Unknown
//IL_029a: Expected O, but got Unknown
ConfigEntry<float> val = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("hpbar", "fgscale"), 1f, new ConfigDescription("test", (AcceptableValueBase)null, Array.Empty<object>()));
val.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val14 = (SettingChangedEventArgs)e;
ConfigSettings.fgScale = (float)val14.ChangedSetting.BoxedValue;
};
ConfigSettings.fgScale = val.Value;
ConfigEntry<float> val2 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("hpbar", "bgscale"), 1f, new ConfigDescription("test", (AcceptableValueBase)null, Array.Empty<object>()));
val2.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val13 = (SettingChangedEventArgs)e;
ConfigSettings.bgScale = (float)val13.ChangedSetting.BoxedValue;
};
ConfigSettings.bgScale = val2.Value;
ConfigEntry<float> val3 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("hpbar", "mgscale"), 1f, new ConfigDescription("test", (AcceptableValueBase)null, Array.Empty<object>()));
val3.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val12 = (SettingChangedEventArgs)e;
ConfigSettings.mgScale = (float)val12.ChangedSetting.BoxedValue;
};
ConfigSettings.mgScale = val3.Value;
ConfigEntry<float> val4 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("hpbar", "olscale"), 1f, new ConfigDescription("test", (AcceptableValueBase)null, Array.Empty<object>()));
val4.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val11 = (SettingChangedEventArgs)e;
ConfigSettings.olScale = (float)val11.ChangedSetting.BoxedValue;
};
ConfigSettings.olScale = val4.Value;
ConfigEntry<float> val5 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("bossbar", "bossfgscale"), 1f, new ConfigDescription("Boss血条前景缩放", (AcceptableValueBase)null, Array.Empty<object>()));
val5.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val10 = (SettingChangedEventArgs)e;
ConfigSettings.bossfgScale = (float)val10.ChangedSetting.BoxedValue;
};
ConfigSettings.bossfgScale = val5.Value;
ConfigEntry<float> val6 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("bossbar", "bossbgscale"), 1f, new ConfigDescription("Boss血条背景缩放", (AcceptableValueBase)null, Array.Empty<object>()));
val6.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val9 = (SettingChangedEventArgs)e;
ConfigSettings.bossbgScale = (float)val9.ChangedSetting.BoxedValue;
};
ConfigSettings.bossbgScale = val6.Value;
ConfigEntry<float> val7 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("bossbar", "bossolscale"), 1f, new ConfigDescription("Boss血条轮廓缩放", (AcceptableValueBase)null, Array.Empty<object>()));
val7.SettingChanged += delegate(object o, EventArgs e)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
SettingChangedEventArgs val8 = (SettingChangedEventArgs)e;
ConfigSettings.bossolScale = (float)val8.ChangedSetting.BoxedValue;
};
ConfigSettings.bossolScale = val7.Value;
}
}
}