mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using BetterAmongUs.Interfaces;
|
|
using BetterAmongUs.Utilities;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace BetterAmongUs.Data.Replay.Events;
|
|
|
|
[Serializable]
|
|
internal sealed class ChatNoteEvent : IReplayEvent<ChatNoteEvent.ChatNoteReplayData, ChatNoteEvent.ChatNoteReplayArgs>
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string Id => "chat_note";
|
|
|
|
[JsonPropertyName("eventData")]
|
|
public ChatNoteReplayData? EventData { get; set; }
|
|
|
|
public void Play()
|
|
{
|
|
if (EventData == null)
|
|
return;
|
|
|
|
var player = Utils.PlayerFromPlayerId(EventData.PlayerId);
|
|
if (player == null)
|
|
return;
|
|
|
|
if (HudManager.InstanceExists)
|
|
{
|
|
HudManager.Instance.Chat.AddChatNote(player.Data, (ChatNoteTypes)EventData.NoteType);
|
|
}
|
|
}
|
|
|
|
public void Undo()
|
|
{
|
|
}
|
|
|
|
public void Record(ChatNoteReplayArgs args)
|
|
{
|
|
EventData = new ChatNoteReplayData(args.Player.PlayerId, (int)args.NoteType);
|
|
}
|
|
|
|
internal record ChatNoteReplayData(byte PlayerId, int NoteType) : IReplayEvent.Data;
|
|
|
|
internal record ChatNoteReplayArgs(PlayerControl Player, ChatNoteTypes NoteType) : IReplayEvent.Args;
|
|
} |