public override void Load() { Logger.SetLogLevel("CollabUtils2", LogLevel.Info); InGameOverworldHelper.Load(); ReturnToLobbyHelper.Load(); StrawberryHooks.Load(); MiniHeartDoor.Load(); LobbyHelper.Load(); SpeedBerryTimerDisplay.Load(); SpeedBerryPBInChapterPanel.Load(); JournalTrigger.Load(); CustomCrystalHeartHelper.Load(); GoldenBerryPlayerRespawnPoint.Load(); SpeedBerry.Load(); AreaCompleteInfoInLevel.Load(); SilverBlock.Load(); MiniHeartDoorUnlockCutsceneTrigger.Load(); LazyLoadingHandler.Load(); SilverBerryCollectTrigger.Load(); Everest.Content.OnUpdate += onModAssetUpdate; hookOrigSessionCtor = new Hook(typeof(Session).GetMethod("orig_ctor"), typeof(CollabModule).GetMethod(nameof(onNewSession), BindingFlags.NonPublic | BindingFlags.Static)); }
public override void Unload() { InGameOverworldHelper.Unload(); ReturnToLobbyHelper.Unload(); StrawberryHooks.Unload(); MiniHeartDoor.Unload(); LobbyHelper.Unload(); SpeedBerryTimerDisplay.Unload(); SpeedBerryPBInChapterPanel.Unload(); JournalTrigger.Unload(); CustomCrystalHeartHelper.Unload(); GoldenBerryPlayerRespawnPoint.Unload(); SpeedBerry.Unload(); AreaCompleteInfoInLevel.Unload(); SilverBlock.Unload(); Everest.Content.OnUpdate -= onModAssetUpdate; }
public override void Load() { Logger.SetLogLevel("CollabUtils2", LogLevel.Info); InGameOverworldHelper.Load(); ReturnToLobbyHelper.Load(); StrawberryHooks.Load(); MiniHeartDoor.Load(); LobbyHelper.Load(); SpeedBerryTimerDisplay.Load(); SpeedBerryPBInChapterPanel.Load(); JournalTrigger.Load(); CustomCrystalHeartHelper.Load(); GoldenBerryPlayerRespawnPoint.Load(); SpeedBerry.Load(); AreaCompleteInfoInLevel.Load(); SilverBlock.Load(); Everest.Content.OnUpdate += onModAssetUpdate; }
public override void Unload() { InGameOverworldHelper.Unload(); ReturnToLobbyHelper.Unload(); StrawberryHooks.Unload(); MiniHeartDoor.Unload(); LobbyHelper.Unload(); SpeedBerryTimerDisplay.Unload(); SpeedBerryPBInChapterPanel.Unload(); JournalTrigger.Unload(); CustomCrystalHeartHelper.Unload(); GoldenBerryPlayerRespawnPoint.Unload(); SpeedBerry.Unload(); AreaCompleteInfoInLevel.Unload(); SilverBlock.Unload(); MiniHeartDoorUnlockCutsceneTrigger.Unload(); LazyLoadingHandler.Unload(); SilverBerryCollectTrigger.Unload(); Everest.Content.OnUpdate -= onModAssetUpdate; hookOrigSessionCtor?.Dispose(); hookOrigSessionCtor = null; }
public override void Update() { Sprite sprite = Get <Sprite>(); if (Follower.HasLeader) { if (TimerDisplay == null) { TimerDisplay = new SpeedBerryTimerDisplay(this); SceneAs <Level>().Add(TimerDisplay); } // show a message about customizing the speed berry timer position when grabbing it for the first time in the save. Player player = Scene.Tracker.GetEntity <Player>(); if (player != null && !CollabModule.Instance.SaveData.SpeedberryOptionMessageShown) { CollabModule.Instance.SaveData.SpeedberryOptionMessageShown = true; Scene.Add(new DialogCutscene("collabutils2_speedberry_optionmessage", player, false)); } } if (TimerDisplay != null && !collected) { if (BronzeTime < TimeSpan.FromTicks(TimerDisplay.GetSpentTime()).TotalSeconds) { // Time ran out TimeRanOut = true; } else if (Follower.Leader?.Entity is Player leaderPlayer && !leaderPlayer.Dead && leaderPlayer.CollideCheck <SpeedBerryCollectTrigger>()) { // collect the speed berry! TimerDisplay.EndTimer(); OnCollect(); collected = true; } else { string nextRank = TimerDisplay.GetNextRank(out float nextTime).ToLowerInvariant(); // the berry is close to exploding, time is over in 1.2 seconds. Start the exploding animation if (nextRank == "bronze" && sprite.CurrentAnimationID != "explosion" && TimeSpan.FromTicks(TimerDisplay.GetSpentTime()).TotalMilliseconds + 1200 > nextTime * 1000) { playAnimationSpeedrunToolSafe(sprite, "explosion"); } // the current animation does not match the expected animation. if (nextRank != "gold" && sprite.CurrentAnimationID != "explosion" && !sprite.CurrentAnimationID.Contains(nextRank)) { playAnimationSpeedrunToolSafe(sprite, "transition_to_" + nextRank); } if (nextRank == "bronze") { P_GoldGlow = P_BronzeGlow; } else if (nextRank == "silver") { P_GoldGlow = P_SilverGlow; } } }