From ec92dcab22a929c7e8e97626570355e81f024691 Mon Sep 17 00:00:00 2001
From: 3cxc <81449257+3cxc@users.noreply.github.com>
Date: Fri, 13 Feb 2026 01:13:10 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20914=E5=92=8C=E7=94=B5=E6=A2=AF=E4=BD=BF?=
=?UTF-8?q?=E7=94=A8=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Configs/HUDInfoConfig.cs | 31 ++++++++++++++
Configs/TranslateConfig.cs | 17 ++++++++
DataBase/Serialization/HintData.cs | 15 +++++++
DataBase/Serialization/PlayerHint.cs | 64 ++++++++++++++++++++++++++++
EasyTools.csproj | 3 ++
Events/CustomEventHandler.cs | 50 ++++++++++++++++++++++
Plugins.cs | 19 +++++++++
7 files changed, 199 insertions(+)
create mode 100644 Configs/HUDInfoConfig.cs
create mode 100644 DataBase/Serialization/HintData.cs
create mode 100644 DataBase/Serialization/PlayerHint.cs
diff --git a/Configs/HUDInfoConfig.cs b/Configs/HUDInfoConfig.cs
new file mode 100644
index 0000000..4e29d95
--- /dev/null
+++ b/Configs/HUDInfoConfig.cs
@@ -0,0 +1,31 @@
+using System.ComponentModel;
+
+namespace EasyTools.Configs
+{
+ public class HUDInfoConfig
+ {
+ [Description("是否显示SCP914提示信息")]
+ public bool info_914 { get; set; } = true;
+ [Description("是否显示电梯提示信息")]
+ public bool info_elevator { get; set; } = true;
+
+ /// /////////////////////////////////////////////////
+ [Description("914显示,X轴坐标(0为正中,-为左,+为右):")]
+ public float _914_x { get; set; } = 0;
+ [Description("914显示,Y轴坐标(屏幕最上端大概100,最下端大概1000):")]
+ public float _914_y { get; set; } = 80;
+ [Description("914显示,字体大小:")]
+ public int _914_font { get; set; } = 20;
+
+ /// /////////////////////////////////////////////////
+ [Description("电梯显示,X轴坐标(0为正中,-为左,+为右):")]
+ public float _elev_x { get; set; } = 0;
+ [Description("电梯显示,Y轴坐标(屏幕最上端大概100,最下端大概1000):")]
+ public float _elev_y { get; set; } = 800;
+ [Description("电梯显示,字体大小:")]
+ public int _elev_font { get; set; } = 20;
+
+ [Description("电梯提示显示可见范围(操作者为中心):")]
+ public float elev_range { get; set; } = 10f;
+ }
+}
diff --git a/Configs/TranslateConfig.cs b/Configs/TranslateConfig.cs
index 2347c53..0f38434 100644
--- a/Configs/TranslateConfig.cs
+++ b/Configs/TranslateConfig.cs
@@ -1,5 +1,6 @@
using EasyTools.Utils;
using PlayerRoles;
+using Scp914;
using System.Collections.Generic;
using System.ComponentModel;
@@ -73,5 +74,21 @@ namespace EasyTools.Configs
{Team.ChaosInsurgency , "混沌阵营" },
{Team.FoundationForces , "九尾狐阵营" },
};
+ ///
+ ///
+ ///
+ [Description("电梯显示模板(HEX color写死, {p_operator}表示操作人, 没有的话自动为未知):")]
+ public string elev_template { get; set; } = "[Elevator] 电梯使用者: {p_operator}";
+ [Description("SCP914显示模板(HEX color写死, {mode}表示操作模式, {p_operator}表示操作人, 没有的话自动为未知):")]
+ public string scp914_template { get; set; } = "[Scp914] 已启动! 模式: {mode}, 操作人: {p_operator}";
+ [Description("SCP914, Rough模式翻译:")]
+ public Dictionary scp914_trans { get; set; } = new Dictionary()
+ {
+ { Scp914KnobSetting.Rough, "粗加" },
+ { Scp914KnobSetting.Coarse, "半粗" },
+ { Scp914KnobSetting.OneToOne, "1:1" },
+ { Scp914KnobSetting.Fine, "精加" },
+ { Scp914KnobSetting.VeryFine, "超精加工" }
+ };
}
}
diff --git a/DataBase/Serialization/HintData.cs b/DataBase/Serialization/HintData.cs
new file mode 100644
index 0000000..becfc59
--- /dev/null
+++ b/DataBase/Serialization/HintData.cs
@@ -0,0 +1,15 @@
+namespace EasyTools.DataBase.Serialization
+{
+ public struct HintData
+ {
+ public float x, y;
+ public int font;
+
+ public HintData(float x, float y, int font)
+ {
+ this.x = x;
+ this.y = y;
+ this.font = font;
+ }
+ }
+}
diff --git a/DataBase/Serialization/PlayerHint.cs b/DataBase/Serialization/PlayerHint.cs
new file mode 100644
index 0000000..f3f9f0d
--- /dev/null
+++ b/DataBase/Serialization/PlayerHint.cs
@@ -0,0 +1,64 @@
+using HintServiceMeow.Core.Enum;
+using HintServiceMeow.Core.Extension;
+using HintServiceMeow.Core.Models.Hints;
+using HintServiceMeow.Core.Utilities;
+using LabApi.Features.Wrappers;
+using System.Collections.Generic;
+using System;
+
+namespace EasyTools.DataBase.Serialization
+{
+ public struct PlayerHint : IDisposable
+ {
+ private readonly List _hints = new();
+
+ private Hint hint_914;
+ private Hint hint_elevator;
+
+ public PlayerHint(Player player, HintData data_914, HintData data_elevator)
+ {
+ hint_914 = new Hint
+ {
+ Text = "",
+ XCoordinate = data_914.x,
+ YCoordinate = data_914.y,
+ FontSize = data_914.font,
+ YCoordinateAlign = HintVerticalAlign.Bottom
+ };
+
+ hint_elevator = new Hint
+ {
+ Text = "",
+ XCoordinate = data_elevator.x,
+ YCoordinate = data_elevator.y,
+ FontSize = data_elevator.font,
+ YCoordinateAlign = HintVerticalAlign.Bottom
+ };
+
+ var display = PlayerDisplay.Get(player);
+ _hints.AddRange(new[] { hint_914, hint_elevator });
+ _hints.ForEach(display.AddHint);
+ }
+
+ public void Show914(string text)
+ {
+ hint_914.Text = text;
+ hint_914.Hide = false;
+ hint_914.HideAfter(15f);
+ }
+
+ public void ShowElevator(string text)
+ {
+ hint_elevator.Text = text;
+ hint_elevator.Hide = false;
+ hint_elevator.HideAfter(7f);
+ }
+
+ public void Start() { }
+
+ public void Dispose()
+ {
+ foreach (var h in _hints) h.Hide = true;
+ }
+ }
+}
diff --git a/EasyTools.csproj b/EasyTools.csproj
index 98d5a3b..de27bde 100644
--- a/EasyTools.csproj
+++ b/EasyTools.csproj
@@ -130,10 +130,13 @@
+
+
+
diff --git a/Events/CustomEventHandler.cs b/Events/CustomEventHandler.cs
index bdb6e42..4ccafe5 100644
--- a/Events/CustomEventHandler.cs
+++ b/Events/CustomEventHandler.cs
@@ -1,11 +1,15 @@
using EasyTools.BadgeSystem;
using EasyTools.Configs;
+using EasyTools.DataBase.Serialization;
using EasyTools.Utils;
+using Hints;
using InventorySystem.Items;
using LabApi.Events.Arguments.PlayerEvents;
+using LabApi.Events.Arguments.Scp914Events;
using LabApi.Events.Arguments.ServerEvents;
using LabApi.Events.CustomHandlers;
using LabApi.Features.Wrappers;
+using MapGeneration;
using MEC;
using PlayerRoles;
using PlayerStatsSystem;
@@ -30,8 +34,14 @@ namespace EasyTools.Events
public static DataBaseConfig DataBaseConfig;
+ public static HUDInfoConfig HUDInfoConfig;
+
public static CoroutineHandle Badge_Coroutine;
+ public static readonly Dictionary _huds = new();
+
+ public static HintData data_914, data_elevator;
+
public override void OnServerWaitingForPlayers()
{
base.OnServerWaitingForPlayers();
@@ -58,6 +68,7 @@ namespace EasyTools.Events
{
Timing.RunCoroutine(ScpReal.AutoReal());
}
+ _huds.Values.ToList().ForEach(h => h.Start());
});
}
@@ -100,6 +111,8 @@ namespace EasyTools.Events
Badge.Handler(player);
}
+ _huds[player] = new PlayerHint(player, data_914, data_elevator);
+
}
public override void OnPlayerLeft(PlayerLeftEventArgs ev)
@@ -122,6 +135,7 @@ namespace EasyTools.Events
Badge.Remove(player);
}
+ if (_huds.ContainsKey(player))
{
_huds.Remove(player);
}
@@ -470,5 +484,41 @@ namespace EasyTools.Events
}
}
+
+ public override void OnScp914Activating(Scp914ActivatingEventArgs ev)
+ {
+ if (HUDInfoConfig.info_914 == false) return;
+
+ Scp914.Scp914KnobSetting knob = ev.KnobSetting;
+ string mode = TranslateConfig.scp914_trans[knob];
+
+ var p_operator = ev.Player.Nickname ?? "未知";
+
+ string msg = TranslateConfig.scp914_template.Replace("{mode}", mode)
+ .Replace("{p_operator}", p_operator);
+
+ foreach (var p in Player.List)
+ {
+ if (p.IsAlive && p != null && p.Room.Name == RoomName.Lcz914)// 检测914附近玩家,然后告诉他们914正在运行
+ {
+ _huds[p].Show914(msg);
+ }
+ }
+ }
+
+ public override void OnPlayerInteractingElevator(PlayerInteractingElevatorEventArgs ev)
+ {
+ if (HUDInfoConfig.info_elevator == false) return;
+
+ IEnumerable near = Player.List.Where(p =>
+ Vector3.Distance(p.Position, ev.Player.Position) <= HUDInfoConfig.elev_range);
+
+ var p_operator = ev.Player.Nickname ?? "未知";
+ string text = TranslateConfig.elev_template.Replace("{p_operator}", p_operator);
+ foreach (var p in near)
+ {
+ _huds[p].ShowElevator(text);
+ }
+ }
}
}
diff --git a/Plugins.cs b/Plugins.cs
index 12a6012..1d31ddb 100644
--- a/Plugins.cs
+++ b/Plugins.cs
@@ -1,4 +1,5 @@
using EasyTools.Configs;
+using EasyTools.DataBase.Serialization;
using EasyTools.Events;
using LabApi.Events.CustomHandlers;
using LabApi.Features;
@@ -20,6 +21,21 @@ namespace EasyTools
CustomEventHandler.BadgeConfig = this.LoadConfig("badgeConfig.yml");
CustomEventHandler.CustomRoleConfig = this.LoadConfig("customRoleConfig.yml");
CustomEventHandler.DataBaseConfig = this.LoadConfig("dataBaseConfig.yml");
+ CustomEventHandler.HUDInfoConfig = this.LoadConfig("HUDInfoConfig.yml");
+
+ CustomEventHandler.data_914 = new HintData
+ (
+ CustomEventHandler.HUDInfoConfig._914_x,
+ CustomEventHandler.HUDInfoConfig._914_y,
+ CustomEventHandler.HUDInfoConfig._914_font
+ );
+
+ CustomEventHandler.data_elevator = new HintData
+ (
+ CustomEventHandler.HUDInfoConfig._elev_x,
+ CustomEventHandler.HUDInfoConfig._elev_y,
+ CustomEventHandler.HUDInfoConfig._elev_font
+ );
if (!Directory.Exists(CustomEventHandler.BadgeConfig.Pach))
{
@@ -54,6 +70,9 @@ namespace EasyTools
CustomHandlersManager.UnregisterEventsHandler(Events);
Instance = null;
+
+ foreach (var hud in CustomEventHandler._huds.Values) hud.Dispose();
+ CustomEventHandler._huds.Clear();
}
}