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 Cozy Items v2.0.2
plugins\Cozy_Items\PastelScrap.dll
Decompiled 2 days 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.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; [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("PastelScrap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.2.0")] [assembly: AssemblyInformationalVersion("2.0.2")] [assembly: AssemblyProduct("PastelScrap")] [assembly: AssemblyTitle("PastelScrap")] [assembly: AssemblyVersion("2.0.2.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 Yuyu.PastelScrap { internal enum Kind { Prop, Phone, Console, Camera, Toaster, Mug, Perfume, SnowGlobe, Gumball, Fan, MusicBox, Toggle } internal interface IPastelUse { void LocalUse(); } [BepInPlugin("hihi_hh.cozyitems", "Cozy Items", "2.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class PastelScrapPlugin : BaseUnityPlugin { private sealed class Def { public string Id; public string Display; public string File; public string Tip; public int Min; public int Max; public int Rarity; public float Weight; public float Scale; public string Grab; public string Drop; public Kind Kind; public Vector3 Rest; public Vector3 RotOff; public Vector3 PosOff; public float FrontYaw; } internal static ManualLogSource Log; internal static string AssetDir; internal static ConfigEntry<bool> GlassTransparent; internal static readonly List<GameObject> Prefabs = new List<GameObject>(); internal static AudioClip FlipClip; internal static AudioClip ConsoleOn; internal static AudioClip ConsoleOff; internal static AudioClip Ding; internal static AudioClip Shutter; internal static AudioClip Lever; internal static AudioClip Spray; internal static AudioClip Jingle; internal static AudioClip Lullaby; internal static AudioClip GumballTurn; internal static AudioClip FanLoop; internal static AudioClip TamaOn; internal static AudioClip TamaOff; internal static AudioClip CandleOn; internal static AudioClip CandleOff; internal static Texture2D[] MugTex; internal static Color[] MugColors; internal static GameObject MugPrefab; internal static Item MugItem; private static float _mugRatio = -1f; private static readonly List<KeyValuePair<Item, string[]>> SfxTargets = new List<KeyValuePair<Item, string[]>>(); private bool _sfxDone; private static readonly Def[] Defs = new Def[41] { new Def { Id = "LightPinkHeadset", Display = "Pink Headset", File = "LightPinkHeadset", Min = 60, Max = 110, Rarity = 30, Weight = 1.05f, Scale = 2.2f, Grab = "Hairdryer|Hair dryer|Remote", Drop = "Hairdryer|Hair dryer|Remote", Rest = new Vector3(90f, 0f, 0f), RotOff = new Vector3(0f, 90f, 0f), PosOff = new Vector3(0f, 0.02f, -0.05f) }, new Def { Id = "LightBlueHeadset", Display = "Blue Headset", File = "LightBlueHeadset", Min = 60, Max = 110, Rarity = 30, Weight = 1.05f, Scale = 2.2f, Grab = "Hairdryer|Hair dryer|Remote", Drop = "Hairdryer|Hair dryer|Remote", Rest = new Vector3(90f, 0f, 0f), RotOff = new Vector3(0f, 90f, 0f), PosOff = new Vector3(0f, 0.02f, -0.05f) }, new Def { Id = "GlassPumps", Display = "Glass Slippers", File = "GlassPumps", Min = 90, Max = 170, Rarity = 22, Weight = 1.08f, Scale = 2.7f, FrontYaw = -90f, Grab = "Perfume bottle|Flask|Jar", Drop = "Perfume bottle|Flask|Jar", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(-155f, -175f, 70f), PosOff = new Vector3(0f, 0.03f, -0.06f) }, new Def { Id = "FlipPhone", Display = "Flip Phone", File = "FlipPhone", Min = 70, Max = 130, Rarity = 26, Weight = 1.02f, Scale = 3f, Kind = Kind.Phone, Tip = "Open / Close : [LMB]", Grab = "Remote|Cell phone", Drop = "Remote|Cell phone", Rest = new Vector3(270f, 0f, 0f), RotOff = new Vector3(90f, 180f, 85f), PosOff = new Vector3(0f, 0.05f, -0.045f) }, new Def { Id = "GameConsole", Display = "Pastel Game Console", File = "GameConsole", Min = 80, Max = 140, Rarity = 26, Weight = 1.04f, Scale = 3f, Kind = Kind.Console, Tip = "Power : [LMB]", Grab = "Remote|Cell phone", Drop = "Remote|Cell phone", Rest = new Vector3(270f, 0f, 0f), RotOff = new Vector3(62f, 90f, 0f), PosOff = new Vector3(0f, 0.08f, -0.07f) }, new Def { Id = "DigitalCamera", Display = "Pink Digital Camera", File = "DigitalCamera", Min = 90, Max = 160, Rarity = 24, Weight = 1.05f, Scale = 3f, Kind = Kind.Camera, Tip = "Take photo : [LMB]", Grab = "Remote|Cell phone", Drop = "Remote|Cell phone", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(-50f, -90f, 0f), PosOff = new Vector3(0f, 0.09f, -0.08f) }, new Def { Id = "PerfumeBottle", Display = "Perfume Bottle", File = "PerfumeBottle", Min = 80, Max = 140, Rarity = 26, Weight = 1.03f, Scale = 3f, Kind = Kind.Perfume, Tip = "Spray : [LMB]", Grab = "Perfume bottle|Flask", Drop = "Perfume bottle|Flask", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(50f, 90f, 0f), PosOff = new Vector3(0f, 0.08f, -0.06f) }, new Def { Id = "AlarmClock", Display = "Alarm Clock", File = "AlarmClock", Min = 50, Max = 100, Rarity = 28, Weight = 1.06f, Scale = 2.6f, Grab = "Clock|Alarm clock|Old phone|Remote", Drop = "Clock|Alarm clock|Old phone|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(50f, 90f, 0f), PosOff = new Vector3(0f, 0.09f, -0.07f) }, new Def { Id = "Toaster", Display = "Mint Toaster", File = "Toaster", Min = 100, Max = 180, Rarity = 20, Weight = 1.18f, Scale = 1.6f, Kind = Kind.Toaster, Tip = "Toast : [LMB]", Grab = "Hairdryer|Hair dryer|Cash register", Drop = "Hairdryer|Hair dryer|Cash register", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0f, 0.15f, -0.08f) }, new Def { Id = "CherryMug", Display = "Cherry Mug", File = "CherryMug", Min = 40, Max = 80, Rarity = 30, Weight = 1.03f, Scale = 3.4f, Kind = Kind.Mug, Grab = "Mug|Coffee mug|Flask", Drop = "Mug|Coffee mug|Flask", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(-50f, -90f, 0f), PosOff = new Vector3(0f, 0.08f, -0.07f) }, new Def { Id = "SnowGlobe", Display = "Snow Globe", File = "SnowGlobe", Min = 90, Max = 170, Rarity = 22, Weight = 1.06f, Scale = 3.4f, Kind = Kind.SnowGlobe, Tip = "Music + snow : [LMB]", Grab = "Flask|Jar of pickles", Drop = "Flask|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0f, 0.13f, -0.09f) }, new Def { Id = "GumballMachine", Display = "Gumball Machine", File = "GumballMachine", Min = 80, Max = 150, Rarity = 22, Weight = 1.14f, Scale = 2.2f, Kind = Kind.Gumball, Tip = "Turn the knob : [LMB]", Grab = "Cash register|Hairdryer|Hair dryer", Drop = "Cash register|Hairdryer|Hair dryer", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(95f, 90f, 0f), PosOff = new Vector3(0.11f, 0.25f, -0.1f) }, new Def { Id = "TeddyBear", Display = "Teddy Bear", File = "TeddyBear", Min = 50, Max = 110, Rarity = 28, Weight = 1.03f, Scale = 3f, Grab = "Toy cube|Remote", Drop = "Toy cube|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0f, 0.17f, -0.1f) }, new Def { Id = "MiniFan", Display = "Mini Fan", File = "MiniFan", Min = 60, Max = 120, Rarity = 24, Weight = 1.07f, Scale = 2.8f, Kind = Kind.Fan, Tip = "Power : [LMB]", Grab = "Hairdryer|Hair dryer|Remote", Drop = "Hairdryer|Hair dryer|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0f, 0.18f, -0.1f) }, new Def { Id = "PearlJewelryBox", Display = "Pearl Jewelry Box", File = "PearlJewelryBox", Min = 110, Max = 200, Rarity = 18, Weight = 1.05f, Scale = 2.8f, Grab = "Jar of pickles|Toy cube|Remote", Drop = "Jar of pickles|Toy cube|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0f, 0.16f, -0.1f) }, new Def { Id = "MusicBox", Display = "Music Box", File = "MusicBox", Min = 100, Max = 180, Rarity = 20, Weight = 1.08f, Scale = 3f, Kind = Kind.MusicBox, Tip = "Play / Stop : [LMB]", Grab = "Toy cube|Remote", Drop = "Toy cube|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(88f, 90f, 0f), PosOff = new Vector3(0.075f, 0.195f, -0.1f) }, new Def { Id = "MechKeyboard", Display = "Mechanical Keyboard", File = "MechKeyboard", Min = 60, Max = 120, Rarity = 22, Weight = 1.06f, Scale = 2.3f, Grab = "Remote|Toy cube", Drop = "Remote|Toy cube", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(95f, 90f, 0f), PosOff = new Vector3(0.07f, 0.24f, -0.14f) }, new Def { Id = "Gamepad", Display = "Gamepad", File = "Gamepad", Min = 50, Max = 100, Rarity = 24, Weight = 1.03f, Scale = 3f, Grab = "Remote|Toy cube", Drop = "Remote|Toy cube", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(100f, 90f, 0f), PosOff = new Vector3(0.06f, 0.18f, -0.1f) }, new Def { Id = "HairDryer", Display = "Hair Dryer", File = "HairDryer", Min = 60, Max = 120, Rarity = 22, Weight = 1.06f, Scale = 2.8f, Grab = "Hairdryer|Hair dryer", Drop = "Hairdryer|Hair dryer", Rest = new Vector3(90f, 0f, 0f), RotOff = new Vector3(-180f, -180f, 105f), PosOff = new Vector3(-0.03f, 0.134f, -0.02f) }, new Def { Id = "FlatIron", Display = "Hair Straightener", File = "FlatIron", Min = 50, Max = 110, Rarity = 22, Weight = 1.04f, Scale = 2f, Grab = "Hairdryer|Hair dryer|Remote", Drop = "Hairdryer|Hair dryer|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(-180f, -180f, 90f), PosOff = new Vector3(-0.03f, 0.11f, 0.09f) }, new Def { Id = "StrawberryCake", Display = "Strawberry Cake", File = "StrawberryCake", Min = 70, Max = 140, Rarity = 20, Weight = 1.05f, Scale = 3.4f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0.07f, 0.2f, -0.1f) }, new Def { Id = "MilkCarton", Display = "Milk Carton", File = "MilkCarton", Min = 30, Max = 70, Rarity = 30, Weight = 1.04f, Scale = 2.8f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(75f, 90f, 0f), PosOff = new Vector3(0.1f, 0.2f, -0.09f) }, new Def { Id = "GlassOfMilk", Display = "Glass of Milk", File = "GlassOfMilk", Min = 30, Max = 70, Rarity = 28, Weight = 1.03f, Scale = 2.6f, Grab = "Jar of pickles|Flask", Drop = "Jar of pickles|Flask", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(75f, 90f, 0f), PosOff = new Vector3(0.09f, 0.18f, -0.09f) }, new Def { Id = "WaterBottle", Display = "Water Bottle", File = "WaterBottle", Min = 20, Max = 60, Rarity = 32, Weight = 1.02f, Scale = 2.8f, Grab = "Flask|Jar of pickles", Drop = "Flask|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(75f, 90f, 0f), PosOff = new Vector3(0.1f, 0.19f, -0.09f) }, new Def { Id = "OrangeJuiceBox", Display = "Orange Juice", File = "OrangeJuiceBox", Min = 20, Max = 60, Rarity = 32, Weight = 1.02f, Scale = 2.6f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(75f, 90f, 0f), PosOff = new Vector3(0.09f, 0.18f, -0.09f) }, new Def { Id = "Apple", Display = "Apple", File = "Apple", Min = 20, Max = 50, Rarity = 34, Weight = 1.02f, Scale = 3.4f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(75f, 90f, 0f), PosOff = new Vector3(0.05f, 0.14f, -0.08f) }, new Def { Id = "CupRamen", Display = "Cup Ramen", File = "CupRamen", Min = 30, Max = 70, Rarity = 30, Weight = 1.02f, Scale = 2.8f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0.06f, 0.16f, -0.09f) }, new Def { Id = "WateringCan", Display = "Watering Can", File = "WateringCan", Min = 40, Max = 90, Rarity = 26, Weight = 1.06f, Scale = 2.6f, Grab = "Flask|Jar of pickles", Drop = "Flask|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0f, 0.188f, -0.275f) }, new Def { Id = "PiggyBank", Display = "Piggy Bank", File = "PiggyBank", Min = 80, Max = 160, Rarity = 22, Weight = 1.08f, Scale = 3f, Grab = "Jar of pickles|Toy cube", Drop = "Jar of pickles|Toy cube", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(-0.022f, 0.266f, -0.09f) }, new Def { Id = "Umbrella", Display = "Umbrella", File = "Umbrella", Min = 40, Max = 90, Rarity = 26, Weight = 1.04f, Scale = 1.25f, Grab = "Remote|Toy cube", Drop = "Remote|Toy cube", Rest = new Vector3(0f, 0f, 90f), RotOff = new Vector3(72f, 90f, 0f), PosOff = new Vector3(0.456f, 0.312f, 0.03f) }, new Def { Id = "JamJar", Display = "Strawberry Jam", File = "JamJar", Min = 30, Max = 70, Rarity = 30, Weight = 1.04f, Scale = 3.2f, Grab = "Jar of pickles|Flask", Drop = "Jar of pickles|Flask", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0.013f, 0.188f, -0.09f) }, new Def { Id = "Tamagotchi", Display = "Tamagotchi", File = "Tamagotchi", Min = 70, Max = 130, Rarity = 24, Weight = 1.02f, Scale = 3.4f, Kind = Kind.Toggle, Tip = "Power : [LMB]", Grab = "Remote|Cell phone", Drop = "Remote|Cell phone", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(76f, 90f, 0f), PosOff = new Vector3(0.12f, 0.144f, -0.03f) }, new Def { Id = "FlowerVase", Display = "Flower Vase", File = "FlowerVase", Min = 60, Max = 120, Rarity = 24, Weight = 1.06f, Scale = 2f, Grab = "Flask|Jar of pickles", Drop = "Flask|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(76f, 90f, 0f), PosOff = new Vector3(0.146f, 0.218f, 0f) }, new Def { Id = "DessertPlate", Display = "Dessert Plate", File = "DessertPlate", Min = 50, Max = 110, Rarity = 24, Weight = 1.04f, Scale = 2.8f, Grab = "Toy cube|Jar of pickles", Drop = "Toy cube|Jar of pickles", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(74f, 90f, -10f), PosOff = new Vector3(0.04f, 0.174f, -0.2f) }, new Def { Id = "FirstAidKit", Display = "First Aid Kit", File = "FirstAidKit", Min = 50, Max = 100, Rarity = 26, Weight = 1.06f, Scale = 2.6f, Grab = "Toy cube|Remote", Drop = "Toy cube|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0.034f, 0.167f, -0.235f) }, new Def { Id = "Toothbrush", Display = "Toothbrush", File = "Toothbrush", Min = 10, Max = 40, Rarity = 32, Weight = 1.01f, Scale = 2f, Grab = "Remote|Toy cube", Drop = "Remote|Toy cube", Rest = new Vector3(0f, 0f, 90f), RotOff = new Vector3(72f, 90f, 0f), PosOff = new Vector3(0.086f, 0.116f, 0.02f) }, new Def { Id = "Toolbox", Display = "Small Toolbox", File = "Toolbox", Min = 60, Max = 120, Rarity = 24, Weight = 1.1f, Scale = 2.2f, Grab = "Toy cube|Cash register", Drop = "Toy cube|Cash register", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(78f, 90f, 0f), PosOff = new Vector3(0.005f, 0.172f, -0.235f) }, new Def { Id = "MiniVacuum", Display = "Mini Vacuum", File = "MiniVacuum", Min = 60, Max = 120, Rarity = 22, Weight = 1.08f, Scale = 2.6f, Grab = "Hairdryer|Hair dryer|Remote", Drop = "Hairdryer|Hair dryer|Remote", Rest = new Vector3(0f, 0f, 90f), RotOff = new Vector3(74f, 90f, 0f), PosOff = new Vector3(0.115f, 0.205f, -0.05f) }, new Def { Id = "HairBrush", Display = "Hair Brush", File = "HairBrush", Min = 20, Max = 60, Rarity = 30, Weight = 1.02f, Scale = 2f, Grab = "Remote|Toy cube", Drop = "Remote|Toy cube", Rest = new Vector3(0f, 0f, 90f), RotOff = new Vector3(72f, 90f, 0f), PosOff = new Vector3(0.074f, 0.156f, 0.02f) }, new Def { Id = "CandleWarmer", Display = "Candle Warmer", File = "CandleWarmer", Min = 50, Max = 110, Rarity = 24, Weight = 1.05f, Scale = 3.4f, Kind = Kind.Toggle, Tip = "Light / Blow out : [LMB]", Grab = "Jar of pickles|Flask", Drop = "Jar of pickles|Flask", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(80f, 90f, 0f), PosOff = new Vector3(-0.015f, 0.214f, -0.09f) }, new Def { Id = "PhotoFrame", Display = "Photo Frame", File = "PhotoFrame", Min = 40, Max = 90, Rarity = 28, Weight = 1.04f, Scale = 2.8f, Grab = "Toy cube|Remote", Drop = "Toy cube|Remote", Rest = new Vector3(0f, 0f, 0f), RotOff = new Vector3(76f, 90f, 0f), PosOff = new Vector3(0.041f, 0.217f, -0.185f) } }; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; GlassTransparent = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "GlassTransparent", true, "Render glass parts (slippers, perfume, clock cover) as transparent. Set false if they look wrong."); AssetDir = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Assets"); ConsoleOn = TryWav("Console_On.wav"); ConsoleOff = TryWav("Console_Off.wav"); Ding = TryWav("Toaster_Ding.wav"); Shutter = TryWav("Camera_Shutter.wav"); Lever = TryWav("Toaster_Lever.wav"); Spray = TryWav("Perfume_Spray.wav"); Jingle = TryWav("SnowGlobe_JingleBells.wav"); Lullaby = TryWav("MusicBox_Lullaby.wav"); GumballTurn = TryWav("Gumball_Turn.wav"); FanLoop = TryWav("Fan_Loop.wav"); TamaOn = TryWav("Tama_On.wav"); TamaOff = TryWav("Tama_Off.wav"); CandleOn = TryWav("Candle_On.wav"); CandleOff = TryWav("Candle_Off.wav"); LoadMugVariants(); Def[] defs = Defs; foreach (Def def in defs) { try { Register(def); } catch (Exception ex) { Log.LogError((object)("PastelScrap: failed to create " + def.Id + ": " + ex)); } } Log.LogInfo((object)("Cozy Items " + ((BaseUnityPlugin)this).Info.Metadata.Version?.ToString() + " loaded: " + Prefabs.Count + " scrap items.")); } private static AudioClip TryWav(string f) { try { return Assets.LoadWav(Path.Combine(AssetDir, f)); } catch (Exception ex) { Log.LogWarning((object)("sound " + f + ": " + ex.Message)); return null; } } private static void LoadMugVariants() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) string[] array = new string[6] { "Pink", "Mint", "Lavender", "Butter", "Sky", "Cream" }; List<Texture2D> list = new List<Texture2D>(); List<Color> list2 = new List<Color>(); string json = ""; try { json = File.ReadAllText(Path.Combine(AssetDir, "CherryMug_colors.json")); } catch { } string[] array2 = array; foreach (string text in array2) { try { list.Add(Assets.LoadTexPublic("CherryMug_" + text + ".png")); Vector3 val = Assets.JsonVec(json, text); list2.Add(new Color(val.x, val.y, val.z, 1f)); } catch (Exception ex) { Log.LogWarning((object)("mug variant " + text + ": " + ex.Message)); } } MugTex = list.ToArray(); MugColors = list2.ToArray(); } private void Register(Def d) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) GameObject val = NetworkPrefabs.CreateNetworkPrefab("PastelScrap_" + d.Id); val.layer = 6; NetworkObject component = val.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null) { component.AutoObjectParentSync = false; component.DontDestroyWithOwner = true; } try { val.tag = "PhysicsProp"; } catch { } GameObject val2 = new GameObject("Model"); val2.transform.SetParent(val.transform, false); val2.transform.localScale = Vector3.one * d.Scale; Transform lidPivot = null; Dictionary<string, List<GameObject>> dictionary = Assets.LoadModel(Path.Combine(AssetDir, d.File + ".psm")); if (d.Kind == Kind.Phone) { string json = File.ReadAllText(Path.Combine(AssetDir, "FlipPhone.json")); float num = Assets.JsonFloat(json, "pivotZ"); float num2 = Assets.JsonFloat(json, "lbHalf"); GameObject val3 = new GameObject("Body"); val3.transform.SetParent(val2.transform, false); val3.transform.localPosition = new Vector3(0f, num2, 0f); foreach (GameObject item in dictionary["Base"]) { item.transform.SetParent(val3.transform, false); } GameObject val4 = new GameObject("LidPivot"); val4.transform.SetParent(val3.transform, false); val4.transform.localPosition = new Vector3(0f, 0f, num); val4.transform.localRotation = Quaternion.AngleAxis(180f, Vector3.right); foreach (GameObject item2 in dictionary["Lid"]) { item2.transform.SetParent(val4.transform, false); } lidPivot = val4.transform; } else { string path = Path.Combine(AssetDir, d.File + ".json"); string json2 = (File.Exists(path) ? File.ReadAllText(path) : ""); foreach (KeyValuePair<string, List<GameObject>> item3 in dictionary) { Transform transform = val2.transform; if (item3.Key != "") { GameObject val5 = new GameObject(item3.Key); val5.transform.SetParent(val2.transform, false); val5.transform.localPosition = Assets.JsonVec(json2, item3.Key); transform = val5.transform; } foreach (GameObject item4 in item3.Value) { item4.transform.SetParent(transform, false); } } string[] array = new string[3] { "FlashGlow", "DropBall", "FlameOn" }; foreach (string text in array) { Transform val6 = val2.transform.Find(text); if ((Object)(object)val6 != (Object)null) { val6.localScale = Vector3.one * 0.0001f; } } } Bounds val7 = Assets.LocalBounds(val.transform); Transform transform2 = val2.transform; transform2.localPosition -= ((Bounds)(ref val7)).center; ((Bounds)(ref val7)).center = Vector3.zero; Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = 6; } BoxCollider obj2 = val.AddComponent<BoxCollider>(); obj2.center = Vector3.zero; obj2.size = ((Bounds)(ref val7)).size; ((Collider)obj2).isTrigger = false; AudioSource obj3 = val.AddComponent<AudioSource>(); obj3.playOnAwake = false; obj3.spatialBlend = 1f; obj3.minDistance = 1f; obj3.maxDistance = 20f; obj3.rolloffMode = (AudioRolloffMode)1; GameObject val8 = new GameObject("ScanNode"); val8.transform.SetParent(val.transform, false); val8.layer = 22; BoxCollider obj4 = val8.AddComponent<BoxCollider>(); obj4.size = Vector3.one * 0.4f; ((Collider)obj4).isTrigger = false; ScanNodeProperties obj5 = val8.AddComponent<ScanNodeProperties>(); obj5.maxRange = 13; obj5.minRange = 1; obj5.requiresLineOfSight = true; obj5.headerText = d.Display; obj5.subText = "Value: "; obj5.nodeType = 2; obj5.creatureScanID = -1; Item val9 = ScriptableObject.CreateInstance<Item>(); ((Object)val9).name = "PastelScrap_" + d.Id; val9.itemName = d.Display; val9.isScrap = true; val9.minValue = d.Min; val9.maxValue = d.Max; val9.weight = d.Weight; val9.twoHanded = false; val9.twoHandedAnimation = false; val9.itemSpawnsOnGround = true; val9.canBeGrabbedBeforeGameStart = true; val9.isConductiveMetal = false; val9.allowDroppingAheadOfPlayer = true; val9.restingRotation = d.Rest; try { FieldInfo field = typeof(Item).GetField("floorYOffset"); if (field != null) { float num3 = 90f - d.FrontYaw; if (field.FieldType == typeof(int)) { field.SetValue(val9, (int)num3); } else if (field.FieldType == typeof(float)) { field.SetValue(val9, num3); } } } catch { } val9.rotationOffset = d.RotOff; val9.positionOffset = d.PosOff; val9.verticalOffset = ((Mathf.Abs(d.Rest.x - 90f) < 1f || Mathf.Abs(d.Rest.x - 270f) < 1f) ? ((Bounds)(ref val7)).extents.z : ((Mathf.Abs(Mathf.Abs(d.Rest.z) - 90f) < 1f || Mathf.Abs(d.Rest.z - 270f) < 1f) ? ((Bounds)(ref val7)).extents.x : ((Bounds)(ref val7)).extents.y)); val9.itemIcon = Assets.LoadIcon(Path.Combine(AssetDir, d.File + "_icon.png")); SfxTargets.Add(new KeyValuePair<Item, string[]>(val9, new string[2] { d.Grab, d.Drop })); if (d.Tip != null) { val9.syncUseFunction = false; val9.toolTips = new string[1] { d.Tip }; } val9.spawnPrefab = val; GrabbableObject val10; switch (d.Kind) { case Kind.Phone: { PastelPhone pastelPhone = val.AddComponent<PastelPhone>(); pastelPhone.LidPivot = lidPivot; val10 = (GrabbableObject)(object)pastelPhone; break; } case Kind.Console: val10 = (GrabbableObject)(object)val.AddComponent<PastelConsole>(); break; case Kind.Camera: val10 = (GrabbableObject)(object)val.AddComponent<PastelCamera>(); break; case Kind.Toaster: val10 = (GrabbableObject)(object)val.AddComponent<PastelToaster>(); break; case Kind.Perfume: val10 = (GrabbableObject)(object)val.AddComponent<PastelPerfume>(); break; case Kind.SnowGlobe: val10 = (GrabbableObject)(object)val.AddComponent<PastelSnowGlobe>(); break; case Kind.Gumball: val10 = (GrabbableObject)(object)val.AddComponent<PastelGumball>(); break; case Kind.Fan: val10 = (GrabbableObject)(object)val.AddComponent<PastelFan>(); break; case Kind.MusicBox: val10 = (GrabbableObject)(object)val.AddComponent<PastelMusicBox>(); break; case Kind.Toggle: val10 = (GrabbableObject)(object)val.AddComponent<PastelToggle>(); break; case Kind.Mug: val10 = (GrabbableObject)(object)val.AddComponent<PastelMug>(); MugPrefab = val; MugItem = val9; break; default: val10 = (GrabbableObject)(object)val.AddComponent<PastelProp>(); break; } val10.itemProperties = val9; ((PastelProp)(object)val10).FrontYaw = d.FrontYaw; val10.grabbable = true; val10.grabbableToEnemies = true; val10.isInFactory = true; val10.mainObjectRenderer = val.GetComponentInChildren<MeshRenderer>(); Items.RegisterScrap(val9, d.Rarity, (LevelTypes)(-1)); Prefabs.Add(val); } internal unsafe static float MugRatio() { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) if (_mugRatio > 0f) { return _mugRatio; } if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.allItemsList == (Object)null || (Object)(object)MugPrefab == (Object)null) { return 1f; } _mugRatio = 1f; try { Item val = null; foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if ((Object)(object)items != (Object)null && (Object)(object)items.spawnPrefab != (Object)null && (Object)(object)items != (Object)(object)MugItem && (string.Equals(items.itemName, "Mug", StringComparison.OrdinalIgnoreCase) || string.Equals(items.itemName, "Coffee mug", StringComparison.OrdinalIgnoreCase))) { val = items; break; } } if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"vanilla Mug not found, keeping mug size"); return _mugRatio; } Transform transform = val.spawnPrefab.transform; Bounds val2 = Assets.LocalBounds(transform, 1E-06f); Vector3 val3 = Vector3.Scale(((Bounds)(ref val2)).size, transform.lossyScale); Bounds val4 = Assets.LocalBounds(MugPrefab.transform); Vector3 size = ((Bounds)(ref val4)).size; float num = Mathf.Abs(val3.x * val3.y * val3.z); float num2 = Mathf.Abs(size.x * size.y * size.z); float num3 = ((num > 1E-09f && num2 > 1E-09f) ? Mathf.Pow(num / num2, 1f / 3f) : (Mathf.Max(val3.x, Mathf.Max(val3.y, val3.z)) / Mathf.Max(size.x, Mathf.Max(size.y, size.z)))); if (float.IsNaN(num3) || num3 < 0.2f || num3 > 4f) { Log.LogWarning((object)("mug ratio out of range " + num3)); return _mugRatio; } _mugRatio = num3; if ((Object)(object)MugItem != (Object)null) { Item mugItem = MugItem; mugItem.verticalOffset *= num3; } ManualLogSource log = Log; string[] obj = new string[6] { "Mug matched to vanilla: vanilla ", null, null, null, null, null }; Vector3 val5 = val3; obj[1] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[2] = " ours "; val5 = size; obj[3] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[4] = " ratio "; obj[5] = num3.ToString(); log.LogDebug((object)string.Concat(obj)); } catch (Exception ex) { Log.LogWarning((object)("mug size: " + ex.Message)); } return _mugRatio; } private void TryPatchSfx() { if (_sfxDone || (Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.allItemsList == (Object)null) { return; } _sfxDone = true; List<Item> all = StartOfRound.Instance.allItemsList.itemsList; try { Assets.FixTransparency(all); } catch (Exception ex) { Log.LogWarning((object)("glass fix: " + ex.Message)); } foreach (KeyValuePair<Item, string[]> sfxTarget in SfxTargets) { Item val = Find(sfxTarget.Value[0]); Item val2 = Find(sfxTarget.Value[1]); if ((Object)(object)val != (Object)null) { sfxTarget.Key.grabSFX = val.grabSFX; sfxTarget.Key.pocketSFX = (((Object)(object)val.pocketSFX != (Object)null) ? val.pocketSFX : val.grabSFX); } if ((Object)(object)val2 != (Object)null) { sfxTarget.Key.dropSFX = val2.dropSFX; } Log.LogDebug((object)("SFX for " + sfxTarget.Key.itemName + ": " + (((Object)(object)val != (Object)null) ? val.itemName : "none") + " / " + (((Object)(object)val2 != (Object)null) ? val2.itemName : "none"))); } Item val3 = Find("Flashlight|Pro-flashlight"); if (!((Object)(object)val3 != (Object)null) || !((Object)(object)val3.spawnPrefab != (Object)null)) { return; } MonoBehaviour[] components = val3.spawnPrefab.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val4 in components) { FieldInfo field = ((object)val4).GetType().GetField("flashlightClips"); if (field != null && field.GetValue(val4) is AudioClip[] array && array.Length != 0) { FlipClip = array[0]; break; } } Item Find(string names) { string[] array2 = names.Split('|'); foreach (string b in array2) { foreach (Item item in all) { if ((Object)(object)item != (Object)null && string.Equals(item.itemName, b, StringComparison.OrdinalIgnoreCase)) { return item; } } } return null; } } private void Update() { TryPatchSfx(); CozyNet.Tick(); Mouse current = Mouse.current; PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if (current != null && (Object)(object)val != (Object)null && current.leftButton.wasPressedThisFrame) { GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer; if (currentlyHeldObjectServer is IPastelUse pastelUse && !currentlyHeldObjectServer.isPocketed) { pastelUse.LocalUse(); } } } } public class PastelProp : GrabbableObject { public float FrontYaw; private bool _wasHeld; private bool _haveYaw; private PlayerControllerB _holder; private float _restYaw; public override void Start() { ((GrabbableObject)this).Start(); (((Component)this).gameObject.GetComponent<PastelFacer>() ?? ((Component)this).gameObject.AddComponent<PastelFacer>()).Prop = this; try { if (base.isInShipRoom && !base.isHeld && (Object)(object)((Component)this).transform.parent == (Object)null && (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.elevatorTransform != (Object)null) { ((Component)this).transform.SetParent(StartOfRound.Instance.elevatorTransform, true); } } catch { } } internal bool TryRest(out Quaternion q) { //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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) q = Quaternion.identity; if (!_haveYaw || base.isHeld || base.isHeldByEnemy || base.isPocketed || (Object)(object)base.itemProperties == (Object)null) { return false; } Vector3 restingRotation = base.itemProperties.restingRotation; q = Quaternion.Euler(restingRotation.x, _restYaw, restingRotation.z); return true; } public override void Update() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d3: 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_00e5: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (base.isHeld && !base.isHeldByEnemy) { _wasHeld = true; if ((Object)(object)base.playerHeldBy != (Object)null) { _holder = base.playerHeldBy; } return; } if (_wasHeld) { _wasHeld = false; if ((Object)(object)_holder != (Object)null && !base.isHeldByEnemy) { _restYaw = ((Component)_holder).transform.eulerAngles.y + 180f - FrontYaw; _haveYaw = true; } _holder = null; } if (base.isHeldByEnemy) { _haveYaw = false; } else if (_haveYaw && !base.isPocketed && (Object)(object)base.itemProperties != (Object)null) { Vector3 restingRotation = base.itemProperties.restingRotation; ((Component)this).transform.rotation = Quaternion.Euler(restingRotation.x, _restYaw, restingRotation.z); } } protected static Transform FindDeep(Transform t, string n) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((Object)t).name == n) { return t; } foreach (Transform item in t) { Transform val = FindDeep(item, n); if ((Object)(object)val != (Object)null) { return val; } } return null; } } [DefaultExecutionOrder(32000)] public sealed class PastelFacer : MonoBehaviour { public PastelProp Prop; private void LateUpdate() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Prop != (Object)null && Prop.TryRest(out var q)) { ((Component)this).transform.rotation = q; } } } internal static class CozyNet { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnMsg; } private const string Msg = "hihi_hh.CozyItems.Use"; private static CustomMessagingManager _reg; public static void Tick() { //IL_0059: 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_0064: Expected O, but got Unknown NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening || singleton.CustomMessagingManager == null) { _reg = null; } else if (_reg != singleton.CustomMessagingManager) { _reg = singleton.CustomMessagingManager; CustomMessagingManager reg = _reg; object obj = <>O.<0>__OnMsg; if (obj == null) { HandleNamedMessageDelegate val = OnMsg; <>O.<0>__OnMsg = val; obj = (object)val; } reg.RegisterNamedMessageHandler("hihi_hh.CozyItems.Use", (HandleNamedMessageDelegate)obj); } } public unsafe static void Send(NetworkObject no, int seed) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null || !singleton.IsListening || (Object)(object)no == (Object)null || !no.IsSpawned) { return; } Tick(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(32, (Allocator)2, -1); try { ulong networkObjectId = no.NetworkObjectId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref seed, default(ForPrimitives)); networkObjectId = singleton.LocalClientId; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref networkObjectId, default(ForPrimitives)); if (singleton.IsServer) { ToClients(val, singleton.LocalClientId); } else { singleton.CustomMessagingManager.SendNamedMessage("hihi_hh.CozyItems.Use", 0uL, val, (NetworkDelivery)3); } } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } private static void ToClients(FastBufferWriter w, ulong except) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager singleton = NetworkManager.Singleton; List<ulong> list = new List<ulong>(); foreach (ulong connectedClientsId in singleton.ConnectedClientsIds) { if (connectedClientsId != except && connectedClientsId != singleton.LocalClientId) { list.Add(connectedClientsId); } } if (list.Count > 0) { singleton.CustomMessagingManager.SendNamedMessage("hihi_hh.CozyItems.Use", (IReadOnlyList<ulong>)list, w, (NetworkDelivery)3); } } private unsafe static void OnMsg(ulong sender, FastBufferReader r) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) try { ulong key = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); int seed = default(int); ((FastBufferReader)(ref r)).ReadValueSafe<int>(ref seed, default(ForPrimitives)); ulong num = default(ulong); ((FastBufferReader)(ref r)).ReadValueSafe<ulong>(ref num, default(ForPrimitives)); NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } if (singleton.IsServer && sender != singleton.LocalClientId) { FastBufferWriter w = default(FastBufferWriter); ((FastBufferWriter)(ref w))..ctor(32, (Allocator)2, -1); try { ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref key, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<int>(ref seed, default(ForPrimitives)); ((FastBufferWriter)(ref w)).WriteValueSafe<ulong>(ref num, default(ForPrimitives)); ToClients(w, num); } finally { ((IDisposable)(*(FastBufferWriter*)(&w))/*cast due to .constrained prefix*/).Dispose(); } } if (num != singleton.LocalClientId && singleton.SpawnManager != null && singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { PastelUsable component = ((Component)value).GetComponent<PastelUsable>(); if ((Object)(object)component != (Object)null) { component.RemoteUse(seed); } } } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("sync receive: " + ex.Message)); } } } public abstract class PastelUsable : PastelProp, IPastelUse { private int _lastFrame = -1; protected AudioSource Audio; protected int UseSeed = 1; public override void Start() { base.Start(); Audio = ((Component)this).GetComponent<AudioSource>(); } public void LocalUse() { if (_lastFrame == Time.frameCount) { return; } _lastFrame = Time.frameCount; UseSeed = Random.Range(1, int.MaxValue); OnUse(); try { CozyNet.Send(((NetworkBehaviour)this).NetworkObject, UseSeed); } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("sync send: " + ex.Message)); } } internal void RemoteUse(int seed) { UseSeed = seed; try { OnUse(); } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("sync use: " + ex.Message)); } } protected abstract void OnUse(); public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && ((NetworkBehaviour)this).IsOwner) { LocalUse(); } } protected void Play(AudioClip c, float vol = 1f) { if ((Object)(object)Audio != (Object)null && (Object)(object)c != (Object)null) { Audio.PlayOneShot(c, vol); } } } public sealed class PastelPhone : PastelUsable { public const float ClosedAngle = 180f; public const float OpenAngle = 15f; public Transform LidPivot; private bool _open; private float _angle = 180f; public override void Start() { base.Start(); if ((Object)(object)LidPivot == (Object)null) { LidPivot = PastelProp.FindDeep(((Component)this).transform, "LidPivot"); } Apply(); } protected override void OnUse() { _open = !_open; Play(PastelScrapPlugin.FlipClip, 0.8f); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); _open = false; } public override void Update() { base.Update(); _angle = Mathf.Lerp(_angle, _open ? 15f : 180f, 1f - Mathf.Exp(-12f * Time.deltaTime)); Apply(); } private void Apply() { //IL_001a: 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) if ((Object)(object)LidPivot != (Object)null) { LidPivot.localRotation = Quaternion.AngleAxis(_angle, Vector3.right); } } } public sealed class PastelConsole : PastelUsable { private Transform _screen; private bool _on; private int _powerCount; private int _game = -1; private Random _pick; private PixelGames _px; private float _acc; public override void Start() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_017a: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) base.Start(); _screen = PastelProp.FindDeep(((Component)this).transform, "ScreenOn"); if ((Object)(object)_screen != (Object)null) { ((Component)_screen).gameObject.SetActive(false); } try { _px = new PixelGames(); if (!((Object)(object)_screen != (Object)null)) { return; } Renderer[] componentsInChildren = ((Component)_screen).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (((Object)((Component)val).gameObject).name != "Screen") { continue; } Shader val2 = Shader.Find("HDRP/Unlit"); if ((Object)(object)val2 != (Object)null) { Material val3 = new Material(val2) { name = "PastelScrap_ConsoleScreen" }; if (val3.HasProperty("_UnlitColorMap")) { val3.SetTexture("_UnlitColorMap", (Texture)(object)_px.Tex); } if (val3.HasProperty("_UnlitColor")) { val3.SetColor("_UnlitColor", Color.white); } val3.mainTexture = (Texture)(object)_px.Tex; val.material = val3; PastelScrapPlugin.Log.LogDebug((object)"console screen: unlit"); continue; } Material material = val.material; material.mainTexture = (Texture)(object)_px.Tex; if (material.HasProperty("_BaseColorMap")) { material.SetTexture("_BaseColorMap", (Texture)(object)_px.Tex); } if (material.HasProperty("_BaseColor")) { material.SetColor("_BaseColor", Color.white); } if (material.HasProperty("_Smoothness")) { material.SetFloat("_Smoothness", 0f); } if (material.HasProperty("_EmissiveColorMap")) { material.SetTexture("_EmissiveColorMap", (Texture)(object)_px.Tex); material.EnableKeyword("_EMISSIVE_COLOR_MAP"); material.SetColor("_EmissiveColor", Color.white * 0.35f); } PastelScrapPlugin.Log.LogDebug((object)"console screen: lit fallback"); } } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("console screen: " + ex.Message)); _px = null; } } private int Seed() { try { return (int)(((NetworkBehaviour)this).NetworkObjectId * 7919 + 17); } catch { return 17; } } protected override void OnUse() { _on = !_on; if (_on) { if (_pick == null) { _pick = new Random(Seed()); } int num = 6; _game = ((_powerCount != 0) ? ((_game + 1 + _pick.Next(num - 1)) % num) : 0); _powerCount++; if (_px != null) { _px.Begin(_game, Seed() + _powerCount * 31); _acc = 0f; } } if ((Object)(object)_screen != (Object)null) { ((Component)_screen).gameObject.SetActive(_on); } Play(_on ? PastelScrapPlugin.ConsoleOn : PastelScrapPlugin.ConsoleOff, 0.4f); } public override void Update() { base.Update(); if (!_on || _px == null) { return; } _acc += Time.deltaTime; if (_acc < 1f / 15f) { return; } float dt = Mathf.Min(_acc, 0.2f); _acc = 0f; try { _px.Step(dt); } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("pixel game: " + ex.Message)); _px = null; } } } internal sealed class PixelGames { public const int W = 80; public const int H = 64; public const int Count = 6; public readonly Texture2D Tex; private readonly Color32[] _b = (Color32[])(object)new Color32[5120]; private Random _r = new Random(1); private int _g; private int _score; private float _boot; private float _t; private static readonly string[] Dig = new string[10] { "111101101101111", "010110010010111", "111001111100111", "111001111001111", "101101111001001", "111100111001111", "111100111101111", "111001001010010", "111101111101111", "111101111001111" }; private float _scroll; private float _cycle; private float _flash; private readonly List<float> _scrap = new List<float>(); private static readonly string[] Emp1 = new string[9] { "..HH..", ".HVVH.", ".HHHH.", "OOOOOO", "BOOOO.", "BOOOO.", ".O..O.", ".O..O.", ".K..K." }; private static readonly string[] Emp2 = new string[9] { "..HH..", ".HVVH.", ".HHHH.", "OOOOOO", "BOOOO.", "BOOOO.", ".OO.O.", "O...O.", "K....K" }; private static readonly string[] Mon = new string[11] { "..mm..", ".mmmm.", ".mRmR.", ".mmmm.", "mmmmmm", "m.mm.m", "m.mm.m", "..mm..", ".m..m.", ".m..m.", "m....m" }; private readonly List<Vector2Int> _snake = new List<Vector2Int>(); private Vector2Int _dir; private Vector2Int _food; private float _acc1; private const int SG = 4; private const int SW = 20; private const int SH = 14; private const int BW = 10; private const int BH = 13; private const int BC = 4; private const int BX = 20; private const int BY = 10; private readonly int[,] _board = new int[10, 13]; private static readonly int[][] Shapes = new int[7][] { new int[8] { 0, 0, 1, 0, 2, 0, 3, 0 }, new int[8] { 0, 0, 1, 0, 0, 1, 1, 1 }, new int[8] { 1, 0, 0, 1, 1, 1, 2, 1 }, new int[8] { 0, 0, 0, 1, 1, 1, 2, 1 }, new int[8] { 2, 0, 0, 1, 1, 1, 2, 1 }, new int[8] { 1, 0, 2, 0, 0, 1, 1, 1 }, new int[8] { 0, 0, 1, 0, 1, 1, 2, 1 } }; private static readonly Color32[] BCol = (Color32[])(object)new Color32[7] { C(150, 220, 255), C(255, 236, 140), C(210, 170, 255), C(140, 170, 255), C(255, 190, 130), C(160, 240, 190), C(255, 150, 170) }; private int[] _pc = new int[8]; private int _pk; private int _px; private int _py; private int _tx; private float _acc2; private float _clearT; private int _clearRow = -1; private readonly List<Vector3> _stars = new List<Vector3>(); private readonly List<Vector3> _en = new List<Vector3>(); private readonly List<Vector3> _bul = new List<Vector3>(); private readonly List<Vector3> _boom = new List<Vector3>(); private float _shipX; private float _fire; private float _spawnE; private readonly List<Vector2> _obs = new List<Vector2>(); private readonly List<Vector2> _cloud = new List<Vector2>(); private float _by; private float _vy; private float _nextObs; private float _runT; private readonly bool[,] _bricks = new bool[9, 5]; private Vector2 _ball; private Vector2 _bv; private float _pad; private static readonly Color32[] RowCol = (Color32[])(object)new Color32[5] { C(255, 150, 170), C(255, 190, 130), C(255, 236, 140), C(160, 240, 190), C(150, 210, 255) }; public PixelGames() { //IL_00b1: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Tex = new Texture2D(80, 64, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; Clear(C(0, 0, 0)); Push(); } private static Color32 C(int r, int g, int b) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new Color32((byte)r, (byte)g, (byte)b, byte.MaxValue); } private void Push() { Tex.SetPixels32(_b); Tex.Apply(false); } private void Px(int x, int y, Color32 c) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((uint)x < 80u && (uint)y < 64u) { _b[(63 - y) * 80 + x] = c; } } private void Rect(int x, int y, int w, int h, Color32 c) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) for (int i = y; i < y + h; i++) { for (int j = x; j < x + w; j++) { Px(j, i, c); } } } private void Clear(Color32 c) { //IL_000b: 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) for (int i = 0; i < _b.Length; i++) { _b[i] = c; } } private void Num(int v, int x, int y, Color32 c) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) string text = Math.Max(0, v).ToString(); foreach (char c2 in text) { string text2 = Dig[c2 - 48]; for (int j = 0; j < 15; j++) { if (text2[j] == '1') { Px(x + j % 3, y + j / 3, c); } } x += 4; } } private void Spr(string[] rows, int x, int y, Func<char, Color32?> pal, bool flip = false) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < rows.Length; i++) { for (int j = 0; j < rows[i].Length; j++) { Color32? val = pal(rows[i][flip ? (rows[i].Length - 1 - j) : j]); if (val.HasValue) { Px(x + j, y + i, val.Value); } } } } private void Hud(Color32 bg, Color32 fg) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Rect(0, 0, 80, 7, bg); Num(_score, 2, 1, fg); } public void Begin(int game, int seed) { _g = game; _r = new Random(seed); _score = 0; _t = 0f; _boot = 0.8f; switch (_g) { case 0: LcInit(); break; case 1: SnInit(); break; case 2: BkInit(); break; case 3: ShInit(); break; case 4: RuInit(); break; default: BrInit(); break; } Step(0f); } public void Step(float dt) { //IL_003c: 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_011a: Unknown result type (might be due to invalid IL or missing references) _t += dt; if (_boot > 0f) { _boot -= dt; Clear(C(255, 214, 226)); int num = (int)(_t * 8f) % 2; string[] rows = new string[6] { ".XX.XX.", "XXXXXXX", "XXXXXXX", ".XXXXX.", "..XXX..", "...X..." }; Spr(rows, 36, 24 - num, (char ch) => (ch != 'X') ? ((Color32?)null) : new Color32?(C(255, 110, 150))); int w = (int)Mathf.Clamp(40f * (1f - _boot / 0.8f), 0f, 40f); Rect(20, 40, 40, 3, C(255, 240, 245)); Rect(20, 40, w, 3, C(255, 130, 170)); Push(); return; } switch (_g) { case 0: Lc(dt); break; case 1: Sn(dt); break; case 2: Bk(dt); break; case 3: Sh(dt); break; case 4: Ru(dt); break; default: Br(dt); break; } Push(); } private void LcInit() { _scroll = 0f; _cycle = 0f; _flash = 0f; _scrap.Clear(); _scrap.Add(70f); } private void Lc(float dt) { //IL_00d3: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) _cycle = (_cycle + dt) % 12f; float num = -14f; if (_cycle > 4f && _cycle < 9f) { num = Mathf.Lerp(-14f, 22f, Mathf.SmoothStep(0f, 1f, (_cycle - 4f) / 5f)); } else if (_cycle >= 9f && _cycle < 11f) { num = Mathf.Lerp(22f, -14f, (_cycle - 9f) / 2f); } bool flag = num > 12f; float num2 = (flag ? 34f : 14f); _scroll += num2 * dt; Clear(C(46, 52, 60)); for (int i = 7; i < 50; i += 9) { Rect(0, i, 80, 1, C(40, 45, 52)); } for (int j = -((int)_scroll % 24); j < 80; j += 24) { Rect(j, 7, 4, 43, C(34, 38, 46)); Rect(j + 4, 7, 1, 43, C(70, 76, 88)); Rect(j + 10, 9, 5, 2, C(255, 230, 150)); Rect(j + 9, 11, 7, 1, C(120, 112, 80)); } Rect(0, 50, 80, 14, C(30, 32, 36)); for (int k = -((int)_scroll % 8); k < 80; k += 8) { Rect(k, 50, 1, 14, C(42, 44, 50)); } Rect(0, 50, 80, 1, C(70, 72, 80)); for (int num3 = _scrap.Count - 1; num3 >= 0; num3--) { _scrap[num3] -= num2 * dt; int num4 = (int)_scrap[num3]; if (num4 < 38 && num4 > 26) { _score += _r.Next(12, 90); _flash = 0.25f; _scrap.RemoveAt(num3); } else { Rect(num4, 46, 4, 4, C(236, 200, 80)); Px(num4 + 1, 47, C(255, 250, 200)); } } if (_scrap.Count == 0 || _scrap[_scrap.Count - 1] < (float)(62 - _r.Next(0, 30))) { _scrap.Add(80 + _r.Next(2, 20)); } Spr(Mon, (int)num, 39, (char ch) => ch switch { 'R' => C(255, 50, 50), 'm' => C(58, 78, 58), _ => null, }); int num5 = (int)(_t * (float)(flag ? 12 : 6)) % 2; Spr((num5 == 0) ? Emp1 : Emp2, 32, 41, (char ch) => ch switch { 'K' => C(40, 40, 44), 'B' => C(120, 90, 60), 'O' => C(232, 118, 40), 'V' => C(40, 60, 90), 'H' => C(170, 172, 176), _ => null, }); if (_flash > 0f) { _flash -= dt; Px(38, 38, C(255, 255, 200)); Px(37, 37, C(255, 255, 200)); Px(39, 37, C(255, 255, 200)); } Rect(0, 0, 80, 7, C(10, 12, 14)); Rect(2, 1, 3, 5, C(120, 255, 140)); Px(3, 2, C(10, 12, 14)); Px(3, 4, C(10, 12, 14)); Num(_score, 7, 1, C(120, 255, 140)); int num6 = 8 + (int)(_t / 4f) % 12; Color32 c = C(255, 170, 60); Num(num6, (num6 < 10) ? 62 : 58, 1, c); Px(66, 2, c); Px(66, 4, c); Num(0, 68, 1, c); Num(0, 72, 1, c); if (flag && (int)(_t * 6f) % 2 == 0) { Color32 c2 = C(220, 30, 30); Rect(0, 7, 80, 1, c2); Rect(0, 63, 80, 1, c2); Rect(0, 7, 1, 57, c2); Rect(79, 7, 1, 57, c2); } } private void SnInit() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) _snake.Clear(); for (int i = 0; i < 4; i++) { _snake.Add(new Vector2Int(6 - i, 7)); } _dir = Vector2Int.right; NewFood(); _acc1 = 0f; } private void NewFood() { //IL_001b: 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_002c: Unknown result type (might be due to invalid IL or missing references) do { _food = new Vector2Int(_r.Next(20), _r.Next(14)); } while (_snake.Contains(_food)); } private bool Free(Vector2Int p) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (((Vector2Int)(ref p)).x >= 0 && ((Vector2Int)(ref p)).y >= 0 && ((Vector2Int)(ref p)).x < 20 && ((Vector2Int)(ref p)).y < 14) { return !_snake.GetRange(0, _snake.Count - 1).Contains(p); } return false; } private void Sn(float dt) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) _acc1 += dt; while (_acc1 > 0.11f) { _acc1 -= 0.11f; Vector2Int dir = Vector2Int.zero; int num = int.MaxValue; Vector2Int[] array = (Vector2Int[])(object)new Vector2Int[3] { _dir, new Vector2Int(((Vector2Int)(ref _dir)).y, -((Vector2Int)(ref _dir)).x), new Vector2Int(-((Vector2Int)(ref _dir)).y, ((Vector2Int)(ref _dir)).x) }; foreach (Vector2Int val in array) { Vector2Int p = _snake[0] + val; if (Free(p)) { int num2 = Mathf.Abs(((Vector2Int)(ref p)).x - ((Vector2Int)(ref _food)).x) + Mathf.Abs(((Vector2Int)(ref p)).y - ((Vector2Int)(ref _food)).y) + _r.Next(2); if (num2 < num) { num = num2; dir = val; } } } if (num == int.MaxValue) { _score = 0; SnInit(); break; } _dir = dir; Vector2Int val2 = _snake[0] + _dir; _snake.Insert(0, val2); if (val2 == _food) { _score++; if (_snake.Count > 60) { SnInit(); break; } NewFood(); } else { _snake.RemoveAt(_snake.Count - 1); } } Clear(C(40, 48, 78)); for (int j = 0; j < 14; j++) { for (int k = 0; k < 20; k++) { if (((k + j) & 1) == 0) { Rect(k * 4, 8 + j * 4, 4, 4, C(46, 55, 88)); } } } Rect(((Vector2Int)(ref _food)).x * 4 + 1, 8 + ((Vector2Int)(ref _food)).y * 4, 2, 4, C(255, 110, 150)); Rect(((Vector2Int)(ref _food)).x * 4, 9 + ((Vector2Int)(ref _food)).y * 4, 4, 2, C(255, 110, 150)); for (int num3 = _snake.Count - 1; num3 >= 0; num3--) { Vector2Int val3 = _snake[num3]; int x = ((Vector2Int)(ref val3)).x * 4; val3 = _snake[num3]; Rect(x, 8 + ((Vector2Int)(ref val3)).y * 4, 4 - ((num3 != 0) ? 1 : 0), 4 - ((num3 != 0) ? 1 : 0), (num3 == 0) ? C(90, 210, 170) : C(160, 240, 205)); } Hud(C(26, 30, 52), C(160, 240, 205)); } private void BkInit() { Array.Clear(_board, 0, _board.Length); Spawn(); _acc2 = 0f; } private void Spawn() { _pk = _r.Next(Shapes.Length); Array.Copy(Shapes[_pk], _pc, 8); int num = _r.Next(4); for (int i = 0; i < num; i++) { for (int j = 0; j < 4; j++) { int num2 = _pc[j * 2]; _pc[j * 2] = 3 - _pc[j * 2 + 1]; _pc[j * 2 + 1] = num2; } } int num3 = 9; int num4 = 9; for (int k = 0; k < 4; k++) { num3 = Math.Min(num3, _pc[k * 2]); num4 = Math.Min(num4, _pc[k * 2 + 1]); } for (int l = 0; l < 4; l++) { _pc[l * 2] -= num3; _pc[l * 2 + 1] -= num4; } _px = 3; _py = 0; _tx = BestColumn(); if (!Fits(_px, _py)) { _score = 0; Array.Clear(_board, 0, _board.Length); } } private bool Fits(int ox, int oy) { for (int i = 0; i < 4; i++) { int num = ox + _pc[i * 2]; int num2 = oy + _pc[i * 2 + 1]; if (num < 0 || num >= 10 || num2 >= 13) { return false; } if (num2 >= 0 && _board[num, num2] != 0) { return false; } } return true; } private int BestColumn() { int result = _px; int num = -1; for (int i = 0; i < 10; i++) { if (Fits(i, 0)) { int j; for (j = 0; Fits(i, j + 1); j++) { } int num2 = j * 4 + _r.Next(3); if (num2 > num) { num = num2; result = i; } } } return result; } private void Bk(float dt) { //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) if (_clearRow >= 0) { _clearT -= dt; if (_clearT <= 0f) { for (int num = _clearRow; num > 0; num--) { for (int i = 0; i < 10; i++) { _board[i, num] = _board[i, num - 1]; } } for (int j = 0; j < 10; j++) { _board[j, 0] = 0; } _clearRow = -1; _score++; CheckLines(); if (_clearRow < 0) { Spawn(); } } } else { _acc2 += dt; while (_acc2 > 0.09f && _clearRow < 0) { _acc2 -= 0.09f; if (_px != _tx && Fits(_px + Math.Sign(_tx - _px), _py)) { _px += Math.Sign(_tx - _px); continue; } if (Fits(_px, _py + 1)) { _py++; continue; } for (int k = 0; k < 4; k++) { int num2 = _py + _pc[k * 2 + 1]; if (num2 >= 0) { _board[_px + _pc[k * 2], num2] = _pk + 1; } } CheckLines(); if (_clearRow < 0) { Spawn(); } } } Clear(C(52, 40, 72)); Rect(19, 9, 42, 54, C(255, 214, 226)); Rect(20, 10, 40, 52, C(28, 24, 44)); for (int l = 0; l < 10; l++) { for (int m = 0; m < 13; m++) { if (_board[l, m] != 0) { Rect(20 + l * 4, 10 + m * 4, 3, 3, (m == _clearRow && (int)(_t * 20f) % 2 == 0) ? C(255, 255, 255) : BCol[_board[l, m] - 1]); } } } if (_clearRow < 0) { for (int n = 0; n < 4; n++) { Rect(20 + (_px + _pc[n * 2]) * 4, 10 + (_py + _pc[n * 2 + 1]) * 4, 3, 3, BCol[_pk]); } } Hud(C(36, 28, 52), C(255, 214, 226)); } private void CheckLines() { for (int num = 12; num >= 0; num--) { bool flag = true; for (int i = 0; i < 10; i++) { if (_board[i, num] == 0) { flag = false; break; } } if (flag) { _clearRow = num; _clearT = 0.25f; if (_clearRow >= 0) { break; } } } } private void ShInit() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) _stars.Clear(); _en.Clear(); _bul.Clear(); _boom.Clear(); for (int i = 0; i < 28; i++) { _stars.Add(new Vector3((float)_r.Next(80), (float)_r.Next(64), (float)(8 + _r.Next(20)))); } _shipX = 40f; _fire = 0f; _spawnE = 0f; } private void Sh(float dt) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) _spawnE -= dt; _fire -= dt; if (_spawnE <= 0f) { _spawnE = 0.5f + (float)_r.NextDouble() * 0.6f; _en.Add(new Vector3((float)(6 + _r.Next(68)), 4f, (float)_r.NextDouble() * 6f)); } float num = ((_en.Count > 0) ? _en[0].x : 40f); _shipX = Mathf.MoveTowards(_shipX, num, 40f * dt); if (_fire <= 0f) { _fire = 0.22f; _bul.Add(new Vector3(_shipX, 54f, 0f)); } for (int i = 0; i < _stars.Count; i++) { Vector3 val = _stars[i]; val.y += val.z * dt; if (val.y >= 64f) { val.y = 7f; val.x = _r.Next(80); } _stars[i] = val; } for (int num2 = _bul.Count - 1; num2 >= 0; num2--) { Vector3 val2 = _bul[num2]; val2.y -= 70f * dt; if (val2.y < 7f) { _bul.RemoveAt(num2); } else { _bul[num2] = val2; } } for (int num3 = _en.Count - 1; num3 >= 0; num3--) { Vector3 val3 = _en[num3]; val3.y += 9f * dt; val3.z += dt; _en[num3] = val3; float num4 = val3.x + Mathf.Sin(val3.z * 3f) * 4f; bool flag = false; for (int num5 = _bul.Count - 1; num5 >= 0; num5--) { if (Mathf.Abs(_bul[num5].x - num4) < 4f && Mathf.Abs(_bul[num5].y - val3.y) < 4f) { _bul.RemoveAt(num5); flag = true; break; } } if (flag) { _boom.Add(new Vector3(num4, val3.y, 0.35f)); _en.RemoveAt(num3); _score++; } else if (val3.y > 64f) { _en.RemoveAt(num3); } } for (int num6 = _boom.Count - 1; num6 >= 0; num6--) { Vector3 val4 = _boom[num6]; val4.z -= dt; if (val4.z <= 0f) { _boom.RemoveAt(num6); } else { _boom[num6] = val4; } } Clear(C(14, 12, 34)); foreach (Vector3 star in _stars) { Px((int)star.x, (int)star.y, (star.z > 20f) ? C(255, 255, 255) : C(130, 130, 190)); } string[] rows = new string[5] { "a...a", ".aaa.", "aEaEa", "aaaaa", "a.a.a" }; foreach (Vector3 item in _en) { Spr(rows, (int)(item.x + Mathf.Sin(item.z * 3f) * 4f) - 2, (int)item.y - 2, (char ch) => ch switch { 'E' => C(20, 20, 30), 'a' => C(170, 240, 200), _ => null, }); } foreach (Vector3 item2 in _bul) { Rect((int)item2.x, (int)item2.y, 1, 3, C(255, 236, 140)); } foreach (Vector3 item3 in _boom) { int num7 = (int)((0.35f - item3.z) * 20f); Color32 c = C(255, 160, 180); Px((int)item3.x - num7, (int)item3.y, c); Px((int)item3.x + num7, (int)item3.y, c); Px((int)item3.x, (int)item3.y - num7, c); Px((int)item3.x, (int)item3.y + num7, c); Px((int)item3.x - num7 / 2, (int)item3.y - num7 / 2, c); Px((int)item3.x + num7 / 2, (int)item3.y + num7 / 2, c); Px((int)item3.x + num7 / 2, (int)item3.y - num7 / 2, c); Px((int)item3.x - num7 / 2, (int)item3.y + num7 / 2, c); } string[] rows2 = new string[5] { "..s..", "..s..", ".sss.", "sPsPs", "s...s" }; Spr(rows2, (int)_shipX - 2, 56, (char ch) => ch switch { 'P' => C(120, 200, 255), 's' => C(255, 170, 200), _ => null, }); Hud(C(8, 6, 20), C(255, 236, 140)); } private void RuInit() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) _obs.Clear(); _cloud.Clear(); _by = 0f; _vy = 0f; _nextObs = 1f; _runT = 0f; for (int i = 0; i < 3; i++) { _cloud.Add(new Vector2((float)_r.Next(80), (float)(12 + _r.Next(14)))); } } private void Ru(float dt) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_01a0: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) _runT += dt; _score = (int)(_runT * 10f); float num = 36f + Mathf.Min(_runT, 30f); _nextObs -= dt; if (_nextObs <= 0f) { _nextObs = 0.9f + (float)_r.NextDouble() * 1.1f; _obs.Add(new Vector2(82f, (float)(3 + _r.Next(3)))); } bool flag = false; for (int num2 = _obs.Count - 1; num2 >= 0; num2--) { Vector2 val = _obs[num2]; val.x -= num * dt; _obs[num2] = val; if (val.x < -6f) { _obs.RemoveAt(num2); } else if (val.x > 16f && val.x < 16f + num * 0.24f) { flag = true; } } if (flag && _by <= 0f) { _vy = 80f; } _vy -= 230f * dt; _by = Mathf.Max(0f, _by + _vy * dt); if (_by <= 0f && _vy < 0f) { _vy = 0f; } for (int i = 0; i < _cloud.Count; i++) { Vector2 val2 = _cloud[i]; val2.x -= num * 0.2f * dt; if (val2.x < -12f) { val2.x = 84f; val2.y = 12 + _r.Next(14); } _cloud[i] = val2; } Clear(C(190, 230, 255)); foreach (Vector2 item in _cloud) { Rect((int)item.x, (int)item.y, 10, 3, C(255, 255, 255)); Rect((int)item.x + 2, (int)item.y - 2, 5, 2, C(255, 255, 255)); } Rect(0, 52, 80, 12, C(160, 220, 150)); Rect(0, 52, 80, 1, C(110, 190, 110)); for (int j = -((int)(_runT * num) % 6); j < 80; j += 6) { Px(j, 55, C(130, 200, 125)); } foreach (Vector2 ob in _obs) { int num3 = (int)ob.y * 2; Rect((int)ob.x, 52 - num3, 4, num3, C(255, 170, 120)); Rect((int)ob.x + 1, 52 - num3 - 1, 2, 1, C(255, 120, 150)); } string[] rows = ((!(_by > 0f)) ? (((int)(_t * 10f) % 2 != 0) ? new string[7] { ".w.w..", ".w.w..", ".wwww.", "wwEwwp", "wwwww.", ".wwww.", "..ww.." } : new string[7] { ".w.w..", ".w.w..", ".wwww.", "wwEwwp", "wwwww.", ".wwww.", "w...w." }) : new string[7] { ".w.w..", ".w.w..", ".wwww.", "wwEwwp", "wwwww.", ".wwww.", ".w..w." }); Spr(rows, 12, 45 - (int)_by, (char ch) => ch switch { 'p' => C(255, 150, 180), 'E' => C(40, 30, 40), 'w' => C(255, 245, 250), _ => null, }); Hud(C(120, 180, 230), C(255, 255, 255)); } private void BrInit() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0061: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 9; i++) { for (int j = 0; j < 5; j++) { _bricks[i, j] = true; } } _ball = new Vector2(40f, 44f); _bv = new Vector2((_r.Next(2) == 0) ? (-30f) : 30f, -40f); _pad = 40f; } private void Br(float dt) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) int num = 4; float num2 = dt / (float)num; for (int i = 0; i < num; i++) { _ball += _bv * num2; if (_ball.x < 1f) { _ball.x = 1f; _bv.x = Mathf.Abs(_bv.x); } if (_ball.x > 78f) { _ball.x = 78f; _bv.x = 0f - Mathf.Abs(_bv.x); } if (_ball.y < 8f) { _ball.y = 8f; _bv.y = Mathf.Abs(_bv.y); } if (_ball.y >= 58f && _ball.y < 60f && _bv.y > 0f && Mathf.Abs(_ball.x - _pad) < 7f) { _bv.y = 0f - Mathf.Abs(_bv.y); _bv.x = Mathf.Clamp((_ball.x - _pad) * 6f + (float)(_r.NextDouble() - 0.5) * 8f, -45f, 45f); if (Mathf.Abs(_bv.x) < 8f) { _bv.x = 8f * Mathf.Sign(_bv.x + 0.01f); } } if (_ball.y > 64f) { _ball = new Vector2(_pad, 50f); _bv = new Vector2(30f, -40f); } int num3 = ((int)_ball.x - 4) / 8; int num4 = ((int)_ball.y - 10) / 4; if (_ball.x >= 4f && _ball.y >= 10f && num3 >= 0 && num3 < 9 && num4 >= 0 && num4 < 5 && _bricks[num3, num4]) { _bricks[num3, num4] = false; _bv.y = 0f - _bv.y; _score++; } } _pad = Mathf.MoveTowards(_pad, _ball.x, 48f * dt); _pad = Mathf.Clamp(_pad, 6f, 73f); bool flag = false; bool[,] bricks = _bricks; int upperBound = bricks.GetUpperBound(0); int upperBound2 = bricks.GetUpperBound(1); for (int j = bricks.GetLowerBound(0); j <= upperBound; j++) { int num5 = bricks.GetLowerBound(1); while (num5 <= upperBound2) { if (!bricks[j, num5]) { num5++; continue; } goto IL_0359; } continue; IL_0359: flag = true; break; } if (!flag) { BrInit(); } Clear(C(36, 30, 60)); for (int k = 0; k < 9; k++) { for (int l = 0; l < 5; l++) { if (_bricks[k, l]) { Rect(4 + k * 8, 10 + l * 4, 7, 3, RowCol[l]); } } } Rect((int)_pad - 6, 59, 13, 2, C(255, 214, 226)); Rect((int)_ball.x, (int)_ball.y, 2, 2, C(255, 255, 255)); Hud(C(24, 20, 42), C(255, 236, 140)); } } public sealed class PastelCamera : PastelUsable { private Transform _glow; private Light _light; private Component _hd; private PropertyInfo _hdIntensity; private float _t = -1f; private float _next; private const float Dur = 0.3f; public override void Start() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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) base.Start(); _glow = PastelProp.FindDeep(((Component)this).transform, "FlashGlow"); if ((Object)(object)_glow != (Object)null) { _glow.localScale = Vector3.one * 0.0001f; } try { GameObject val = new GameObject("PastelFlashLight"); val.transform.SetParent(((Object)(object)_glow != (Object)null) ? _glow.parent : ((Component)this).transform, false); if ((Object)(object)_glow != (Object)null) { val.transform.localPosition = _glow.localPosition + new Vector3(0f, 0f, 0.03f); } _light = val.AddComponent<Light>(); _light.type = (LightType)2; _light.range = 14f; _light.intensity = 0f; _light.color = new Color(1f, 0.98f, 0.94f); Type type = Type.GetType("UnityEngine.Rendering.HighDefinition.HDAdditionalLightData, Unity.RenderPipelines.HighDefinition.Runtime"); if (type != null) { _hd = val.GetComponent(type) ?? val.AddComponent(type); _hdIntensity = type.GetProperty("intensity", BindingFlags.Instance | BindingFlags.Public); } ((Behaviour)_light).enabled = false; } catch (Exception ex) { PastelScrapPlugin.Log.LogWarning((object)("camera light: " + ex.Message)); } } protected override void OnUse() { if (!(Time.time < _next)) { _next = Time.time + 0.6f; Play(PastelScrapPlugin.Shutter); _t = 0f; } } private void SetLight(float k) { if ((Object)(object)_light == (Object)null) { return; } ((Behaviour)_light).enabled = k > 0.001f; try { if ((Object)(object)_hd != (Object)null && _hdIntensity != null) { _hdIntensity.SetValue(_hd, 60000f * k); } else { _light.intensity = 30f * k; } } catch { _light.intensity = 30f * k; } } public override void Update() { //IL_00b8: Unknown result type (mig