diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d1ece54..4d075e0 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -30,6 +30,11 @@ jobs: - name: Build run: dotnet build --no-restore - - - name: Test - run: dotnet test --no-build --verbosity normal + + - name: Generate NuGet packages + run: nuget pack + + - name: Upload NuGet package + uses: actions/upload-artifact@v4 + with: + path: YongAnFrame.*.nupkg diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 556f7a5..b911f62 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -31,6 +31,11 @@ jobs: - name: Build run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal + - name: Generate NuGet packages + run: nuget pack + + - name: Upload NuGet package + uses: actions/upload-artifact@v4 + with: + path: YongAnFrame.*.nupkg diff --git a/Commands/ExpCommand.cs b/Commands/ExpCommand.cs index 1a6dc8a..d6329f4 100644 --- a/Commands/ExpCommand.cs +++ b/Commands/ExpCommand.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Permissions.Extensions; using System; +using System.Linq; namespace YongAnFrame.Commands { @@ -19,7 +20,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = "NO"; if (sender.CheckPermission("yongan404.level.add")) { - if (arguments.Array.Length > 2) + if (arguments.Count >= 1) { Player.Get(arguments.Array[1]).ToFPlayer().Level += ulong.Parse(arguments.Array[2]); response = "OK"; diff --git a/Commands/MessageCommand.cs b/Commands/MessageCommand.cs index b3f6b50..5b1ec40 100644 --- a/Commands/MessageCommand.cs +++ b/Commands/MessageCommand.cs @@ -24,7 +24,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s List choicePlayer = []; if (arguments.Count < 3) { - response = "不允许的格式,格式应该是int string int"; + response = "不允许的格式,格式应该是 int string int"; return false; } switch (arguments.Array[1]) @@ -32,7 +32,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s case "all": if (!sender.CheckPermission("yongan404.message.choice.all")) { - response = "请保证你有yongan404.message.choice.all权限"; + response = "请保证你有 yongan404.message.choice.all 权限"; return false; } foreach (Player player in Player.List) @@ -46,7 +46,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { if (idStringArray.Length > 1 && !sender.CheckPermission("yongan404.message.choice.multiple")) { - response = "请保证你有yongan404.message.choice.multiple权限"; + response = "请保证你有 yongan404.message.choice.multiple 权限"; return false; } @@ -73,7 +73,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { if (duration > 10 && !sender.CheckPermission("yongan404.message.send.large_duration")) { - response = "请保证你有yongan404.message.send.large_duration权限"; + response = "请保证你有 yongan404.message.send.large_duration 权限"; return false; } diff --git a/Commands/PlayerCommand.cs b/Commands/PlayerCommand.cs index 19c185e..1823024 100644 --- a/Commands/PlayerCommand.cs +++ b/Commands/PlayerCommand.cs @@ -17,20 +17,19 @@ public class PlayerCommand : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { response = "NULL"; - if (arguments.Count < 2) + if (arguments.Count >= 1 && Player.TryGet(sender, out Player player)) { + FramePlayer fPlayer = FramePlayer.Get(player); switch (arguments.Array[1]) { case "BDNT": - if (Player.TryGet(sender, out Player player)) - { - FramePlayer fPlayer = FramePlayer.Get(player); - fPlayer.HintManager.Clean(); - fPlayer.ExPlayer.ShowHint($"{YongAnFramePlugin.Instance.Translation.BypassDoNotTrack.Split('\n')}", 10000f); - } + fPlayer.HintManager.Clean(); + fPlayer.ExPlayer.ShowHint($"{YongAnFramePlugin.Instance.Translation.BypassDoNotTrack.Split('\n')}", 10000f); + return true; + case "INFO": + return true; } - } return false; } diff --git a/Commands/SkillCommand.cs b/Commands/SkillCommand.cs index 3c7f3ed..c7d95a1 100644 --- a/Commands/SkillCommand.cs +++ b/Commands/SkillCommand.cs @@ -1,6 +1,9 @@ using CommandSystem; using Exiled.API.Features; using System; +using YongAnFrame.Players; +using YongAnFrame.Roles; +using YongAnFrame.Roles.Properties; namespace YongAnFrame.Commands { @@ -20,12 +23,20 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { response = "NO"; - if (arguments.Array.Length > 1 && int.TryParse(arguments.Array[1], out int num) && Player.TryGet(sender, out Player player)) + if (arguments.Count >= 1 && int.TryParse(arguments.Array[1], out int num) && Player.TryGet(sender, out Player player)) { - //TODO - return true; + FramePlayer fPlayer = FramePlayer.Get(player); + + if (fPlayer.CustomRolePlus != null && fPlayer.CustomRolePlus.Check(fPlayer, out CustomRolePlusProperties data)) + { + SkillManager skillManager = data.SkillManagers[num]; + skillManager.Run(); + fPlayer.HintManager.MessageTexts.Add(new HintManager.Text($"技能[{skillManager.SkillProperties.Name}:{fPlayer.CustomRolePlus.GetType().GUID.ToString() + 10000}]已经发动,持续时间:{skillManager.SkillProperties.ActiveMaxTime}", skillManager.SkillProperties.ActiveMaxTime)); + response = "OK"; + return true; + } + return false; } - return false; } } diff --git a/Players/FramePlayer.cs b/Players/FramePlayer.cs index 2b3c1fa..d07f347 100644 --- a/Players/FramePlayer.cs +++ b/Players/FramePlayer.cs @@ -312,7 +312,7 @@ private IEnumerator DynamicRankTitlesShow() } if (usingRankTitles == null) { - RankColor = command[1] != "null" ? command[1] : RankColor; + RankColor = command[1]; } yield return Timing.WaitForSeconds(float.Parse(command[2])); } @@ -327,7 +327,7 @@ private IEnumerator DynamicTitlesShow() CustomName = $"[LV:{Level}][{command[0]}]{ExPlayer.Nickname}"; if (usingRankTitles == null) { - RankColor = command[1] != "null" ? command[1] : RankColor; + RankColor = command[1]; } yield return Timing.WaitForSeconds(float.Parse(command[2])); } diff --git a/Players/HintManager.cs b/Players/HintManager.cs index ab249bd..806ae34 100644 --- a/Players/HintManager.cs +++ b/Players/HintManager.cs @@ -30,7 +30,7 @@ private IEnumerator Update() string[] text = new string[36]; int used = 0; - text[used] = $"YongAnFrame 1.0.0-Beta4"; + text[used] = $"YongAnFrame 1.0.0-Beta5"; if (fPlayer.ExPlayer.DoNotTrack && !fPlayer.IsBDNT) { @@ -91,7 +91,6 @@ private IEnumerator Update() if (fPlayer.CustomRolePlus != null) { - text[34] += $"{fPlayer.CustomRolePlus.Name}"; text[35] = fPlayer.CustomRolePlus.Description; } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 70b8fb9..ca90715 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ [assembly: AssemblyProduct("YongAnFrame")] [assembly: AssemblyCopyright("Copyright © YongAn404")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyCulture("zh-cn")] // 将 ComVisible 设置为 false 会使此程序集中的类型 //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 @@ -31,5 +31,5 @@ //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.12")] -[assembly: AssemblyFileVersion("1.0.0.12")] +[assembly: AssemblyVersion("1.0.0.13")] +[assembly: AssemblyFileVersion("1.0.0.13")] diff --git a/README.md b/README.md index 7a76b55..b3e98b3 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ ## 联系我们 ## QQ:3489728203
-Mail:3489728203@qq.com
+E-Mail:yongandevelopers@163.com Bug反馈或有疑问欢迎提交issue(请附带错误日志/截图,以及问题的详细描述) diff --git a/Roles/CustomRolePlus.cs b/Roles/CustomRolePlus.cs index bb45873..a1b809b 100644 --- a/Roles/CustomRolePlus.cs +++ b/Roles/CustomRolePlus.cs @@ -10,6 +10,8 @@ using PlayerRoles; using System; using System.Collections.Generic; +using System.Reflection; +using System.Runtime.InteropServices; using YongAnFrame.Players; using YongAnFrame.Roles.Enums; using YongAnFrame.Roles.Interfaces; @@ -17,6 +19,7 @@ namespace YongAnFrame.Roles { + [Guid("913613e0-c6e7-4511-a079-bacc7bc0089c")] public abstract class CustomRolePlus : CustomRole { /// @@ -30,7 +33,7 @@ public abstract class CustomRolePlus : CustomRole /// /// 获取或设置自定义角色是否开启生成 /// - public bool IsStaetSpawn { get; set; } = true; + public bool IsStartSpawn { get; set; } = true; internal Dictionary BaseData { get; } = []; /// /// 获取或设置自定义角色的更多属性 @@ -242,7 +245,7 @@ private void OnStaticRestartingRound() private void OnSpawning(SpawningEventArgs args) { FramePlayer fPlayer = args.Player.ToFPlayer(); - if (IsStaetSpawn && (OldRole != RoleTypeId.None && args.Player.Role.Type == OldRole) || (OldRole == RoleTypeId.None && args.Player.Role.Type == Role)) + if (IsStartSpawn && (OldRole != RoleTypeId.None && args.Player.Role.Type == OldRole) || (OldRole == RoleTypeId.None && args.Player.Role.Type == Role)) { switch (SpawnProperties.RefreshTeam) { @@ -281,6 +284,7 @@ private void OnDroppingItem(DroppingItemEventArgs args) else { skillsManager.Run(); + fPlayer.HintManager.MessageTexts.Add(new HintManager.Text($"技能[{skillsManager.SkillProperties.Name}]已经发动,持续时间:{skillsManager.SkillProperties.ActiveMaxTime}", skillsManager.SkillProperties.ActiveMaxTime)); } args.IsAllowed = false; } @@ -402,6 +406,7 @@ protected override void ShowMessage(Player player) } } + [Guid("913613e0-c6e7-4511-a079-bacc7bc9000c")] public abstract class CustomRolePlus : CustomRolePlus where T : CustomRolePlusProperties, new() { /// diff --git a/Roles/MusicManager.cs b/Roles/MusicManager.cs index 7b05647..eac55c1 100644 --- a/Roles/MusicManager.cs +++ b/Roles/MusicManager.cs @@ -19,6 +19,9 @@ public sealed class MusicManager private static readonly MusicManager instance = new(); private int num = 1; + /// + /// 获取单例 + /// public static MusicManager Instance => instance; /// /// 获取或设置放音频的玩家(NPC) @@ -90,7 +93,7 @@ public AudioPlayerBase Play(string musicFile, string npcName, FramePlayer source /// NPC名称 /// 指定玩家 /// - public AudioPlayerBase Play(string musicFile, string npcName, Player source) + public AudioPlayerBase Play(string musicFile, string npcName, FramePlayer source) { return Play(musicFile, npcName, new TrackEvent(), source, [], false, 80, false); } @@ -99,20 +102,24 @@ public AudioPlayerBase Play(string musicFile, string npcName, Player source) /// /// 音频文件 /// NPC名称 - /// 播放事件 - /// 传播距离检测源头玩家 - /// 传播距离 - /// 额外可接收音频的玩家 + /// 播放事件,可以是 null + /// 传播距离检测源头玩家,如果是 null 所有人都将听到 + /// 传播距离(源头玩家为 null 将无效) + /// 额外可接收音频的玩家,可以是 null /// 是否覆盖播放 /// 音量大小 /// 是否循环 /// - public AudioPlayerBase Play(string musicFile, string npcName, TrackEvent trackEvent, FramePlayer source, float distance, FramePlayer[] extraPlay, bool isSole = false, float volume = 80, bool isLoop = false) + public AudioPlayerBase Play(string musicFile, string npcName, TrackEvent? trackEvent, FramePlayer source, float distance, FramePlayer[] extraPlay, bool isSole = false, float volume = 80, bool isLoop = false) { AudioPlayerBase audioPlayerBase = null; try { - OnTrackLoaded += trackEvent.TrackLoaded; + if (trackEvent.HasValue) + { + OnTrackLoaded += trackEvent.Value.TrackLoaded; + } + if (!MusicNpc.TryGetValue(npcName, out ReferenceHub npc)) { npc = CreateMusicNpc(npcName); @@ -129,17 +136,21 @@ public AudioPlayerBase Play(string musicFile, string npcName, TrackEvent trackEv } } - if (extraPlay != null) + + if (source != null) { - audioPlayerBase.AudioToPlay = extraPlay.Select((s) => { return s.ExPlayer.UserId; }).ToList(); + audioPlayerBase.AudioToPlay = FramePlayer.List.Where(p => Vector3.Distance(p.ExPlayer.Position, source.ExPlayer.Position) <= distance).Select((s) => s.ExPlayer.UserId).ToList(); + } + else + { + audioPlayerBase.AudioToPlay = FramePlayer.List.Select((s) => s.ExPlayer.UserId).ToList(); } - if (distance != 0) + if (extraPlay != null) { - audioPlayerBase.AudioToPlay ??= []; - foreach (var player in Player.List.Where(p => Vector3.Distance(p.Position, source.ExPlayer.Position) <= distance)) + foreach (var player in extraPlay) { - audioPlayerBase.AudioToPlay.Add(player.UserId); + audioPlayerBase.AudioToPlay.Add(player.ExPlayer.UserId); } } @@ -193,7 +204,7 @@ public AudioPlayerBase Play(string musicFile, string npcName, TrackEvent trackEv audioPlayerBase.AudioToPlay = extraPlay.Select((s) => { return s.ExPlayer.UserId; }).ToList(); } - audioPlayerBase.AudioToPlay.Add(source.UserId); + audioPlayerBase.AudioToPlay.Add(source.ExPlayer.UserId); audioPlayerBase.Enqueue($"{Paths.Plugins}/{Server.Port}/YongAnPluginData/{musicFile}.ogg", 0); audioPlayerBase.Volume = volume; diff --git a/Roles/SkillManager.cs b/Roles/SkillManager.cs index 05112ea..48049f3 100644 --- a/Roles/SkillManager.cs +++ b/Roles/SkillManager.cs @@ -52,6 +52,9 @@ private ISkillBurialEnd SkillBurialEnd return null; } } + /// + /// 获取技能的属性 + /// public SkillProperties SkillProperties { get => skill.SkillProperties[Id]; } /// diff --git a/YongAnFrame.csproj b/YongAnFrame.csproj index fcc077f..2dc1c39 100644 --- a/YongAnFrame.csproj +++ b/YongAnFrame.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + bin\Debug\YongAnFrame.xml pdbonly @@ -133,8 +134,9 @@ + + - diff --git a/YongAnFrame.nuspec b/YongAnFrame.nuspec index 85f9145..5586d46 100644 --- a/YongAnFrame.nuspec +++ b/YongAnFrame.nuspec @@ -2,21 +2,21 @@ $id$ - 1.0.0-beta4 + 1.0.0-beta5 $title$ $author$ true LGPL-3.0-only - docs\README.md + docs\README.md https://github.com/SCP-SL-Plugin-YongAnTeam/YongAnFrame $description$ $version$ $copyright$ - EXILED SCPSL + EXILED SCPSL SCP:SL - + \ No newline at end of file diff --git a/YongAnFramePlugin.cs b/YongAnFramePlugin.cs index 67d8983..4201c13 100644 --- a/YongAnFramePlugin.cs +++ b/YongAnFramePlugin.cs @@ -15,7 +15,7 @@ public sealed class YongAnFramePlugin : Plugin { private static YongAnFramePlugin instance; /// - /// 获取单例 + /// 获取单例 /// public static YongAnFramePlugin Instance => instance; /// diff --git a/YongAnTool.cs b/YongAnTool.cs index 51e538f..3d4a3f4 100644 --- a/YongAnTool.cs +++ b/YongAnTool.cs @@ -8,18 +8,38 @@ namespace YongAnFrame { + /// + /// 扩展方法工具类 + /// public static class YongAnTool { + /// + /// 作为种子取随机数 + /// + /// + /// 最小值 + /// 最大值 + /// public static int StrictNext(this Random r, int min, int max) { return new Random(BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0)).Next(min, max); } + /// + /// 转换为 + /// + /// + /// public static FramePlayer ToFPlayer(this Player p) { return FramePlayer.Get(p); } + /// + /// 转换为 + /// + /// + /// public static RefreshTeamType ToRefreshTeamType(this SpawnableTeamType stp) { return stp switch diff --git a/docs/articles/index.md b/docs/articles/index.md new file mode 100644 index 0000000..f787e87 --- /dev/null +++ b/docs/articles/index.md @@ -0,0 +1,5 @@ +--- +title: articles +--- + +# null \ No newline at end of file diff --git a/docs/docfx.json b/docs/docfx.json index 4484751..a4a8c88 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -25,7 +25,7 @@ "_lang": "zh-CN", "_gitContribute": { "repo": "https://github.com/SCP-SL-Plugin-YongAnTeam/YongAnFrame", - "branch": "dev" + "branch": "master" } }, "template": [ "default", "modern" ], diff --git a/lib/net48/Assembly-CSharp-firstpass.dll b/lib/net48/Assembly-CSharp-firstpass.dll index 2768684..9383cfa 100644 Binary files a/lib/net48/Assembly-CSharp-firstpass.dll and b/lib/net48/Assembly-CSharp-firstpass.dll differ diff --git a/lib/net48/Mirror.dll b/lib/net48/Mirror.dll index b93ac0b..bf8dc56 100644 Binary files a/lib/net48/Mirror.dll and b/lib/net48/Mirror.dll differ