Skip to content

Commit

Permalink
添加全场广播
Browse files Browse the repository at this point in the history
  • Loading branch information
commandf1 committed Oct 1, 2024
1 parent 0f1c97e commit 8e08e9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions COG/Listener/Impl/RpcListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void AfterRpcReceived(PlayerHandleRpcEvent @event)
{
var killer = reader.ReadNetObject<PlayerControl>();
var target = reader.ReadNetObject<PlayerControl>();
var showAnimationToEverybody = reader.ReadBoolean();

target.Exiled();
if (MeetingHud.Instance)
Expand All @@ -92,9 +93,15 @@ public void AfterRpcReceived(PlayerHandleRpcEvent @event)
MeetingHud.Instance.CheckForEndVoting();
}

if (PlayerControl.LocalPlayer.PlayerId == target.PlayerId)
foreach (var player in PlayerUtils.GetAllAlivePlayers())
{
HudManager.Instance.KillOverlay.ShowKillAnimation(killer.Data, target.Data);
if (player.PlayerId == target.PlayerId)
{
HudManager.Instance.KillOverlay.ShowKillAnimation(killer.Data, target.Data);
continue;
}

HudManager.Instance.KillOverlay.ShowKillAnimation(target.Data, target.Data);
}

break;
Expand Down
4 changes: 3 additions & 1 deletion COG/Utils/PlayerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ public static void RpcAdvancedMurderPlayer(this PlayerControl killer, PlayerCont
/// </summary>
/// <param name="killer"></param>
/// <param name="target"></param>
public static void RpcKillPlayerCompletely(this PlayerControl killer, PlayerControl target)
/// <param name="showAnimationToEverybody"></param>
public static void RpcKillPlayerCompletely(this PlayerControl killer, PlayerControl target, bool showAnimationToEverybody = false)
{
var rpc = RpcUtils.StartRpcImmediately(PlayerControl.LocalPlayer, KnownRpc.KillPlayerCompletely, GetAllPlayers().ToArray());
rpc.WriteNetObject(killer);
rpc.WriteNetObject(target);
rpc.Write(showAnimationToEverybody);
rpc.Finish();
}

Expand Down

0 comments on commit 8e08e9c

Please sign in to comment.