diff --git a/MiraAPI.Example/ExampleEventHandlers.cs b/MiraAPI.Example/ExampleEventHandlers.cs
index 91d7899..618ea2f 100644
--- a/MiraAPI.Example/ExampleEventHandlers.cs
+++ b/MiraAPI.Example/ExampleEventHandlers.cs
@@ -35,6 +35,7 @@ public static class ExampleEventHandlers
});
}
+ // If you want to add extra votes to a player, do something like this.
[RegisterEvent]
public static void StartMeetingEvent(StartMeetingEvent _)
{
@@ -47,6 +48,7 @@ public static class ExampleEventHandlers
}
}
+ // Example of using the Voting API to make a role similar to the Prosecutor from Town of Us.
[RegisterEvent(15)]
public static void HandleVoteEvent(HandleVoteEvent @event)
{
diff --git a/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs b/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs
new file mode 100644
index 0000000..131b6d5
--- /dev/null
+++ b/MiraAPI/Events/Vanilla/Meeting/Voting/PopulateResultsEvent.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using MiraAPI.Voting;
+
+namespace MiraAPI.Events.Vanilla.Meeting.Voting;
+
+///
+/// Called in VotingUtils.HandlePopulateResults.
+/// Cancelling is NOT advised but if you do plan on cancelling, please ensure you account for displaying ALL player's votes.
+///
+public class PopulateResultsEvent : MiraCancelableEvent
+{
+ ///
+ /// Gets a list of networked votes.
+ ///
+ public List Votes { get; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The list of votes.
+ public PopulateResultsEvent(List votes)
+ {
+ Votes = votes;
+ }
+}
diff --git a/MiraAPI/Voting/VotingUtils.cs b/MiraAPI/Voting/VotingUtils.cs
index d850226..d10aeac 100644
--- a/MiraAPI/Voting/VotingUtils.cs
+++ b/MiraAPI/Voting/VotingUtils.cs
@@ -111,6 +111,14 @@ public static class VotingUtils
/// The list of networked votes.
public static void HandlePopulateResults(List votes)
{
+ PopulateResultsEvent @event = new PopulateResultsEvent(votes);
+ MiraEventManager.InvokeEvent(@event);
+
+ if (@event.IsCancelled)
+ {
+ return;
+ }
+
MeetingHud.Instance.TitleText.text =
DestroyableSingleton.Instance.GetString(
StringNames.MeetingVotingResults,