add RoundStartEvent.cs

This commit is contained in:
XtraCube committed 2025-03-29 21:51:31 -04:00
1 parent 1a53e2b045
commit 31132e6e65
3 files changed
+31

No files matched your search

@@ -0,0 +1,21 @@
namespace MiraAPI.Events.Vanilla.Gameplay;
/// <summary>
/// Start Round event, invoked on IntroCutscene.OnDestroy and ExileController.WrapUp.
/// </summary>
public class RoundStartEvent : MiraEvent
{
/// <summary>
/// Gets a value indicating whether the event was triggered by the IntroCutscene or ExileController.
/// </summary>
public bool TriggeredByIntro { get; }
/// <summary>
/// Initializes a new instance of the <see cref="RoundStartEvent"/> class.
/// </summary>
/// <param name="triggeredByIntro">Whether the event was triggered by the intro or not.</param>
public RoundStartEvent(bool triggeredByIntro)
{
TriggeredByIntro = triggeredByIntro;
}
}
+1
View File
@@ -61,5 +61,6 @@ public static class IntroCutscenePatches
public static void GameBeginPatch(IntroCutscene __instance)
{
MiraEventManager.InvokeEvent(new IntroEndEvent(__instance));
MiraEventManager.InvokeEvent(new RoundStartEvent(true));
}
}
+9
View File
@@ -1,5 +1,6 @@
using HarmonyLib;
using MiraAPI.Events;
using MiraAPI.Events.Vanilla.Gameplay;
using MiraAPI.Events.Vanilla.Meeting;
using MiraAPI.Roles;
@@ -31,4 +32,12 @@ public static class EjectionPatches
__instance.completeString = role.GetCustomEjectionMessage(__instance.initData.networkedPlayer);
}
[HarmonyPostfix]
[HarmonyPatch(nameof(ExileController.WrapUp))]
public static void WrapUpPostfix(ExileController __instance)
{
var @event = new RoundStartEvent(false);
MiraEventManager.InvokeEvent(@event);
}
}