Due to update 2.4.3, some mods may no longer function. FixedConfig may be necessary.
Decompiled source of More Platforms Beta v1.0.2
BepInEx/plugins/MorePlataforms.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BoplFixedMath; using HarmonyLib; using LisoMapData; using Microsoft.CodeAnalysis; using PlatformApi; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("More Platforms Beta")] [assembly: AssemblyProduct("More Platforms Beta")] [assembly: AssemblyFileVersion("1.0.0.3")] [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 LisoMod { public sealed class AttachScope { public Vec2 IncomingVelocity; } public sealed class BubbleClock { private bool burstPending; public BubblePhase Phase { get; private set; } public Fix Age { get; private set; } public bool JustHidden { get; private set; } public bool JustReturned { get; private set; } public bool JustBurst { get; private set; } public bool Visible => Phase != BubblePhase.Hidden; public bool Collidable { get { if (Phase != BubblePhase.Ready) { return Phase == BubblePhase.Trembling; } return true; } } public void Touch() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (Phase == BubblePhase.Ready) { Phase = BubblePhase.Trembling; Age = Fix.Zero; } } public void Hit() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (Collidable) { Phase = BubblePhase.Bursting; Age = Fix.Zero; burstPending = true; } } public void Tick(Fix dt, Fix touchDelay, Fix returnDelay) { //IL_002b: 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_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_004e: 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_0067: 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_00a1: 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_00d0: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) JustHidden = false; JustReturned = false; JustBurst = false; if (burstPending) { JustBurst = true; burstPending = false; } if (!(dt <= Fix.Zero) && Phase != BubblePhase.Ready) { Age += dt; if (Phase == BubblePhase.Trembling && Age >= touchDelay) { Phase = BubblePhase.Bursting; Age = Fix.Zero; JustBurst = true; } else if (Phase == BubblePhase.Bursting && Age >= (Fix)0.18) { Phase = BubblePhase.Hidden; Age = Fix.Zero; JustHidden = true; } else if (Phase == BubblePhase.Hidden && returnDelay >= Fix.Zero && Age >= returnDelay) { Phase = BubblePhase.Ready; Age = Fix.Zero; JustReturned = true; } } } } public sealed class BubbleFlashEffect : MonoBehaviour { private SpriteRenderer sprite; private float age; private float radius; public void Initialize(SpriteRenderer renderer, float extent) { //IL_0014: 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_0029: 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) sprite = renderer; radius = extent; ((Component)this).transform.localScale = Vector3.one * radius * 0.3f; sprite.color = new Color(1f, 1f, 1f, 0.45f); } private void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (!GameSessionHandler.GameIsPaused) { age += Time.deltaTime * Mathf.Max(0f, (float)GameTime.PlayerTimeScale); float num = age / 0.32f; if (num >= 1f || (Object)(object)sprite == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.localScale = Vector3.one * (radius * 2f * (0.15f + 0.85f * num)); sprite.color = new Color(1f, 1f, 1f, 0.45f * (1f - num)); } } } public enum BubblePhase { Ready, Trembling, Bursting, Hidden } public sealed class BubblePlatform : MonoUpdatable, ICollisionCallback { private static readonly FieldInfo BeamHits = typeof(DetPhysics).GetField("beamRaycastHitRRs", BindingFlags.Instance | BindingFlags.NonPublic); private readonly BubbleClock clock = new BubbleClock(); private readonly BubbleWindMotion wind = new BubbleWindMotion(); private StickyRoundedRectangle platform; private DPhysicsRoundedRect collider; private bool registered; private bool errorLogged; private bool returnedLogged; private Fix originalWidth; private Fix originalHeight; private Fix originalRadius; private Fix originalScale; private Fix originalRotation; private Vec2 home; private Fix bobTime; private MaterialBall projectile; public bool EditorMotion; public BubbleClock Clock => clock; public bool Initialized => registered; public Vec2 WindOffset => wind.Offset; public Vec2 Home => home; public override bool IsEnabled() { return ((MonoUpdatable)this).IsEnabled(); } public unsafe void Initialize() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a3: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) projectile = ((Component)this).GetComponent<MaterialBall>(); platform = ((Component)this).GetComponent<StickyRoundedRectangle>(); collider = ((Component)this).GetComponent<DPhysicsRoundedRect>(); if (!registered && !((Object)(object)platform == (Object)null) && !((Object)(object)collider == (Object)null) && !((Object)(object)platform.GetGroundBody() == (Object)null)) { Vec2 val = collider.CalcExtents(); originalWidth = val.x; originalHeight = val.y; originalRadius = collider.radius; originalScale = collider.Scale; home = platform.GetGroundBody().position; originalRotation = platform.GetGroundBody().rotation; PlatformPhysics.Kinematic(platform); ((MonoUpdatable)this).HierarchyNumber = ((MonoUpdatable)platform).HierarchyNumber; collider.RegisterCollisionCallback((ICollisionCallback)(object)this); registered = true; if (LisoPlugin.Log != null) { ManualLogSource log = LisoPlugin.Log; string name = ((Object)((Component)this).gameObject).name; Vec2 val2 = home; log.LogInfo((object)("LISO bolha inicializada: " + name + " em " + ((object)(*(Vec2*)(&val2))/*cast due to .constrained prefix*/).ToString())); } } } private void Awake() { Updater.RegisterUpdatable((MonoUpdatable)(object)this); } public override void Init() { try { Initialize(); } catch (Exception error) { ReportError(error); } } public void Touch() { if (!((Object)(object)projectile != (Object)null) || !projectile.Held) { bool num = clock.Phase == BubblePhase.Ready; clock.Touch(); if (num && LisoPlugin.Log != null) { LisoPlugin.Log.LogInfo((object)"LISO bolha tocada: estouro em 2.2 s, em qualquer ponto da superficie."); } } } public void Hit() { if (!((Object)(object)projectile != (Object)null) || !projectile.Held) { bool collidable = clock.Collidable; clock.Hit(); if (collidable && LisoPlugin.Log != null) { LisoPlugin.Log.LogInfo((object)"LISO bolha atingida: iniciando estouro."); } } } public void PushWind(Vec2 force) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (registered && clock.Collidable && !GameSessionHandler.GameIsPaused && !GameTime.IsTimeStopped()) { wind.Push(force); } } public void ApplyEditorPosition(Vec2 position) { //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_002c: Unknown result type (might be due to invalid IL or missing references) if (registered && !((MonoUpdatable)platform).IsDestroyed) { platform.GetGroundBody().position = position + wind.Offset; PlatformPhysics.SynchronizePose(platform); } } public void OnCollide(CollisionInformation collision) { //IL_0015: 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_0029: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!registered || !clock.Collidable || (Object)(object)collision.colliderPP.fixTrans == (Object)null) { return; } GameObject gameObject = ((Component)collision.colliderPP.fixTrans).gameObject; if ((Object)(object)gameObject.GetComponent<Arrow>() != (Object)null || (Object)(object)gameObject.GetComponent<Grenade>() != (Object)null || (Object)(object)gameObject.GetComponent<Explosion>() != (Object)null || (Object)(object)gameObject.GetComponent<BlackHole>() != (Object)null) { Hit(); return; } if ((Object)(object)gameObject.GetComponent<SpikeAttack>() != (Object)null || (Object)(object)gameObject.GetComponent<SimpleSparkNode>() != (Object)null || (Object)(object)gameObject.GetComponent<StretchableLightning>() != (Object)null || (!SurfaceAttacks.NormalPlayer(gameObject) && (Object)(object)gameObject.GetComponent<Dash>() != (Object)null)) { Hit(); return; } Boulder component = gameObject.GetComponent<Boulder>(); if ((Object)(object)component != (Object)null && component.HasBeenDropped() && Vec2.SqrMagnitude(collision.colliderImpactVelocity) > Fix.One) { Hit(); } else if ((Object)(object)gameObject.GetComponent<PlayerPhysics>() != (Object)null) { Touch(); } } public static bool CanAttach(StickyRoundedRectangle ground, Vec2 location) { BubblePlatform bubblePlatform = (((Object)(object)ground == (Object)null) ? null : ((Component)ground).GetComponent<BubblePlatform>()); if ((Object)(object)bubblePlatform != (Object)null) { return bubblePlatform.clock.Collidable; } return false; } public static void RestrictToTop(PlayerPhysics physics) { } public static bool HopPrefix(PlayerPhysics __instance) { return __instance.IsGrounded(); } private static void Release(PlayerPhysics physics, StickyRoundedRectangle ground) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_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_0027: 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) PlayerBody playerBody = physics.GetPlayerBody(); Vec2 val = ground.currentNormal(playerBody); playerBody.selfImposedVelocity = new Vec2(val.y, -val.x) * physics.groundedSpeed; physics.UnGround(true, false); } public static void CheckWallPostfix(Vec2 pos, Vec2 dir, Fix speed, ref RaycastInformation __result) { //IL_0095: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ed: 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_00ef: 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) if (!((RaycastInformation)(ref __result)).HitSomething() || (Object)(object)__result.pp.fixTrans == (Object)null || (Object)(object)((Component)__result.pp.fixTrans).GetComponent<BubblePlatform>() == (Object)null) { return; } List<DPhysicsRoundedRect> list = new List<DPhysicsRoundedRect>(); try { for (int i = 0; i < 24; i++) { if (!((RaycastInformation)(ref __result)).HitSomething()) { break; } if (!((Object)(object)__result.pp.fixTrans != (Object)null)) { break; } StickyRoundedRectangle component = ((Component)__result.pp.fixTrans).GetComponent<StickyRoundedRectangle>(); BubblePlatform bubblePlatform = (((Object)(object)component == (Object)null) ? null : ((Component)component).GetComponent<BubblePlatform>()); if ((Object)(object)bubblePlatform == (Object)null || (CanAttach(component, __result.nearPos) && Vec2.Dot(dir, component.currentNormal(__result.nearPos)) <= Fix.Zero) || (Object)(object)bubblePlatform.collider == (Object)null) { break; } list.Add(bubblePlatform.collider); ((Behaviour)bubblePlatform.collider).enabled = false; __result = DetPhysics.Get().RaycastToClosestRoundedRect(pos, dir, speed); } } finally { foreach (DPhysicsRoundedRect item in list) { if ((Object)(object)item != (Object)null) { ((Behaviour)item).enabled = true; } } } } public static void BeamPostfix(DetPhysics __instance, int ind) { FixTransform[] array = (FixTransform[])BeamHits.GetValue(__instance); if (array != null && ind >= 0 && ind < array.Length && !((Object)(object)array[ind] == (Object)null) && !GameTime.IsTimeStoppedFor(__instance.beamBodies[ind].ownerId)) { BubblePlatform component = ((Component)array[ind]).GetComponent<BubblePlatform>(); if ((Object)(object)component != (Object)null) { component.Hit(); } } } public static void ArrowPrefix(CollisionInformation collision) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)collision.colliderPP.fixTrans == (Object)null)) { BubblePlatform component = ((Component)collision.colliderPP.fixTrans).GetComponent<BubblePlatform>(); if ((Object)(object)component != (Object)null) { component.Hit(); } } } public static void ExplosionPostfix(Explosion __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) DPhysicsCircle component = ((Component)__instance).GetComponent<DPhysicsCircle>(); FixTransform component2 = ((Component)__instance).GetComponent<FixTransform>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { return; } PhysicsParent[] array = (PhysicsParent[])(object)new PhysicsParent[128]; int num = DetPhysics.Get().circleCastRoundedRect(component2.position, component.radius, ref array); for (int i = 0; i < num; i++) { BubblePlatform bubblePlatform = (((Object)(object)array[i].fixTrans == (Object)null) ? null : ((Component)array[i].fixTrans).GetComponent<BubblePlatform>()); if ((Object)(object)bubblePlatform != (Object)null) { bubblePlatform.Hit(); } } } public override void UpdateSim(Fix deltaTime) { //IL_000f: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_023d: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0298: 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) if (GameSessionHandler.GameIsPaused || GameSessionHandler.HasGameEnded()) { return; } Fix val = deltaTime * GameTime.PlayerTimeScale; if (val <= Fix.Zero) { return; } try { if (!registered) { Initialize(); } if (!registered || ((MonoUpdatable)platform).IsDestroyed || ((Object)(object)projectile != (Object)null && projectile.Held)) { return; } if (clock.Collidable) { bobTime += val; wind.Tick(val); if (!EditorMotion && (Object)(object)projectile == (Object)null) { SurfaceOptions surfaceOptions = SurfaceTuning.Get(platform); platform.GetGroundBody().position = home + wind.Offset + Vec2.up * (Fix.Sin(bobTime * (Fix)(surfaceOptions?.BubbleBobSpeed ?? 0.9)) * (Fix)(surfaceOptions?.BubbleBob ?? 0.3)); } PlatformPhysics.SynchronizePose(platform); } PlayerPhysics[] array = Object.FindObjectsOfType<PlayerPhysics>(); foreach (PlayerPhysics val2 in array) { if (val2.IsGrounded() && (Object)(object)val2.getAttachedGround() == (Object)(object)platform) { Touch(); } } bool enabled = ((Behaviour)collider).enabled; SurfaceOptions surfaceOptions2 = SurfaceTuning.Get(platform); clock.Tick(val, (Fix)(surfaceOptions2?.BubbleDelay ?? 2.2), (surfaceOptions2 != null && !surfaceOptions2.BubbleRespawn) ? ((Fix)(-1L)) : ((Fix)(surfaceOptions2?.BubbleRespawnSeconds ?? 10.0))); if (clock.JustReturned) { wind.Reset(); bobTime = Fix.Zero; collider.Scale = originalScale; ((Component)this).GetComponent<ResizablePlatform>().ResizePlatform(originalHeight, originalWidth, originalRadius, true); if (!EditorMotion) { platform.GetGroundBody().position = home; } platform.GetGroundBody().rotation = originalRotation; collider.velocity = Vec2.zero; collider.angularVelocity = Fix.Zero; PlatformPhysics.SynchronizePose(platform); if (!returnedLogged && LisoPlugin.Log != null) { LisoPlugin.Log.LogInfo((object)"LISO bolha reapareceu apos 10 s."); } returnedLogged = true; } ((Behaviour)collider).enabled = clock.Collidable; if (enabled && !clock.Collidable) { DropPlayers(); } if (clock.JustBurst) { RemoveAttachments(); PopEffects(); } if (clock.JustHidden) { if ((Object)(object)projectile != (Object)null) { Updater.DestroyFix(((Component)this).gameObject); return; } Arrow[] componentsInChildren = ((Component)this).GetComponentsInChildren<Arrow>(); for (int j = 0; j < componentsInChildren.Length; j++) { Updater.DestroyFix(((Component)componentsInChildren[j]).gameObject); } } errorLogged = false; } catch (Exception error) { ReportError(error); } } private void PopEffects() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0047: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_009c: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00b1: 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_00c6: 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) Vec2 val = collider.CalcExtents(); Fix val2 = (Fix.Max(val.x, val.y) + collider.radius + (Fix)4L) * (Fix)1.5; SurfaceOptions surfaceOptions = SurfaceTuning.Get(platform); PlatformPhysics.RadialBurst(platform.GetGroundBody().position, val2, (Fix)(surfaceOptions?.BubblePush ?? 1.0)); RoundedRect roundedRect = collider.GetRoundedRect(); Vec2 val3 = ((RoundedRect)(ref roundedRect)).Pos(); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((float)val3.x, (float)val3.y, 0f); try { SurfaceEffects.BubbleFlash(val4, platform.GetSpriteRenderer(), (float)val2); } catch (Exception error) { ReportError(error); } try { SurfaceEffects.Water(val4, platform.GetSpriteRenderer()); } catch (Exception error2) { ReportError(error2); } try { SurfaceAudio.PlayBubble(((Component)this).gameObject); } catch (Exception error3) { ReportError(error3); } } private void RemoveAttachments() { MonoUpdatable[] componentsInChildren = ((Component)this).GetComponentsInChildren<MonoUpdatable>(); foreach (MonoUpdatable val in componentsInChildren) { if ((Object)(object)((Component)val).gameObject != (Object)(object)((Component)this).gameObject && val is IPlatformAttachable) { Updater.DestroyFix(((Component)val).gameObject); } } RopeAttachment[] array = Object.FindObjectsOfType<RopeAttachment>(); foreach (RopeAttachment val2 in array) { if ((Object)(object)val2.GetPlatformParent() == (Object)(object)platform) { SurfaceAttacks.DetachRope(val2); } } } private void ReportError(Exception error) { if (!errorLogged && LisoPlugin.Log != null) { LisoPlugin.Log.LogError((object)("LISO bolha: " + error)); } errorLogged = true; } private void DropPlayers() { PlayerPhysics[] array = Object.FindObjectsOfType<PlayerPhysics>(); foreach (PlayerPhysics val in array) { if (val.IsGrounded() && (Object)(object)val.getAttachedGround() == (Object)(object)platform) { Release(val, platform); } } } private void OnDestroy() { ((MonoUpdatable)this).IsDestroyed = true; if ((Object)(object)collider != (Object)null && registered) { collider.UnRegisterCollisionCallback((ICollisionCallback)(object)this); } } public static void VerifyFields() { if (BeamHits == null) { throw new MissingFieldException("DetPhysics.beamRaycastHitRRs ausente."); } } } public sealed class BubbleWindMotion { public Vec2 Offset { get; private set; } public Vec2 Velocity { get; private set; } public void Push(Vec2 force) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_001e: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) ((Vec2)(ref force))..ctor(Fix.Clamp(force.x, (Fix)(-200L), (Fix)200L), Fix.Clamp(force.y, (Fix)(-200L), (Fix)200L)); Velocity += force * (Fix)0.03; Fix val = Vec2.Magnitude(Velocity); if (val > (Fix)6L) { Velocity = Velocity / val * (Fix)6L; } } public void Tick(Fix dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) if (!(dt <= Fix.Zero)) { Offset += Velocity * dt; Fix val = Vec2.Magnitude(Offset); if (val > (Fix)80L) { Offset = Offset / val * (Fix)80L; } Velocity *= Fix.Clamp(Fix.One - dt * (Fix)1.4, Fix.Zero, Fix.One); if (Vec2.SqrMagnitude(Velocity) < (Fix)0.0001) { Velocity = Vec2.zero; } } } public void Reset() { //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) Offset = Vec2.zero; Velocity = Vec2.zero; } } public sealed class CloudClock { public Fix Lifetime = (Fix)12L; public Fix ShakeSeconds = (Fix)6L; public Fix Used { get; private set; } public bool Destroyed { get; private set; } public Fix Remaining => Fix.Max(Fix.Zero, Lifetime - Used); public void Tick(bool occupied, Fix dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) if (!Destroyed && occupied && !(dt <= Fix.Zero)) { Used = Fix.Min(Lifetime, Used + dt); if (Used >= Lifetime) { Destroyed = true; } } } public Fix Shake(bool occupied) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_002a: 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_0035: 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_0040: 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_004a: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (!occupied || Destroyed) { return Fix.Zero; } if (!(ShakeSeconds <= Fix.Zero)) { return Fix.Clamp((Used - (Lifetime - ShakeSeconds)) / ShakeSeconds, Fix.Zero, Fix.One); } return Fix.Zero; } public void Destroy() { Destroyed = true; } } public sealed class CloudContactMotion { private Fix target; private Fix remaining; public static Fix Limit => (Fix)0.38; public Fix Offset { get; private set; } public void Touch(Fix normalY) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!(Fix.Abs(normalY) < (Fix)0.55)) { target = ((normalY > Fix.Zero) ? (-Limit) : Limit); remaining = (Fix)0.55; } } public void Tick(bool occupied, Fix dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0085: 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_008f: 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_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0030: 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_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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) if (dt <= Fix.Zero) { return; } if (occupied) { target = -Limit; remaining = (Fix)0.55; Offset = Towards(Offset, target, dt * (Fix)1.2); return; } Fix val = Fix.Min(dt, remaining); Offset = Towards(Offset, target, val * (Fix)1.2); remaining -= val; dt -= val; if (remaining <= Fix.Zero) { Offset = Towards(Offset, Fix.Zero, dt * (Fix)0.45); } } private static Fix Towards(Fix value, Fix destination, Fix step) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_001f: 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_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) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!(destination < value)) { return Fix.Min(destination, value + step); } return Fix.Max(destination, value - step); } } public sealed class CloudPlatform : MonoUpdatable, ICollisionCallback { private readonly CloudClock clock = new CloudClock(); private readonly CloudTravel travel = new CloudTravel(); private readonly CloudContactMotion contact = new CloudContactMotion(); private StickyRoundedRectangle platform; private DPhysicsRoundedRect shape; private Vec2 origin; private Fix age; private bool initialized; private bool removed; private bool occupied; private bool errorLogged; private MaterialBall projectile; public bool EditorMotion; public bool Initialized => initialized; public bool Dead { get { if (!removed) { return clock.Destroyed; } return true; } } public Fix Used => clock.Used; public float Compression { get { //IL_0013: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (!occupied) { return 0.2f * (float)(Fix.Abs(contact.Offset) / CloudContactMotion.Limit); } return 0.2f; } } public Fix ContactOffset => contact.Offset; public float Shake => (float)clock.Shake(occupied); public float VisualTime => (float)age; public bool Occupied => occupied; public int ForegroundOrder { get; private set; } public int ForegroundLayer { get; private set; } private void Awake() { Updater.RegisterUpdatable((MonoUpdatable)(object)this); } public void Initialize() { //IL_0073: 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_0096: Unknown result type (might be due to invalid IL or missing references) if (initialized) { return; } platform = ((Component)this).GetComponent<StickyRoundedRectangle>(); shape = ((Component)this).GetComponent<DPhysicsRoundedRect>(); projectile = ((Component)this).GetComponent<MaterialBall>(); if (!((Object)(object)platform == (Object)null) && !((Object)(object)shape == (Object)null) && !((Object)(object)platform.GetGroundBody() == (Object)null)) { origin = platform.GetGroundBody().position; if ((Object)(object)projectile == (Object)null) { platform.GetGroundBody().rotation = Fix.Zero; } PlatformPhysics.Kinematic(platform); ((MonoUpdatable)this).HierarchyNumber = ((MonoUpdatable)platform).HierarchyNumber; shape.RegisterCollisionCallback((ICollisionCallback)(object)this); travel.Begin((Updater.RandomInt(0, 2) != 0) ? 1 : (-1)); initialized = true; } } public override void Init() { try { Initialize(); } catch (Exception error) { Report(error); } } public override bool IsEnabled() { if (((MonoUpdatable)this).IsEnabled()) { return !removed; } return false; } public void Touch(Vec2 point) { //IL_001c: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (!Dead && initialized) { contact.Touch(platform.currentNormal(point).y); } } public void ApplyEditorPosition(Vec2 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) CloudContactSafety.Move(this, position); } public void OnCollide(CollisionInformation collision) { //IL_0008: 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_001c: 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_003e: 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) if (Dead || (Object)(object)collision.colliderPP.fixTrans == (Object)null) { return; } GameObject gameObject = ((Component)collision.colliderPP.fixTrans).gameObject; if (!SurfaceAttacks.PassivePlatform(gameObject)) { if (SurfaceAttacks.NormalPlayer(gameObject)) { Touch(collision.contactPoint); } else { DestroyCloud(); } } } public override void UpdateSim(Fix deltaTime) { //IL_0015: 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_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_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_03b6: 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_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_038a: 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_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_011e: 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_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_045b: 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_0465: 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_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: 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_026b: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0315: 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_0327: Unknown result type (might be due to invalid IL or missing references) if (GameSessionHandler.GameIsPaused || GameSessionHandler.HasGameEnded()) { return; } Fix val = deltaTime * GameTime.PlayerTimeScale; if (val <= Fix.Zero) { return; } try { if (!initialized) { Initialize(); } if (!initialized || removed || ((Object)(object)projectile != (Object)null && projectile.Held)) { return; } occupied = false; ForegroundOrder = ((Renderer)platform.GetSpriteRenderer()).sortingOrder; ForegroundLayer = ((Renderer)platform.GetSpriteRenderer()).sortingLayerID; PlayerPhysics[] array = Object.FindObjectsOfType<PlayerPhysics>(); foreach (PlayerPhysics val2 in array) { if (!((Component)val2).gameObject.activeInHierarchy || !CloudContactSafety.HasPhysicalContact(val2, platform) || (Object)(object)val2.getAttachedGround() != (Object)(object)platform) { continue; } PlayerBody playerBody = val2.GetPlayerBody(); Vec2 val3 = platform.currentNormal(playerBody); if (!(val3.y < (Fix)0.3)) { occupied = true; SlimeController component = ((Component)val2).GetComponent<SlimeController>(); SpriteRenderer val4 = (((Object)(object)component != (Object)null && ((Component)component).gameObject.activeInHierarchy) ? component.GetPlayerSprite() : (((Component)val2).GetComponent<SpriteRenderer>() ?? ((Component)val2).GetComponentInChildren<SpriteRenderer>())); if (!((Object)(object)val4 == (Object)null)) { ForegroundOrder = Math.Max(ForegroundOrder, ((Renderer)val4).sortingOrder + 1); ForegroundLayer = ((Renderer)val4).sortingLayerID; CloudSinkingVisual obj = ((Component)val2).GetComponent<CloudSinkingVisual>() ?? ((Component)val2).gameObject.AddComponent<CloudSinkingVisual>(); BoplBody groundBody = platform.GetGroundBody(); Vec2 val5 = shape.CalcExtents(); float val6 = 2f * (float)(val5.x + shape.radius); float num = 2f * (float)(val5.y + shape.radius); Vec2 val7 = playerBody.position - val3 * val2.radius - groundBody.position; float num2 = (LisoSprites.CloudTopAt(0.5f + (float)Vec2.Dot(val7, groundBody.right) / Math.Max(0.001f, val6)) - 0.5f) * num * (1f - 0.12f * Compression); obj.Set(amount: Math.Max(0f, (float)Vec2.Dot(val7, groundBody.up) - num2) + Math.Max(0.16f, (float)val2.radius * (0.26f + 0.12f * Compression)), player: val2, sprite: val4, ground: platform, outward: new Vector3((float)val3.x, (float)val3.y, 0f)); } } } SurfaceOptions surfaceOptions = SurfaceTuning.Get(platform); if (surfaceOptions != null) { clock.Lifetime = (Fix)surfaceOptions.CloudLifetime; clock.ShakeSeconds = (Fix)surfaceOptions.CloudShakeSeconds; travel.Speed = (Fix)surfaceOptions.CloudSpeed; travel.LegSeconds = (Fix)surfaceOptions.CloudTurnSeconds; } clock.Tick(occupied, val); if (clock.Destroyed) { DestroyCloud(); return; } if (travel.NeedsDirection) { travel.Begin((Updater.RandomInt(0, 2) != 0) ? 1 : (-1)); } contact.Tick(occupied, val); if (!EditorMotion && (Object)(object)projectile == (Object)null) { travel.Tick(val); platform.GetGroundBody().position = origin + Vec2.right * travel.Offset + Vec2.up * contact.Offset; } PlatformPhysics.SynchronizePose(platform); age += val; } catch (Exception error) { Report(error); } } public void DestroyCloud() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!removed) { removed = true; clock.Destroy(); if ((Object)(object)shape == (Object)null) { shape = ((Component)this).GetComponent<DPhysicsRoundedRect>(); } if ((Object)(object)shape != (Object)null) { ((Behaviour)shape).enabled = false; } if ((Object)(object)platform == (Object)null) { platform = ((Component)this).GetComponent<StickyRoundedRectangle>(); } if ((Object)(object)platform != (Object)null) { PlatformPhysics.Drop(platform); } try { SurfaceEffects.Cloud(((Component)this).transform.position, ((Object)(object)platform == (Object)null) ? null : platform.GetSpriteRenderer()); } catch (Exception error) { Report(error); } Updater.DestroyFix(((Component)this).gameObject); } } private void Report(Exception error) { if (!errorLogged && LisoPlugin.Log != null) { LisoPlugin.Log.LogError((object)("LISO nuvem: " + error)); } errorLogged = true; } private void OnDestroy() { ((MonoUpdatable)this).IsDestroyed = true; if (initialized && (Object)(object)shape != (Object)null) { shape.UnRegisterCollisionCallback((ICollisionCallback)(object)this); } } internal static Vec2 EditorBindingPosition(StickyRoundedRectangle candidate) { //IL_0037: 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) CloudPlatform component = ((Component)candidate).GetComponent<CloudPlatform>(); if (!((Object)(object)component == (Object)null) && component.initialized) { return component.origin; } return candidate.GetGroundBody().position; } } public sealed class CloudSinkingVisual : MonoBehaviour { private PlayerPhysics physics; private SpriteRenderer original; private SpriteRenderer picture; private StickyRoundedRectangle platform; private Vector3 normal; private float depth; private bool hidden; private bool wasEnabled; public void Set(PlayerPhysics player, SpriteRenderer sprite, StickyRoundedRectangle ground, Vector3 outward, float amount) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) amount = CloudContactSafety.LimitDepth(amount, player); if ((Object)(object)original != (Object)(object)sprite) { Restore(); if ((Object)(object)picture != (Object)null) { Object.Destroy((Object)(object)((Component)picture).gameObject); } picture = null; } physics = player; original = sprite; platform = ground; normal = outward; depth = amount; } private void LateUpdate() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) if (!CloudContactSafety.CanRender(physics, platform)) { Restore(); return; } if ((Object)(object)original == (Object)null || (Object)(object)platform == (Object)null || ((MonoUpdatable)platform).IsDestroyed || (Object)(object)physics == (Object)null || !((Component)physics).gameObject.activeInHierarchy || !physics.IsGrounded() || (Object)(object)physics.getAttachedGround() != (Object)(object)platform) { Restore(); return; } if ((Object)(object)picture == (Object)null) { GameObject val = new GameObject("_CloudImmersedSlime"); val.transform.SetParent(((Component)original).transform, false); picture = val.AddComponent<SpriteRenderer>(); } if (!hidden) { wasEnabled = ((Renderer)original).enabled; hidden = true; } ((Renderer)original).enabled = false; ((Renderer)picture).enabled = wasEnabled; picture.sprite = original.sprite; ((Renderer)picture).sharedMaterial = ((Renderer)original).sharedMaterial; picture.color = original.color; picture.flipX = original.flipX; picture.flipY = original.flipY; ((Renderer)picture).sortingLayerID = ((Renderer)original).sortingLayerID; ((Renderer)picture).sortingOrder = ((Renderer)original).sortingOrder; ((Component)picture).transform.localPosition = ((Component)original).transform.InverseTransformVector(-normal * depth); } private void Restore() { if (hidden && (Object)(object)original != (Object)null) { ((Renderer)original).enabled = wasEnabled; } if ((Object)(object)picture != (Object)null) { ((Renderer)picture).enabled = false; } hidden = false; } private void OnDisable() { Restore(); } private void OnDestroy() { Restore(); if ((Object)(object)picture != (Object)null) { Object.Destroy((Object)(object)((Component)picture).gameObject); } } } public sealed class CloudTravel { public Fix Speed = (Fix)0.4; public Fix LegSeconds = (Fix)20L; public CloudTravelPhase Phase { get; private set; } public Fix Age { get; private set; } public Fix Offset { get; private set; } public int Direction { get; private set; } public bool NeedsDirection { get; private set; } = true; public void Begin(int direction) { //IL_000f: 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) Direction = ((direction >= 0) ? 1 : (-1)); Age = Fix.Zero; Offset = Fix.Zero; Phase = CloudTravelPhase.Outward; NeedsDirection = false; } public void Tick(Fix dt) { //IL_0008: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007a: 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_0085: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00eb: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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) if (NeedsDirection || dt <= Fix.Zero) { return; } for (int i = 0; i < 8; i++) { if (!(dt > Fix.Zero)) { break; } if (NeedsDirection) { break; } Fix val = ((Phase == CloudTravelPhase.Outward || Phase == CloudTravelPhase.Returning) ? LegSeconds : ((Fix)0.4)); Fix val2 = Fix.Min(dt, val - Age); Age += val2; dt -= val2; if (Phase == CloudTravelPhase.Outward) { Offset += (Fix)(long)Direction * Speed * val2; } if (Phase == CloudTravelPhase.Returning) { Offset -= (Fix)(long)Direction * Speed * val2; } if (!(Age < val)) { Age = Fix.Zero; if (Phase == CloudTravelPhase.Outward) { Phase = CloudTravelPhase.TurnPause; } else if (Phase == CloudTravelPhase.TurnPause) { Phase = CloudTravelPhase.Returning; } else if (Phase == CloudTravelPhase.Returning) { Offset = Fix.Zero; Phase = CloudTravelPhase.HomePause; } else { NeedsDirection = true; } continue; } break; } } } public enum CloudTravelPhase { Outward, TurnPause, Returning, HomePause } public sealed class ContactClock { public Fix Elapsed { get; private set; } public Fix Away { get; private set; } public void Tick(bool contact, bool near, Fix dt, Fix cap, Fix recovery) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0020: 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_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006e: Unknown result type (might be due to invalid IL or missing references) if (dt <= Fix.Zero) { return; } if (contact) { Away = Fix.Zero; Elapsed = Fix.Min(cap, Elapsed + dt); return; } if (near) { Away = Fix.Zero; return; } Away = Fix.Min(recovery, Away + dt); if (Away >= recovery) { Elapsed = Fix.Zero; } } public void Reset() { //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) Elapsed = Fix.Zero; Away = Fix.Zero; } } public static class DecorationRoundSeed { private static uint localRound; public static uint Current { get; private set; } = 37u; public static void Install(Harmony harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.Method(typeof(Updater), "InitSeed", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(DecorationRoundSeed), "ObserveNativeSeed", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void BeginMap() { if (GameLobby.isOnlineGame || GameLobby.isPlayingAReplay) { Current = SteamManager.startParameters.seed; } else { Current = (uint)(Environment.TickCount + (int)(++localRound) * -1640531527); } } public static void ObserveNativeSeed(uint seed) { Current = seed; } public static int Mix(uint seed, int salt) { int num = (int)seed ^ (salt + -1640531527); int num2 = (num ^ (num >>> 16)) * 2146121005; int num3 = (num2 ^ (num2 >>> 15)) * -2073254261; return num3 ^ (num3 >>> 16); } } internal static class DecorationTestSpec { internal static int[] Read(IDictionary<string, object> root, IDictionary<string, object> platform, SurfaceKind kind) { if (kind != SurfaceKind.Sand || root == null || !root.TryGetValue("MorePlatformsDecorationTest", out var value) || !(value is bool) || !(bool)value || !platform.TryGetValue("MorePlatformsTestDecorations", out var value2)) { return null; } IEnumerable obj = value2 as IEnumerable; if (obj == null || value2 is string) { throw new ArgumentException("Lista de enfeites de teste invalida."); } List<int> list = new List<int>(); foreach (object item in obj) { if (!(item is double) && !(item is float) && !(item is int) && !(item is long)) { throw new ArgumentException("Enfeite de teste deve ser um indice numerico."); } double num = Convert.ToDouble(item); if (double.IsNaN(num) || num < 0.0 || num > 11.0 || num != Math.Floor(num) || list.Count >= 2) { throw new ArgumentException("Use ate dois indices de enfeite entre 0 e 11."); } list.Add((int)num); } return list.ToArray(); } } public sealed class DesertAudio : IDisposable { private sealed class Saved { public AudioSource Source; public AudioClip Clip; public AudioManager Manager; public int SoundIndex; public AudioClip SoundClip; public float Volume; public float SoundVolume; public bool Playing; } private readonly Dictionary<AudioSource, Saved> saved = new Dictionary<AudioSource, Saved>(); private AudioClip replacement; public static bool IsWater(string name) { if (string.IsNullOrEmpty(name)) { return false; } name = name.ToLowerInvariant(); if (name.Contains("bubble") || name.Contains("liso")) { return false; } if (!name.Contains("water") && !name.Contains("ocean") && !name.Contains("splash") && !name.StartsWith("waves") && !name.StartsWith("wave_")) { return name == "sea"; } return true; } public void Refresh() { //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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)replacement == (Object)null) { ref AudioClip reference = ref replacement; Object quicksandClip = SurfaceAudio.QuicksandClip; reference = (AudioClip)(object)((quicksandClip is AudioClip) ? quicksandClip : null); } if ((Object)(object)replacement == (Object)null) { return; } AudioManager val = AudioManager.Get(); if ((Object)(object)val != (Object)null && val.sounds != null) { for (int i = 0; i < val.sounds.Length; i++) { Sound val2 = val.sounds[i]; if (!((Object)(object)val2.source == (Object)null) && (IsWater(val2.name) || ((Object)(object)val2.clip != (Object)null && IsWater(((Object)val2.clip).name)))) { Replace(val2.source, val, i); } } } AudioSource[] array = Object.FindObjectsOfType<AudioSource>(); foreach (AudioSource val3 in array) { if (!((Object)(object)val3 == (Object)null) && !saved.ContainsKey(val3) && !((Object)(object)val3.clip == (Object)null) && (IsWater(((Object)val3.clip).name) || IsWater(((Object)((Component)val3).gameObject).name))) { Replace(val3, null, -1); } } } private void Replace(AudioSource source, AudioManager manager, int index) { //IL_00e1: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (!this.saved.ContainsKey(source)) { Saved saved = new Saved { Source = source, Clip = source.clip, Volume = source.volume, Playing = source.isPlaying, Manager = manager, SoundIndex = index, SoundClip = (((Object)(object)manager == (Object)null) ? null : manager.sounds[index].clip), SoundVolume = (((Object)(object)manager == (Object)null) ? 0f : manager.sounds[index].volume) }; this.saved.Add(source, saved); if (saved.Playing) { source.Stop(); } source.clip = replacement; source.volume = saved.Volume * 0.3f; if ((Object)(object)manager != (Object)null) { Sound val = manager.sounds[index]; val.clip = replacement; val.volume = saved.SoundVolume * 0.3f; manager.sounds[index] = val; } if (saved.Playing) { source.Play(); } } } public void Dispose() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) foreach (Saved value in saved.Values) { if ((Object)(object)value.Manager != (Object)null && value.Manager.sounds != null && value.SoundIndex >= 0 && value.SoundIndex < value.Manager.sounds.Length) { Sound val = value.Manager.sounds[value.SoundIndex]; if ((Object)(object)val.clip == (Object)(object)replacement) { val.clip = value.SoundClip; val.volume = value.SoundVolume; value.Manager.sounds[value.SoundIndex] = val; } } if (!((Object)(object)value.Source == (Object)null) && !((Object)(object)value.Source.clip != (Object)(object)replacement)) { bool isPlaying = value.Source.isPlaying; value.Source.Stop(); value.Source.clip = value.Clip; value.Source.volume = value.Volume; if (isPlaying && value.Source.loop && (Object)(object)value.Clip != (Object)null) { value.Source.Play(); } } } saved.Clear(); replacement = null; } } public static class DesertDecorationArt { private static Texture2D texture; private static bool loaded; private static readonly Sprite[] sprites = (Sprite[])(object)new Sprite[12]; private static readonly int[,] regions = new int[12, 4] { { 63, 125, 270, 174 }, { 416, 66, 342, 243 }, { 849, 29, 251, 305 }, { 1158, 132, 331, 180 }, { 51, 370, 354, 232 }, { 476, 427, 251, 150 }, { 795, 388, 356, 234 }, { 1200, 367, 284, 253 }, { 53, 598, 334, 393 }, { 451, 723, 273, 268 }, { 859, 632, 256, 359 }, { 1178, 771, 311, 221 } }; public static Sprite Get(int index) { if (!loaded) { Load(); } return sprites[index]; } public static void Load() { //IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown if (loaded) { return; } try { using (Stream stream = typeof(DesertDecorationArt).Assembly.GetManifestResourceStream("LisoMod.DesertDecor.png")) { using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { throw new FileNotFoundException("DesertDecor.png"); } stream.CopyTo(memoryStream); texture = new Texture2D(2, 2, (TextureFormat)4, false) { name = "LISO desert decorations atlas", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; if (!(bool)Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule", throwOnError: true).GetMethod("LoadImage", new Type[3] { typeof(Texture2D), typeof(byte[]), typeof(bool) }).Invoke(null, new object[3] { texture, memoryStream.ToArray(), false })) { throw new InvalidDataException("DesertDecor.png"); } } for (int i = 0; i < sprites.Length; i++) { sprites[i] = RootArt.Crop(texture, regions[i, 0], regions[i, 1], regions[i, 2], regions[i, 3], trim: true); ((Object)sprites[i]).name = "LISO desert decor " + i; } loaded = true; } catch { Release(); throw; } finally { if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } texture = null; } } public static void Release() { for (int i = 0; i < sprites.Length; i++) { if ((Object)(object)sprites[i] != (Object)null) { Object.Destroy((Object)(object)sprites[i]); } sprites[i] = null; } if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } texture = null; loaded = false; } } public static class DesertDecorationPolicy { public const int FloorCount = 10; public const int PlatformSlots = 2; public static int Seed(float x, float y) { return ((int)Math.Round(x * 100f) * 73856093) ^ ((int)Math.Round(y * 100f) * 19349663) ^ 0x51A790; } public static int PlatformCount(float width) { if (!(width < 1.5f)) { if (!(width < 7f)) { return 2; } return 1; } return 0; } public static int PlatformCount(Random random) { return PlatformCount(random, desert: true); } public static int PlatformCount(Random random, bool desert) { int num = random.Next(100); if (!desert) { if (num >= 70) { if (num >= 95) { return 2; } return 1; } return 0; } if (num >= 30) { if (num >= 80) { return 2; } return 1; } return 0; } public static int Art(Random random, bool quicksand) { return Art(random, quicksand, 1); } public static int Art(Random random, bool quicksand, int platformCount) { return Art(random, quicksand, platformCount, desert: true); } public static int Art(Random random, bool quicksand, int platformCount, bool desert) { int num = random.Next(100); int num2 = (quicksand ? 25 : ((!desert) ? ((platformCount == 2) ? 85 : 10) : ((platformCount == 2) ? 50 : 60))); int num3 = (quicksand ? 60 : 5); return ((num < num2) ? 8 : ((num < num2 + num3) ? 4 : 0)) + random.Next(4); } public static float Width(int art, Random random) { return ((art >= 8) ? 0.6f : ((art == 2) ? 0.65f : 0.85f)) + (float)random.NextDouble() * 0.45f; } public static float SizeVariation(Random random) { return 1f + (float)random.NextDouble() * 0.15f; } public static float VisualScale(int art, float spriteWidth, float spriteHeight, float variation) { float num = ((art >= 8) ? 2.8f : 4.5f); float num2 = ((art >= 8) ? 4.6f : 3.12f); return Math.Max(num / Math.Max(0.001f, spriteWidth), num2 / Math.Max(0.001f, spriteHeight)) * variation * ((art < 8) ? 0.5f : 0.82500005f); } public static float Top(float x, float extentX, float extentY, float radius) { float num = Math.Max(0f, Math.Abs(x) - extentX); return extentY + (float)Math.Sqrt(Math.Max(0f, radius * radius - num * num)); } public static float FloorX(int index, Random random, float left, float right) { return left + (right - left) * ((float)index + 0.2f + (float)random.NextDouble() * 0.6f) / 10f; } } internal static class DesertGroundGeometry { internal static void UpdateVertices(Vector3[] vertices, int columns, int rows, float left, float right, float bottom, float surface, float time, bool reposition) { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0081: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (reposition) { for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { float num = Mathf.Lerp(left, right, (float)j / (float)columns); float num2 = Mathf.Lerp(left, right, (float)(j + 1) / (float)columns); float num3 = Mathf.Lerp(bottom, surface, (float)i / (float)rows); float num4 = Mathf.Lerp(bottom, surface, (float)(i + 1) / (float)rows); int num5 = (i * columns + j) * 4; vertices[num5] = new Vector3(num, num3, 0f); vertices[num5 + 1] = new Vector3(num, num4, 0f); vertices[num5 + 2] = new Vector3(num2, num4, 0f); vertices[num5 + 3] = new Vector3(num2, num3, 0f); } } } float num6 = Mathf.Lerp(bottom, surface, 1f); for (int k = 0; k < columns; k++) { int num7 = ((rows - 1) * columns + k) * 4; float x = vertices[num7].x; float x2 = vertices[num7 + 3].x; vertices[num7 + 1] = new Vector3(x, num6 + Mathf.Sin(x * 2f + time * 0.5f) * 0.045f, 0f); vertices[num7 + 2] = new Vector3(x2, num6 + Mathf.Sin(x2 * 2f + time * 0.5f) * 0.045f, 0f); } } internal static Bounds BoundsFor(float left, float right, float bottom, float surface) { //IL_0017: 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_0038: Unknown result type (might be due to invalid IL or missing references) return new Bounds(new Vector3((left + right) * 0.5f, (bottom + surface) * 0.5f, 0f), new Vector3(right - left + 0.1f, surface - bottom + 0.1f, 0.1f)); } } public sealed class DesertHeatEffect : MonoBehaviour { public DesertRuntime Owner; private Camera camera; private RenderTexture captured; private CommandBuffer commands; private readonly float[] sourceU = new float[128]; private readonly float[] sourceV = new float[128]; private float lastTime = -100f; private float lastStrength = -1f; private int renderedFrame = -10; private bool failed; private bool ownsOffscreen; private bool previousOffscreen; private bool topOrigin; private bool Active { get { if ((Object)(object)Owner != (Object)null && (Object)(object)camera != (Object)null && ((Behaviour)camera).enabled && DesertRuntime.HeatActive && Owner.HeatIntensity > 0f && !GameSessionHandler.GameIsPaused) { return !GameSessionHandler.HasGameEnded(); } return false; } } public void Bind(Camera cam, DesertRuntime owner) { camera = cam; Owner = owner; } public void RefreshCapture() { //IL_00b6: 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_00c6: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (!Active || failed) { Detach(); return; } try { int num = HeatMiragePolicy.CaptureWidth(camera.pixelWidth, camera.pixelHeight); int num2 = HeatMiragePolicy.CaptureHeight(camera.pixelWidth, camera.pixelHeight); if ((Object)(object)captured == (Object)null || !captured.IsCreated() || ((Texture)captured).width != num || ((Texture)captured).height != num2) { Detach(); if ((Object)(object)captured != (Object)null) { captured.Release(); Object.Destroy((Object)(object)captured); } captured = new RenderTexture(num, num2, 0, (RenderTextureFormat)0) { name = "LISO bounded heat mirage capture", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; if (!captured.Create()) { throw new InvalidOperationException("A captura da camera nao foi criada."); } } if (commands == null) { previousOffscreen = camera.forceIntoRenderTexture; ownsOffscreen = true; camera.forceIntoRenderTexture = true; topOrigin = SystemInfo.graphicsUVStartsAtTop; commands = new CommandBuffer { name = "LISO heat: capture final camera image" }; commands.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2), RenderTargetIdentifier.op_Implicit((Texture)(object)captured)); commands.SetRenderTarget(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)2)); camera.AddCommandBuffer((CameraEvent)20, commands); renderedFrame = -10; lastTime = -100f; } } catch (Exception ex) { failed = true; Detach(); if (LisoPlugin.Log != null) { LisoPlugin.Log.LogWarning((object)("LISO miragem: " + ex.Message)); } } } private void OnPostRender() { if (commands != null && Active) { renderedFrame = Time.frameCount; } } public void DrawMirage() { //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_0012: Invalid comparison between Unknown and I4 //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01ba: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) if (Event.current == null || (int)Event.current.type != 7 || !Active || commands == null || (Object)(object)captured == (Object)null || !captured.IsCreated() || renderedFrame < 0 || Time.frameCount - renderedFrame > 1) { return; } float heatTime = Owner.HeatTime; float heatIntensity = Owner.HeatIntensity; if (HeatMiragePolicy.NeedsRefresh(heatTime, lastTime, heatIntensity, lastStrength)) { for (int i = 0; i < 128; i++) { float v = 1f - ((float)i + 0.5f) / 128f; float exposure = (Owner.Exposure(0.2f, v) + Owner.Exposure(0.5f, v) + Owner.Exposure(0.8f, v)) / 3f; sourceU[i] = HeatMiragePolicy.OffsetU(v, heatTime, heatIntensity, exposure); sourceV[i] = HeatMiragePolicy.SourceV(i, heatTime, heatIntensity, exposure); } lastTime = heatTime; lastStrength = heatIntensity; } Rect rect = camera.rect; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x * (float)Screen.width, (1f - ((Rect)(ref rect)).yMax) * (float)Screen.height, ((Rect)(ref rect)).width * (float)Screen.width, ((Rect)(ref rect)).height * (float)Screen.height); int num = Mathf.RoundToInt(((Rect)(ref val)).height); if (num <= 0 || ((Rect)(ref val)).width <= 0f) { return; } Color color = GUI.color; Matrix4x4 matrix = GUI.matrix; GUI.color = Color.white; GUI.matrix = Matrix4x4.identity; try { GUI.BeginGroup(val); try { GUI.DrawTextureWithTexCoords(new Rect(0f, 0f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), (Texture)(object)captured, new Rect(0f, HeatCaptureOrientation.Start(0f, topOrigin), 1f, HeatCaptureOrientation.Height(1f, topOrigin)), false); for (int j = 0; j < 128; j++) { float num2 = 1f - ((float)j + 0.5f) / 128f; if (!(num2 < 0.06f) && !(num2 > 0.94f)) { int num3 = HeatMiragePolicy.PixelBoundary(j, num); int num4 = HeatMiragePolicy.PixelBoundary(j + 1, num); if (num4 > num3) { GUI.DrawTextureWithTexCoords(new Rect(0f, (float)num3, ((Rect)(ref val)).width, (float)(num4 - num3)), (Texture)(object)captured, new Rect(sourceU[j], HeatCaptureOrientation.Start(sourceV[j], topOrigin), 1f, HeatCaptureOrientation.Height(1f / 128f, topOrigin)), false); } } } } finally { GUI.EndGroup(); } } finally { GUI.color = color; GUI.matrix = matrix; } } private void Detach() { if (commands != null) { if ((Object)(object)camera != (Object)null) { camera.RemoveCommandBuffer((CameraEvent)20, commands); } commands.Release(); commands = null; } if (ownsOffscreen) { if ((Object)(object)camera != (Object)null) { camera.forceIntoRenderTexture = previousOffscreen; } ownsOffscreen = false; } renderedFrame = -10; } private void OnDisable() { Detach(); } private void OnDestroy() { Detach(); if ((Object)(object)captured != (Object)null) { captured.Release(); Object.Destroy((Object)(object)captured); captured = null; } } } public static class DesertHeatVisual { public static float Intensity(double age) { return (float)Math.Max(0.0, Math.Min(1.0, Math.Min(age / 0.65, (10.0 - age) / 0.65))); } public static float Offset(double u, double v, double time) { return (float)((0.35 + 0.65 * (1.0 - v)) * (Math.Sin(v * 52.0 + time * 3.8 + Math.Sin(u * 11.0 - time) * 0.8) * 0.0042 + Math.Sin(v * 89.0 - time * 5.1 + u * 8.0) * 0.0018)); } public static float Band(double u, double v, double time) { return (float)(0.5 + 0.5 * Math.Sin(v * 46.0 + Math.Sin(u * 9.0 + time * 1.4) * 1.7 - time * 2.8)); } public static float Haze(double u, double v, double time) { double num = Math.Max(0.0, Math.Sin(v * 30.0 + Math.Sin(u * 8.0 + time * 1.1) * 1.4 - time * 2.2)); return (float)(num * num * num * num); } } public static class DesertHooks { public static void Install(Harmony harmony) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown harmony.Patch((MethodBase)AccessTools.PropertyGetter(typeof(SceneBounds), "WaterHeight"), new HarmonyMethod(typeof(DesertHooks), "WaterPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static bool WaterPrefix(ref Fix __result) { //IL_0010: 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) if (!DesertRuntime.Enabled) { return true; } __result = (Fix)(-10000L); return false; } } public sealed class DesertLighting { public const int Columns = 64; public const int Rows = 36; private readonly float[] shadowTop = new float[64]; private readonly List<RoundedRect> roofs = new List<RoundedRect>(); private float bottom; private float top; private float left; private float right; private float floor; public void Update(Camera camera, Fix floorHeight) { //IL_000e: 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_006e: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //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_00b8: 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_00d0: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01b3: 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) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) float orthographicSize = camera.orthographicSize; bottom = ((Component)camera).transform.position.y - orthographicSize; top = bottom + 2f * orthographicSize; left = ((Component)camera).transform.position.x - orthographicSize * camera.aspect; right = left + 2f * orthographicSize * camera.aspect; floor = (float)floorHeight; DetPhysics val = DetPhysics.Get(); Fix val2 = SceneBounds.BlastZone_YMax + (Fix)200L; roofs.Clear(); for (int i = 0; i < val.roundedRects.Length; i++) { PhysicsParent val3 = val.roundedRects.physicsParents[i]; if (!((Object)(object)val3.fixTrans == (Object)null) && val3.monobehaviourCollider != null && !val3.monobehaviourCollider.IsDestroyed && DetPhysics.IsActive(val3) && !((Object)(object)((Component)val3.fixTrans).GetComponent<StickyRoundedRectangle>() == (Object)null)) { roofs.Add(val.roundedRects.colliders[i]); } } Vec2 val4 = default(Vec2); Fix val6 = default(Fix); Fix val7 = default(Fix); for (int j = 0; j < 64; j++) { ((Vec2)(ref val4))..ctor((Fix)(left + (right - left) * ((float)j + 0.5f) / 64f), val2); Fix val5 = Fix.MaxValue; float num = floor; for (int k = 0; k < roofs.Count; k++) { if (Raycast.RayCastRoundedRect(val4, Vec2.down, roofs[k], ref val6, ref val7) && val7 >= Fix.Zero && val6