using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BRCStyleMeter;
using BRCStyleMeter.Compat;
using BRCStyleMeter.Patches;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MovementPlus;
using Reptile;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("MovementPlus")]
[assembly: AssemblyCompany("[rewind]")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+60507f14375188a6f46000836e81c44d33a8ad5f")]
[assembly: AssemblyProduct("BRCStyleMeter")]
[assembly: AssemblyTitle("rewind.BRCStyleMeter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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;
}
}
}
[HarmonyPatch(typeof(GameplayUI))]
public class GameplayUIPatch
{
[HarmonyPostfix]
[HarmonyPatch("Init")]
public static void Init(GameplayUI __instance)
{
Plugin.ui = __instance;
((Component)__instance.gameplayScreen).gameObject.AddComponent<UI>();
}
}
namespace BRCStyleMeter
{
public class Config
{
public class GeneralSection
{
public enum AlignOptions
{
Left,
Right,
TopLeft,
TopRight,
TopCenter
}
public enum VisibilityOptions
{
[Description("Always meter & rank")]
AlwaysVisible,
[Description("Only during combo")]
OnlyInCombo,
[Description("Always meter, no rank")]
AlwaysVisibleButRankHidden,
[Description("Meter only during combo, no rank")]
OnlyInComboButRankHidden,
[Description("Always rank, no log")]
AlwaysVisibleButLogHidden,
[Description("Rank only during combo, no log")]
OnlyInComboButLogHidden
}
public enum LabelSources
{
GraffitiNew,
TricksInCombo,
[Description("TargetScore (NOTE: several color issues rn)")]
TargetScore,
Information,
Context,
Rep,
ScoreMultiplier
}
public ConfigEntry<AlignOptions> Align { get; } = config.Bind<AlignOptions>(category, "Alignment", AlignOptions.Left, "Position of the style meter on screen.");
public ConfigEntry<AlignOptions> AlignLog { get; } = config.Bind<AlignOptions>(category, "Alignment (Trick log)", AlignOptions.Left, "Position of the trick log on screen.");
public ConfigEntry<VisibilityOptions> Visibility { get; } = config.Bind<VisibilityOptions>(category, "Visibility", VisibilityOptions.OnlyInCombo, "When the style meter is visible.");
public ConfigEntry<int> Displayed { get; } = config.Bind<int>(category, "Displayed Tricks", 6, "Number of recent tricks displayed in the style meter.");
public ConfigEntry<bool> ReverseOrder { get; } = config.Bind<bool>(category, "Reverse Trick Order", false, "When enabled, newest tricks appear at the top instead of the bottom.");
public ConfigEntry<float> MinAlpha { get; } = config.Bind<float>(category, "Minimum fade", 0.2f, new ConfigDescription("How transparent the text is at its most faded.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
public ConfigEntry<LabelSources> RankLabel { get; } = config.Bind<LabelSources>(category, "Source (Label)", LabelSources.TargetScore, "Font source for the rank display.");
public ConfigEntry<LabelSources> LogLabel { get; } = config.Bind<LabelSources>(category, "Source (Log)", LabelSources.GraffitiNew, "Font source for the trick log display.");
public GeneralSection(ConfigFile config, string category)
{
}//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
}
public class FormattingSection
{
public ConfigEntry<string> Format { get; } = config.Bind<string>(category, "Trick Formatting", "+ {name}", "Text format for displaying a trick.\n {name} — Trick name.");
public ConfigEntry<string> FormatCons { get; } = config.Bind<string>(category, "Trick Formatting (Consecutive)", "+ {name} (x{amt})", "Format used when the same trick is performed consecutively.\n {name} — Trick name\n {amt} — Consecutive count.");
public FormattingSection(ConfigFile config, string category)
{
}
}
public class ColorsSection
{
public ConfigEntry<Color> CoreColor1 { get; } = config.Bind<Color>(category, "Primary Color", new Color(0.95686275f, 0.827451f, 22f / 85f, 1f), "Main color used for core elements.");
public ConfigEntry<Color> CoreColor2 { get; } = config.Bind<Color>(category, "Secondary Color", new Color(2f / 15f, 9f / 85f, 0.050980393f, 1f), "Secondary accent color.");
public ConfigEntry<Color> TextColor { get; } = config.Bind<Color>(category, "Text Color", Color.white, "Color used for trick log text.");
public ColorsSection(ConfigFile config, string category)
{
}//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
}
public class ListsSection
{
private const string DefaultRanks = "Crusty:-1,Bombastic:1500,Ace!:4000,Smokin':8000,Straight Stylin':20000,ALL CITY:50000";
private const string RanksDescription = "Defines the ranks and their score thresholds.\nFormat: \"RankName:<score>,...\" (Requires full restart)";
private const string DefaultBlacklist = "";
private const string BlacklistDescription = "Trick names to exclude, separated by '|'. (Requires full restart)";
public ConfigEntry<string> RanksSetting { get; }
public ConfigEntry<string> BlacklistSetting { get; }
public List<RankEntry> Ranks { get; }
public HashSet<string> MoveBlacklist { get; }
public ListsSection(ConfigFile config, string category)
{
RanksSetting = config.Bind<string>(category, "Ranks", "Crusty:-1,Bombastic:1500,Ace!:4000,Smokin':8000,Straight Stylin':20000,ALL CITY:50000", "Defines the ranks and their score thresholds.\nFormat: \"RankName:<score>,...\" (Requires full restart)");
BlacklistSetting = config.Bind<string>(category, "Blacklist", "", "Trick names to exclude, separated by '|'. (Requires full restart)");
Ranks = ParseRanks(RanksSetting.Value);
MoveBlacklist = ParseBlacklist(BlacklistSetting.Value);
}
private static List<RankEntry> ParseRanks(string raw)
{
List<RankEntry> list = new List<RankEntry>();
string[] array = raw.Split(new char[1] { ',' });
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split(new char[1] { ':' });
if (array2.Length == 2 && float.TryParse(array2[1].Trim(), out var result))
{
list.Add(new RankEntry(array2[0].Trim(), result));
}
}
list.Sort((RankEntry a, RankEntry b) => a.Score.CompareTo(b.Score));
return list;
}
private static HashSet<string> ParseBlacklist(string raw)
{
HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
if (!string.IsNullOrWhiteSpace(raw))
{
string[] array = raw.Split(new char[1] { '|' });
foreach (string text in array)
{
hashSet.Add(text.Trim());
}
}
return hashSet;
}
}
public GeneralSection General = new GeneralSection(config, "General");
public FormattingSection Formatting = new FormattingSection(config, "Formatting");
public ColorsSection Colors = new ColorsSection(config, "Colors");
public ListsSection Lists = new ListsSection(config, "Lists");
public Config(ConfigFile config)
{
}
}
public struct RankEntry
{
public string Name;
public float Score;
public RankEntry(string name, float score)
{
Name = name;
Score = score;
}
}
[BepInPlugin("rewind.BRCStyleMeter", "BRCStyleMeter", "1.0.0")]
[BepInProcess("Bomb Rush Cyberfunk.exe")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
public static Harmony HarmonyInstance { get; private set; }
public static Config CFG { get; private set; }
public static GameplayUI ui { get; set; }
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
Instance = this;
CFG = new Config(((BaseUnityPlugin)this).Config);
HarmonyInstance = new Harmony("rewind.BRCStyleMeter");
HarmonyInstance.PatchAll();
if (MovementPlusCompat.Enabled)
{
MovementPlusCompat.ApplyPatches(HarmonyInstance);
}
foreach (RankEntry rank in CFG.Lists.Ranks)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$"{rank.Name} requires {rank.Score} points");
}
}
}
public class Util
{
public static string CompleteTags(string input)
{
Stack<string> stack = new Stack<string>();
StringBuilder stringBuilder = new StringBuilder(input);
for (int i = 0; i < input.Length; i++)
{
if (input[i] == '<')
{
int num = input.IndexOf('>', i);
if (num == -1)
{
break;
}
bool flag = input[i + 1] == '/';
int num2 = i + ((!flag) ? 1 : 2);
string text = input.Substring(num2, num - num2);
int num3 = text.IndexOf('=');
if (num3 != -1)
{
text = text.Substring(0, num3);
}
if (text.StartsWith("#"))
{
text = "color";
}
if (!flag)
{
stack.Push(text);
}
else if (stack.Count > 0 && stack.Peek().Equals(text, StringComparison.OrdinalIgnoreCase))
{
stack.Pop();
}
i = num;
}
}
while (stack.Count > 0)
{
stringBuilder.Append("</" + stack.Pop() + ">");
}
return stringBuilder.ToString();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "rewind.BRCStyleMeter";
public const string PLUGIN_NAME = "BRCStyleMeter";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BRCStyleMeter.Patches
{
public class UI : MonoBehaviour
{
private TextMeshProUGUI rankLabel;
private TextMeshProUGUI trickLogLabel;
private static Config.GeneralSection Cfg => Plugin.CFG.General;
private static Config.ColorsSection Colors => Plugin.CFG.Colors;
public static UI Instance { get; private set; }
public bool LogVisible { get; private set; } = true;
public bool RankVisible { get; private set; } = true;
private void Awake()
{
Instance = this;
Plugin.CFG.General.Align.SettingChanged += delegate
{
Refresh();
};
Plugin.CFG.General.AlignLog.SettingChanged += delegate
{
Refresh();
};
Plugin.CFG.General.RankLabel.SettingChanged += delegate
{
RebuildUI();
};
Plugin.CFG.General.LogLabel.SettingChanged += delegate
{
RebuildUI();
};
Plugin.CFG.Colors.CoreColor1.SettingChanged += delegate
{
Refresh();
};
Plugin.CFG.Colors.CoreColor2.SettingChanged += delegate
{
Refresh();
};
Plugin.CFG.Colors.TextColor.SettingChanged += delegate
{
Refresh();
};
BuildUI();
}
private void BuildUI()
{
GameplayUI value = Traverse.Create((object)Core.Instance.UIManager).Field<GameplayUI>("gameplay").Value;
RectTransform component = ((Component)value.gameplayScreen).GetComponent<RectTransform>();
(TMP_FontAsset font, Material mat) tuple = ResolveLabel(value, Cfg.RankLabel.Value);
TMP_FontAsset item = tuple.font;
Material item2 = tuple.mat;
(TMP_FontAsset font, Material mat) tuple2 = ResolveLabel(value, Cfg.LogLabel.Value);
TMP_FontAsset item3 = tuple2.font;
Material item4 = tuple2.mat;
rankLabel = CreateLabel("StyleMeterRank", item, 48f, component);
((TMP_Text)rankLabel).fontMaterial = item2;
trickLogLabel = CreateLabel("StyleMeterTrickLog", item3, 28f, component);
((TMP_Text)trickLogLabel).fontMaterial = item4;
Refresh();
}
private void RebuildUI()
{
if ((Object)(object)rankLabel != (Object)null)
{
Object.Destroy((Object)(object)((Component)rankLabel).gameObject);
}
if ((Object)(object)trickLogLabel != (Object)null)
{
Object.Destroy((Object)(object)((Component)trickLogLabel).gameObject);
}
BuildUI();
}
private static (TMP_FontAsset font, Material mat) ResolveLabel(GameplayUI gameplay, Config.GeneralSection.LabelSources option)
{
TextMeshProUGUI val = (TextMeshProUGUI)(option switch
{
Config.GeneralSection.LabelSources.GraffitiNew => gameplay.graffitiNewLabel,
Config.GeneralSection.LabelSources.TricksInCombo => gameplay.tricksInComboLabel,
Config.GeneralSection.LabelSources.TargetScore => gameplay.targetScoreLabel,
Config.GeneralSection.LabelSources.Information => gameplay.informationLabel,
Config.GeneralSection.LabelSources.Context => gameplay.contextLabel,
Config.GeneralSection.LabelSources.Rep => gameplay.repLabel,
Config.GeneralSection.LabelSources.ScoreMultiplier => gameplay.scoreMultiplierLabel,
_ => gameplay.targetScoreLabel,
});
return (((TMP_Text)val).font, ((TMP_Text)val).fontMaterial);
}
public void Refresh()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0085: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
var (anchor, pivot, alignment, position) = GetRankAlignmentData(Cfg.Align.Value);
var (anchor2, pivot2, alignment2, position2) = GetLogAlignmentData(Cfg.AlignLog.Value);
ApplyLayout(rankLabel, 48f, alignment, anchor, pivot, position);
ApplyLayout(trickLogLabel, 28f, alignment2, anchor2, pivot2, position2);
((TMP_Text)rankLabel).faceColor = Color32.op_Implicit(Colors.CoreColor1.Value);
((TMP_Text)rankLabel).outlineColor = Color32.op_Implicit(Colors.CoreColor2.Value);
}
private static TextMeshProUGUI CreateLabel(string name, TMP_FontAsset font, float fontSize, RectTransform parent)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
TextMeshProUGUI obj = new GameObject(name).AddComponent<TextMeshProUGUI>();
((TMP_Text)obj).font = font;
((TMP_Text)obj).fontSize = fontSize;
((TMP_Text)obj).enableWordWrapping = false;
((TMP_Text)obj).text = string.Empty;
((Transform)((TMP_Text)obj).rectTransform).SetParent((Transform)(object)parent, false);
return obj;
}
private static void ApplyLayout(TextMeshProUGUI label, float fontSize, TextAlignmentOptions alignment, Vector2 anchor, Vector2 pivot, Vector2 position)
{
//IL_0008: 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_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_0025: 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)
((TMP_Text)label).fontSize = fontSize;
((TMP_Text)label).alignment = alignment;
RectTransform rectTransform = ((TMP_Text)label).rectTransform;
Vector2 anchorMin = (rectTransform.anchorMax = anchor);
rectTransform.anchorMin = anchorMin;
rectTransform.pivot = pivot;
rectTransform.anchoredPosition = position;
}
private static (Vector2 anchor, Vector2 pivot, TextAlignmentOptions align, Vector2 pos) GetRankAlignmentData(Config.GeneralSection.AlignOptions align)
{
//IL_0027: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
return align switch
{
Config.GeneralSection.AlignOptions.Right => (new Vector2(1f, 0.5f), new Vector2(1f, 0f), (TextAlignmentOptions)516, new Vector2(-40f, 80f)),
Config.GeneralSection.AlignOptions.TopLeft => (new Vector2(0f, 1f), new Vector2(0f, 1f), (TextAlignmentOptions)257, new Vector2(40f, -40f)),
Config.GeneralSection.AlignOptions.TopCenter => (new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), (TextAlignmentOptions)258, new Vector2(0f, -40f)),
Config.GeneralSection.AlignOptions.TopRight => (new Vector2(1f, 1f), new Vector2(1f, 1f), (TextAlignmentOptions)260, new Vector2(-40f, -40f)),
_ => (new Vector2(0f, 0.5f), new Vector2(0f, 0f), (TextAlignmentOptions)513, new Vector2(40f, 80f)),
};
}
private static (Vector2 anchor, Vector2 pivot, TextAlignmentOptions align, Vector2 pos) GetLogAlignmentData(Config.GeneralSection.AlignOptions align)
{
//IL_0027: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
return align switch
{
Config.GeneralSection.AlignOptions.Right => (new Vector2(1f, 0.5f), new Vector2(1f, 1f), (TextAlignmentOptions)260, new Vector2(-40f, 60f)),
Config.GeneralSection.AlignOptions.TopLeft => (new Vector2(0f, 1f), new Vector2(0f, 1f), (TextAlignmentOptions)257, new Vector2(40f, -80f)),
Config.GeneralSection.AlignOptions.TopCenter => (new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), (TextAlignmentOptions)258, new Vector2(0f, -80f)),
Config.GeneralSection.AlignOptions.TopRight => (new Vector2(1f, 1f), new Vector2(1f, 1f), (TextAlignmentOptions)260, new Vector2(-40f, -80f)),
_ => (new Vector2(0f, 0.5f), new Vector2(0f, 1f), (TextAlignmentOptions)257, new Vector2(40f, 60f)),
};
}
public void SetRank(string rank)
{
((TMP_Text)rankLabel).text = rank;
}
public void SetTrickLog(string tricks)
{
((TMP_Text)trickLogLabel).text = tricks;
}
public void SetVisible(bool logVisible, bool rankVisible)
{
LogVisible = logVisible;
RankVisible = rankVisible;
TextMeshProUGUI obj = rankLabel;
if (obj != null)
{
((Component)obj).gameObject.SetActive(RankVisible);
}
TextMeshProUGUI obj2 = trickLogLabel;
if (obj2 != null)
{
((Component)obj2).gameObject.SetActive(LogVisible);
}
}
}
[HarmonyPatch(typeof(Player))]
internal class PlayerPatch
{
private struct TrickEntry
{
public TrickType Type;
public string Name;
public int Number;
public int Count;
public TrickEntry(TrickType type, string name, int number, int count = 1)
{
//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)
Type = type;
Name = name;
Number = number;
Count = count;
}
}
public static Player CurrentPlayer = null;
public static bool pendingClear = false;
private static readonly List<TrickEntry> TrickHistory = new List<TrickEntry>();
private static string CurrentRank = "";
private static Config Cfg => Plugin.CFG;
[HarmonyPatch("UpdatePlayer")]
[HarmonyPostfix]
private static void Player_UpdatePlayer_Postfix(Player __instance)
{
bool flag = __instance.IsComboing();
switch (Cfg.General.Visibility.Value)
{
case Config.GeneralSection.VisibilityOptions.AlwaysVisible:
UI.Instance.SetVisible(logVisible: true, rankVisible: true);
break;
case Config.GeneralSection.VisibilityOptions.OnlyInCombo:
UI.Instance.SetVisible(flag, flag);
break;
case Config.GeneralSection.VisibilityOptions.AlwaysVisibleButRankHidden:
UI.Instance.SetVisible(logVisible: true, rankVisible: false);
break;
case Config.GeneralSection.VisibilityOptions.OnlyInComboButRankHidden:
UI.Instance.SetVisible(flag, rankVisible: false);
break;
case Config.GeneralSection.VisibilityOptions.AlwaysVisibleButLogHidden:
UI.Instance.SetVisible(logVisible: false, rankVisible: true);
break;
case Config.GeneralSection.VisibilityOptions.OnlyInComboButLogHidden:
UI.Instance.SetVisible(logVisible: false, flag);
break;
}
}
[HarmonyPatch("Init")]
[HarmonyPostfix]
private static void Player_Init_Postfix(Player __instance)
{
if (!__instance.isAI)
{
CurrentPlayer = __instance;
}
}
[HarmonyPatch("DoTrick")]
[HarmonyPostfix]
private static void Player_DoTrick_Postfix(Player __instance, TrickType type, string trickName, int trickNum)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.isAI)
{
SharedDoTrick(__instance, type, trickName, trickNum);
}
}
public static void SharedDoTrick(Player player, TrickType type, string trickName = "", int trickNum = -1)
{
//IL_00a0: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
if (pendingClear)
{
TrickHistory.Clear();
pendingClear = false;
}
if (Cfg.Lists.MoveBlacklist.Contains(trickName))
{
return;
}
if (TrickHistory.Count > 0)
{
int index = TrickHistory.Count - 1;
TrickEntry value = TrickHistory[index];
if (value.Name == trickName && value.Type == type)
{
value.Count++;
TrickHistory[index] = value;
}
else
{
TrickHistory.Add(new TrickEntry(type, trickName, trickNum));
}
}
else
{
TrickHistory.Add(new TrickEntry(type, trickName, trickNum));
}
UpdateLog(player);
UpdateRank(player);
}
[HarmonyPatch("DropCombo")]
[HarmonyPatch("LandCombo")]
[HarmonyPostfix]
private static void Player_DropCombo_LandCombo_Postfix(Player __instance)
{
if (!CurrentPlayer.IsComboing())
{
pendingClear = true;
}
}
public static void UpdateRank(Player player)
{
UI instance = UI.Instance;
if (!((Object)(object)instance == (Object)null))
{
CurrentRank = GetRank(Cfg.Lists.Ranks, player.baseScore * player.scoreMultiplier).Name;
instance.SetRank(CurrentRank);
}
}
public static void UpdateLog(Player player)
{
UI instance = UI.Instance;
if (!((Object)(object)instance == (Object)null))
{
int value = Cfg.General.Displayed.Value;
int num = Mathf.Max(0, TrickHistory.Count - value);
List<TrickEntry> range = TrickHistory.GetRange(num, TrickHistory.Count - num);
int count = range.Count;
List<string> list = new List<string>(count);
for (int i = 0; i < count; i++)
{
TrickEntry trickEntry = range[i];
string trickFormat = GetTrickFormat(trickEntry.Name, trickEntry.Count);
int num2 = count - 1 - i;
float alpha = ((count == 1) ? 1f : Mathf.Lerp(1f, Cfg.General.MinAlpha.Value, (float)num2 / (float)(count - 1)));
list.Add(WrapWithHexAlpha(trickFormat, alpha));
}
if (Cfg.General.ReverseOrder.Value)
{
list.Reverse();
}
instance.SetTrickLog(string.Join("\n", list));
}
}
private static string GetTrickFormat(string name, int count)
{
return ((count > 1) ? Cfg.Formatting.FormatCons.Value : Cfg.Formatting.Format.Value).Replace("{name}", Util.CompleteTags(name)).Replace("{amt}", count.ToString());
}
private static string WrapWithHexAlpha(string text, float alpha)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
int num = Mathf.Clamp(Mathf.RoundToInt(alpha * 255f), 0, 255);
string arg = ColorUtility.ToHtmlStringRGB(Cfg.Colors.TextColor.Value);
return $"<color=#{arg}{num:X2}>{text}</color>";
}
public static RankEntry GetRank(List<RankEntry> ranks, float score)
{
RankEntry result = new RankEntry("No Rank", -999f);
foreach (RankEntry rank in ranks)
{
if (score >= rank.Score)
{
result = rank;
continue;
}
break;
}
return result;
}
}
}
namespace BRCStyleMeter.Compat
{
internal static class MovementPlusCompat
{
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled.GetValueOrDefault();
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.yuril.MovementPlus");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void ApplyPatches(Harmony harmony)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.Method(typeof(MPTrickManager), "DoTrick", (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(MovementPlusCompat), "MPTrickManager_PostFix_Dotrick", (Type[])null, (Type[])null);
harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
public static void MPTrickManager_PostFix_Dotrick(string name, int points)
{
if ((Object)(object)PlayerPatch.CurrentPlayer == (Object)null)
{
return;
}
int num = name.LastIndexOf(" x ");
if (num >= 0)
{
int num2 = num + 3;
if (num2 < name.Length && int.TryParse(name.Substring(num2), out var _))
{
name = name.Substring(0, num).TrimEnd(Array.Empty<char>());
}
}
PlayerPatch.SharedDoTrick(PlayerPatch.CurrentPlayer, (TrickType)0, name);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}