From 1ccf5b88c57cd9ccd61f6629403418f32d3dc495 Mon Sep 17 00:00:00 2001 From: MeowServer~ <157404441+MeowServer@users.noreply.github.com> Date: Thu, 13 Jun 2024 00:31:26 +0800 Subject: [PATCH] V3.3.0 Seperate PlayerUITemplate from PlayerUI --- Config/GeneralConfig.cs | 145 ------- Config/PlayerDisplayConfigs/HintConfigs.cs | 44 ++ .../PlayerDisplayConfig.cs | 0 Config/PlayerUIConfig.cs | 21 - Config/PlayerUITemplateConfigs.cs | 42 -- Config/PlayerUIToolConfig.cs | 25 -- Config/PluginConfig.cs | 31 +- PlayerUI/PlayerUI.cs | 146 +------ PlayerUI/UITemplates/AliveTemplates.cs | 375 ------------------ PlayerUI/UITemplates/Base.cs | 46 --- PlayerUI/UITemplates/CustomRoleTemplates.cs | 61 --- PlayerUI/UITemplates/OtherTemplates.cs | 261 ------------ PlayerUI/UITools.cs | 184 --------- Plugin.cs | 12 +- 14 files changed, 54 insertions(+), 1339 deletions(-) delete mode 100644 Config/GeneralConfig.cs create mode 100644 Config/PlayerDisplayConfigs/HintConfigs.cs rename Config/{ => PlayerDisplayConfigs}/PlayerDisplayConfig.cs (100%) delete mode 100644 Config/PlayerUIConfig.cs delete mode 100644 Config/PlayerUITemplateConfigs.cs delete mode 100644 Config/PlayerUIToolConfig.cs delete mode 100644 PlayerUI/UITemplates/AliveTemplates.cs delete mode 100644 PlayerUI/UITemplates/Base.cs delete mode 100644 PlayerUI/UITemplates/CustomRoleTemplates.cs delete mode 100644 PlayerUI/UITemplates/OtherTemplates.cs delete mode 100644 PlayerUI/UITools.cs diff --git a/Config/GeneralConfig.cs b/Config/GeneralConfig.cs deleted file mode 100644 index 73d8af6..0000000 --- a/Config/GeneralConfig.cs +++ /dev/null @@ -1,145 +0,0 @@ -using Exiled.API.Enums; -using PlayerRoles; -using Respawning; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.Config -{ - public class GeneralConfig - { - [Description("Translation of different role types")] - public Dictionary RoleName { get; private set; } = new Dictionary() - { - { RoleTypeId.None, "无角色"}, - { RoleTypeId.Scp173, "Scp173"}, - { RoleTypeId.ClassD, "D级人员"}, - { RoleTypeId.Spectator, "观察者"}, - { RoleTypeId.Scp106, "Scp106"}, - { RoleTypeId.NtfSpecialist, "九尾狐收容专家"}, - { RoleTypeId.Scp049, "Scp049"}, - { RoleTypeId.Scientist, "科学家"}, - { RoleTypeId.Scp079, "Scp079"}, - { RoleTypeId.ChaosConscript, "混沌征召兵"}, - { RoleTypeId.Scp096, "Scp096"}, - { RoleTypeId.Scp0492, "Scp049-2"}, - { RoleTypeId.NtfSergeant, "九尾狐中士"}, - { RoleTypeId.NtfCaptain, "九尾狐指挥官"}, - { RoleTypeId.NtfPrivate, "九尾狐列兵"}, - { RoleTypeId.Tutorial, "教程人员"}, - { RoleTypeId.FacilityGuard, "设施警卫"}, - { RoleTypeId.Scp939, "Scp939"}, - { RoleTypeId.CustomRole, "自定义角色"}, - { RoleTypeId.ChaosRifleman, "混沌步枪兵"}, - { RoleTypeId.ChaosMarauder, "混沌掠夺者"}, - { RoleTypeId.ChaosRepressor, "混沌压制者"}, - { RoleTypeId.Overwatch, "角色Overwatch"}, - { RoleTypeId.Filmmaker, "摄像机"}, - { RoleTypeId.Scp3114, "Scp3114"}, - }; - - [Description("Translation of different team types")] - public Dictionary TeamName { get; private set; } = new Dictionary() - { - { Team.ChaosInsurgency, "混沌分裂者" }, - { Team.ClassD, "D级人员" }, - { Team.Dead, "死后阵营" }, - { Team.FoundationForces, "基金会阵营" }, - { Team.OtherAlive, "其他阵营" }, - { Team.Scientists, "科学家" }, - { Team.SCPs, "SCP"}, - }; - - [Description("Translation of different item types")] - public Dictionary ItemName { get; private set; } = new Dictionary() - { - {ItemType.KeycardJanitor,"保洁员钥匙卡" }, - {ItemType.KeycardScientist,"科学家钥匙卡" }, - {ItemType.KeycardResearchCoordinator,"研究主管钥匙卡" }, - {ItemType.KeycardZoneManager,"区域主管钥匙卡" }, - {ItemType.KeycardGuard,"设施警卫钥匙卡"}, - {ItemType.KeycardMTFOperative,"九尾狐特工钥匙卡" }, - {ItemType.KeycardMTFCaptain,"九尾狐指挥官钥匙卡" }, - {ItemType.KeycardFacilityManager,"设施主管钥匙卡" }, - {ItemType.KeycardChaosInsurgency,"混沌破解装置" }, - {ItemType.KeycardO5,"O5钥匙卡" }, - {ItemType.Radio,"对讲机" }, - {ItemType.GunCOM15,"COM15" }, - {ItemType.Medkit,"急救包" }, - {ItemType.Flashlight,"手电筒" }, - {ItemType.MicroHID,"MicroHID" }, - {ItemType.SCP500,"SCP500" }, - {ItemType.SCP207,"SCP207" }, - {ItemType.Ammo12gauge,"12口径弹药" }, - {ItemType.GunE11SR,"E11SR" }, - {ItemType.GunCrossvec,"Crossvec" }, - {ItemType.Ammo556x45,"556x45弹药" }, - {ItemType.GunFSP9,"FSP9" }, - {ItemType.GunLogicer,"Logicer" }, - {ItemType.GrenadeHE,"高爆手雷" }, - {ItemType.GrenadeFlash,"闪光弹" }, - {ItemType.Ammo44cal,"44cal弹药" }, - {ItemType.Ammo762x39,"762x39弹药" }, - {ItemType.Ammo9x19,"9x19弹药" }, - {ItemType.GunCOM18,"COM18" }, - {ItemType.SCP018,"SCP018" }, - {ItemType.SCP268,"SCP268" }, - {ItemType.Adrenaline,"肾上腺素" }, - {ItemType.Painkillers,"止痛药" }, - {ItemType.Coin,"硬币" }, - {ItemType.ArmorLight,"轻型装甲" }, - {ItemType.ArmorCombat,"中型装甲" }, - {ItemType.ArmorHeavy,"重型装甲" }, - {ItemType.GunRevolver,"Revolver" }, - {ItemType.GunAK,"AK" }, - {ItemType.GunShotgun,"Shotgun" }, - {ItemType.SCP330,"SCP330" }, - {ItemType.SCP2176,"SCP2176" }, - {ItemType.SCP244a,"SCP244a" }, - {ItemType.SCP244b,"SCP244b" }, - {ItemType.AntiSCP207,"粉色SCP207" } - }; - - [Description("Translation of different zone names")] - public Dictionary ZoneName { get; private set; } = new Dictionary() - { - {ZoneType.LightContainment, "轻收容区" }, - {ZoneType.HeavyContainment, "重收容区" }, - {ZoneType.Entrance, "入口区" }, - {ZoneType.Surface, "地表区" }, - {ZoneType.Unspecified, "未指定区域" } - }; - - [Description("Translation of different AmmoName types")] - public Dictionary AmmoName { get; private set; } = new Dictionary() - { - {AmmoType.Ammo12Gauge,"12口径弹药" }, - {AmmoType.Nato556,"556x45弹药" }, - {AmmoType.Ammo44Cal,"44cal弹药" }, - {AmmoType.Nato762,"762x39弹药" }, - {AmmoType.Nato9,"9x19弹药" }, - {AmmoType.None,"无弹药" } - }; - - [Description("Translation of different respawnable role types")] - public Dictionary RespawnTeamDictionary { get; private set; } = new Dictionary - { - {SpawnableTeamType.NineTailedFox,"九尾狐" }, - {SpawnableTeamType.ChaosInsurgency,"混沌分裂者" }, - {SpawnableTeamType.None, "暂时未定" } - }; - - [Description("Translation of different warhead status")] - public Dictionary WarheadStatusDictionary { get; private set; } = new Dictionary - { - {WarheadStatus.Armed, "已就绪" }, - {WarheadStatus.NotArmed, "未就绪" }, - {WarheadStatus.Detonated, "已被引爆" }, - {WarheadStatus.InProgress, "正在倒计时" }, - }; - } -} diff --git a/Config/PlayerDisplayConfigs/HintConfigs.cs b/Config/PlayerDisplayConfigs/HintConfigs.cs new file mode 100644 index 0000000..345a02d --- /dev/null +++ b/Config/PlayerDisplayConfigs/HintConfigs.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HintServiceMeow.Config.PlayerDisplayConfigs +{ + public abstract class AbstractHintConfig + { + private HintAlignment alignment; + + private int fontSize; + + private string message; + + public AbstractHintConfig(string message, HintAlignment alignment, int fontSize) + { + this.message = message; + this.alignment = alignment; + this.fontSize = fontSize; + } + } + + public class HintConfig : AbstractHintConfig + { + public int yCoordinate; + + public HintConfig(int yCoordinate,string message, HintAlignment alignment, int fontSize) : base(message, alignment, fontSize) + { + this.yCoordinate = yCoordinate; + } + } + + public class DynamicHintConfig : AbstractHintConfig + { + public DynamicHintField hintField; + + public DynamicHintConfig(DynamicHintField hintField, string message, HintAlignment alignment, int fontSize, int topYCoordinate, int bottomYCoordinate) : base(message, alignment, fontSize) + { + this.hintField = hintField; + } + } +} diff --git a/Config/PlayerDisplayConfig.cs b/Config/PlayerDisplayConfigs/PlayerDisplayConfig.cs similarity index 100% rename from Config/PlayerDisplayConfig.cs rename to Config/PlayerDisplayConfigs/PlayerDisplayConfig.cs diff --git a/Config/PlayerUIConfig.cs b/Config/PlayerUIConfig.cs deleted file mode 100644 index 1cd6c92..0000000 --- a/Config/PlayerUIConfig.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.Config -{ - public class PlayerUIConfig - { - [Description("Enable or disable common hints. Changing this option might cause error if other plugins are using CommonHints")] - public bool EnableCommonHints { get; set; } = true; - - [Description("Enable or disable player effects. Changing this option might cause error if other plugins are using Effects")] - public bool EnableEffects { get; set; } = true; - - [Description("Enable or disable playerUITemplate")] - public bool EnableUITemplates { get; set; } = true; - } -} diff --git a/Config/PlayerUITemplateConfigs.cs b/Config/PlayerUITemplateConfigs.cs deleted file mode 100644 index 6743a80..0000000 --- a/Config/PlayerUITemplateConfigs.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.Config -{ - public class GeneralHumanTemplateConfig - { - public string TopBar { get; set; } = "TPS:{TPS} | {PlayerName}"; - public string BottomBar { get; set; } = "{PlayerNickname}|{Role}|{AmmoInfo}|{ArmorInfo}|Meow"; - } - - public class SCPTemplateConfig - { - public string TopBar { get; set; } = "TPS:{TPS} | {PlayerName}"; - public string BottomBar { get; set; } = "{PlayerNickname}|{Role}|剩余{TeammateCount}队友|Meow"; - } - - public class CustomHumanTemplateConfig - { - public string TopBar { get; set; } = "TPS:{TPS} | {PlayerName}"; - public string BottomBar { get; set; } = "{PlayerNickname}|{Role}|{AmmoInfo}|{ArmorInfo}|Meow"; - } - - public class CustomSCPTemplateConfig - { - public string TopBar { get; set; } = "TPS:{TPS} | {PlayerName}"; - public string BottomBar { get; set; } = "{PlayerNickname}|{Role}|剩余{TeammateCount}队友|{AmmoInfo}|{ArmorInfo}|Meow"; - } - - public class SpectatorTemplateConfig - { - [Description("RespawnTimer: Time interval between each hint")] - public int HintDisplayInterval { get; set; } = 10; - - [Description("RespawnTimer: A list of hints you want to display")] - public List Hints { get; private set; } = new List() { "Some hints", "Some other hints" }; - } -} diff --git a/Config/PlayerUIToolConfig.cs b/Config/PlayerUIToolConfig.cs deleted file mode 100644 index 323ac95..0000000 --- a/Config/PlayerUIToolConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.Config -{ - - public class PlayerUIToolsConfig - { - [Description("Message template when the player has no armor")] - public string NoArmor { get; set; } = "没有装甲"; - - [Description("Message template when the player has no ammo")] - public string NoAmmo { get; set; } = "没有备弹"; - - [Description("Message template when the player has 1 type of ammo")] - public string AmmoHint1 { get; set; } = "{Ammo}共{NumOfAmmo}发"; - - [Description("Message template when the player has multiple types of ammo")] - public string AmmoHint2 { get; set; } = "各种备弹共{NumOfAmmo}发"; - } -} diff --git a/Config/PluginConfig.cs b/Config/PluginConfig.cs index de79b71..ce9e480 100644 --- a/Config/PluginConfig.cs +++ b/Config/PluginConfig.cs @@ -1,6 +1,5 @@ using Exiled.API.Enums; using Exiled.API.Interfaces; -using HintServiceMeow.UITemplates; using PlayerRoles; using Respawning; @@ -12,40 +11,12 @@ namespace HintServiceMeow.Config { public class PluginConfig:IConfig { - public static PluginConfig instance; + internal static PluginConfig instance; public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = false; [Description("Configs for PlayerDisplay. Changing these configs might leads to errors")] public PlayerDisplayConfig PlayerDisplayConfig { get; set; } = new PlayerDisplayConfig(); - - - [Description("The config for general names")] - public GeneralConfig GeneralConfig { get; set; } = new GeneralConfig(); - - [Description("All of the following configs are used for PlayerUI")] - public bool EnablePlayerUI { get; set; } = true; - - [Description("The config for PlayerUI")] - public PlayerUIConfig PlayerUIConfig { get; set; } = new PlayerUIConfig(); - - [Description("The config for PlayerUITools, will affect multiple templates")] - public PlayerUIToolsConfig PlayerUIToolsConfig { get; private set; } = new PlayerUIToolsConfig(); - - [Description("The config for general human tempalte")] - public GeneralHumanTemplateConfig GeneralHumanTemplateConfig { get; private set; } = new GeneralHumanTemplateConfig(); - - [Description("The config for scp tempalte")] - public SCPTemplateConfig ScpTemplateConfig { get; private set; } = new SCPTemplateConfig(); - - [Description("The config for custom human tempalte")] - public CustomHumanTemplateConfig CustomHumanTemplate { get; private set; } = new CustomHumanTemplateConfig(); - - [Description("The config for custom scp tempalte")] - public CustomSCPTemplateConfig CustomSCPTemplate { get; private set; } = new CustomSCPTemplateConfig(); - - [Description("The config for spectator tempalte")] - public SpectatorTemplateConfig SpectatorTemplateConfig { get; private set; } = new SpectatorTemplateConfig(); } } diff --git a/PlayerUI/PlayerUI.cs b/PlayerUI/PlayerUI.cs index 7f6212d..e6f5c31 100644 --- a/PlayerUI/PlayerUI.cs +++ b/PlayerUI/PlayerUI.cs @@ -3,7 +3,6 @@ using PlayerRoles; using HintServiceMeow.Effect; -using HintServiceMeow.UITemplates; using System; using System.Collections.Generic; @@ -65,9 +64,6 @@ public class PlayerUI new DynamicHint(560, 700, HintAlignment.Center, "", "otherHint4", true), }; - //Template - private PlayerUITemplateBase template; - private CoroutineHandle templateUpdateCoroutine; //Private Effect Methods private IEnumerator effectCoroutineMethod() @@ -376,133 +372,6 @@ public void ShowOtherHint(string[] hints, int time) } } - //Private Template Methods - private void SetTemplate() - { - StopTemplateCoroutine(); - - template?.DestructTemplate(); - - if(PlayerUICommonTools.IsCustomRole(player)) - { - if(PlayerUICommonTools.IsSCP(player)) - { - template = new CustomSCPTemplate(player); - } - else - { - template = new CustomHumanTemplate(player); - } - } - else - { - if (player.IsAlive && player.IsHuman) - { - template = new GeneralHumanTemplate(player); - } - else if (player.IsAlive && player.IsScp) - { - template = new SCPTemplate(player); - } - else if (player.Role.Type == RoleTypeId.Spectator) - { - template = new SpectatorTemplate(player); - } - else - { - template = null; - } - } - - template?.SetUpTemplate(); - StartTemplateCoroutine(); - } - - private void DestructTemplate() - { - StopTemplateCoroutine(); - template?.DestructTemplate(); - } - - private bool CheckTemplate() - { - bool isCorrectType; - - if (PlayerUICommonTools.IsCustomRole(player)) - { - if (PlayerUICommonTools.IsSCP(player)) - { - isCorrectType = template?.type == PlayerUITemplateBase.PlayerUITemplateType.CustomSCP; - } - else - { - isCorrectType = template?.type == PlayerUITemplateBase.PlayerUITemplateType.CustomHuman; - } - } - else - { - if (player.IsAlive && player.IsHuman) - { - isCorrectType = template?.type == PlayerUITemplateBase.PlayerUITemplateType.GeneralHuman; - } - else if (player.IsAlive && player.IsScp) - { - isCorrectType = template?.type == PlayerUITemplateBase.PlayerUITemplateType.SCP; - } - else if (player.Role.Type == RoleTypeId.Spectator) - { - isCorrectType = template?.type == PlayerUITemplateBase.PlayerUITemplateType.Spectator; - } - else - { - isCorrectType = template == null; - } - } - - return isCorrectType; - } - - private IEnumerator TemplateUpdateCoroutineMethod() - { - while (true) - { - if (!player.IsConnected) - { - yield return Timing.WaitForSeconds(0.1f); - continue; - } - - try - { - if (!CheckTemplate()) - { - SetTemplate(); - } - - template?.UpdateTemplate(); - } - catch (Exception ex) - { - } - - yield return Timing.WaitForSeconds(0.1f); - } - } - - private void StartTemplateCoroutine() - { - if (templateUpdateCoroutine.IsRunning) - Timing.KillCoroutines(templateUpdateCoroutine); - - templateUpdateCoroutine = Timing.RunCoroutine(TemplateUpdateCoroutineMethod()); - } - - private void StopTemplateCoroutine() - { - if(templateUpdateCoroutine.IsRunning) - Timing.KillCoroutines(templateUpdateCoroutine); - } - //internal PlayerUI methods internal PlayerUI(Player player) { @@ -515,17 +384,9 @@ internal PlayerUI(Player player) this.player = player; this.playerDisplay = PlayerDisplay.Get(player); - //effect - if(PluginConfig.instance.PlayerUIConfig.EnableEffects) - SetUpEffect(); + SetUpEffect(); - //common hints - if (PluginConfig.instance.PlayerUIConfig.EnableCommonHints) - SetUpCommonHints(); - - //template - if (PluginConfig.instance.PlayerUIConfig.EnableUITemplates) - SetTemplate(); + SetUpCommonHints(); playerUIs.Add(this); } @@ -538,9 +399,6 @@ internal void Destruct() //Common Hints DestructCommonHints(); - //Template - DestructTemplate(); - playerUIs.Remove(this); } diff --git a/PlayerUI/UITemplates/AliveTemplates.cs b/PlayerUI/UITemplates/AliveTemplates.cs deleted file mode 100644 index 63ed803..0000000 --- a/PlayerUI/UITemplates/AliveTemplates.cs +++ /dev/null @@ -1,375 +0,0 @@ -using CustomPlayerEffects; -using Exiled.Events.EventArgs.Player; -using PlayerRoles.FirstPersonControl; -using PlayerRoles.PlayableScps; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using Exiled.API.Features.Roles; -using HintServiceMeow.Config; - -namespace HintServiceMeow.UITemplates -{ - internal abstract class AliveTemplate : PlayerUITemplateBase - { - //Top Bar - public Hint TopBar = new Hint(0, HintAlignment.Center, "", "TopBar1", true).setFontSize(15); - - //Bottom Bar - public Hint BottomBar = new Hint(710, HintAlignment.Center, "", "BottomBar1", true).setFontSize(20); - - private DynamicHint spectatorTip = new DynamicHint(100, 300, HintAlignment.Right, "", "SpectatorHints1", true).setFontSize(20); - private DynamicHint[] spectatorHints = new DynamicHint[4] - { - new DynamicHint(120, 320, HintAlignment.Right, "", "SpectatorHints1", true).setFontSize(20), - new DynamicHint(140, 340, HintAlignment.Right, "", "SpectatorHints2", true).setFontSize(20), - new DynamicHint(160, 360, HintAlignment.Right, "", "SpectatorHints3", true).setFontSize(20), - new DynamicHint(180, 380, HintAlignment.Right, "", "SpectatorHints4", true).setFontSize(20) - }; - - public AliveTemplate(Player player) : base(player) - { - } - - public override void UpdateTemplate() - { - UpdateTopBar(); - UpdateBottomBar(); - UpdateSpectatorHints(); - } - - public override void SetUpTemplate() - { - playerDisplay.AddHint(TopBar); - playerDisplay.AddHint(BottomBar); - - playerDisplay.AddHints(spectatorHints); - } - - public override void DestructTemplate() - { - playerDisplay.RemoveHint(TopBar); - playerDisplay.RemoveHint(BottomBar); - - playerDisplay.RemoveHints(spectatorHints); - } - - protected abstract void UpdateTopBar(); - - protected abstract void UpdateBottomBar(); - - protected virtual void UpdateSpectatorHints() - { - var spectatingPlayers = PlayerUICommonTools.GetSpectatorInfo(player); - - spectatorTip.hide = true; - spectatorHints.ForEach(x => x.hide = true); - - if(spectatingPlayers.Count > 0) - { - spectatorTip.message = "👥观察者"; - spectatorTip.hide = false; - } - - for (int i = 0; i < spectatingPlayers.Count && i < spectatorHints.Count(); i++) - { - spectatorHints[i].message = $"-{spectatingPlayers[i].Nickname}"; - spectatorHints[i].hide = false; - } - - if(spectatingPlayers.Count > spectatorHints.Count()) - { - spectatorHints[spectatorHints.Count() - 1].message = $"共{spectatingPlayers.Count}个观察者正在观察您"; - } - - } - } - internal class GeneralHumanTemplate : AliveTemplate - { - public override PlayerUITemplateType type { get; } = PlayerUITemplateType.GeneralHuman; - - public GeneralHumanTemplate(Player player) : base(player) - { - - } - - protected override void UpdateTopBar() - { - string template = PluginConfig.instance.GeneralHumanTemplateConfig.TopBar; - - TopBar.message = PlayerUICommonTools.GetContent(template, player); - TopBar.hide = false; - } - - protected override void UpdateBottomBar() - { - string template = PluginConfig.instance.GeneralHumanTemplateConfig.BottomBar; - - BottomBar.message = PlayerUICommonTools.GetContent(template, player); - BottomBar.hide = false; - } - } - - internal class SCPTemplate : AliveTemplate - { - public override PlayerUITemplateType type { get; } = PlayerUITemplateType.SCP; - - protected List SCPInformations = new List(); - - //SCP Info Slots - protected Hint[] infoSlots = new Hint[4] - { - new Hint(30, HintAlignment.Right, "", "infoSlot1", true).setFontSize(20), - new Hint(50, HintAlignment.Right, "", "infoSlot2", true).setFontSize(20), - new Hint(70, HintAlignment.Right, "", "infoSlot3", true).setFontSize(20), - new Hint(90, HintAlignment.Right, "", "infoSlot4", true).setFontSize(20) - }; - - public SCPTemplate(Player player) : base(player) - { - } - - protected override void UpdateTopBar() - { - string template = PluginConfig.instance.ScpTemplateConfig.TopBar; - - TopBar.message = PlayerUICommonTools.GetContent(template, player); - TopBar.hide = false; - } - - protected override void UpdateBottomBar() - { - string template = PluginConfig.instance.ScpTemplateConfig.BottomBar; - - BottomBar.message = PlayerUICommonTools.GetContent(template, player); - BottomBar.hide = false; - } - - public override void SetUpTemplate() - { - foreach (var slot in infoSlots) - { - playerDisplay.AddHint(slot); - } - - BindEvents(); - - base.SetUpTemplate(); - } - - public override void DestructTemplate() - { - foreach (var slot in infoSlots) - { - playerDisplay.RemoveHint(slot); - } - - UnbindEvents(); - - SCPInformations.Clear(); - - base.DestructTemplate(); - } - - public override void UpdateTemplate() - { - CheckVisionInfo(); - - SCPInformations.RemoveAll(x => Round.ElapsedTime - x.timeAdded > TimeSpan.FromSeconds(10)); - - infoSlots[0].message = SCPInformations.Count > 0 ? SCPInformations[0]?.info : string.Empty; - infoSlots[1].message = SCPInformations.Count > 1 ? SCPInformations[1]?.info : string.Empty; - infoSlots[2].message = SCPInformations.Count > 2 ? SCPInformations[2]?.info : string.Empty; - infoSlots[3].message = SCPInformations.Count > 3 ? SCPInformations[3]?.info : string.Empty; - - foreach (var slot in infoSlots) - { - slot.hide = string.IsNullOrEmpty(slot.message); - } - - base.UpdateTemplate(); - } - - protected void BindEvents() - { - Exiled.Events.Handlers.Player.Hurt += OnHurting; - Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; - } - - protected void UnbindEvents() - { - Exiled.Events.Handlers.Player.Hurt -= OnHurting; - Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; - } - - protected Dictionary lastTimeHurtInformed = new Dictionary(); - protected void OnHurting(HurtEventArgs ev) - { - try - { - if (PlayerUICommonTools.IsSCP(ev.Player) && ev.Player.Role.Type != RoleTypeId.Scp0492 && ev.Player.Health <= ev.Player.MaxHealth * 0.2) - { - if (lastTimeHurtInformed.ContainsKey(ev.Player)) - { - if (Round.ElapsedTime - lastTimeHurtInformed[ev.Player] > TimeSpan.FromSeconds(40)) - { - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SCPLowHP, $"{PluginConfig.instance.GeneralConfig.RoleName[ev.Player.Role.Type]}的血量较低|血量:{(int)ev.Player.Health}", Round.ElapsedTime)); - lastTimeHurtInformed[ev.Player] = Round.ElapsedTime; - } - } - else - { - lastTimeHurtInformed.Add(ev.Player, Round.ElapsedTime); - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SCPLowHP, $"{PluginConfig.instance.GeneralConfig.RoleName[ev.Player.Role.Type]}的血量较低|血量:{(int)ev.Player.Health}", Round.ElapsedTime)); - } - } - } - catch(Exception ex) - { - - } - } - - protected void OnChangingRole(ChangingRoleEventArgs ev) - { - try - { - if (PlayerUICommonTools.IsSCP(ev.Player) && ev.Player.Role.Type != RoleTypeId.Scp0492 && ev.NewRole == RoleTypeId.Spectator) - { - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SCPDeath, $"{PluginConfig.instance.GeneralConfig.RoleName[ev.Player.Role.Type]}已死亡", Round.ElapsedTime)); - } - }catch(Exception ex) - { - - } - } - - protected Dictionary lastTimeSpotted = new Dictionary(); - protected void CheckVisionInfo() - { - try - { - if (Player.List.Count(x => x.IsHuman) <= 4) - { - foreach (Player player in Player.List) - { - if (!PlayerUICommonTools.IsSCP(player)) - continue; - - foreach (Player target in Player.List) - { - if (!target.IsHuman || target.Role.Team == Team.OtherAlive) - continue; - - if (!CanSee(player, target)) - continue; - - if (lastTimeSpotted.ContainsKey(player)) - { - if (Round.ElapsedTime - lastTimeSpotted[player] > TimeSpan.FromSeconds(40)) - { - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SpotHuman, $"{PluginConfig.instance.GeneralConfig.RoleName[player.Role.Type]}在{PluginConfig.instance.GeneralConfig.ZoneName[player.Zone]}找到了一个人类", Round.ElapsedTime)); - lastTimeSpotted[player] = Round.ElapsedTime; - } - } - else - { - lastTimeSpotted.Add(player, Round.ElapsedTime); - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SCPDeath, $"{PluginConfig.instance.GeneralConfig.RoleName[player.Role.Type]}在{PluginConfig.instance.GeneralConfig.ZoneName[player.Zone]}找到了一个人类", Round.ElapsedTime)); - } - } - } - } - else - { - foreach (Player player in Player.List) - { - if (!PlayerUICommonTools.IsSCP(player)) - continue; - - List targets = new List(); - - foreach (Player target in Player.List) - { - if (!target.IsHuman || target.Role.Team == Team.OtherAlive) - continue; - - if (!CanSee(player, target)) - continue; - - if (lastTimeSpotted.ContainsKey(target)) - { - if (Round.ElapsedTime - lastTimeSpotted[target] > TimeSpan.FromSeconds(40)) - { - targets.Add(target); - } - } - else - { - targets.Add(target); - } - } - - if (targets.Count >= 4) - { - SCPInformations.Insert(0, new SCPEventHint(SCPEventHint.SCPEventType.SpotHuman2, $"⚪{PluginConfig.instance.GeneralConfig.RoleName[player.Role.Type]}在{player.Zone}找到了大量人类", Round.ElapsedTime)); - foreach (Player target in targets) - { - if (lastTimeSpotted.ContainsKey(target)) - { - lastTimeSpotted[target] = Round.ElapsedTime; - } - else - { - lastTimeSpotted.Add(target, Round.ElapsedTime); - } - } - } - } - } - } - catch (Exception e) - { - - } - } - - protected bool CanSee(Player player, Player target) - { - if (!target.ReferenceHub.playerEffectsController.GetEffect().IsEnabled) - { - IFpcRole fpcRole = target.ReferenceHub.roleManager.CurrentRole as IFpcRole; - if (fpcRole != null && VisionInformation.GetVisionInformation(player.ReferenceHub, player.CameraTransform, fpcRole.FpcModule.Position, fpcRole.FpcModule.CharacterControllerSettings.Radius, default, true, true, 0, false).IsLooking) - { - return true; - } - } - return false; - } - - public class SCPEventHint - { - public enum SCPEventType - { - SCPDeath, - SCPLowHP, - SpotHuman,//sport human when there's <4 humans - SpotHuman2//Spot >7 humans - } - SCPEventType sCPEventType; - public string info; - public TimeSpan timeAdded; - - public SCPEventHint(SCPEventType type, string info, TimeSpan timeAdded) - { - this.sCPEventType = type; - this.info = info; - this.timeAdded = timeAdded; - } - } - } -} diff --git a/PlayerUI/UITemplates/Base.cs b/PlayerUI/UITemplates/Base.cs deleted file mode 100644 index 48d0cb0..0000000 --- a/PlayerUI/UITemplates/Base.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.UITemplates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.UITemplates -{ - internal interface IPlayerUITemplate - { - void UpdateTemplate(); - void SetUpTemplate(); - void DestructTemplate(); - } - - internal abstract class PlayerUITemplateBase: IPlayerUITemplate - { - public enum PlayerUITemplateType - { - GeneralHuman, - Spectator, - SCP, - CustomSCP, - CustomHuman - } - public abstract PlayerUITemplateType type { get; } - - public Player player; - public PlayerDisplay playerDisplay; - - public PlayerUITemplateBase(Player player) - { - this.player = player; - this.playerDisplay = PlayerDisplay.Get(player); - } - - public abstract void UpdateTemplate(); - - public abstract void SetUpTemplate(); - - public abstract void DestructTemplate(); - } - -} diff --git a/PlayerUI/UITemplates/CustomRoleTemplates.cs b/PlayerUI/UITemplates/CustomRoleTemplates.cs deleted file mode 100644 index 1fc9b89..0000000 --- a/PlayerUI/UITemplates/CustomRoleTemplates.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.CustomRoles.API.Features; -using HintServiceMeow.Config; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow.UITemplates -{ - internal class CustomSCPTemplate : SCPTemplate - { - public override PlayerUITemplateType type { get; } = PlayerUITemplateType.CustomSCP; - - public CustomSCPTemplate(Player player) : base(player) - { - } - - protected override void UpdateTopBar() - { - string template = PluginConfig.instance.CustomSCPTemplate.TopBar; - - TopBar.message = PlayerUICommonTools.GetContent(template, player); - TopBar.hide = false; - } - - protected override void UpdateBottomBar() - { - string template = PluginConfig.instance.CustomSCPTemplate.BottomBar; - - BottomBar.message = PlayerUICommonTools.GetContent(template, player); - BottomBar.hide = false; - } - } - - internal class CustomHumanTemplate : GeneralHumanTemplate - { - public override PlayerUITemplateType type { get; } = PlayerUITemplateType.CustomHuman; - - public CustomHumanTemplate(Player player) : base(player) - { - } - - protected override void UpdateTopBar() - { - string template = PluginConfig.instance.CustomHumanTemplate.TopBar; - - TopBar.message = PlayerUICommonTools.GetContent(template, player); - TopBar.hide = false; - } - - protected override void UpdateBottomBar() - { - string template = PluginConfig.instance.CustomHumanTemplate.BottomBar; - - BottomBar.message = PlayerUICommonTools.GetContent(template, player); - BottomBar.hide = false; - } - } -} diff --git a/PlayerUI/UITemplates/OtherTemplates.cs b/PlayerUI/UITemplates/OtherTemplates.cs deleted file mode 100644 index 88307ff..0000000 --- a/PlayerUI/UITemplates/OtherTemplates.cs +++ /dev/null @@ -1,261 +0,0 @@ -using PlayerRoles.PlayableScps.Scp079; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; - -namespace HintServiceMeow.UITemplates -{ - internal class SpectatorTemplate : PlayerUITemplateBase - { - public override PlayerUITemplateType type { get; } = PlayerUITemplateType.Spectator; - - private Hint topInformation = new Hint(0, HintAlignment.Center, "", null, false).setFontSize(10); - - private Hint respawnTimer = new Hint(420, HintAlignment.Center, "", null, false).setFontSize(25); - - private Hint warheadStatus = new Hint(450, HintAlignment.Left, "", null, false); - private Hint generatorsStatus = new Hint(470, HintAlignment.Left, "", null, false); - - private Hint spectatorsInformation = new Hint(490, HintAlignment.Right, "", null, false); - - private Hint NTFTicketInformation = new Hint(510, HintAlignment.Right, "", null, false); - private Hint CITicketInformation = new Hint(530, HintAlignment.Right, "", null, false); - - private Hint hint = new Hint(550, HintAlignment.Center, "", null, false); - - - public SpectatorTemplate(Player player) : base(player) - { - - } - - public override void DestructTemplate() - { - playerDisplay.RemoveHint(topInformation); - - playerDisplay.RemoveHint(respawnTimer); - - playerDisplay.RemoveHint(warheadStatus); - playerDisplay.RemoveHint(generatorsStatus); - - playerDisplay.RemoveHint(spectatorsInformation); - - playerDisplay.RemoveHint(NTFTicketInformation); - playerDisplay.RemoveHint(CITicketInformation); - - playerDisplay.RemoveHint(hint); - } - - public override void SetUpTemplate() - { - playerDisplay.AddHint(topInformation); - - playerDisplay.AddHint(respawnTimer); - - playerDisplay.AddHint(warheadStatus); - playerDisplay.AddHint(generatorsStatus); - - playerDisplay.AddHint(spectatorsInformation); - - playerDisplay.AddHint(NTFTicketInformation); - playerDisplay.AddHint(CITicketInformation); - - playerDisplay.AddHint(hint); - } - - public override void UpdateTemplate() - { - topInformation.message = SpectatorUITools.GetTopInformation(); - - respawnTimer.message = SpectatorUITools.GetRespawnTimer(); - - warheadStatus.message = SpectatorUITools.GetWarheadStatus(); - generatorsStatus.message = SpectatorUITools.GetGeneratorsStatus(); - - spectatorsInformation.message = SpectatorUITools.GetSpectatorsInformation(); - - NTFTicketInformation.message = SpectatorUITools.GetNTFTicketInformation(); - CITicketInformation.message = SpectatorUITools.GetCITicketInformation(); - - hint.message = SpectatorUITools.GetHint(); - } - - public static class SpectatorUITools - { - public static string GetTopInformation() - { - //Round time: {round_minutes}:{round_seconds} | TPS: {tps}/{tickrate} - string template = "游戏已进行{RoundMinutes} : {RoundSecond} | TPS: {TPS}/{tickrate} "; - string message = String.Empty; - - message = template - .Replace("{RoundMinutes}", Round.ElapsedTime.ToString("mm"))//Time - .Replace("{RoundSecond}", Round.ElapsedTime.ToString("ss"))//Time - .Replace("{TPS}", Server.Tps.ToString())//TPS - .Replace("{tickrate}", "60");//Default TPS: 60 - - return message; - - } - - public static string GetRespawnTimer() - { - string message = String.Empty; - - if (Respawn.IsSpawning) - { - string template = "您会在{RespawnMinute} : {RespawnSecond}后部署为:{RespawnTeam}"; - - message = template - .Replace("{RespawnMinute}", Respawn.TimeUntilSpawnWave.ToString("mm"))//Respawn Time - .Replace("{RespawnSecond}", Respawn.TimeUntilSpawnWave.ToString("ss"))//Respawn Time - .Replace("{RespawnTeam}", Config.PluginConfig.instance.GeneralConfig.RespawnTeamDictionary[Respawn.NextKnownTeam]);//Team - } - else - { - string template = "您会在{RespawnMinute} : {RespawnSecond}后重新部署"; - - message = template - .Replace("{RespawnMinute}", Respawn.TimeUntilSpawnWave.ToString("mm"))//Respawn Time - .Replace("{RespawnSecond}", Respawn.TimeUntilSpawnWave.ToString("ss"));//Respawn Time - } - return message; - } - - public static string GetWarheadStatus() - { - //Warhead Status: {warhead_status} - string template = "Alpha核弹状态: {WarheadStatus} {TimeRemaining}"; - string message = String.Empty; - - - if (Warhead.Status == Exiled.API.Enums.WarheadStatus.InProgress) - { - message = template - .Replace("{WarheadStatus}", Config.PluginConfig.instance.GeneralConfig.WarheadStatusDictionary[Warhead.Status]) - .Replace("{TimeRemaining}", "" + ((int)Warhead.DetonationTimer).ToString() + "秒" + ""); - } - else - { - message = template - .Replace("{WarheadStatus}", Config.PluginConfig.instance.GeneralConfig.WarheadStatusDictionary[Warhead.Status]) - .Replace("{TimeRemaining}", String.Empty); - } - - return message; - - } - - public static string GetGeneratorsStatus() - { - //Generators: {generator_engaged}/{generator_count} - - string templateWhenNotFullyActivated = "{EngagedGeneratorNum}个发电机被激活 共有{TotalGeneratorNum}个发电机"; - string templateWhenFullyActivated = "所有发电机已被激活"; - string message = String.Empty; - - var activatedGeneratorNum = Scp079Recontainer.AllGenerators.Count(x => x.Engaged); - var totalGeneratorNum = Scp079Recontainer.AllGenerators.Count(); - - if (activatedGeneratorNum < totalGeneratorNum) - { - message = templateWhenNotFullyActivated - .Replace("{EngagedGeneratorNum}", activatedGeneratorNum.ToString()) - .Replace("{TotalGeneratorNum}", totalGeneratorNum.ToString()); - } - else if (activatedGeneratorNum >= totalGeneratorNum) - { - message = templateWhenFullyActivated; - } - - return message; - } - - public static string GetSpectatorsInformation() - { - //Spectators: {spectators_num} - - string template = "观察者数量:{spectators_num}"; - string message = String.Empty; - - if (Player.Get(RoleTypeId.Spectator).Count() < 10) - { - message = template.Replace("{spectators_num}", "0" + Player.Get(RoleTypeId.Spectator).Count().ToString()); - } - else - { - message = template.Replace("{spectators_num}", Player.Get(RoleTypeId.Spectator).Count().ToString()); - } - - return message; - } - - public static string GetNTFTicketInformation() - { - //NTF Spawn Chance: {ntf_spawn_chance}% - - string template = "九尾狐部署票数:{NTFTicketNum}"; - string message = String.Empty; - - if ((int)Respawn.NtfTickets < 10) - { - message = template.Replace("{NTFTicketNum}", ("0" + (int)Respawn.NtfTickets).ToString()); - } - else - { - message = template.Replace("{NTFTicketNum}", ((int)Respawn.NtfTickets).ToString()); - } - - return message; - } - - public static string GetCITicketInformation() - { - //CI Spawn Chance: {ci_spawn_chance}% - - string template = "混沌分裂者部署票数:{CITicketNum}"; - string message = String.Empty; - - if ((int)Respawn.ChaosTickets < 10) - { - message = template.Replace("{CITicketNum}", ("0" + (int)Respawn.ChaosTickets).ToString()); - } - else - { - message = template.Replace("{CITicketNum}", ((int)Respawn.ChaosTickets).ToString()); - } - - - return message; - } - - private static int hintIndex = 0; - private static TimeSpan lastTimeRefresh = TimeSpan.Zero; - private static TimeSpan timeToRefresh = TimeSpan.FromSeconds(Config.PluginConfig.instance.SpectatorTemplateConfig.HintDisplayInterval); - public static string GetHint() - { - var TimeInterval = Round.ElapsedTime - lastTimeRefresh; - if (TimeInterval > timeToRefresh) - { - //If need refresh - lastTimeRefresh = Round.ElapsedTime; - - if (hintIndex == Config.PluginConfig.instance.SpectatorTemplateConfig.Hints.Count() - 1) - { - hintIndex = 0; - } - else - { - hintIndex++; - } - } - - return Config.PluginConfig.instance.SpectatorTemplateConfig.Hints[hintIndex]; - } - } - } -} diff --git a/PlayerUI/UITools.cs b/PlayerUI/UITools.cs deleted file mode 100644 index e7deda1..0000000 --- a/PlayerUI/UITools.cs +++ /dev/null @@ -1,184 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Roles; -using Exiled.CustomRoles.API.Features; -using HintServiceMeow.Config; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HintServiceMeow -{ - public static class PlayerUICommonTools - { - /// - /// This code return a value that indicate whether a player is a scp, this include custom roles that include "SCP" in their name - /// - /// - /// - public static bool IsSCP(Player player) - { - foreach (CustomRole customRole in CustomRole.Registered) - { - if (customRole.Check(player) && customRole.Name.ToLower().Contains("scp"))//wtf am I doing.... - { - return true; - } - } - - return player.Role.Team == Team.SCPs; - } - - public static bool IsCustomRole(Player player) - { - if (CustomRole.Registered.Any(x => x.Check(player))) - { - return true; - } - - return false; - } - - public static CustomRole GetCustomRole(Player player) - { - foreach (CustomRole customRole in CustomRole.Registered) - { - if (customRole.Check(player)) - { - return customRole; - } - } - - return null; - } - - public static string GetArmorInfo(Player player) - { - if (player.CurrentArmor != null) - { - return PluginConfig.instance.GeneralConfig.ItemName[player.CurrentArmor.Type]; - } - - return PluginConfig.instance.PlayerUIToolsConfig.NoArmor; - } - - public static string GetAmmoInfo(Player player) - { - Dictionary ammos = - player.Ammo - .Where(x => x.Key != ItemType.None && x.Value > 0) - .ToDictionary(x => x.Key, x => x.Value); - - string ammoStatus; - - if (player.CurrentItem is Firearm firearm) - { - AmmoType ammoType = firearm.AmmoType; - ItemType itemType = ammoType.GetItemType(); - - if (!ammos.ContainsKey(itemType) || ammos[itemType] == 0) - { - ammoStatus = PluginConfig.instance.PlayerUIToolsConfig.NoAmmo; - } - else - { - ammoStatus = PluginConfig.instance.PlayerUIToolsConfig.AmmoHint1 - .Replace("{Ammo}", PluginConfig.instance.GeneralConfig.AmmoName[ammoType]) - .Replace("{NumOfAmmo}", ammos[itemType].ToString()); - } - } - else - { - var numOfAmmoTypes = ammos.Keys.Count; - - if (numOfAmmoTypes <= 0) - { - ammoStatus = PluginConfig.instance.PlayerUIToolsConfig.NoAmmo; - } - else if (numOfAmmoTypes <= 1) - { - ammoStatus = PluginConfig.instance.PlayerUIToolsConfig.AmmoHint1 - .Replace("{Ammo}", PluginConfig.instance.GeneralConfig.ItemName[ammos.First().Key]) - .Replace("{NumOfAmmo}", ammos.First().Value.ToString()); - } - else - { - var totalAmmos = 0; - - foreach (var numOfAmmo in ammos.Values) - { - totalAmmos += numOfAmmo; - } - - ammoStatus = PluginConfig.instance.PlayerUIToolsConfig.AmmoHint2 - .Replace("{NumOfAmmo}", totalAmmos.ToString()); - } - } - - return ammoStatus; - } - - public static string GetContent(String template, Player player) //replace the template with the actual content - { - //player nickname, actual name, role, rolecolor, ammo, armor, team, - //TPS, - PluginConfig config = PluginConfig.instance; - - template = template - //Player Name - .Replace("{PlayerNickname}", player.CustomName) - .Replace("{PlayerName}", player.Nickname) - //Roles - .Replace("{Role}", GetCustomRole(player)?.Name ?? config.GeneralConfig.RoleName[player.Role.Type]) - .Replace("{RoleColor}", player.Role.Color.ToHex()) - .Replace("{Team}", config.GeneralConfig.TeamName[player.Role.Team]) - .Replace("{TeammateCount}", (Player.List.Count(x => player.LeadingTeam == x.LeadingTeam) - 1).ToString()) - //Ammo/Armor info - .Replace("{AmmoInfo}", GetAmmoInfo(player)) - .Replace("{ArmorInfo}", GetArmorInfo(player)) - //Server info - .Replace("{TPS}", Server.Tps.ToString()); - - return template; - } - - public static List GetSpectatorInfo(Player player)//get a list of all the spectators watching this player - { - List spectatingPlayers = new List(); - - if (player == null) - return spectatingPlayers; - - foreach (Player item in Player.List) - { - if(item == null || item.Role == null) - continue; - - if (item.Role.Type != RoleTypeId.Spectator) - continue; - - try - { - SpectatorRole spectator = player.Role.As(); - - if (spectator != null && spectator.SpectatedPlayer == player) - { - spectatingPlayers.Add(player); - } - } - catch (Exception) - { - continue; - } - - } - - return spectatingPlayers; - } - } -} diff --git a/Plugin.cs b/Plugin.cs index 629130e..637dd4d 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -37,15 +37,18 @@ // * Use patch to block all the hints from other plugins // * V3.2.0 // * Organized config -// * Make PlayerUI more customizable +// * Make PlayerUI more customizable +// * V3.3.0 +// * Seperate PlayerUITemplate from PlayerUI +// * PlayerUITemplate is now a new plugin called CustomizableUIMeow namespace HintServiceMeow { - class Plugin : Plugin + public class Plugin : Plugin { public override string Name => "HintServiceMeow"; public override string Author => "MeowServerOwner"; - public override Version Version => new Version(3, 2, 0); + public override Version Version => new Version(3, 3, 0); public override PluginPriority Priority => PluginPriority.First; @@ -89,8 +92,7 @@ private static void OnVerified(VerifiedEventArgs ev) if (ev.Player.IsNPC) return; var pd = new PlayerDisplay(ev.Player); - if(PluginConfig.instance.EnablePlayerUI) - new PlayerUI(ev.Player); + new PlayerUI(ev.Player); EventHandler.InvokeNewPlayerEvent(pd); }