using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NineSolsAPI.Utils;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ColorAssist")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("ColorAssist")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ColorAssist")]
[assembly: AssemblyTitle("ColorAssist")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
internal sealed class ConfigurationManagerAttributes
{
public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);
public bool? ShowRangeAsPercent;
public Action<ConfigEntryBase> CustomDrawer;
public CustomHotkeyDrawerFunc CustomHotkeyDrawer;
public bool? Browsable;
public string Category;
public object DefaultValue;
public bool? HideDefaultButton;
public bool? HideSettingName;
public string Description;
public string DispName;
public int? Order;
public bool? ReadOnly;
public bool? IsAdvanced;
public Func<object, string> ObjToStr;
public Func<string, object> StrToObj;
}
namespace ColorAssist
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("ColorAssist", "ColorAssist", "1.0.0")]
public class ColorAssist : BaseUnityPlugin
{
public ConfigEntry<string> curFilter;
private ConfigEntry<bool> isEnableFilter;
private ConfigEntry<bool> isProtanopia;
private ConfigEntry<bool> isProtanomaly;
private ConfigEntry<bool> isDeuteranopia;
private ConfigEntry<bool> isDeuteranomaly;
private ConfigEntry<bool> isTritanopia;
private ConfigEntry<bool> isTritanomaly;
private ConfigEntry<bool> isAchromatopsia;
private ConfigEntry<bool> isAchromatomaly;
public ConfigEntry<bool> isNormalHeealthBar;
public ConfigEntry<bool> isInternalHeealthBar;
public ConfigEntry<bool> isBossHeealthBar;
public ConfigEntry<bool> isAttackEffect;
public ConfigEntry<Color> _NormalHpColor;
public ConfigEntry<Color> _InternalHpColor;
public ConfigEntry<Color> _BossHpColor;
public ConfigEntry<Color> _AttackEffectColor;
public Color defaultColor;
private const string Protanopia = "Protanopia";
private const string Protanomaly = "Protanomaly";
private const string Deuteranopia = "Deuteranopia";
private const string Deuteranomaly = "Deuteranomaly";
private const string Tritanopia = "Tritanopia";
private const string Tritanomaly = "Tritanomaly";
private const string Achromatopsia = "Achromatopsia";
private const string Achromatomaly = "Achromatomaly";
public Material[] colorBlindMaterials;
public Material kickHint;
public Material defaultMaterial;
private AssetBundle shader;
private ColorblindFilter colorblindFilter;
private Harmony harmony;
public static ColorAssist Instance { get; private set; }
private void Awake()
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Expected O, but got Unknown
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Expected O, but got Unknown
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Expected O, but got Unknown
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Expected O, but got Unknown
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Expected O, but got Unknown
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Expected O, but got Unknown
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Expected O, but got Unknown
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Expected O, but got Unknown
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Expected O, but got Unknown
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Expected O, but got Unknown
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Expected O, but got Unknown
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_049f: Unknown result type (might be due to invalid IL or missing references)
//IL_04a9: Expected O, but got Unknown
//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Expected O, but got Unknown
//IL_0514: Unknown result type (might be due to invalid IL or missing references)
//IL_0519: Unknown result type (might be due to invalid IL or missing references)
//IL_053e: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Expected O, but got Unknown
//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Expected O, but got Unknown
//IL_070a: Unknown result type (might be due to invalid IL or missing references)
//IL_070f: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
harmony = Harmony.CreateAndPatchAll(typeof(ColorAssist).Assembly, (string)null);
Instance = this;
curFilter = ((BaseUnityPlugin)this).Config.Bind<string>("", "Current Filter", "", new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 20
}
}));
isEnableFilter = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Enable Filter", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 19
}
}));
isProtanopia = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Protanopia", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 18
}
}));
isProtanomaly = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Protanomaly", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 17
}
}));
isDeuteranopia = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Deuteranopia", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 16
}
}));
isDeuteranomaly = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Deuteranomaly", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 15
}
}));
isTritanopia = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Tritanopia", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 14
}
}));
isTritanomaly = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Tritanomaly", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 13
}
}));
isAchromatopsia = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Achromatopsia", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 12
}
}));
isAchromatomaly = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Achromatomaly", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 11
}
}));
isNormalHeealthBar = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Enable NormalHeealthBar Color", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 10
}
}));
_NormalHpColor = ((BaseUnityPlugin)this).Config.Bind<Color>("", "Normal Health Color", Color.op_Implicit(new Vector4(255f, 255f, 0f, 255f)), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 9
}
}));
isInternalHeealthBar = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Enable InternalHeealthBar Color", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 8
}
}));
_InternalHpColor = ((BaseUnityPlugin)this).Config.Bind<Color>("", "Internal Health Color", Color.op_Implicit(new Vector4(255f, 255f, 0f, 255f)), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 7
}
}));
isBossHeealthBar = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Enable BossHeealthBar Color", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 6
}
}));
_BossHpColor = ((BaseUnityPlugin)this).Config.Bind<Color>("", "Boss Health Color", Color.op_Implicit(new Vector4(255f, 255f, 0f, 255f)), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 5
}
}));
isAttackEffect = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Enable AttackEffect Color", false, new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 4
}
}));
_AttackEffectColor = ((BaseUnityPlugin)this).Config.Bind<Color>("", "Attack Effect Color", Color.op_Implicit(new Vector4(255f, 255f, 0f, 255f)), new ConfigDescription("", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 3
}
}));
colorBlindMaterials = LoadColorBlindMaterials();
isEnableFilter.SettingChanged += delegate
{
UpdateFilterUsage();
};
isProtanopia.SettingChanged += delegate
{
ChangeFilter("Protanopia");
};
isProtanomaly.SettingChanged += delegate
{
ChangeFilter("Protanomaly");
};
isDeuteranopia.SettingChanged += delegate
{
ChangeFilter("Deuteranopia");
};
isDeuteranomaly.SettingChanged += delegate
{
ChangeFilter("Deuteranomaly");
};
isTritanopia.SettingChanged += delegate
{
ChangeFilter("Tritanopia");
};
isTritanomaly.SettingChanged += delegate
{
ChangeFilter("Tritanomaly");
};
isAchromatopsia.SettingChanged += delegate
{
ChangeFilter("Achromatopsia");
};
isAchromatomaly.SettingChanged += delegate
{
ChangeFilter("Achromatomaly");
};
isNormalHeealthBar.SettingChanged += delegate
{
UpdateHealthColor();
};
_NormalHpColor.SettingChanged += delegate
{
UpdateHealthColor();
};
isInternalHeealthBar.SettingChanged += delegate
{
UpdateHealthColor();
};
_InternalHpColor.SettingChanged += delegate
{
UpdateHealthColor();
};
isBossHeealthBar.SettingChanged += delegate
{
UpdateHealthColor();
};
_BossHpColor.SettingChanged += delegate
{
UpdateHealthColor();
};
isAttackEffect.SettingChanged += delegate
{
UpdateAttackEffectColor();
};
_AttackEffectColor.SettingChanged += delegate
{
UpdateAttackEffectColor();
};
defaultMaterial = new Material(Shader.Find("Sprites/Default"));
defaultColor = new Color(0.259f, 1f, 0.521f, 1f);
UpdateHealthColor();
UpdateAttackEffectColor();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ColorAssist is loaded!");
}
private void Start()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private Material[] LoadColorBlindMaterials()
{
shader = AssemblyUtils.GetEmbeddedAssetBundle("ColorAssist.Resources.shader");
return (Material[])(object)new Material[8]
{
shader.LoadAsset<Material>("Protanopia"),
shader.LoadAsset<Material>("Protanomaly"),
shader.LoadAsset<Material>("Deuteranopia"),
shader.LoadAsset<Material>("Deuteranomaly"),
shader.LoadAsset<Material>("Tritanopia"),
shader.LoadAsset<Material>("Tritanomaly"),
shader.LoadAsset<Material>("Achromatopsia"),
shader.LoadAsset<Material>("Achromatomaly")
};
}
private void UpdateFilterUsage()
{
if ((Object)(object)colorblindFilter == (Object)null)
{
AttachColorblindFilter();
}
colorblindFilter?.SetUseFilter(isEnableFilter.Value);
}
private void AttachColorblindFilter()
{
Camera[] allCameras = Camera.allCameras;
foreach (Camera val in allCameras)
{
if (((Object)((Component)val).gameObject).name == "ApplicationUICam")
{
colorblindFilter = ((Component)val).gameObject.GetComponent<ColorblindFilter>() ?? ((Component)val).gameObject.AddComponent<ColorblindFilter>();
break;
}
}
}
private void SetFilterMaterial(Material filterMaterial)
{
AttachColorblindFilter();
if ((Object)(object)colorblindFilter != (Object)null)
{
colorblindFilter.setMaterial(filterMaterial);
curFilter.Value = ((Object)filterMaterial).name;
}
}
private void ChangeFilter(string filterName)
{
string filterName2 = filterName;
Material val = Array.Find(colorBlindMaterials, (Material m) => ((Object)m).name == filterName2);
if ((Object)(object)val != (Object)null)
{
SetFilterMaterial(val);
}
isEnableFilter.Value = true;
}
private void UpdateAttackEffectColor()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0054: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "A11_S0_Boss_YiGung_回蓬萊"))
{
activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "A11_S0_Boss_YiGung"))
{
return;
}
}
MakeOutline("Animator/View/YiGung/Weapon/Foo/FooSprite", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Weapon/Sword/Effect", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Attack Effect/紅白白紅/紅/AttackEffect", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Attack Effect/紅白白紅/究極紅/AttackEffect", _AttackEffectColor.Value);
}
private void UpdateHealthColor()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
UpdateBarAndAnimator("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/HealthBarBase/HealthBar/BG renderer/RecoverableHealth", isInternalHeealthBar.Value, ConvertToColor(_InternalHpColor.Value), new Color(0.566f, 0f, 0.161f, 0.706f));
UpdateBarAndAnimator("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/MonsterHPRoot/BossHPRoot/UIBossHP(Clone)/Offset(DontKeyAnimationOnThisNode)/AnimationOffset/HealthBar/BG/MaxHealth/Internal Injury", isInternalHeealthBar.Value, ConvertToColor(_InternalHpColor.Value), new Color(0.481f, 0f, 0.242f, 1f));
UpdateBarAndAnimator("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/HealthBarBase/HealthBar/BG renderer/Health", isNormalHeealthBar.Value, ConvertToColor(_NormalHpColor.Value), new Color(0.321f, 1f, 0.678f, 1f), "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/HideUIAbilityCheck/[Activate] PlayerUI Folder/PlayerInGameUI renderer/LeftTop/HealthBarBase/HealthBar");
UpdateBarAndAnimator("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/MonsterHPRoot/BossHPRoot/UIBossHP(Clone)/Offset(DontKeyAnimationOnThisNode)/AnimationOffset/HealthBar/BG/MaxHealth/Health", isBossHeealthBar.Value, ConvertToColor(_BossHpColor.Value), new Color(1f, 0.239f, 0.324f, 1f), "GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/MonsterHPRoot/BossHPRoot/UIBossHP(Clone)");
}
private void UpdateBarAndAnimator(string barPath, bool condition, Color trueColor, Color falseColor, string animatorPath = "")
{
//IL_0037: 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)
if (!string.IsNullOrEmpty(animatorPath))
{
DisableAnimator(animatorPath);
}
GameObject val = GameObject.Find(barPath);
if (Object.op_Implicit((Object)(object)val))
{
SpriteRenderer component = val.GetComponent<SpriteRenderer>();
if (Object.op_Implicit((Object)(object)component))
{
component.color = (condition ? trueColor : falseColor);
}
}
}
private void DisableAnimator(string objectPath)
{
GameObject val = GameObject.Find(objectPath);
if (Object.op_Implicit((Object)(object)val))
{
Animator component = val.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
((Behaviour)component).enabled = false;
}
}
}
private void EnableAnimator(string objectPath)
{
GameObject val = GameObject.Find(objectPath);
if (Object.op_Implicit((Object)(object)val))
{
Animator component = val.GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component))
{
((Behaviour)component).enabled = true;
}
}
}
private Color ConvertToColor(Color colorConfig)
{
//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_0012: 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)
return new Color(colorConfig.r, colorConfig.g, colorConfig.b, colorConfig.a);
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_00cb: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
if (((Scene)(ref scene)).name == "TitleScreenMenu")
{
AttachColorblindFilter();
UpdateFilterUsage();
}
if ((Object)(object)kickHint == (Object)null)
{
GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
foreach (GameObject val in array)
{
if (((Object)val).name == "MultiSpriteEffect_Prefab 識破提示Variant")
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Object found: " + ((Object)val).name));
((BaseUnityPlugin)this).Logger.LogInfo((object)((Renderer)val.GetComponentInChildren<SpriteRenderer>()).material);
kickHint = ((Renderer)val.GetComponentInChildren<SpriteRenderer>()).material;
}
}
}
if (((Scene)(ref scene)).name == "A11_S0_Boss_YiGung_回蓬萊" || ((Scene)(ref scene)).name == "A11_S0_Boss_YiGung")
{
MakeOutline("Animator/View/YiGung/Weapon/Foo/FooSprite", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Weapon/Sword/Effect", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Attack Effect/紅白白紅/紅/AttackEffect", _AttackEffectColor.Value);
MakeOutline("Animator/View/YiGung/Attack Effect/紅白白紅/究極紅/AttackEffect", _AttackEffectColor.Value);
}
UpdateHealthColor();
}
private void MakeOutline(string path, Color color)
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.Find(path);
SpriteRenderer val = ((obj != null) ? obj.GetComponent<SpriteRenderer>() : null);
if ((Object)(object)val == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"SpriteRenderer not found at the given path.");
return;
}
((Renderer)val).material = (isAttackEffect.Value ? kickHint : defaultMaterial);
if (((Renderer)val).material.HasProperty("_OutlineColor"))
{
((Renderer)val).material.SetColor("_OutlineColor", isAttackEffect.Value ? color : defaultColor);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Outline color set successfully.");
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Material does not support _OutlineColor property.");
}
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
AssetBundle obj = shader;
if (obj != null)
{
obj.Unload(false);
}
harmony.UnpatchSelf();
}
}
public class ColorblindFilter : MonoBehaviour
{
[SerializeField]
private bool _useFilter = true;
private Material _mat;
public bool UseFilter => _useFilter;
private void Awake()
{
string value = ColorAssist.Instance.curFilter.Value;
_mat = GetMaterialByName(value) ?? ColorAssist.Instance.colorBlindMaterials[0];
}
public void setMaterial(Material m)
{
_mat = m;
}
private void OnRenderImage(RenderTexture src, RenderTexture dst)
{
if (_useFilter)
{
Graphics.Blit((Texture)(object)src, dst, _mat);
}
else
{
Graphics.Blit((Texture)(object)src, dst);
}
}
private Material GetMaterialByName(string materialName)
{
Material[] colorBlindMaterials = ColorAssist.Instance.colorBlindMaterials;
foreach (Material val in colorBlindMaterials)
{
if (((Object)val).name == materialName)
{
return val;
}
}
return null;
}
public void SetUseFilter(bool useFilter)
{
_useFilter = useFilter;
}
}
internal static class Log
{
private static ManualLogSource? logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogDebug(data);
}
}
internal static void Error(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogError(data);
}
}
internal static void Fatal(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogFatal(data);
}
}
internal static void Info(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogInfo(data);
}
}
internal static void Message(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogMessage(data);
}
}
internal static void Warning(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogWarning(data);
}
}
}
[HarmonyPatch]
public class Patches
{
[HarmonyPatch(typeof(SpriteRendererRCGExt), "Awake")]
[HarmonyPrefix]
private static bool hookSpriteRendererRCGExt(ref SpriteRendererRCGExt __instance)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (((Object)((Component)__instance).gameObject).name == "Internal Injury" && ColorAssist.Instance.isInternalHeealthBar.Value)
{
((Component)__instance).gameObject.GetComponent<SpriteRenderer>().color = ColorAssist.Instance._InternalHpColor.Value;
}
return true;
}
[HarmonyPatch(typeof(PoolManager), "Borrow", new Type[]
{
typeof(PoolObject),
typeof(Vector3),
typeof(Quaternion),
typeof(Transform),
typeof(Action<PoolObject>)
})]
[HarmonyPostfix]
public static void Postfix(ref PoolObject __result, PoolObject prefab, Vector3 position, Quaternion rotation, Transform parent = null, Action<PoolObject> handler = null)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: 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_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
Color val = (ColorAssist.Instance.isAttackEffect.Value ? ColorAssist.Instance._AttackEffectColor.Value : ColorAssist.Instance.defaultColor);
if ((Object)(object)ColorAssist.Instance.kickHint == (Object)null)
{
GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
foreach (GameObject val2 in array)
{
if (((Object)val2).name == "MultiSpriteEffect_Prefab 識破提示Variant")
{
ColorAssist.Instance.kickHint = ((Renderer)val2.GetComponentInChildren<SpriteRenderer>()).material;
}
}
}
Material material = (ColorAssist.Instance.isAttackEffect.Value ? ColorAssist.Instance.kickHint : ColorAssist.Instance.defaultMaterial);
if (((Object)prefab).name == "Effect_TaiDanger")
{
SpriteRenderer component = ((Component)((Component)__result).transform.Find("Sprite")).GetComponent<SpriteRenderer>();
if ((Object)(object)ColorAssist.Instance.kickHint != (Object)null)
{
((Renderer)component).material = material;
if (((Renderer)component).material.HasProperty("_OutlineColor"))
{
((Renderer)component).material.SetColor("_OutlineColor", val);
}
else
{
Debug.LogWarning((object)"Material does not have '_OutlineColor' property.");
}
}
}
if (((Object)prefab).name == "MultiSpriteEffect_Prefab 識破提示Variant")
{
SpriteRenderer component2 = ((Component)((Component)__result).transform.Find("View").Find("Sprite")).GetComponent<SpriteRenderer>();
if (((Renderer)component2).material.HasProperty("_OutlineColor"))
{
((Renderer)component2).material.SetColor("_OutlineColor", val);
}
else
{
Debug.LogWarning((object)"Material does not have '_OutlineColor' property.");
}
}
if (((Object)prefab).name == "紅閃 FullScreen Slash FX Damage Danger")
{
Transform val3 = ((Component)__result).transform.Find("Animator");
string[] array2 = new string[3] { "Line", "SHape", "SHape 2" };
foreach (string text in array2)
{
SpriteRenderer component3 = ((Component)val3.Find(text)).GetComponent<SpriteRenderer>();
((Renderer)component3).material = material;
if (((Renderer)component3).material.HasProperty("_OutlineColor"))
{
((Renderer)component3).material.SetColor("_OutlineColor", val);
}
else
{
Debug.LogWarning((object)("Material in " + text + " does not have '_OutlineColor' property."));
}
}
}
if (((Object)prefab).name == "UIBossHP" && ColorAssist.Instance.isBossHeealthBar.Value)
{
((Behaviour)((Component)__result).GetComponent<Animator>()).enabled = false;
((Component)((Component)__result).transform.Find("Offset(DontKeyAnimationOnThisNode)").Find("AnimationOffset").Find("HealthBar")
.Find("BG")
.Find("MaxHealth")
.Find("Health")).GetComponent<SpriteRenderer>().color = ColorAssist.Instance._BossHpColor.Value;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ColorAssist";
public const string PLUGIN_NAME = "ColorAssist";
public const string PLUGIN_VERSION = "1.0.0";
}
}