Decompiled source of BoostColors v1.1.0

BoostColors.dll

Decompiled a year ago
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BoostColors.Patches;
using BoostColors.Properties;
using HarmonyLib;
using Reptile;
using TMPro;
using UnityEngine;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BoostColors")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Change the colors of the boost effects.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("BoostColors")]
[assembly: AssemblyTitle("BoostColors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace BoostColors
{
	public static class Assets
	{
		public static AssetBundle bundle = AssetBundle.LoadFromMemory(Resources.boostcolors);

		public static Texture SwirlColorPalletes = bundle.LoadAsset<Texture>("assets/SwirlColorPalletes.png");

		public static Texture effectTex = bundle.LoadAsset<Texture>("assets/effectTex.png");

		public static Texture GetBoostpackTexture(BoostColor color)
		{
			return bundle.LoadAsset<Texture>($"assets/boost{color}Tex.png");
		}

		public static Texture GetTrailTexture(BoostColor color)
		{
			return bundle.LoadAsset<Texture>($"assets/{color}ToAlpha.png");
		}

		public static float GetSwirlColorIndex(BoostColor color)
		{
			if (1 == 0)
			{
			}
			float result = color switch
			{
				BoostColor.Red => 0.031f, 
				BoostColor.Orange => 0.094f, 
				BoostColor.Yellow => 0.157f, 
				BoostColor.Lime => 0.219f, 
				BoostColor.Green => 0.281f, 
				BoostColor.Teal => 0.344f, 
				BoostColor.LightBlue => 0.406f, 
				BoostColor.Blue => 0.469f, 
				BoostColor.DarkBlue => 0.531f, 
				BoostColor.Indigo => 0.594f, 
				BoostColor.Purple => 0.656f, 
				BoostColor.Magenta => 0.719f, 
				BoostColor.Pink => 0.781f, 
				BoostColor.White => 0.844f, 
				BoostColor.Gray => 0.906f, 
				BoostColor.Black => 0.969f, 
				_ => 0.406f, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public static Vector2 GetFrictionColorOffset(BoostColor color)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			Vector2 result = (Vector2)(color switch
			{
				BoostColor.Red => new Vector2(0.01f, 0f), 
				BoostColor.Orange => new Vector2(0.01f, -0.16f), 
				BoostColor.Yellow => new Vector2(0.01f, -0.32f), 
				BoostColor.Lime => new Vector2(0.01f, -0.48f), 
				BoostColor.Green => new Vector2(0.01f, -0.64f), 
				BoostColor.Teal => new Vector2(0.01f, -0.8f), 
				BoostColor.LightBlue => new Vector2(0.33f, 0f), 
				BoostColor.Blue => new Vector2(0.33f, -0.16f), 
				BoostColor.DarkBlue => new Vector2(0.33f, -0.32f), 
				BoostColor.Indigo => new Vector2(0.33f, -0.48f), 
				BoostColor.Purple => new Vector2(0.33f, -0.64f), 
				BoostColor.Magenta => new Vector2(0.66f, 0f), 
				BoostColor.Pink => new Vector2(0.66f, -0.16f), 
				BoostColor.White => new Vector2(0.66f, -0.32f), 
				BoostColor.Gray => new Vector2(0.66f, -0.48f), 
				BoostColor.Black => new Vector2(0.66f, -0.64f), 
				_ => new Vector2(0.33f, 0f), 
			});
			if (1 == 0)
			{
			}
			return result;
		}

		public static Sprite GetComboFillSprite(BoostColor color)
		{
			if (!Core.configSetUIColors.Value)
			{
				return bundle.LoadAsset<Sprite>("assets/comboTimerFill.png");
			}
			return bundle.LoadAsset<Sprite>($"assets/comboTimerFill{color}.png");
		}

		public static Sprite GetComboBGSprite(BoostColor color)
		{
			if (!Core.configSetUIColors.Value)
			{
				return bundle.LoadAsset<Sprite>("assets/comboTimerBG.png");
			}
			return bundle.LoadAsset<Sprite>($"assets/comboTimerBG{color}.png");
		}

		public static Color32 GetTextFaceColor(BoostColor color)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			if (!Core.configSetUIColors.Value)
			{
				return new Color32((byte)244, (byte)211, (byte)66, byte.MaxValue);
			}
			if (1 == 0)
			{
			}
			Color32 result = (Color32)(color switch
			{
				BoostColor.Red => new Color32((byte)244, (byte)84, (byte)66, byte.MaxValue), 
				BoostColor.Orange => new Color32((byte)244, (byte)146, (byte)66, byte.MaxValue), 
				BoostColor.Yellow => new Color32((byte)244, (byte)211, (byte)66, byte.MaxValue), 
				BoostColor.Lime => new Color32((byte)196, (byte)244, (byte)65, byte.MaxValue), 
				BoostColor.Green => new Color32((byte)119, (byte)244, (byte)66, byte.MaxValue), 
				BoostColor.Teal => new Color32((byte)65, (byte)244, (byte)163, byte.MaxValue), 
				BoostColor.LightBlue => new Color32((byte)66, (byte)226, (byte)244, byte.MaxValue), 
				BoostColor.Blue => new Color32((byte)0, (byte)165, byte.MaxValue, byte.MaxValue), 
				BoostColor.DarkBlue => new Color32((byte)66, (byte)84, (byte)245, byte.MaxValue), 
				BoostColor.Indigo => new Color32((byte)118, (byte)0, byte.MaxValue, byte.MaxValue), 
				BoostColor.Purple => new Color32((byte)191, (byte)66, (byte)245, byte.MaxValue), 
				BoostColor.Magenta => new Color32((byte)245, (byte)66, (byte)135, byte.MaxValue), 
				BoostColor.Pink => new Color32((byte)247, (byte)116, (byte)201, byte.MaxValue), 
				BoostColor.White => new Color32((byte)229, (byte)229, (byte)229, byte.MaxValue), 
				BoostColor.Gray => new Color32((byte)127, (byte)127, (byte)127, byte.MaxValue), 
				BoostColor.Black => new Color32((byte)36, (byte)36, (byte)36, byte.MaxValue), 
				_ => new Color32((byte)244, (byte)211, (byte)66, byte.MaxValue), 
			});
			if (1 == 0)
			{
			}
			return result;
		}

		public static Color32 GetTextOutlineColor(BoostColor color)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			if (!Core.configSetUIColors.Value)
			{
				return new Color32((byte)34, (byte)27, (byte)13, byte.MaxValue);
			}
			if (1 == 0)
			{
			}
			Color32 result = (Color32)(color switch
			{
				BoostColor.Red => new Color32((byte)33, (byte)15, (byte)13, byte.MaxValue), 
				BoostColor.Orange => new Color32((byte)33, (byte)26, (byte)13, byte.MaxValue), 
				BoostColor.Yellow => new Color32((byte)34, (byte)27, (byte)13, byte.MaxValue), 
				BoostColor.Lime => new Color32((byte)28, (byte)33, (byte)13, byte.MaxValue), 
				BoostColor.Green => new Color32((byte)15, (byte)33, (byte)13, byte.MaxValue), 
				BoostColor.Teal => new Color32((byte)13, (byte)33, (byte)24, byte.MaxValue), 
				BoostColor.LightBlue => new Color32((byte)13, (byte)31, (byte)33, byte.MaxValue), 
				BoostColor.Blue => new Color32((byte)13, (byte)26, (byte)33, byte.MaxValue), 
				BoostColor.DarkBlue => new Color32((byte)13, (byte)15, (byte)33, byte.MaxValue), 
				BoostColor.Indigo => new Color32((byte)22, (byte)13, (byte)33, byte.MaxValue), 
				BoostColor.Purple => new Color32((byte)27, (byte)13, (byte)33, byte.MaxValue), 
				BoostColor.Magenta => new Color32((byte)33, (byte)13, (byte)20, byte.MaxValue), 
				BoostColor.Pink => new Color32((byte)33, (byte)13, (byte)26, byte.MaxValue), 
				BoostColor.White => new Color32((byte)33, (byte)33, (byte)33, byte.MaxValue), 
				BoostColor.Gray => new Color32((byte)16, (byte)16, (byte)16, byte.MaxValue), 
				BoostColor.Black => new Color32((byte)127, (byte)127, (byte)127, byte.MaxValue), 
				_ => new Color32((byte)34, (byte)27, (byte)13, byte.MaxValue), 
			});
			if (1 == 0)
			{
			}
			return result;
		}
	}
	[BepInPlugin("trpg.brc.boostcolors", "BoostColors", "1.1.0")]
	public class Core : BaseUnityPlugin
	{
		public const string PluginGUID = "trpg.brc.boostcolors";

		public const string PluginName = "BoostColors";

		public const string PluginVersion = "1.1.0";

		public static Core Instance;

		public static ManualLogSource Logger = Logger.CreateLogSource("BoostColors");

		public static ConfigEntry<bool> configSetUIColors;

		public static ConfigEntry<BoostColor> configPrimaryColor;

		public static ConfigEntry<BoostColor> configSecondaryColor;

		public GameplayUI ui;

		public Image chargeBar;

		public SkinnedMeshRenderer boostpackPrimaryEffect;

		public SkinnedMeshRenderer boostpackSecondaryEffect;

		public TrailRenderer boostpackTrail;

		public SkinnedMeshRenderer frictionPrimaryEffect1;

		public SkinnedMeshRenderer frictionPrimaryEffect2;

		public SkinnedMeshRenderer frictionSecondaryEffect1;

		public SkinnedMeshRenderer frictionSecondaryEffect2;

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Logger.LogInfo((object)"BoostColors is loaded.");
			Instance = this;
			Harmony val = new Harmony("BoostColors");
			val.PatchAll(typeof(BaseModule_HandleStageFullyLoaded_Patch));
			val.PatchAll(typeof(Player_SetCharacter_Patch));
			val.PatchAll(typeof(Core_OnApplicationFocus_Patch));
			configSetUIColors = ((BaseUnityPlugin)this).Config.Bind<bool>("Colors", "configSetUIColors", true, "Set text and combo bar colors");
			configPrimaryColor = ((BaseUnityPlugin)this).Config.Bind<BoostColor>("Colors", "configPrimaryColor", BoostColor.Yellow, "Primary boost color");
			configSecondaryColor = ((BaseUnityPlugin)this).Config.Bind<BoostColor>("Colors", "configSecondaryColor", BoostColor.LightBlue, "Secondary boost color");
		}

		public void FindVFX()
		{
			if (Core.Instance.BaseModule.IsPlayingInStage)
			{
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				Traverse val = Traverse.Create((object)currentPlayer);
				PlayerVisualEffects vFX = val.Field<CharacterVisual>("characterVisual").Value.VFX;
				ui = val.Field<GameplayUI>("ui").Value;
				chargeBar = ui.chargeBar;
				boostpackPrimaryEffect = ((Component)vFX.boostpackEffect.transform.Find("boostMesh")).GetComponent<SkinnedMeshRenderer>();
				boostpackSecondaryEffect = ((Component)vFX.boostpackBlueEffect.transform.Find("boostMesh")).GetComponent<SkinnedMeshRenderer>();
				boostpackTrail = vFX.boostpackTrail.GetComponent<TrailRenderer>();
				frictionPrimaryEffect1 = ((Component)vFX.frictionEffect.transform.Find("Cylinder015")).GetComponent<SkinnedMeshRenderer>();
				frictionPrimaryEffect2 = ((Component)vFX.frictionEffect.transform.Find("Cylinder016")).GetComponent<SkinnedMeshRenderer>();
				frictionSecondaryEffect1 = ((Component)vFX.frictionBlueEffect.transform.Find("Cylinder015")).GetComponent<SkinnedMeshRenderer>();
				frictionSecondaryEffect2 = ((Component)vFX.frictionBlueEffect.transform.Find("Cylinder016")).GetComponent<SkinnedMeshRenderer>();
			}
		}

		public void SetTextures()
		{
			if ((Object)(object)frictionSecondaryEffect2 == (Object)null)
			{
				Logger.LogWarning((object)"Not all VFX components were found.");
				return;
			}
			((Graphic)chargeBar).material.SetTexture("_ColorTex", Assets.SwirlColorPalletes);
			((Renderer)frictionPrimaryEffect1).material.SetTexture("_MainTex", Assets.effectTex);
			((Renderer)frictionPrimaryEffect2).material.SetTexture("_MainTex", Assets.effectTex);
			((Renderer)frictionSecondaryEffect1).material.SetTexture("_MainTex", Assets.effectTex);
			((Renderer)frictionSecondaryEffect2).material.SetTexture("_MainTex", Assets.effectTex);
		}

		public void SetColors(BoostColor primary, BoostColor secondary)
		{
			if (!Core.Instance.BaseModule.IsPlayingInStage)
			{
				Logger.LogWarning((object)"Can't set colors because player is not currently in stage.");
				return;
			}
			if ((Object)(object)frictionSecondaryEffect2 == (Object)null)
			{
				Logger.LogWarning((object)"Not all components were found.");
				return;
			}
			Logger.LogInfo((object)$"Setting colors ({primary}, {secondary})");
			SetUIColor(primary);
			SetComboColors(primary, secondary);
			SetBarPrimaryColor(primary);
			SetBarSecondaryColor(secondary);
			SetBoostPrimaryColor(primary);
			SetBoostSecondaryColor(secondary);
			SetBoostTrailColor(primary);
			SetFrictionPrimaryColor(primary);
			SetFrictionSecondaryColor(secondary);
		}

		public void SetUIColor(BoostColor color)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ui == (Object)null)
			{
				Logger.LogWarning((object)"Can't set UI colors because GameplayUI is null!");
				return;
			}
			((TMP_Text)ui.scoreCalcLabel).faceColor = Assets.GetTextFaceColor(color);
			((TMP_Text)ui.scoreCalcLabel).outlineColor = Assets.GetTextOutlineColor(color);
			((TMP_Text)ui.targetScoreLabel).faceColor = Assets.GetTextFaceColor(color);
			((TMP_Text)ui.targetScoreLabel).outlineColor = Assets.GetTextOutlineColor(color);
			((TMP_Text)ui.totalScoreLabel).faceColor = Assets.GetTextFaceColor(color);
			((TMP_Text)ui.totalScoreLabel).outlineColor = Assets.GetTextOutlineColor(color);
		}

		public void SetComboColors(BoostColor primary, BoostColor secondary)
		{
			if ((Object)(object)ui == (Object)null)
			{
				Logger.LogWarning((object)"Can't set UI colors because GameplayUI is null!");
				return;
			}
			ui.comboTimeOutBar.sprite = Assets.GetComboFillSprite(primary);
			ui.comboTimeOutBackdrop.sprite = Assets.GetComboBGSprite(secondary);
		}

		public void SetBarPrimaryColor(BoostColor color)
		{
			if ((Object)(object)chargeBar == (Object)null)
			{
				Logger.LogWarning((object)"Can't set charge bar color because chargeBar is null!");
			}
			else
			{
				ui.chargeBarTrickingColorIndex = Assets.GetSwirlColorIndex(color);
			}
		}

		public void SetBarSecondaryColor(BoostColor color)
		{
			if ((Object)(object)chargeBar == (Object)null)
			{
				Logger.LogWarning((object)"Can't set charge bar color because chargeBar is null!");
			}
			else
			{
				ui.chargeBarDefaultColorIndex = Assets.GetSwirlColorIndex(color);
			}
		}

		public void SetBoostPrimaryColor(BoostColor color)
		{
			if ((Object)(object)boostpackPrimaryEffect == (Object)null)
			{
				Logger.LogWarning((object)"Can't set boost primary color because boostpackPrimaryEffect is null!");
			}
			else
			{
				((Renderer)boostpackPrimaryEffect).material.SetTexture("_ScreenSpaceTexture", Assets.GetBoostpackTexture(color));
			}
		}

		public void SetBoostSecondaryColor(BoostColor color)
		{
			if ((Object)(object)boostpackSecondaryEffect == (Object)null)
			{
				Logger.LogWarning((object)"Can't set boost secondary color because boostpackSecondaryEffect is null!");
			}
			else
			{
				((Renderer)boostpackSecondaryEffect).material.SetTexture("_ScreenSpaceTexture", Assets.GetBoostpackTexture(color));
			}
		}

		public void SetBoostTrailColor(BoostColor color)
		{
			if ((Object)(object)boostpackTrail == (Object)null)
			{
				Logger.LogWarning((object)"Can't set boost trail color because boostpackTrail is null!");
			}
			else
			{
				((Renderer)boostpackTrail).material.SetTexture("_MainTex", Assets.GetTrailTexture(color));
			}
		}

		public void SetFrictionPrimaryColor(BoostColor color)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)frictionPrimaryEffect1 == (Object)null || (Object)(object)frictionPrimaryEffect2 == (Object)null)
			{
				Logger.LogWarning((object)"Can't set friction primary color because a SkinnedMeshRenderer is null!");
				return;
			}
			((Renderer)frictionPrimaryEffect1).material.mainTextureOffset = Assets.GetFrictionColorOffset(color);
			((Renderer)frictionPrimaryEffect2).material.mainTextureOffset = Assets.GetFrictionColorOffset(color);
		}

		public void SetFrictionSecondaryColor(BoostColor color)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)frictionSecondaryEffect1 == (Object)null || (Object)(object)frictionSecondaryEffect2 == (Object)null)
			{
				Logger.LogWarning((object)"Can't set friction secondary color because a SkinnedMeshRenderer is null!");
				return;
			}
			((Renderer)frictionSecondaryEffect1).material.mainTextureOffset = Assets.GetFrictionColorOffset(color);
			((Renderer)frictionSecondaryEffect2).material.mainTextureOffset = Assets.GetFrictionColorOffset(color);
		}

		public Material GetImageMaterial(Image image)
		{
			return ((Graphic)image).material;
		}
	}
	public enum BoostColor
	{
		Red,
		Orange,
		Yellow,
		Lime,
		Green,
		Teal,
		LightBlue,
		Blue,
		DarkBlue,
		Purple,
		Indigo,
		Magenta,
		Pink,
		White,
		Gray,
		Black
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BoostColors";

		public const string PLUGIN_NAME = "BoostColors";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace BoostColors.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("BoostColors.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] boostcolors
		{
			get
			{
				object @object = ResourceManager.GetObject("boostcolors", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace BoostColors.Patches
{
	[HarmonyPatch(typeof(BaseModule), "HandleStageFullyLoaded")]
	public class BaseModule_HandleStageFullyLoaded_Patch
	{
		public static void Postfix()
		{
			Core.Instance.FindVFX();
			Core.Instance.SetTextures();
			Core.Instance.SetColors(Core.configPrimaryColor.Value, Core.configSecondaryColor.Value);
			Core.Instance.ui.SetTrickingChargeBarActive(false);
		}
	}
	[HarmonyPatch(typeof(Core), "OnApplicationFocus")]
	public class Core_OnApplicationFocus_Patch
	{
		public static void Prefix(bool focus)
		{
			if (!focus)
			{
				return;
			}
			((BaseUnityPlugin)Core.Instance).Config.Reload();
			if (Core.Instance.BaseModule.IsPlayingInStage)
			{
				Core.Instance.SetColors(Core.configPrimaryColor.Value, Core.configSecondaryColor.Value);
				if (WorldHandler.instance.GetCurrentPlayer().IsComboing())
				{
					Core.Instance.ui.SetTrickingChargeBarActive(true);
				}
				else
				{
					Core.Instance.ui.SetTrickingChargeBarActive(false);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Player), "SetCharacter")]
	public class Player_SetCharacter_Patch
	{
		public static void Postfix(Player __instance, Characters setChar, int setOutfit = 0)
		{
			if (!Core.Instance.BaseModule.IsLoading && !Traverse.Create((object)__instance).Field<bool>("isAI").Value)
			{
				Core.Instance.FindVFX();
				Core.Instance.SetTextures();
				Core.Instance.SetColors(Core.configPrimaryColor.Value, Core.configSecondaryColor.Value);
			}
		}
	}
}