Skip to content

Commit

Permalink
完成
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirin3rd committed May 4, 2024
1 parent 81b9de5 commit bd6abd8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
11 changes: 7 additions & 4 deletions util/Broadcast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace UtilPlugin
public enum BroadcastPriority : byte { Lowest = 1, Lower = 50, Normal = 100, Higher = 150, Highest = 200, eme = 255}
public class BroadcastItem
{
public bool Noprefix = false;
public bool showtime = false;
public int time;
public string prefix, text;
Expand All @@ -22,10 +23,12 @@ public class BroadcastItem
public static bool operator >(BroadcastItem lhs, BroadcastItem rhs) => lhs.priority > rhs.priority;
public override string ToString()
{
string result = $"<size=26>「{prefix}」:{text}";
if (showtime) result += $"[{time}]</size>";
else result += "</size>";
return result;
string result = "";
if (!Noprefix) result += $"{prefix}」:";
result += text;
if (showtime) result += $"[{time}]</size>";
else result += "</size>";
return result;
}
}
public class BroadcastMain
Expand Down
26 changes: 8 additions & 18 deletions util/Commands.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
//Copyright 2023 Silver Wolf,All Rights Reserved.
using CommandSystem;
using Exiled.API.Features;
using Google.Protobuf.WellKnownTypes;
using Hints;
using InventorySystem;
using InventorySystem.Disarming;
using MEC;
using PlayerRoles;
using SCPSLAudioApi.AudioCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UtilPlugin;
using Utils.Networking;
using VoiceChat;

namespace CommandSystem
Expand Down Expand Up @@ -123,10 +113,10 @@ public class StopCleanup : ICommand
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
Timing.KillCoroutines(UtilPlugin.EventHandler._cleanupcoroutine);
if (arguments.Count != 1 || arguments.At(0) != "false")
{
PluginAPI.Core.Server.SendBroadcast($"管理员 {Player.Get((sender as CommandSender).SenderId).Nickname} 关闭了本局的自动清理", 10);
}
//if (arguments.Count != 1 || arguments.At(0) != "false")
//{
// PluginAPI.Core.Server.SendBroadcast($"管理员 {Player.Get((sender as CommandSender).SenderId).Nickname} 关闭了本局的自动清理", 10);
//}
response = "Done!";
return true;
}
Expand All @@ -144,10 +134,10 @@ public class StopSystemWarhead : ICommand
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
Timing.KillCoroutines(UtilPlugin.SystemWarhead._systemwarheadwaiter);
if (arguments.Count != 1 || arguments.At(0) != "false")
{
PluginAPI.Core.Server.SendBroadcast($"管理员 {Player.Get((sender as CommandSender).SenderId).Nickname} 关闭了本局的系统核弹", 10);
}
//if (arguments.Count != 1 || arguments.At(0) != "false")
//{
// PluginAPI.Core.Server.SendBroadcast($"管理员 {Player.Get((sender as CommandSender).SenderId).Nickname} 关闭了本局的系统核弹", 10);
//}
response = "Done!";
return true;
}
Expand Down
11 changes: 7 additions & 4 deletions util/Voting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void OnRoundEnded(RoundEndedEventArgs ev)
Timing.KillCoroutines(votingcoroutine);
if (voting)
{
BroadcastMain.SendGlobalcast(new BroadcastItem { priority = (byte)BroadcastPriority.Higher, time = 10 });
BroadcastMain.SendGlobalcast(new BroadcastItem { priority = (byte)BroadcastPriority.Higher, time = 5, prefix = "<color=red>投票失败</color>", text = "回合已结束" });
//PluginAPI.Core.Server.SendBroadcast($"<size=24><color=red>「投票失败」</color>回合已结束</size>", 5, Broadcast.BroadcastFlags.Normal, true);
voting = false;
}
Expand All @@ -47,7 +47,8 @@ public static bool CancalVote(Player player, bool sendbroadcast = false)
if (voting)
{
Timing.KillCoroutines(votingcoroutine);
PluginAPI.Core.Server.SendBroadcast($"<size=24><color=red>「投票失败」</color>管理员强制废除了此次投票</size>", 5, Broadcast.BroadcastFlags.Normal, true);
BroadcastMain.SendGlobalcast(new BroadcastItem { priority = (byte)BroadcastPriority.Higher, time = 5, prefix = "<color=red>投票失败</color>", text = "管理员强制废除了此次投票" });
//PluginAPI.Core.Server.SendBroadcast($"<size=24><color=red>「投票失败」</color>管理员强制废除了此次投票</size>", 5, Broadcast.BroadcastFlags.Normal, true);
AcceptPlayer = new ConcurrentBag<string>();
AgainstPlayer = new ConcurrentBag<string>();
Timing.CallDelayed(90f, () => Canvote = true);
Expand All @@ -69,11 +70,13 @@ public static void OnVotingEnded(VotingEvent votingEvent)
if (votingEvent.OnVotingEnded() || Accepted)
{
votingEvent.Action();
PluginAPI.Core.Server.SendBroadcast($"<size=24><color=green>「投票通过」</color>{votingEvent.AcceptBroadcast}</size>", 5, Broadcast.BroadcastFlags.Normal);
BroadcastMain.SendGlobalcast(new BroadcastItem { priority = (byte)BroadcastPriority.Higher, time = 5, prefix = "<color=green>投票通过</color>", text = $"{votingEvent.AcceptBroadcast}" });
//PluginAPI.Core.Server.SendBroadcast($"<size=24><color=green>「投票通过」</color>{votingEvent.AcceptBroadcast}</size>", 5, Broadcast.BroadcastFlags.Normal);
}
else
{
PluginAPI.Core.Server.SendBroadcast($"<size=24><color=red>「投票失败」</color>没有足够玩家投票</size>", 5, Broadcast.BroadcastFlags.Normal, true);
BroadcastMain.SendGlobalcast(new BroadcastItem { priority = (byte)BroadcastPriority.Higher, time = 5, prefix = "<color=red>投票失败</color>", text = $"没有足够玩家投票" });
//PluginAPI.Core.Server.SendBroadcast($"<size=24><color=red>「投票失败」</color>没有足够玩家投票</size>", 5, Broadcast.BroadcastFlags.Normal, true);
}
Accepted = false;
AcceptPlayer = new ConcurrentBag<string>();
Expand Down

0 comments on commit bd6abd8

Please sign in to comment.