Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

イビルハッカーのメッセージで無人の部屋をグレー色に着色する #45

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Roles/Impostor/EvilHacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public override void OnReportDeadBody(PlayerControl reporter, GameData.PlayerInf
var builder = new StringBuilder(512);

// 送信するメッセージを生成
var previous = -1;
foreach (var admin in admins)
{
var entry = admin.Value;
Expand All @@ -131,6 +132,24 @@ public override void OnReportDeadBody(PlayerControl reporter, GameData.PlayerInf
{
builder.Append(ImpostorMark);
}
// 色分けは無人をスキップしない場合のみ
if (!skipUnoccupiedRooms)
{
switch (previous, entry.TotalPlayers)
{
// 1部屋目で今の部屋が無人の場合
case (-1, 0):
// 前の部屋が有人で今の部屋が無人の場合
case ( > 0, 0):
// グレー
builder.Append(GrayTag);
break;
// 前の部屋が無人で今の部屋が有人の場合
case (0, > 0):
builder.Append(ColorCloseTag);
break;
}
}
// 部屋名と合計プレイヤー数を表記
builder.Append(DestroyableSingleton<TranslationController>.Instance.GetString(entry.Room));
builder.Append(": ");
Expand All @@ -142,6 +161,7 @@ public override void OnReportDeadBody(PlayerControl reporter, GameData.PlayerInf
builder.Append('×').Append(entry.NumDeadBodies).Append(')');
}
builder.Append('\n');
previous = entry.TotalPlayers;
}

// 送信
Expand Down Expand Up @@ -269,6 +289,8 @@ private void Inherit()
private static readonly string ImpostorMark = "★".Color(Palette.ImpostorRed);
/// <summary>相方がキルしたときに名前の下に通知を表示する長さ</summary>
private static readonly TimeSpan NotifyDuration = TimeSpan.FromSeconds(10);
private const string GrayTag = "<color=#777>";
private const string ColorCloseTag = "</color>";

private readonly struct MurderNotify
{
Expand Down