Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BaconRPG v1.1.1
BepInEx/plugins/BaconRPG.dll
Decompiled 3 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BaconGameRules; using BaconShared; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using MoreShipUpgrades.API; using MoreShipUpgrades.Misc.Upgrades; using MoreShipUpgrades.UI.TerminalNodes; using Steamworks; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.UI; [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("BaconRPG")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BaconRPG")] [assembly: AssemblyTitle("BaconRPG")] [assembly: AssemblyMetadata("AI_Assisted_Creation", "Code generated with Claude Code, Anthropic's AI coding agent")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 BaconShared { internal enum FxMode { Full, Reduced, Off } internal enum Ease { Linear, OutCubic, InCubic, OutBack, InOutSine, Smooth, Overshoot } internal static class Fx { private struct Tween { internal int Id; internal bool Owned; internal Component Owner; internal float Start; internal float Duration; internal Ease Ease; internal Action<float> Step; internal Action Done; } private struct Wobble { internal RectTransform Rect; internal bool Scale; internal float Start; internal float Duration; internal float Amount; internal float Hz; internal float Last; } private struct Count { internal TMP_Text Text; internal string Format; internal float From; internal float To; internal float Value; internal float Start; internal float Duration; internal float NextTick; internal bool Sound; } private struct Typing { internal TMP_Text Text; internal float Start; internal float Rate; internal float TickVolume; internal int Total; internal int Shown; internal int TickEvery; internal Action Done; } private struct Decrypting { internal TMP_Text Text; internal string Final; internal char[] Buffer; internal float Start; internal float Duration; internal float Next; } private struct Glitching { internal TMP_Text Text; internal string Source; internal TMP_MeshInfo[] Cache; internal float End; internal float Next; } internal sealed class Brackets { private readonly Image[] _arms = (Image[])(object)new Image[8]; private RectTransform _root; private Color _color; internal float Arm; internal float Thickness; internal float From; internal float To; internal bool Breathe; private float _start; private float _out = -1f; internal RectTransform Target { get; private set; } internal Color Color { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _color; } set { //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_0023: Unknown result type (might be due to invalid IL or missing references) _color = value; for (int i = 0; i < _arms.Length; i++) { if ((Object)(object)_arms[i] != (Object)null) { ((Graphic)_arms[i]).color = value; } } } } internal bool Shown { get { if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf) { return (Object)(object)Target != (Object)null; } return false; } } internal Brackets(Color color, float arm, float thickness, float from, float to) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) _color = color; Arm = arm; Thickness = thickness; From = from; To = to; } internal void Attach(RectTransform target, bool animate = true) { if ((Object)(object)target == (Object)null) { Hide(); return; } if ((Object)(object)_root == (Object)null) { Build(target); } bool num = (Object)(object)Target != (Object)(object)target || !((Component)_root).gameObject.activeSelf; Target = target; if ((Object)(object)((Transform)_root).parent != (Object)(object)target) { ((Transform)_root).SetParent((Transform)(object)target, false); } UiKit.Stretch(_root); ((Transform)_root).SetAsLastSibling(); ((Component)_root).gameObject.SetActive(true); if (!Rigs.Contains(this)) { Rigs.Add(this); } if (num) { _start = (animate ? Now : (Now - 0.12f)); _out = -1f; Place((Mode == FxMode.Off || !animate) ? To : From); } } internal void Hide() { Target = null; if ((Object)(object)_root != (Object)null) { ((Component)_root).gameObject.SetActive(false); } } private void Build(RectTransform target) { //IL_0035: 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_007c: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_008e: Unknown result type (might be due to invalid IL or missing references) _root = UiKit.Empty((Transform)(object)target, "Brackets"); Vector2 val2 = default(Vector2); for (int i = 0; i < 8; i++) { Image val = ((Component)UiKit.Empty((Transform)(object)_root, "Arm")).gameObject.AddComponent<Image>(); ((Graphic)val).color = _color; ((Graphic)val).raycastTarget = false; RectTransform rectTransform = ((Graphic)val).rectTransform; int num = i / 2; ((Vector2)(ref val2))..ctor((num >= 2) ? 1f : 0f, (num % 2 == 1) ? 1f : 0f); Vector2 val3 = (rectTransform.pivot = val2); Vector2 anchorMin = (rectTransform.anchorMax = val3); rectTransform.anchorMin = anchorMin; _arms[i] = val; } } private void Place(float distance) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009b: Unknown result type (might be due to invalid IL or missing references) distance = Mathf.Round(distance); if (distance != _out) { _out = distance; for (int i = 0; i < 8; i++) { RectTransform rectTransform = ((Graphic)_arms[i]).rectTransform; Vector2 anchorMin = rectTransform.anchorMin; float num = ((anchorMin.x > 0.5f) ? 1f : (-1f)); float num2 = ((anchorMin.y > 0.5f) ? 1f : (-1f)); rectTransform.sizeDelta = ((i % 2 == 0) ? new Vector2(Arm, Thickness) : new Vector2(Thickness, Arm)); rectTransform.anchoredPosition = new Vector2(num * distance, num2 * distance); } } } internal bool Tick(float now) { if ((Object)(object)_root == (Object)null || (Object)(object)Target == (Object)null || !((Component)_root).gameObject.activeInHierarchy) { if ((Object)(object)_root != (Object)null) { return (Object)(object)Target != (Object)null; } return false; } float num = Mathf.Clamp01((now - _start) / 0.12f); if (num < 1f && Mode != FxMode.Off) { Place(Mathf.LerpUnclamped(From, To, OutBack(num))); return true; } if (Breathe && Mode == FxMode.Full) { Place(To + ((Mathf.Sin((now - _start) * MathF.PI) > 0f) ? 1f : 0f)); return true; } Place(To); return false; } } private struct Particle { internal Image Image; internal Vector2 Position; internal Vector2 Velocity; internal float Age; internal float Life; internal float Alpha; } internal sealed class Crt { private readonly RectTransform _window; private readonly Image _flicker; private readonly Image _tear; private readonly RawImage _roll; private readonly Color _tint; private readonly List<TMP_Text> _texts = new List<TMP_Text>(); private Material _ghost; private float _nextFlicker; private float _nextGlitch; private float _glitchEnd; private float _rollStart; private float _shownStrength = -1f; private bool _off; private const float RollSeconds = 7f; private const float RollRest = 4f; private const float RollHeight = 180f; private static readonly List<TMP_Text> Found = new List<TMP_Text>(); private static float Strength { get { if (!CrtOn || Mode == FxMode.Off) { return 0f; } return Mathf.Clamp01(CrtStrength); } } internal Crt(RectTransform window, Color tint) { //IL_0024: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01cb: Unknown result type (might be due to invalid IL or missing references) _window = window; _tint = tint; RectTransform val = UiKit.Empty((Transform)(object)window, "CRT"); UiKit.Stretch(val); ((Component)val).gameObject.AddComponent<Canvas>(); ((Component)val).gameObject.AddComponent<RectMask2D>(); _roll = ((Component)UiKit.Empty((Transform)(object)val, "Roll")).gameObject.AddComponent<RawImage>(); _roll.texture = (Texture)(object)UiKit.Band(); ((Graphic)_roll).raycastTarget = false; RectTransform rectTransform = ((Graphic)_roll).rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(1f, 1f); rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.sizeDelta = new Vector2(0f, 180f); _flicker = ((Component)UiKit.Empty((Transform)(object)val, "Flicker")).gameObject.AddComponent<Image>(); ((Graphic)_flicker).raycastTarget = false; UiKit.Stretch(((Graphic)_flicker).rectTransform); _tear = ((Component)UiKit.Empty((Transform)(object)val, "Tear")).gameObject.AddComponent<Image>(); ((Graphic)_tear).raycastTarget = false; RectTransform rectTransform2 = ((Graphic)_tear).rectTransform; rectTransform2.anchorMin = new Vector2(0f, 1f); rectTransform2.anchorMax = new Vector2(1f, 1f); rectTransform2.pivot = new Vector2(0.5f, 1f); rectTransform2.sizeDelta = new Vector2(0f, 2f); ((Graphic)_flicker).color = (((Graphic)_tear).color = (((Graphic)_roll).color = Color.clear)); _rollStart = Now; _nextGlitch = float.MaxValue; Crts.Add(this); } internal void Adopt(Transform root) { //IL_003f: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if ((Object)(object)root == (Object)null) { return; } TMP_FontAsset font = UiKit.Font; if ((Object)(object)_ghost == (Object)null && (Object)(object)font != (Object)null && (Object)(object)((TMP_Asset)font).material != (Object)null) { _ghost = new Material(((TMP_Asset)font).material) { name = "CRT ghost", hideFlags = (HideFlags)61 }; _ghost.EnableKeyword(ShaderUtilities.Keyword_Underlay); _ghost.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0.55f); _ghost.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0f); _shownStrength = -1f; } if ((Object)(object)_ghost == (Object)null) { return; } _texts.RemoveAll((TMP_Text text) => (Object)(object)text == (Object)null); ((Component)root).GetComponentsInChildren<TMP_Text>(true, Found); foreach (TMP_Text item in Found) { if (!((Object)(object)item.font != (Object)(object)font) && (!((Object)(object)item.fontSharedMaterial != (Object)(object)((TMP_Asset)font).material) || !((Object)(object)item.fontSharedMaterial != (Object)(object)_ghost))) { item.fontSharedMaterial = _ghost; if (!_texts.Contains(item)) { _texts.Add(item); } } } Found.Clear(); Ghost(0f); } internal void GlitchNow() { _nextGlitch = Now; } private void Ghost(float jump) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_ghost == (Object)null)) { float strength = Strength; _ghost.SetColor(ShaderUtilities.ID_UnderlayColor, new Color(_tint.r, _tint.g, _tint.b, 0.2f * strength)); _ghost.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, (0.3f + jump) * ((strength > 0f) ? 1f : 0f)); _ghost.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -0.06f); } } internal bool Tick(float now) { //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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_window == (Object)null || (Object)(object)_flicker == (Object)null) { _texts.RemoveAll((TMP_Text text) => (Object)(object)text == (Object)null); if ((Object)(object)_ghost != (Object)null && _texts.Count == 0) { Object.Destroy((Object)(object)_ghost); } return false; } if (!((Component)_window).gameObject.activeInHierarchy) { return true; } float strength = Strength; if (strength != _shownStrength) { _shownStrength = strength; Ghost(0f); } if (!(strength > 0f) || Mode != FxMode.Full) { if (!_off) { _off = true; Image flicker = _flicker; Image tear = _tear; Color val = (((Graphic)_roll).color = Color.clear); Color color = (((Graphic)tear).color = val); ((Graphic)flicker).color = color; _glitchEnd = 0f; Ghost(0f); } return true; } _off = false; if (now >= _nextFlicker) { _nextFlicker = now + 1f / 30f; float num = Mathf.PerlinNoise(now * 6f, 0.37f); float num2 = ((Random.value < 0.02f) ? 0.03f : 0f); ((Graphic)_flicker).color = new Color(0f, 0f, 0f, (0.012f + 0.022f * num + num2) * strength); } float num3 = (now - _rollStart) % 11f; Rect rect; if (num3 < 7f) { rect = _window.rect; float height = ((Rect)(ref rect)).height; ((Graphic)_roll).rectTransform.anchoredPosition = new Vector2(0f, 0f - Mathf.Lerp(-180f, height, num3 / 7f)); ((Graphic)_roll).color = new Color(_tint.r, _tint.g, _tint.b, 0.035f * strength); } else if (((Graphic)_roll).color.a != 0f) { ((Graphic)_roll).color = Color.clear; } if (now >= _nextGlitch) { _nextGlitch = float.MaxValue; _glitchEnd = now + Random.Range(0.06f, 0.11f); RectTransform rectTransform = ((Graphic)_tear).rectTransform; float num4 = Random.Range(0.1f, 0.9f); rect = _window.rect; rectTransform.anchoredPosition = new Vector2(0f, 0f - Mathf.Round(num4 * ((Rect)(ref rect)).height)); ((Graphic)_tear).color = new Color(_tint.r, _tint.g, _tint.b, 0.14f * strength); Ghost(Random.Range(0.4f, 0.8f)); TMP_Text val3 = PickText(); if ((Object)(object)val3 != (Object)null) { Glitch(val3, _glitchEnd - now); } } else if (_glitchEnd > 0f && now >= _glitchEnd) { _glitchEnd = 0f; ((Graphic)_tear).color = Color.clear; Ghost(0f); } return true; } private TMP_Text PickText() { for (int i = 0; i < 6; i++) { if (_texts.Count <= 0) { break; } int index = Random.Range(0, _texts.Count); TMP_Text val = _texts[index]; if ((Object)(object)val == (Object)null) { _texts.RemoveAt(index); } else if (!IsTyping(val) && !IsDecrypting(val) && !Rolling(val) && ((Component)val).gameObject.activeInHierarchy && val.textInfo != null && val.textInfo.characterCount > 0) { return val; } } return null; } } internal static FxMode Mode = FxMode.Full; internal static bool CrtOn = true; internal static float CrtStrength = 0.6f; internal const float ReducedSeconds = 0.12f; internal const float LargeFlashCap = 0.25f; private static readonly List<Tween> Tweens = new List<Tween>(); private static int _nextId; private static readonly List<Wobble> Wobbles = new List<Wobble>(); private static readonly List<Count> Counts = new List<Count>(); private const float TickEvery = 0.035f; private static readonly List<Typing> Typings = new List<Typing>(); private static readonly List<Decrypting> Decrypts = new List<Decrypting>(); private const string Scramble = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#$%&*+=?"; private static readonly List<Glitching> Glitches = new List<Glitching>(); private static readonly List<Brackets> Rigs = new List<Brackets>(); private const int PoolSize = 64; private static readonly Particle[] Particles = new Particle[64]; private static RectTransform _burstRoot; private static int _alive; private static int _nextParticle; private static readonly List<Crt> Crts = new List<Crt>(); private static float Now => Time.unscaledTime; internal static bool Full => Mode == FxMode.Full; internal static float OutCubic(float t) { float num = 1f - t; return 1f - num * num * num; } internal static float InCubic(float t) { return t * t * t; } internal static float OutBack(float t) { float num = t - 1f; return 1f + 2.70158f * num * num * num + 1.70158f * num * num; } internal static float InOutSine(float t) { return 0.5f - 0.5f * Mathf.Cos(MathF.PI * t); } internal static float Smooth(float t) { return t * t * (3f - 2f * t); } internal static float Overshoot(float t) { float num = t - 1f; return 1f + 2f * num * num * num + 1f * num * num; } internal static float Eval(Ease ease, float t) { return ease switch { Ease.OutCubic => OutCubic(t), Ease.InCubic => InCubic(t), Ease.OutBack => OutBack(t), Ease.InOutSine => InOutSine(t), Ease.Smooth => Smooth(t), Ease.Overshoot => Overshoot(t), _ => t, }; } internal static void Tick() { float now = Now; TickTweens(now); TickWobbles(now); TickCounts(now); TickTyping(now); TickDecrypts(now); TickGlitches(now); TickBrackets(now); TickBurst(now); TickCrts(now); } private static void Report(string what, Exception e) { UiKit.Log?.Invoke("Fx " + what + " failed: " + e.Message); } internal static int Run(Component owner, float duration, Action<float> step, Ease ease = Ease.OutCubic, float delay = 0f, Action done = null) { if (Mode == FxMode.Off || duration <= 0f) { step?.Invoke(1f); done?.Invoke(); return 0; } if (Mode == FxMode.Reduced) { duration = Mathf.Min(duration, 0.12f); delay = Mathf.Min(delay, 0.12f); } return Add(owner, duration, step, ease, delay, done); } private static int Add(Component owner, float duration, Action<float> step, Ease ease, float delay, Action done) { int num = ++_nextId; Tweens.Add(new Tween { Id = num, Owned = (owner != null), Owner = owner, Start = Now + delay, Duration = Mathf.Max(duration, 0.0001f), Ease = ease, Step = step, Done = done }); step?.Invoke(Eval(ease, 0f)); return num; } internal static void Cancel(int id) { End(id, finish: false); } internal static void Finish(int id) { End(id, finish: true); } private static void End(int id, bool finish) { if (id == 0) { return; } for (int i = 0; i < Tweens.Count; i++) { Tween tween = Tweens[i]; if (tween.Id == id) { Tweens[i] = default(Tween); if (finish) { Complete(tween); } break; } } } internal static void CancelAll(Component owner) { for (int i = 0; i < Tweens.Count; i++) { if (Tweens[i].Id != 0 && Tweens[i].Owned && (Object)(object)Tweens[i].Owner == (Object)(object)owner) { Tweens[i] = default(Tween); } } } internal static bool Running(int id) { if (id == 0) { return false; } for (int i = 0; i < Tweens.Count; i++) { if (Tweens[i].Id == id) { return true; } } return false; } private static void Complete(Tween tween) { try { tween.Step?.Invoke(1f); tween.Done?.Invoke(); } catch (Exception e) { Report("tween", e); } } private static void TickTweens(float now) { int count = Tweens.Count; for (int i = 0; i < count; i++) { Tween tween = Tweens[i]; if (tween.Id == 0) { continue; } if (tween.Owned && ((Object)(object)tween.Owner == (Object)null || !tween.Owner.gameObject.activeInHierarchy)) { Tweens[i] = default(Tween); } else { if (now < tween.Start) { continue; } float num = Mathf.Clamp01((now - tween.Start) / tween.Duration); if (num >= 1f) { Tweens[i] = default(Tween); Complete(tween); continue; } try { tween.Step?.Invoke(Eval(tween.Ease, num)); } catch (Exception e) { Tweens[i] = default(Tween); Report("tween", e); } } } Compact(Tweens); } private static void Compact(List<Tween> list) { int num = 0; for (int i = 0; i < list.Count; i++) { if (list[i].Id != 0) { list[num++] = list[i]; } } if (num < list.Count) { list.RemoveRange(num, list.Count - num); } } internal static void Flash(Graphic graphic, Color color, float peak, float duration, bool large = true) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)graphic == (Object)null || Mode == FxMode.Off) { return; } if (large) { peak = Mathf.Min(peak, 0.25f); } CancelAll((Component)(object)graphic); Run((Component)(object)graphic, duration, delegate(float t) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)graphic != (Object)null) { graphic.color = new Color(color.r, color.g, color.b, peak * (1f - t)); } }); } internal static void Shake(RectTransform rect, float pixels = 7f, float duration = 0.28f, float hz = 30f) { if (!((Object)(object)rect == (Object)null) && Mode == FxMode.Full) { AddWobble(rect, scale: false, pixels, duration, hz); } } internal static void Punch(RectTransform rect, float amount = 0.06f, float duration = 0.25f, float hz = 8f) { if (!((Object)(object)rect == (Object)null) && Mode != FxMode.Off) { if (Mode == FxMode.Reduced) { duration = Mathf.Min(duration, 0.12f); } AddWobble(rect, scale: true, amount, duration, hz); } } private static void AddWobble(RectTransform rect, bool scale, float amount, float duration, float hz) { for (int i = 0; i < Wobbles.Count; i++) { Wobble value = Wobbles[i]; if (!((Object)(object)value.Rect != (Object)(object)rect) && value.Scale == scale) { value.Start = Now; value.Duration = duration; value.Amount = amount; value.Hz = hz; Wobbles[i] = value; return; } } Wobbles.Add(new Wobble { Rect = rect, Scale = scale, Start = Now, Duration = duration, Amount = amount, Hz = hz, Last = (scale ? 1f : 0f) }); } private static void TickWobbles(float now) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00cd: 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_00f1: Unknown result type (might be due to invalid IL or missing references) for (int num = Wobbles.Count - 1; num >= 0; num--) { Wobble value = Wobbles[num]; if ((Object)(object)value.Rect == (Object)null) { Wobbles.RemoveAt(num); } else { float num2 = Mathf.Clamp01((now - value.Start) / value.Duration); float num3 = (1f - num2) * (1f - num2); float num4 = Mathf.Sin((now - value.Start) * value.Hz * 2f * MathF.PI) * num3; if (value.Scale) { float num5 = ((num2 >= 1f) ? 1f : (1f + value.Amount * num4)); Vector3 localScale = ((Transform)value.Rect).localScale; float num6 = localScale.x / value.Last * num5; float num7 = localScale.y / value.Last * num5; ((Transform)value.Rect).localScale = new Vector3(num6, num7, localScale.z); value.Last = num5; } else { float num8 = ((num2 >= 1f) ? 0f : Mathf.Round(value.Amount * num4)); RectTransform rect = value.Rect; rect.anchoredPosition += new Vector2(num8 - value.Last, 0f); value.Last = num8; } if (num2 >= 1f) { Wobbles.RemoveAt(num); } else { Wobbles[num] = value; } } } } internal static void Roll(TMP_Text text, float from, float to, float duration = 0.6f, string format = "{0}", bool sound = true) { if ((Object)(object)text == (Object)null) { return; } for (int i = 0; i < Counts.Count; i++) { if ((Object)(object)Counts[i].Text == (Object)(object)text) { from = Counts[i].Value; Counts.RemoveAt(i); break; } } if (Mode == FxMode.Off || duration <= 0f || Mathf.Approximately(from, to)) { text.SetText(format, Mathf.Round(to)); if (sound && !Mathf.Approximately(from, to)) { Sfx.Play(Cue.TickDone); } return; } if (Mode == FxMode.Reduced) { duration = Mathf.Min(duration, 0.12f); } Counts.Add(new Count { Text = text, Format = format, From = from, To = to, Value = from, Start = Now, Duration = duration, Sound = sound }); text.SetText(format, Mathf.Round(from)); } internal static bool Rolling(TMP_Text text) { for (int i = 0; i < Counts.Count; i++) { if ((Object)(object)Counts[i].Text == (Object)(object)text) { return true; } } return false; } private static void TickCounts(float now) { for (int num = Counts.Count - 1; num >= 0; num--) { Count value = Counts[num]; if ((Object)(object)value.Text == (Object)null) { Counts.RemoveAt(num); } else { float num2 = Mathf.Clamp01((now - value.Start) / value.Duration); float num3 = Mathf.Lerp(value.From, value.To, OutCubic(num2)); if (Mathf.Round(num3) != Mathf.Round(value.Value)) { value.Text.SetText(value.Format, Mathf.Round(num3)); } value.Value = num3; if (num2 >= 1f) { Counts.RemoveAt(num); if (value.Sound) { Sfx.Play(Cue.TickDone); } } else { if (value.Sound && now >= value.NextTick) { value.NextTick = now + 0.035f; Sfx.Play(Cue.Tick); } Counts[num] = value; } } } } internal static void Type(TMP_Text text, float charsPerSecond, float delay = 0f, int ticksEvery = 0, Action done = null, float tickVolume = 1f) { if ((Object)(object)text == (Object)null) { return; } StopTyping(text, finish: false); text.ForceMeshUpdate(true, true); int characterCount = text.textInfo.characterCount; if (Mode == FxMode.Off || characterCount == 0 || charsPerSecond <= 0f) { text.maxVisibleCharacters = 99999; done?.Invoke(); return; } if (Mode == FxMode.Reduced) { charsPerSecond = Mathf.Max(charsPerSecond, (float)characterCount / 0.12f); delay = Mathf.Min(delay, 0.12f); ticksEvery = 0; } text.maxVisibleCharacters = 0; Typings.Add(new Typing { Text = text, Start = Now + delay, Rate = charsPerSecond, TickVolume = tickVolume, Total = characterCount, TickEvery = ticksEvery, Done = done }); } internal static bool IsTyping(TMP_Text text) { for (int i = 0; i < Typings.Count; i++) { if ((Object)(object)Typings[i].Text == (Object)(object)text) { return true; } } return false; } internal static void Skip(TMP_Text text) { StopTyping(text, finish: true); for (int num = Decrypts.Count - 1; num >= 0; num--) { if ((Object)(object)Decrypts[num].Text == (Object)(object)text) { text.SetText(Decrypts[num].Final, true); Decrypts.RemoveAt(num); } } for (int num2 = Counts.Count - 1; num2 >= 0; num2--) { if ((Object)(object)Counts[num2].Text == (Object)(object)text) { text.SetText(Counts[num2].Format, Mathf.Round(Counts[num2].To)); Counts.RemoveAt(num2); } } } private static void StopTyping(TMP_Text text, bool finish) { for (int num = Typings.Count - 1; num >= 0; num--) { if (!((Object)(object)Typings[num].Text != (Object)(object)text)) { Typing typing = Typings[num]; Typings.RemoveAt(num); if (finish) { if ((Object)(object)text != (Object)null) { text.maxVisibleCharacters = 99999; } typing.Done?.Invoke(); } } } } private static void TickTyping(float now) { for (int num = Typings.Count - 1; num >= 0; num--) { Typing value = Typings[num]; if ((Object)(object)value.Text == (Object)null) { Typings.RemoveAt(num); } else if (!(now < value.Start)) { int num2 = Mathf.Min(value.Total, Mathf.FloorToInt((now - value.Start) * value.Rate)); if (num2 > value.Shown) { if (value.TickEvery > 0 && num2 / value.TickEvery != value.Shown / value.TickEvery) { Sfx.Play(Cue.Key, value.TickVolume); } value.Shown = num2; value.Text.maxVisibleCharacters = num2; } if (num2 >= value.Total) { Typings.RemoveAt(num); value.Text.maxVisibleCharacters = 99999; try { value.Done?.Invoke(); } catch (Exception e) { Report("typing", e); } } else { Typings[num] = value; } } } } internal static void Decrypt(TMP_Text text, string final, float duration = 0.5f) { if ((Object)(object)text == (Object)null) { return; } final = final ?? ""; char[] array = null; for (int num = Decrypts.Count - 1; num >= 0; num--) { if ((Object)(object)Decrypts[num].Text == (Object)(object)text) { array = Decrypts[num].Buffer; Decrypts.RemoveAt(num); } } if (Mode != FxMode.Full || duration <= 0f || final.Length == 0) { text.SetText(final, true); return; } if (array == null || array.Length < final.Length) { array = new char[final.Length]; } Decrypts.Add(new Decrypting { Text = text, Final = final, Buffer = array, Start = Now, Duration = duration }); Fill(Decrypts[Decrypts.Count - 1], 0f); } private static void Fill(Decrypting decrypt, float t) { string final = decrypt.Final; int num = Mathf.FloorToInt(t * (float)final.Length); for (int i = 0; i < final.Length; i++) { char c = final[i]; decrypt.Buffer[i] = ((i < num || c == ' ') ? c : "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#$%&*+=?"[Random.Range(0, "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#$%&*+=?".Length)]); } decrypt.Text.SetCharArray(decrypt.Buffer, 0, final.Length); } internal static bool IsDecrypting(TMP_Text text) { for (int i = 0; i < Decrypts.Count; i++) { if ((Object)(object)Decrypts[i].Text == (Object)(object)text) { return true; } } return false; } private static void TickDecrypts(float now) { for (int num = Decrypts.Count - 1; num >= 0; num--) { Decrypting decrypting = Decrypts[num]; if ((Object)(object)decrypting.Text == (Object)null) { Decrypts.RemoveAt(num); } else { float num2 = Mathf.Clamp01((now - decrypting.Start) / decrypting.Duration); if (num2 >= 1f) { decrypting.Text.SetText(decrypting.Final, true); Decrypts.RemoveAt(num); } else if (!(now < decrypting.Next)) { decrypting.Next = now + 1f / 30f; Fill(decrypting, num2); Decrypts[num] = decrypting; } } } } internal static void Glitch(TMP_Text text, float duration = 0.15f) { if ((Object)(object)text == (Object)null || Mode != FxMode.Full || !((Component)text).gameObject.activeInHierarchy) { return; } for (int i = 0; i < Glitches.Count; i++) { if ((Object)(object)Glitches[i].Text == (Object)(object)text) { Glitching value = Glitches[i]; value.End = Mathf.Max(value.End, Now + duration); Glitches[i] = value; return; } } Glitching glitch = new Glitching { Text = text, End = Now + duration }; Recopy(ref glitch); Glitches.Add(glitch); } private static void Recopy(ref Glitching glitch) { glitch.Text.ForceMeshUpdate(true, true); glitch.Source = glitch.Text.text; glitch.Cache = glitch.Text.textInfo.CopyMeshInfoVertexData(); } private static bool Restore(Glitching glitch) { TMP_TextInfo textInfo = glitch.Text.textInfo; if (glitch.Cache == null || textInfo.meshInfo == null || textInfo.meshInfo.Length < glitch.Cache.Length) { return false; } for (int i = 0; i < glitch.Cache.Length; i++) { Vector3[] vertices = glitch.Cache[i].vertices; Vector3[] vertices2 = textInfo.meshInfo[i].vertices; if (vertices == null || vertices2 == null || vertices2.Length < vertices.Length) { return false; } Array.Copy(vertices, vertices2, vertices.Length); } return true; } private static void TickGlitches(float now) { for (int num = Glitches.Count - 1; num >= 0; num--) { Glitching glitch = Glitches[num]; if ((Object)(object)glitch.Text == (Object)null) { Glitches.RemoveAt(num); } else { bool flag = (object)glitch.Text.text != glitch.Source; if (now >= glitch.End || !((Component)glitch.Text).gameObject.activeInHierarchy) { if (!flag && Restore(glitch)) { glitch.Text.UpdateVertexData((TMP_VertexDataUpdateFlags)1); } Glitches.RemoveAt(num); } else if (!(now < glitch.Next)) { glitch.Next = now + 0.05f; if (flag) { Recopy(ref glitch); } if (Restore(glitch)) { Tear(glitch.Text); } Glitches[num] = glitch; } } } } private static void Tear(TMP_Text text) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0087: Unknown result type (might be due to invalid IL or missing references) TMP_TextInfo textInfo = text.textInfo; if (textInfo.lineCount == 0) { return; } TMP_LineInfo val = textInfo.lineInfo[Random.Range(0, textInfo.lineCount)]; float num = ((Random.value < 0.5f) ? (-Random.Range(1, 3)) : Random.Range(1, 3)); for (int i = val.firstCharacterIndex; i <= val.lastCharacterIndex && i < textInfo.characterCount; i++) { TMP_CharacterInfo val2 = textInfo.characterInfo[i]; if (val2.isVisible) { Vector3[] vertices = textInfo.meshInfo[val2.materialReferenceIndex].vertices; for (int j = 0; j < 4; j++) { vertices[val2.vertexIndex + j].x += num; } } } text.UpdateVertexData((TMP_VertexDataUpdateFlags)1); } internal static RectTransform Stamp(Transform parent, string word, Color color, float size = 30f, float hold = 0.6f, Vector2 at = default(Vector2)) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) RectTransform holder = UiKit.Empty(parent, "Stamp"); RectTransform obj = holder; RectTransform obj2 = holder; RectTransform obj3 = holder; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj3.pivot = val; Vector2 anchorMin = (obj2.anchorMax = val); obj.anchorMin = anchorMin; holder.anchoredPosition = at; Image obj4 = ((Component)UiKit.Empty((Transform)(object)holder, "Plate")).gameObject.AddComponent<Image>(); ((Graphic)obj4).color = new Color(0.02f, 0.03f, 0.02f, 0.92f); ((Graphic)obj4).raycastTarget = false; UiKit.Stretch(((Graphic)obj4).rectTransform); TextMeshProUGUI obj5 = UiKit.Text((Transform)(object)holder, word, size, color, (TextAlignmentOptions)514); ((TMP_Text)obj5).fontStyle = (FontStyles)1; ((TMP_Text)obj5).characterSpacing = 4f; Vector2 preferredValues = ((TMP_Text)obj5).GetPreferredValues(word); holder.sizeDelta = new Vector2(preferredValues.x + size * 0.9f, preferredValues.y + size * 0.35f); UiKit.Stretch(((TMP_Text)obj5).rectTransform); UiKit.SoftFrame((Transform)(object)holder, color); CanvasGroup group = ((Component)holder).gameObject.AddComponent<CanvasGroup>(); group.blocksRaycasts = false; group.interactable = false; ((Transform)holder).SetAsLastSibling(); Run(null, 0.1f, delegate(float t) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)holder == (Object)null)) { float num = Mathf.Lerp(1.25f, 1f, t); ((Transform)holder).localScale = new Vector3(num, num, 1f); } }); Add(null, 0.2f, delegate(float t) { if ((Object)(object)group != (Object)null) { group.alpha = 1f - t; } }, Ease.Linear, 0.1f + hold, delegate { if ((Object)(object)holder != (Object)null) { Object.Destroy((Object)(object)((Component)holder).gameObject); } }); if (Mode == FxMode.Off && (Object)(object)holder != (Object)null) { ((Transform)holder).localScale = Vector3.one; } return holder; } internal static Brackets NewBrackets(Color color, float arm = 12f, float thickness = 2f, float from = 8f, float to = 3f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return new Brackets(color, arm, thickness, from, to); } private static void TickBrackets(float now) { for (int num = Rigs.Count - 1; num >= 0; num--) { bool flag; try { flag = Rigs[num].Tick(now); } catch (Exception e) { flag = false; Report("brackets", e); } if (!flag) { Rigs.RemoveAt(num); } } } internal static void Burst(RectTransform at, Color color, int count = 16, float speed = 260f, bool diamonds = false) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_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_010c: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)at == (Object)null || Mode != FxMode.Full) { return; } Canvas componentInParent = ((Component)at).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent == (Object)null) { return; } Transform transform = ((Component)componentInParent.rootCanvas).transform; if ((Object)(object)_burstRoot == (Object)null) { _burstRoot = UiKit.Empty(transform, "Burst"); ((Component)_burstRoot).gameObject.AddComponent<Canvas>(); for (int i = 0; i < 64; i++) { Image val = ((Component)UiKit.Empty((Transform)(object)_burstRoot, "Bit")).gameObject.AddComponent<Image>(); ((Graphic)val).raycastTarget = false; ((Behaviour)val).enabled = false; Particles[i] = new Particle { Image = val }; } } if ((Object)(object)((Transform)_burstRoot).parent != (Object)(object)transform) { ((Transform)_burstRoot).SetParent(transform, false); } UiKit.Stretch(_burstRoot); ((Transform)_burstRoot).SetAsLastSibling(); RectTransform burstRoot = _burstRoot; Rect rect = at.rect; Vector2 val2 = Vector2.op_Implicit(((Transform)burstRoot).InverseTransformPoint(((Transform)at).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center)))); count = Mathf.Min(count, 64); Vector2 val3 = default(Vector2); for (int j = 0; j < count; j++) { int nextParticle = _nextParticle; _nextParticle = (_nextParticle + 1) % 64; Particle particle = Particles[nextParticle]; if (!((Object)(object)particle.Image == (Object)null)) { if (!((Behaviour)particle.Image).enabled) { _alive++; } float num = Random.value * MathF.PI * 2f; float num2 = Mathf.Round(Random.Range(2f, 5f)); particle.Position = val2; particle.Velocity = new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * speed * Random.Range(0.35f, 1f); particle.Age = 0f; particle.Life = Random.Range(0.45f, 0.8f); particle.Alpha = Mathf.Min(0.7f, color.a); RectTransform rectTransform = ((Graphic)particle.Image).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0.5f); rectTransform.pivot = val3; Vector2 anchorMin = (rectTransform.anchorMax = val3); rectTransform.anchorMin = anchorMin; rectTransform.sizeDelta = new Vector2(num2, num2); ((Transform)rectTransform).localRotation = (diamonds ? Quaternion.Euler(0f, 0f, 45f) : Quaternion.identity); rectTransform.anchoredPosition = val2; ((Graphic)particle.Image).color = new Color(color.r, color.g, color.b, particle.Alpha); ((Behaviour)particle.Image).enabled = true; Particles[nextParticle] = particle; } } } private static void TickBurst(float now) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00e4: 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_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_00fa: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (_alive <= 0) { return; } if ((Object)(object)_burstRoot == (Object)null) { _alive = 0; return; } float num = Mathf.Min(Time.unscaledDeltaTime, 0.05f); int num2 = 0; for (int i = 0; i < 64; i++) { Particle particle = Particles[i]; if (!((Object)(object)particle.Image == (Object)null) && ((Behaviour)particle.Image).enabled) { particle.Age += num; if (particle.Age >= particle.Life || Mode != FxMode.Full) { ((Behaviour)particle.Image).enabled = false; Particles[i] = particle; continue; } ref Vector2 velocity = ref particle.Velocity; velocity *= 1f - 3.5f * num; particle.Velocity.y -= 120f * num; ref Vector2 position = ref particle.Position; position += particle.Velocity * num; ((Graphic)particle.Image).rectTransform.anchoredPosition = particle.Position; Color color = ((Graphic)particle.Image).color; color.a = particle.Alpha * (1f - particle.Age / particle.Life); ((Graphic)particle.Image).color = color; Particles[i] = particle; num2++; } } _alive = num2; } internal static Crt NewCrt(RectTransform window, Color tint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return new Crt(window, tint); } private static void TickCrts(float now) { for (int num = Crts.Count - 1; num >= 0; num--) { bool flag; try { flag = Crts[num].Tick(now); } catch (Exception e) { flag = false; Report("CRT", e); } if (!flag) { Crts.RemoveAt(num); } } } } internal enum Cue { Tick, TickDone, Scan, Injury, Notify, Tip, Warning, Bleep, LevelUp, XpDown, Collect, CollectSmall, XpUp, LevelDown, Alert, Deny, Enter, Leave, Key, Purchase, Broadcast, Suit, Select, Press, Cancel, Tune } internal static class Sfx { internal static float Volume = 0.7f; internal static bool HoverSounds = true; private const int Voices = 4; private static readonly string[] Groups = new string[5] { "UIAudio", "TerminalAudio", "MovementAudio", "SelectAudio", "MenuManager" }; private const int UiGroup = 0; private const int TerminalGroup = 1; private const int MovementGroup = 2; private const int SelectGroup = 3; private const int MenuGroup = 4; private static readonly int CueCount = Enum.GetValues(typeof(Cue)).Length; private static Transform _host; private static Transform _root; private static AudioSource[][] _voices; private static readonly int[] Next = new int[Groups.Length]; private static AudioSource _hum; private static HUDManager _mixedFor; private static Terminal _terminal; private static float[] _lastPlayed; private static bool _namesLogged; private const float SameClipGap = 0.035f; private const float KeyGap = 1f / 15f; private static float _humVolume; private static Terminal Terminal { get { if ((Object)(object)_terminal == (Object)null) { _terminal = Object.FindObjectOfType<Terminal>(); } return _terminal; } } internal static void Attach(Transform host) { if (!((Object)(object)_host == (Object)(object)host) || !((Object)(object)_root != (Object)null)) { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)((Component)_root).gameObject); } _host = host; _root = null; } } private static bool Ready() { //IL_0035: 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) if ((Object)(object)_root != (Object)null) { return true; } if ((Object)(object)_host == (Object)null) { _host = new GameObject("BaconShared Sfx").transform; } _root = new GameObject("Sounds").transform; _root.SetParent(_host, false); _voices = new AudioSource[Groups.Length][]; for (int i = 0; i < Groups.Length; i++) { _voices[i] = (AudioSource[])(object)new AudioSource[4]; for (int j = 0; j < 4; j++) { _voices[i][j] = NewSource(Groups[i]); } } _hum = NewSource("UIAudio"); _hum.loop = true; _mixedFor = null; _lastPlayed = new float[CueCount]; for (int k = 0; k < _lastPlayed.Length; k++) { _lastPlayed[k] = -1f; } Mix(); return true; } private static AudioSource NewSource(string name) { //IL_0001: 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) GameObject val = new GameObject(name); val.transform.SetParent(_root, false); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.spatialBlend = 0f; obj.bypassReverbZones = true; return obj; } private static void Mix() { HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance == (Object)(object)_mixedFor || (Object)(object)instance.UIAudio == (Object)null || _voices == null) { return; } _mixedFor = instance; AudioMixerGroup outputAudioMixerGroup = instance.UIAudio.outputAudioMixerGroup; AudioSource[][] voices = _voices; foreach (AudioSource[] array in voices) { foreach (AudioSource val in array) { if ((Object)(object)val != (Object)null) { val.outputAudioMixerGroup = outputAudioMixerGroup; } } } if ((Object)(object)_hum != (Object)null) { _hum.outputAudioMixerGroup = outputAudioMixerGroup; } } internal static void Tick() { if (!((Object)(object)_root == (Object)null)) { Mix(); if ((Object)(object)_hum != (Object)null && _hum.isPlaying) { _hum.volume = _humVolume * Volume; } } } private static AudioClip First(AudioClip[] clips) { if (clips == null || clips.Length == 0) { return null; } return clips[0]; } internal static AudioClip Clip(Cue cue) { HUDManager instance = HUDManager.Instance; StartOfRound instance2 = StartOfRound.Instance; GameNetworkManager instance3 = GameNetworkManager.Instance; switch (cue) { case Cue.Tick: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.addToScrapTotalSFX; case Cue.TickDone: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.finishAddingToTotalSFX; case Cue.Scan: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.scanSFX; case Cue.Injury: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.criticalInjury; case Cue.Notify: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.globalNotificationSFX; case Cue.Tip: if (!((Object)(object)instance != (Object)null)) { return null; } return First(instance.tipsSFX); case Cue.Warning: if (!((Object)(object)instance != (Object)null)) { return null; } return First(instance.warningSFX); case Cue.Bleep: if (!((Object)(object)instance != (Object)null)) { return null; } return First(instance.dialogueBleeps); case Cue.LevelUp: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.levelIncreaseSFX; case Cue.XpDown: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.decreaseXPSFX; case Cue.Collect: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.displayCollectedScrapSFX; case Cue.CollectSmall: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.displayCollectedScrapSFXSmall; case Cue.XpUp: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.increaseXPSFX; case Cue.LevelDown: if (!((Object)(object)instance != (Object)null)) { return null; } return instance.levelDecreaseSFX; case Cue.Alert: if (!((Object)(object)instance2 != (Object)null)) { return null; } return instance2.HUDSystemAlertSFX; case Cue.Deny: if (!((Object)(object)ShipBuildModeManager.Instance != (Object)null)) { return null; } return ShipBuildModeManager.Instance.denyPlacementSFX; case Cue.Enter: if (!((Object)(object)Terminal != (Object)null)) { return null; } return Terminal.enterTerminalSFX; case Cue.Leave: if (!((Object)(object)Terminal != (Object)null)) { return null; } return Terminal.leaveTerminalSFX; case Cue.Key: { AudioClip[] array = (((Object)(object)Terminal != (Object)null) ? Terminal.keyboardClips : null); if (array == null || array.Length == 0) { return null; } return array[Random.Range(0, array.Length)]; } case Cue.Purchase: if (!((Object)(object)Terminal != (Object)null)) { return null; } return First(Terminal.syncedAudios); case Cue.Broadcast: if (!((Object)(object)Terminal != (Object)null)) { return null; } return Terminal.codeBroadcastSFX; case Cue.Suit: if (!((Object)(object)instance2 != (Object)null)) { return null; } return instance2.changeSuitSFX; case Cue.Select: if (!((Object)(object)instance3 != (Object)null)) { return null; } return instance3.buttonSelectSFX; case Cue.Press: if (!((Object)(object)instance3 != (Object)null)) { return null; } return instance3.buttonPressSFX; case Cue.Cancel: if (!((Object)(object)instance3 != (Object)null)) { return null; } return instance3.buttonCancelSFX; case Cue.Tune: if (!((Object)(object)instance3 != (Object)null)) { return null; } return instance3.buttonTuneSFX; default: return null; } } private static int Group(Cue cue, AudioClip clip) { if (cue <= Cue.Deny) { return 0; } if (cue <= Cue.Broadcast) { return 1; } if (cue == Cue.Suit) { return 2; } string name = ((Object)clip).name; if (!name.StartsWith("HoverButton", StringComparison.Ordinal) && !name.StartsWith("ButtonPress", StringComparison.Ordinal)) { return 4; } return 3; } private static bool Minor(Cue cue) { if (cue != Cue.Select && cue != Cue.Key && cue != Cue.Tick && cue != Cue.Tune) { return cue == Cue.Bleep; } return true; } internal static void Play(Cue cue, float volume = 1f, float pitch = 1f) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (Volume <= 0f || volume <= 0f) { return; } AudioClip val = Clip(cue); if ((Object)(object)val == (Object)null || !Ready()) { return; } LogNames(); float unscaledTime = Time.unscaledTime; if ((_lastPlayed[(int)cue] >= 0f && unscaledTime - _lastPlayed[(int)cue] < ((cue == Cue.Key) ? (1f / 15f) : 0.035f)) || (Minor(cue) && Busy(val))) { return; } AudioSource val2 = Voice(Group(cue, val), !Minor(cue)); if (!((Object)(object)val2 == (Object)null)) { _lastPlayed[(int)cue] = unscaledTime; if ((int)val.loadState == 0) { val.LoadAudioData(); } val2.Stop(); val2.clip = val; val2.pitch = pitch; val2.volume = Mathf.Clamp01(volume) * Volume; val2.Play(); } } internal static void Hover(float volume = 0.3f, float pitch = 1f) { if (HoverSounds && Fx.Mode == FxMode.Full) { Play(Cue.Select, volume, pitch); } } private static bool Busy(AudioClip clip) { AudioClip val = null; for (int i = 0; i < _voices.Length; i++) { AudioSource[] array = _voices[i]; foreach (AudioSource val2 in array) { if (!((Object)(object)val2 == (Object)null) && val2.isPlaying && !((Object)(object)val2.clip == (Object)null) && !((Object)(object)val2.clip == (Object)(object)clip)) { if ((Object)(object)val == (Object)null) { val = val2.clip; } else if ((Object)(object)val2.clip != (Object)(object)val) { return true; } } } } return false; } private static AudioSource Voice(int group, bool steal) { AudioSource[] array = _voices[group]; for (int i = 0; i < 4; i++) { int num = (Next[group] + i) % 4; if ((Object)(object)array[num] != (Object)null && !array[num].isPlaying) { Next[group] = (num + 1) % 4; return array[num]; } } if (!steal) { return null; } int num2 = Next[group]; Next[group] = (num2 + 1) % 4; return array[num2]; } internal static void Hum(bool on, float pitch = 1f, float volume = 0.6f) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if (!on) { if ((Object)(object)_hum != (Object)null && _hum.isPlaying) { _hum.Stop(); } return; } HUDManager instance = HUDManager.Instance; AudioClip val = (((Object)(object)instance != (Object)null) ? instance.increaseXPSFX : null); if (!((Object)(object)val == (Object)null) && !(Volume <= 0f) && Ready() && !((Object)(object)_hum == (Object)null)) { _humVolume = Mathf.Clamp01(volume); _hum.pitch = pitch; _hum.volume = _humVolume * Volume; if ((Object)(object)_hum.clip != (Object)(object)val) { _hum.clip = val; } if ((int)val.loadState == 0) { val.LoadAudioData(); } if (!_hum.isPlaying) { _hum.Play(); } } } internal static void Preload() { for (int i = 0; i < CueCount; i++) { Cue cue = (Cue)i; if (cue == Cue.Key) { AudioClip[] array = (((Object)(object)Terminal != (Object)null) ? Terminal.keyboardClips : null); if (array != null) { AudioClip[] array2 = array; for (int j = 0; j < array2.Length; j++) { Load(array2[j]); } } } else { Load(Clip(cue)); } } if ((Object)(object)HUDManager.Instance != (Object)null) { Load(HUDManager.Instance.increaseXPSFX); } } private static void Load(AudioClip clip) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)clip != (Object)null && (int)clip.loadState == 0) { clip.LoadAudioData(); } } private static void LogNames() { if (!_namesLogged) { GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance == (Object)null)) { _namesLogged = true; UiKit.Log?.Invoke("Sounds: menu clips select " + Name(instance.buttonSelectSFX) + ", press " + Name(instance.buttonPressSFX) + ", cancel " + Name(instance.buttonCancelSFX) + ", tune " + Name(instance.buttonTuneSFX)); } } } private static string Name(AudioClip clip) { if (!((Object)(object)clip != (Object)null)) { return "none"; } return ((Object)clip).name; } } internal static class UiKit { internal static TMP_FontAsset Font; internal static Action<string> Log; private static Sprite _frame; private static Texture2D _hazard; private static Texture2D _noise; private static Texture2D _perforation; private static Texture2D _dotLeader; private static Texture2D _scanline; private static Texture2D _barcode; private static Texture2D _band; private const string Wanted = "★◆▲▼█▓░→✓›·▪"; private static readonly string[] Fallbacks = new string[12] { "*", "+", "^", "v", "#", "#", ":", ">", "+", ">", ".", "-" }; private static readonly bool[] Present = new bool["★◆▲▼█▓░→✓›·▪".Length]; private static TMP_FontAsset _probed; private static readonly string[] GlyphText = Split("★◆▲▼█▓░→✓›·▪"); internal static void Fit(CanvasScaler scaler) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) scaler.uiScaleMode = (ScaleMode)1; scaler.referenceResolution = new Vector2(1920f, 1080f); scaler.screenMatchMode = (ScreenMatchMode)1; } internal static RectTransform Root(Transform canvas, string name) { //IL_001b: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Empty(canvas, name); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); obj.pivot = val; Vector2 anchorMin = (obj.anchorMax = val); obj.anchorMin = anchorMin; obj.anchoredPosition = Vector2.zero; obj.sizeDelta = new Vector2(1920f, 1080f); return obj; } internal static RectTransform Empty(Transform parent, string name) { //IL_0014: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } internal static void Stretch(RectTransform rect) { //IL_0001: 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_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_001e: 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) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; Vector2 offsetMin = (rect.offsetMax = Vector2.zero); rect.offsetMin = offsetMin; } internal static TextMeshProUGUI Text(Transform parent, string text, float size, Color color, TextAlignmentOptions align = (TextAlignmentOptions)514) { //IL_0036: 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) TextMeshProUGUI val = ((Component)Empty(parent, "Text")).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)val).font = Font; } ((TMP_Text)val).fontSize = size; ((Graphic)val).color = color; ((TMP_Text)val).alignment = align; ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).richText = true; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).text = text; return val; } internal static Image SoftFrame(Transform parent, Color color, float thickness = 2f) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) Image obj = ((Component)Empty(parent, "Frame")).gameObject.AddComponent<Image>(); obj.sprite = FrameSprite(); obj.type = (Type)1; obj.fillCenter = false; obj.pixelsPerUnitMultiplier = 1f / thickness; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; Stretch(((Graphic)obj).rectTransform); return obj; } internal static Sprite FrameSprite() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_frame != (Object)null) { return _frame; } Color32[] array = (Color32[])(object)new Color32[25]; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { bool flag = ((j == 1 || j == 3) && i >= 1 && i <= 3) || ((i == 1 || i == 3) && j >= 1 && j <= 3); array[i * 5 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(flag ? 255u : 0u)); } } _frame = Sprite.Create(NewTexture(5, 5, array, (TextureWrapMode)1, (FilterMode)1), new Rect(0f, 0f, 5f, 5f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(2f, 2f, 2f, 2f)); ((Object)_frame).hideFlags = (HideFlags)61; return _frame; } internal static Texture2D Hazard() { //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) if ((Object)(object)_hazard != (Object)null) { return _hazard; } Color32[] array = (Color32[])(object)new Color32[256]; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { array[i * 16 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(((j + i) % 16 < 8) ? 255u : 0u)); } } return _hazard = NewTexture(16, 16, array, (TextureWrapMode)0, (FilterMode)1); } internal static Texture2D Noise() { //IL_004f: 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) if ((Object)(object)_noise != (Object)null) { return _noise; } Color32[] array = (Color32[])(object)new Color32[4096]; uint num = 2654435769u; for (int i = 0; i < array.Length; i++) { num ^= num << 13; num ^= num >> 17; num ^= num << 5; byte b = (byte)(num & 0xFF); array[i] = new Color32(b, b, b, byte.MaxValue); } return _noise = NewTexture(64, 64, array, (TextureWrapMode)0, (FilterMode)0); } internal static Texture2D Perforation() { //IL_0049: 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) if ((Object)(object)_perforation != (Object)null) { return _perforation; } Color32[] array = (Color32[])(object)new Color32[12]; for (int i = 0; i < 2; i++) { for (int j = 0; j < 6; j++) { array[i * 6 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)((j != 2 && j != 3) ? 255u : 0u)); } } return _perforation = NewTexture(6, 2, array, (TextureWrapMode)0, (FilterMode)0); } internal static Texture2D DotLeader() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_dotLeader != (Object)null) { return _dotLeader; } Color32 val = default(Color32); ((Color32)(ref val))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); return _dotLeader = NewTexture(4, 1, (Color32[])(object)new Color32[4] { new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), val, val, val }, (TextureWrapMode)0, (FilterMode)0); } internal static Texture2D Scanline() { //IL_0031: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_scanline != (Object)null) { return _scanline; } return _scanline = NewTexture(1, 3, (Color32[])(object)new Color32[3] { new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)110) }, (TextureWrapMode)0, (FilterMode)0); } internal static Texture2D Barcode() { //IL_0069: 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) if ((Object)(object)_barcode != (Object)null) { return _barcode; } Color32[] array = (Color32[])(object)new Color32[48]; uint num = 625341585u; for (int i = 0; i < 48; i++) { num ^= num << 13; num ^= num >> 17; num ^= num << 5; bool flag = i >= 2 && i < 46 && (num & 3) != 0; array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(flag ? 255u : 0u)); } return _barcode = NewTexture(48, 1, array, (TextureWrapMode)1, (FilterMode)0); } internal static Texture2D Band() { //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) if ((Object)(object)_band != (Object)null) { return _band; } Color32[] array = (Color32[])(object)new Color32[32]; for (int i = 0; i < 32; i++) { float num = Mathf.Sin(MathF.PI * ((float)i + 0.5f) / 32f); array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255f * num * num)); } return _band = NewTexture(1, 32, array, (TextureWrapMode)1, (FilterMode)1); } private static Texture2D NewTexture(int width, int height, Color32[] pixels, TextureWrapMode wrap, FilterMode filter) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //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_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Texture2D val = new Texture2D(width, height, (TextureFormat)4, false) { wrapMode = wrap, filterMode = filter, hideFlags = (HideFlags)61 }; val.SetPixels32(pixels); val.Apply(false, true); return val; } internal static void Probe(TMP_FontAsset font) { if ((Object)(object)font == (Object)null || (Object)(object)font == (Object)(object)_probed) { return; } _probed = font; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < "★◆▲▼█▓░→✓›·▪".Length; i++) { bool flag; try { flag = font.HasCharacter("★◆▲▼█▓░→✓›·▪"[i], true, false); } catch (Exception) { flag = false; } Present[i] = flag; if (!flag) { stringBuilder.Append("★◆▲▼█▓░→✓›·▪"[i]).Append(' '); } } Log?.Invoke((stringBuilder.Length == 0) ? ("Glyphs: " + ((Object)font).name + " has every symbol") : $"Glyphs: {((Object)font).name} lacks {stringBuilder}(ASCII stand-ins used)"); } internal static string Glyph(char symbol) { int num = "★◆▲▼█▓░→✓›·▪".IndexOf(symbol); if (num < 0) { return symbol.ToString(); } if (!Present[num] && !((Object)(object)_probed == (Object)null)) { return Fallbacks[num]; } return GlyphText[num]; } internal static bool Has(char symbol) { int num = "★◆▲▼█▓░→✓›·▪".IndexOf(symbol); if (num >= 0) { return Present[num]; } return true; } private static string[] Split(string symbols) { string[] array = new string[symbols.Length]; for (int i = 0; i < symbols.Length; i++) { array[i] = symbols[i].ToString(); } return array; } internal static bool PointerOver(RectTransform rect) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) Mouse current = Mouse.current; if (current != null && (Object)(object)rect != (Object)null) { return RectTransformUtility.RectangleContainsScreenPoint(rect, ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue(), (Camera)null); } return false; } } internal class DealIn : MonoBehaviour { internal float Delay; internal float Distance = 420f; internal float Duration = 0.45f; private float _start = -1f; private float _offset; private CanvasGroup _group; private void LateUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)((Component)this).transform; if (_start < 0f) { if (Fx.Mode == FxMode.Off) { Object.Destroy((Object)(object)this); return; } if (Fx.Mode == FxMode.Reduced) { Duration = Mathf.Min(Duration, 0.12f); Delay *= 0.25f; } _start = Time.unscaledTime + Delay; _group = ((Component)this).gameObject.GetComponent<CanvasGroup>() ?? ((Component)this).gameObject.AddComponent<CanvasGroup>(); } float num = Mathf.Clamp01((Time.unscaledTime - _start) / Duration); float num2 = Fx.OutCubic(num); float num3 = (0f - (1f - num2)) * Distance; val.anchoredPosition += new Vector2(0f, num3 - _offset); _offset = num3; _group.alpha = num2; if (num >= 1f) { Object.Destroy((Object)(object)this); } } } internal class HoverTile : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler { internal Image Fill; internal Image Frame; internal Image Sweep; internal Color Normal; internal Color Hover; internal Color FrameNormal; internal Color FrameHover; internal Action OnClick; internal Action OnPress; internal Action OnHold; internal Action OnRefuse; private bool _over; private bool _down; private float _blend; private float _dip = 1f; internal bool Over => _over; internal void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _over = UiKit.PointerOver((RectTransform)((Component)this).transform); _blend = (_over ? 1f : 0f); Paint(); } public void OnPointerEnter(PointerEventData data) { _over = true; } public void OnPointerExit(PointerEventData data) { _over = false; _down = false; } public void OnPointerClick(PointerEventData data) { if (OnClick != null) { OnClick(); } else { OnRefuse?.Invoke(); } } public void OnPointerDown(PointerEventData data) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)data.button == 0) { _down = true; OnPress?.Invoke(); } } public void OnPointerUp(PointerEventData data) { _down = false; } private void OnDisable() { _down = false; if (_dip != 1f) { SetDip(1f); } } private void Update() { _blend = Mathf.MoveTowards(_blend, _over ? 1f : 0f, Time.unscaledDeltaTime * 9f); Paint(); float num = ((_down && Fx.Mode != FxMode.Off) ? 0.985f : 1f); if (_dip != num) { SetDip(Mathf.MoveTowards(_dip, num, Time.unscaledDeltaTime * 0.3f)); } } private void SetDip(float dip) { //IL_006e: 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_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_002b: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { Vector2 anchoredPosition = val.anchoredPosition; Vector2 val2 = new Vector2(0.5f, 0.5f) - val.pivot; Rect rect = val.rect; val.anchoredPosition = anchoredPosition + Vector2.Scale(val2, ((Rect)(ref rect)).size) * (_dip - dip); } _dip = dip; ((Component)this).transform.localScale = new Vector3(dip, dip, 1f); } private void Paint() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Fill != (Object)null) { ((Graphic)Fill).color = Color.Lerp(Normal, Hover, _blend); } if ((Object)(object)Frame != (Object)null) { ((Graphic)Frame).color = Color.Lerp(FrameNormal, FrameHover, _blend); } } } } namespace BaconRPG { internal enum Slot { Teammate, Body, Trap, Door, Radar, Button, ItemUp, Item, Mayday, Stand, Dead } internal enum Who { Alive, Dead, Any } internal sealed class Ability { internal string Id; internal string Node; internal string Letter = "?"; internal Slot Slot; internal int Order; internal float Hold = 1.5f; internal float Wait; internal Func<PlayerRecord, float> WaitFor; internal int Charges; internal Func<PlayerRecord, int> ChargesLeft; internal string Approved; internal bool Local; internal bool NoChip; internal Who Who; internal Func<Aim, Use> Find; internal Action<Ability, Use> Fire; internal Func<PlayerRecord, PlayerControllerB, Ask, string> Host; internal float ReadyAt; internal float PendingUntil = -1f; internal int TreeIndex; internal int Added; } internal sealed class Use { internal object Thing; internal string Label; internal string Node; internal bool Blocked; internal bool Flag; internal int Target = -1; internal long Id; internal Vector3 Point; internal float X; internal float Y; } internal sealed class Aim { internal PlayerControllerB Player; internal Transform View; internal PlayerControllerB Watched; internal PlayerControllerB Teammate; internal DeadBodyInfo Body; internal TerminalAccessibleObject Code; internal TerminalAccessibleObject BigDoor; internal Component Trap; internal Component Door; internal InteractTrigger Trigger; internal EnemyAI Monster; internal GrabbableObject Item; internal GrabbableObject Held; internal float TeammateAt = -1f; internal float BodyAt = -1f; internal float TrapAt = -1f; internal float DoorAt = -1f; internal float TriggerAt = -1f; internal float MonsterAt = -1f; internal float ItemAt = -1f; internal float BigDoorAt = -1f; internal Vector3 Point; internal float PointAt = -1f; internal Collider PointOn; internal bool Mayday; internal bool LookingUp; internal bool Busy { get { if (!Near(TeammateAt, 6f) && !Near(BodyAt, 6f) && !Near(TrapAt, 6f)) { return Near(DoorAt, 6f); } return true; } } private static bool Near(float at, float range) { if (at >= 0f) { return at <= range; } return false; } } internal static class Abilities { private sealed class Hosted { internal Func<PlayerRecord, PlayerControllerB, Ask, string> Handler; internal Who Who; internal string Node; } internal const float TapSeconds = 0.22f; internal const float HoldRange = 42f; internal const float PendingWait = 3f; private static readonly List<Ability> All = new List<Ability>(); private static readonly Dictionary<string, Hosted> Hosts = new Dictionary<string, Hosted>(); private static readonly Dictionary<string, Action<Skill>> Shows = new Dictionary<string, Action<Skill>>(); private static bool _loaded; private static bool _sorted; private static bool _down; private static bool _fired; private static bool _maydayKey; private static float _downAt; private static float _holdStart; private static float _nextChips; private static Ability _holding; private static object _holdThing; private static PlayerControllerB _watched; private static readonly RaycastHit[] Hits = (RaycastHit[])(object)new RaycastHit[16]; private static readonly IComparer<RaycastHit> Nearest = Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); private static readonly Dictionary<ulong, int> MaxSeen = new Dictionary<ulong, int>(); private static StartOfRound _maxRound; private static readonly object TauntTarget = new object(); internal static event Action<PlayerControllerB> DeadTap; internal static void Register(Ability ability) { if (ability != null && !string.IsNullOrEmpty(ability.Id) && ability.Find != null) { All.RemoveAll((Ability other) => other.Id == ability.Id); ability.Added = All.Count; int num = ((ability.Node != null) ? Tree.Nodes.FindIndex((Node node) => node.Id == ability.Node) : (-1)); ability.TreeIndex = ((num < 0) ? int.MaxValue : num); All.Add(ability); _sorted = false; if (ability.Host != null) { OnAsk(ability.Id, ability.Host, ability.Who, ability.Node); } } } internal static void OnAsk(string kind, Func<PlayerRecord, PlayerControllerB, Ask, string> handler, Who who = Who.Alive, string node = null) { if (!string.IsNullOrEmpty(kind) && handler != null) { Hosts[kind] = new Hosted { Handler = handler, Who = who, Node = node }; } } internal static void OnSkill(string kind, Action<Skill> show) { if (!string.IsNullOrEmpty(kind) && show != null) { Shows[kind] = show; } } internal static Ability Get(string id) { return All.Find((Ability ability) => ability.Id == id || ability.Node == id); } private static void Ready() { if (_loaded) { return; } _loaded = true; Builtin(); Type[] types; try { types = typeof(Abilities).Assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { types = ex.Types; } Type[] array = types; foreach (Type type in array) { if (!(type == null) && !(type == typeof(Abilities))) { try { type.GetMethod("RegisterAbilities", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null)?.Invoke(null, null); } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Abilities: " + type.Name + " couldn't register its skills: " + (ex2.InnerException?.Message ?? ex2.Message))); } } } Client.Replied += OnReply; Plugin.Log.LogInfo((object)$"Abilities: {All.Count} X skills and {Hosts.Count} host checks registered"); } private static void Sort() { if (_sorted) { return; } _sorted = true; All.Sort(delegate(Ability a, Ability b) { int num = a.Slot.CompareTo(b.Slot); if (num == 0) { num = a.Order.CompareTo(b.Order); } if (num == 0) { num = a.TreeIndex.CompareTo(b.TreeIndex); } return (num == 0) ? a.Added.CompareTo(b.Added) : num; }); } internal static float Wait(PlayerRecord record, string id) { Ready(); Ability ability = Get(id); if (ability == null) { return 0f; } return Wait(record, ability); } internal static float Wait(PlayerRecord record, Ability ability) { return ((ability.WaitFor != null && record != null) ? ability.WaitFor(record) : ability.Wait) * FatePerks.WaitFactor(record, ability); } internal static void Tick() { Ready(); Sort(); PlayerControllerB local = Client.Local; if (Time.time >= _nextChips) { _nextChips = Time.time + 0.5f; Chips(local); } bool flag = (Object)(object)local != (Object)null && !Hud.Busy && !local.isTypingChat; bool flag2 = flag && Plugin.Keys.Mayday.IsPressed(); if (!flag2 && (!flag || !Plugin.Keys.Skill.IsPressed())) { if (_down && !_maydayKey && !Hud.Busy && (Object)(object)local != (Object)null && !_fired && Time.time - _downAt < 0.22f) { Tap(local); } _down = false; Let(); return; } if (!_down) { _down = true; _fired = false; _downAt = Time.time; _maydayKey = flag2; } if (_fired) { return; } Aim aim = Look(local); if (aim != null) { aim.Mayday = _maydayKey; } Ability chosen = null; Use use = ((aim != null) ? Choose(aim, out chosen) : null); if (use == null) { Let(); return; } if (!use.Blocked && FatePerks.TooHurt(chosen, local)) { use = new Use { Thing = use.Thing, Blocked = true, Label = "BURNOUT: NEEDS 15 HEALTH" }; } if (use.Blocked) { Let(); Reticle.Legacy(use.Label); return; } Reticle.Arm(chosen.NoChip ? null : chosen.Id); object obj = use.Thing ?? chosen; if (chosen != _holding || obj != _holdThing || (Object)(object)aim.Watched != (Object)(object)_watched) { _holding = chosen; _holdThing = obj; _watched = aim.Watched; _holdStart = Time.time; } float time = Time.time; float num = Mathf.Max(chosen.ReadyAt, chosen.PendingUntil); if (time < num) { _holdStart = time; Reticle.Wait(obj, use.Label, num - time); return; } float num2 = (time - _holdStart) / Mathf.Max(0.05f, chosen.Hold); Reticle.Hold(obj, use.Label, num2); if (!(num2 < 1f)) { Activate(chosen, use); _fired = true; Let(); } } private static void Let() { _holding = null; _holdThing = null; _watched = null; Reticle.Arm(null); } private static void Tap(PlayerControllerB player) { if (player.isPlayerDead) { if (Abilities.DeadTap == null) { return; } Delegate[] invocationList = Abilities.DeadTap.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action<PlayerControllerB> action = (Action<PlayerControllerB>)invocationList[i]; try { action(player); } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Abilities: a dead player's tap failed: {arg}"); } } } else { Comms.Callout(player); } } private static Use Choose(Aim aim, out Ability chosen) { chosen = null; bool isPlayerDead = aim.Player.isPlayerDead; Use use = null; Ability ability = null; Slot slot = Slot.Teammate; foreach (Ability item in All) { if (use != null && item.Slot != slot) { break; } if ((isPlayerDead ? (item.Who == Who.Alive) : (item.Who == Who.Dead)) || item.Slot == Slot.Mayday != aim.Mayday || (item.Node != null && !Client.Owns(aim.Player, item.Node))) { continue; } Use use2; try { use2 = item.Find(aim); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Abilities: " + item.Id + "'s aim check failed: " + ex.Message)); continue; } if (use2 != null) { if (!use2.Blocked) { chosen = item; return use2; } if (use == null) { use = use2; ability = item; slot = item.Slot; } } } chosen = ability; return use; } private static void Activate(Ability ability, Use use) { try { if (ability.Fire != null) { ability.Fire(ability, use); } else { Send(ability, use); } } catch (Exception arg) { Plugin.Log.LogWarning((object)$"Abilities: {ability.Id} failed: {arg}"); return; } Reticle.Fired(); if (ability.Local) { ability.ReadyAt = Time.time + Wait(Client.Me, ability); Chip(ability, Client.Me); FatePerks.Burn(ability); } else { ability.PendingUntil = Time.time + 3f; } Plugin.Log.LogInfo((object)("Abilities: used " + ability.Id + ": " + use.Label)); } internal static void Send(Ability ability, Use use) { //IL_002b: 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) Net.ToHost(new Ask { Kind = ability.Id, Target = use.Target, Id = use.Id, Point = use.Point, Flag = use.Flag, Node = use.Node, X = use.X, Y = use.Y }); } private static void OnReply(Reply reply) { if (reply == null || reply.Ok) { return; } foreach (Ability item in All) { if (item.Id == reply.Kind) { item.PendingUntil = -1f; } } } private static Aim Look(PlayerControllerB player) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return null; } PlayerControllerB watched = null; Transform val; if (player.isPlayerDead) { watched = player.spectatedPlayerScript; val = (((Object)(object)instance.spectateCamera != (Object)null) ? ((Component)instance.spectateCamera).transform : null); } else { val = (((Object)(object)player.gameplayCamera != (Object)null) ? ((Component)player.gameplayCamera).transform : null); } if ((Object)(object)val == (Object)null) { return null; } Aim aim = Scan(player, val, 42f, -1); aim.Watched = watched; return aim; } internal static Aim Scan(PlayerControllerB player, Transform view, float range, int mask) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) Aim aim = new Aim { Player = player, View = view, Held = player.currentlyHeldObjectServer, LookingUp = (view.forward.y >= 0.94f) }; int num = Physics.RaycastNonAlloc(view.position, view.forward, Hits, range, mask, (QueryTriggerInteraction)2); while (num == Hits.Length && range > 2f) { range *= 0.5f; num = Physics.RaycastNonAlloc(view.position, view.forward, Hits, range, mask, (QueryTriggerInteraction)2); } Array.Sort(Hits, 0, num, Nearest); for (int i = 0; i < num; i++) { RaycastHit val = Hits[i]; if ((Object)(object)((RaycastHit)(ref val)).collider == (Object)null) { continue; } PlayerControllerB componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerControllerB>(); if (!((Object)(object)componentInParent == (Object)(object)player)) { bool flag = Classify(aim, (Component)(object)((RaycastHit)(ref val)).collider, ((RaycastHit)(ref val)).distance); if (!(((RaycastHit)(ref val)).collider.isTrigger || (Object)(object)componentInParent != (Object)null || flag)) { aim.Point = ((RaycastHit)(ref val)).point; aim.PointAt = ((RaycastHit)(ref val)).distance; aim.PointOn = ((RaycastHit)(ref val)).collider; break; } } } return aim; } internal static bool Classify(Aim aim, Component on, float distance) { PlayerControllerB componentInParent = on.GetComponentInParent<PlayerControllerB>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)aim.Player && componentInParent.isPlayerControlled && !componentInParent.isPlayerDead && (Object)(object)aim.Teammate == (Object)null) { aim.Teammate = componentInParent; aim.TeammateAt = distance; } DeadBodyInfo val = on.GetComponentInParent<DeadBodyInfo>(); if ((Object)(object)val == (Object)null) { RagdollGrabbableObject componentInParent2 = on.GetComponentInParent<RagdollGrabbableObject>(); if (componentInParent2 != null) { val = componentInParent2.ragdoll; } } if ((Object)(object)val != (Object)null && (Object)(object)aim.Body == (Obj