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 BaconCards v1.1.0
BepInEx/plugins/BaconCards.dll
Decompiled 7 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BaconGameRules; using BaconRPG; using BaconShared; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using LethalLib.Modules; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using Mimics; using MoreShipUpgrades.API; using MoreShipUpgrades.UI.TerminalNodes; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; using WeatherRegistry; using WeatherRegistry.Enums; [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("BaconCards")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BaconCards")] [assembly: AssemblyTitle("BaconCards")] [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 BaconCards { internal sealed class DebuffInfo { internal string Id; internal string Name; internal string Description; internal int Tier; internal int MaxStacks; internal Func<bool> Available; } internal static class Cards { internal const int Common = 0; internal const int Rare = 1; internal const int Epic = 2; internal const int Legendary = 3; internal static readonly string[] RarityNames = new string[4] { "COMMON", "RARE", "EPIC", "LEGENDARY" }; internal static readonly Color[] RarityColors = (Color[])(object)new Color[4] { new Color(0.78f, 0.8f, 0.84f), new Color(0.3f, 0.6f, 1f), new Color(0.72f, 0.38f, 1f), new Color(1f, 0.76f, 0.18f) }; private static readonly int[] RarityOdds = new int[4] { 55, 28, 14, 3 }; internal const int Normal = 0; internal const int Cursed = 1; internal const int Doomed = 2; internal static readonly string[] TierNames = new string[3] { "NORMAL", "CURSED", "DOOMED" }; internal static readonly Color[] TierColors = (Color[])(object)new Color[3] { new Color(0.9f, 0.9f, 0.35f), new Color(1f, 0.5f, 0.15f), new Color(0.95f, 0.12f, 0.15f) }; internal static readonly List<DebuffInfo> Debuffs = new List<DebuffInfo> { D(0, "prices", "Inflation", "Store prices +10%."), D(0, "scanner", "Budget Scanner", "The scanner reaches 20% less far."), D(0, "mines_n", "Extra Mines", "10% more mines."), D(0, "turrets_n", "Extra Turrets", "10% more turrets."), D(0, "fines", "Stricter Fines", "The fine for each dead employee is 50% bigger."), C(0, "peepers", "Peepers Move In", "Peepers can show up on the moons.", () => Gates.Has("peepers")), D(1, "turrets_c", "Turret Surplus", "25% more turrets."), D(1, "mines_c", "Minefield", "25% more mines."), D(1, "spikes", "Spike Season", "25% more spike traps and other traps."), D(1, "monsters_c", "Infestation", "15% more monsters."), D(1, "scrap_c", "Picked Clean", "10% less scrap."), C(1, "mimics", "Mimics", "Some doors are Mimics now.", () => Gates.Has("mimics")), C(1, "lockers", "Lockers", "Lockers can show up in the facilities.", () => Gates.Has("lockers")), C(1, "elements", "Harsh Elements", "Heatwave, Blizzard, Toxic Smog and other harsh weathers can roll.", () => Gates.Has("elements")), C(1, "wesley", "Wild Weather", "Hurricanes, Earthquakes, Minefields, Forsaken and Hallowed can roll.", () => Gates.Has("wesley")), D(2, "monsters_d", "Swarm", "30% more monsters."), D(2, "quota", "Greedy Company", "The quota grows 20% faster."), D(2, "weathers", "Bad Forecast", "Bad weather comes much more often."), D(2, "scrap_d", "Slim Pickings", "20% less scrap."), C(2, "snail", "The Immortal Snail", "It's coming. It never stops.", () => Gates.Has("snail")), C(2, "legend", "Blood and Majora Moons", "Blood Moons and Majora Moons can rise.", () => Gates.Has("legend")) }; private static readonly int[] SalePercents = new int[4] { 20, 30, 40, 50 }; private static readonly int[] XpPercents = new int[4] { 15, 25, 40, 60 }; private static readonly int[] ScrapPercents = new int[4] { 10, 15, 20, 30 }; private static readonly int[] UpgradeLevels = new int[4] { 1, 2, 2, 3 }; private static readonly float[] CreditFactors = new float[4] { 1f, 1.6f, 2.4f, 3.2f }; internal static readonly int[][] Deliveries = new int[4][] { new int[4] { 1, 1, 0, 0 }, new int[4] { 1, 2, 0, 1 }, new int[4] { 1, 0, 2, 2 }, new int[4] { 2, 0, 3, 3 } }; internal static int Quotas { get { if (!((Object)(object)TimeOfDay.Instance != (Object)null)) { return 0; } return TimeOfDay.Instance.timesFulfilledQuota; } } private static DebuffInfo D(int tier, string id, string name, string description) { return new DebuffInfo { Tier = tier, Id = id, Name = name, Description = description, MaxStacks = 3, Available = () => true }; } private static DebuffInfo C(int tier, string id, string name, string description, Func<bool> available) { return new DebuffInfo { Tier = tier, Id = id, Name = name, Description = description, MaxStacks = 1, Available = available }; } internal static DebuffInfo Debuff(string id) { foreach (DebuffInfo debuff in Debuffs) { if (debuff.Id == id) { return debuff; } } return null; } internal static List<Card> DealRewards(RunState run, Random random) { List<string> list = Moons.NextToOpen(run, 3, random); List<Card> list2 = new List<Card>(); HashSet<string> taken = new HashSet<string>(); for (int i = 0; i < 3; i++) { Card card = new Card { Rarity = RollRarity(random), Moon = ((i < list.Count) ? list[i] : null) }; for (int num = ((card.Rarity != 3) ? 1 : 2); num > 0; num--) { Bonus bonus = RollBonus(run, card, random, taken); if (bonus != null) { card.Bonuses.Add(bonus); } } list2.Add(card); } Shuffle(list2, random); return list2; } internal static List<Card> DealMystery(RunState run, Random random) { List<Card> list = new List<Card>(); for (int i = 0; i <= 2; i++) { List<DebuffInfo> list2 = new List<DebuffInfo>(); foreach (DebuffInfo debuff in Debuffs) { if (debuff.Tier == i && run.Count(debuff.Id) < debuff.MaxStacks && Safe(debuff.Available)) { list2.Add(debuff); } } list.Add(new Card { Tier = i, Debuff = ((list2.Count > 0) ? list2[random.Next(list2.Count)].Id : null) }); } Shuffle(list, random); return list; } private static int RollRarity(Random random) { int num = random.Next(100); for (int i = 0; i < 3; i++) { if (num < RarityOdds[i]) { return i; } num -= RarityOdds[i]; } return 3; } private static Bonus RollBonus(RunState run, Card card, Random random, HashSet<string> taken) { List<string> list = new List<string> { "credits", "delivery" }; if (LguLink.Installed && LguLink.Upgradable().Count > 0) { list.Add("upgrade"); } if (run.SaleUntil <= Quotas) { list.Add("sale"); } if (RpgLink.Installed && run.XpUntil <= Quotas) { list.Add("xp"); } if (card.Moon != null) { list.Add("scrap"); } list.RemoveAll((string kind) => card.Bonuses.Exists((Bonus bonus) => bonus.Kind == kind)); if (list.Count == 0) { return null; } List<string> list2 = list.FindAll((string kind) => !taken.Contains(kind)); List<string> list3 = ((list2.Count > 0) ? list2 : list); string text = list3[random.Next(list3.Count)]; taken.Add(text); int rarity = card.Rarity; switch (text) { case "credits": { int amount = Mathf.RoundToInt((float)(60 + 30 * Quotas) * CreditFactors[rarity] / 5f) * 5; return new Bonus { Kind = text, Amount = amount }; } case "delivery": return new Bonus { Kind = text, Amount = rarity }; case "sale": return new Bonus { Kind = text, Amount = SalePercents[rarity] }; case "xp": return new Bonus { Kind = text, Amount = XpPercents[rarity] }; case "scrap": return new Bonus { Kind = text, Target = card.Moon, Amount = ScrapPercents[rarity] }; default: { List<string> list4 = LguLink.Upgradable(); string text2 = list4[random.Next(list4.Count)]; return new Bonus { Kind = text, Target = text2, Amount = Mathf.Clamp(UpgradeLevels[rarity], 1, LguLink.LevelsLeft(text2)) }; } } } private static bool Safe(Func<bool> check) { try { return check(); } catch { return false; } } private static void Shuffle<T>(List<T> list, Random random) { for (int num = list.Count - 1; num > 0; num--) { int num2 = random.Next(num + 1); int index = num; int index2 = num2; T value = list[num2]; T value2 = list[num]; list[index] = value; list[index2] = value2; } } internal static string Title(Bonus bonus) { return bonus.Kind switch { "credits" => $"+{bonus.Amount} CREDITS", "delivery" => "FREE DELIVERY", "sale" => $"{bonus.Amount}% OFF THE STORE", "xp" => $"+{bonus.Amount}% XP", "scrap" => $"+{bonus.Amount}% SCRAP VALUE", "upgrade" => "FREE " + bonus.Target.ToUpperInvariant(), _ => bonus.Kind.ToUpperInvariant(), }; } internal static string Detail(Bonus bonus) { return bonus.Kind switch { "credits" => "Paid to the ship right away.", "delivery" => DeliveryText(bonus.Amount) + " come down with the next landing.", "sale" => "On everything in the store, until the next quota.", "xp" => "For everyone, until the next quota.", "scrap" => "On " + bonus.Target + ", for the rest of the run.", "upgrade" => string.Format("{0} {1} of this Lategame Upgrades crew upgrade.", bonus.Amount, (bonus.Amount == 1) ? "level" : "levels"), _ => "", }; } internal static string DeliveryText(int size) { List<string> list = new List<string>(); int[] array = Deliveries[Mathf.Clamp(size, 0, Deliveries.Length - 1)]; string[] array2 = new string[4] { "shovel", "flashlight", "pro-flashlight", "walkie-talkie" }; for (int i = 0; i < array.Length; i++) { if (array[i] > 0) { list.Add((array[i] == 1) ? ("a " + array2[i]) : $"{array[i]} {array2[i]}s"); } } string text = ((list.Count == 1) ? list[0] : (string.Join(", ", list.GetRange(0, list.Count - 1)) + " and " + list[list.Count - 1])); return char.ToUpperInvariant(text[0]) + text.Substring(1); } } internal static class CardScreen { private struct Ticker { internal TMP_Text Text; internal float Start; internal float Duration; internal int Length; internal int Settled; } private sealed class View { internal int Index; internal Card Card; internal RectTransform Body; internal RectTransform Content; internal RectTransform Shine; internal RectTransform Burst; internal RectTransform Badge; internal RectTransform Ribbon; internal RectTransform Chips; internal CanvasGroup BadgeGroup; internal CanvasGroup RibbonGroup; internal CanvasGroup ChipsGroup; internal Image[] Halo; internal Image[] BurstLines; internal Image Shade; internal Image Flash; internal Image ShineImage; internal Image BadgeFill; internal Image RibbonFill; internal TextMeshProUGUI BadgeText; internal Outline Edge; internal Color Color; internal readonly List<Image> Gems = new List<Image>(); internal Spark[] Sparks; internal float DealStart; internal float ReadyAt; internal float FlipStart = -1f; internal float Lift; internal float Pick; internal float Drop; internal float Mine; internal float FlashAt = -10f; internal float ChosenAt = -10f; internal float ShakeAt = -10f; internal float ShakeSize; internal float PopAt = -10f; internal RawImage Static; internal TextMeshProUGUI Mark; internal float NextStatic; internal float NextGlitch; internal bool Swapped; internal bool Chosen; internal bool Dropped; internal bool Landed; internal int Votes; internal string ChipKey = ""; } private sealed class Spark { internal RectTransform Rect; internal Image[] Parts; internal float Born = -10f; internal float Life = 1f; internal float Size = 1f; } private const float CardWidth = 380f; private const float CardHeight = 540f; private const float Gap = 60f; private const float Top = 250f; private const float DealTime = 0.65f; private const float FlipTime = 0.42f; private const float BarWidth = 600f; private const int MaxChips = 6; private static readonly Color White = new Color(0.93f, 0.93f, 0.95f); private static readonly Color Grey = new Color(0.6f, 0.62f, 0.66f); private static readonly Color Ink = new Color(0.02f, 0.024f, 0.03f); private static readonly Color CardFill = new Color(0.035f, 0.04f, 0.05f, 1f); private static readonly Color BackColor = new Color(0.85f, 0.86f, 0.9f); private static readonly float[] PileTilt = new float[3] { 9f, -6f, 4f }; private static readonly float[] ShineEvery = new float[4] { 6f, 4.5f, 3.4f, 2.4f }; private static readonly float[] ShineStrength = new float[4] { 0.025f, 0.035f, 0.05f, 0.07f }; private static readonly float[] HaloAlpha = new float[3] { 0.05f, 0.1f, 0.2f }; private static readonly float[] LandPitch = new float[3] { 0.95f, 1f, 1.05f }; private const float StaticEvery = 0.05f; private const float StaticTexel = 192f; private const char Arrow = '▼'; private static Canvas _canvas; private static RectTransform _table; private static RectTransform _cards; private static RectTransform _voteFill; private static RectTransform _chip; private static TextMeshProUGUI _title; private static TextMeshProUGUI _subtitle; private static TextMeshProUGUI _hint; private static TextMeshProUGUI _voteInfo; private static TextMeshProUGUI _chipText; private static Image _spot; private static Image _screenFlash; private static Image _voteFillImage; private static GameObject _continue; private static GameObject _voteBar; private static HoverTile _continueTile; private static Fx.Brackets _chipBrackets; private static readonly List<View> Views = new List<View>(); private static bool _open; private static bool _revealed; private static bool _voteSet; private static int _mode; private static int _shownDealt = -1; private static int _seenDealt = -1; private static int _localHover = -1; private static int _pendingVote = -1; private static int _lastVote = -1; private static int _soundHover = -1; private static int _othersVotes; private static int _clockTicked = -1; private static int _chipAt = -1; private static float _dealAt = -1f; private static float _openAt = -1f; private static float _voteDeadline; private static float _pendingUntil; private static float _hoverSoundAt; private static float _chipX; private static Color _spotColor; private static readonly List<Ticker> Tickers = new List<Ticker>(); private static readonly StringBuilder Heard = new StringBuilder(); private static int _decrypts; private static int _chipShows; internal static bool IsOpen => _open; private static float DealSeconds => Seconds(0.65f); private static float FlipSeconds => Seconds(0.42f); private static bool Voting { get { if (_voteSet && Client.Run.Vote && Client.Run.Step == _mode && Client.Run.Dealt == _shownDealt && !_revealed) { return _dealAt < 0f; } return false; } } private static ulong LocalId { get { if (!((Object)(object)NetworkManager.Singleton != (Object)null)) { return 0uL; } return NetworkManager.Singleton.LocalClientId; } } private static int Crew { get { if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return 1; } return StartOfRound.Instance.connectedPlayersAmount + 1; } } internal static void Reset() { _open = (_revealed = (_voteSet = false)); _mode = 0; _shownDealt = (_seenDealt = (_localHover = (_pendingVote = (_lastVote = -1)))); _soundHover = (_clockTicked = (_chipAt = -1)); _dealAt = (_openAt = -1f); Views.Clear(); Tickers.Clear(); Heard.Length = 0; _decrypts = (_chipShows = 0); _chipBrackets = null; } p