From b63aac37dd81537373734bc961974affdcc57f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B8=E5=AE=89404?= <101850798+YongAn404@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:58:30 +0800 Subject: [PATCH] doc (#19) --- Commands/ExpCommand.cs | 2 +- Players/CustomPlayer.cs | 62 +++++++++++++++++++++++++---- Players/FramePlayer.cs | 5 +++ Players/ICustomAlgorithm.cs | 5 +++ Roles/Properties/SkillProperties.cs | 2 +- YongAnTool.cs | 13 +++--- 6 files changed, 72 insertions(+), 17 deletions(-) diff --git a/Commands/ExpCommand.cs b/Commands/ExpCommand.cs index fd0e992..0a0c6c3 100644 --- a/Commands/ExpCommand.cs +++ b/Commands/ExpCommand.cs @@ -10,7 +10,7 @@ namespace BAPlugin.Command [CommandHandler(typeof(RemoteAdminCommandHandler))] public class ExpCommand : ICommand { - public string Command => "experience"; + public string Command => "pexperience"; public string[] Aliases => ["pexp"]; diff --git a/Players/CustomPlayer.cs b/Players/CustomPlayer.cs index f03ab6f..f670c2e 100644 --- a/Players/CustomPlayer.cs +++ b/Players/CustomPlayer.cs @@ -1,21 +1,69 @@ -namespace YongAnFrame.Players +using YongAnFrame.Roles; + +namespace YongAnFrame.Players { public abstract class CustomPlayer(FramePlayer player) { + /// + /// 拥有该实例的框架玩家 + /// public FramePlayer FramePlayer { get; private set; } = player; + /// + /// 是否有效 + /// public bool IsInvalid => FramePlayer == null; - public float ExpMultiplier { get { return FramePlayer.ExpMultiplier; } set { FramePlayer.ExpMultiplier = value; } } - public ulong Exp { get { return FramePlayer.Exp; } set { FramePlayer.Exp = value; } } - public ulong Level { get { return FramePlayer.Level; } set { FramePlayer.Level = value; } } + /// + /// 实例拥有的自定义角色 + /// + public CustomRolePlus CustomRolePlus => FramePlayer.CustomRolePlus; + /// + /// 提示系统管理器 + /// public HintManager HintManager => FramePlayer.HintManager; - public PlayerTitle UsingTitles { get { return FramePlayer.UsingTitles; } set { FramePlayer.UsingTitles = value; } } - public PlayerTitle UsingRankTitles { get { return FramePlayer.UsingRankTitles; } set { FramePlayer.UsingRankTitles = value; } } + /// + /// 正在使用的主要自定义算法 + /// + public ICustomAlgorithm CustomAlgorithm { get => FramePlayer.CustomAlgorithm; set=> FramePlayer.CustomAlgorithm = value; } + /// + /// 玩家等级 + /// + public ulong Level { get => FramePlayer.Level; set => FramePlayer.Level = value; } + /// + /// 玩家经验 + /// + public ulong Exp { get => FramePlayer.Exp; set => FramePlayer.Exp = value; } + /// + /// 玩家经验倍率 + /// + public float ExpMultiplier { get => FramePlayer.ExpMultiplier; set => FramePlayer.ExpMultiplier = value; } + /// + /// 玩家批准绕过DNT + /// + public bool IsBDNT { get => FramePlayer.IsBDNT; set => FramePlayer.IsBDNT = value; } + /// + /// 正在使用的名称称号 + /// + public PlayerTitle UsingTitles { get => FramePlayer.UsingTitles; set => FramePlayer.UsingTitles = value; } + /// + /// 正在使用的排名称号 + /// + public PlayerTitle UsingRankTitles { get => FramePlayer.UsingRankTitles; set => FramePlayer.UsingRankTitles = value; } + + /// + /// 添加经验 + /// + /// 数值 + /// 原因 public void AddExp(ulong exp, string name = "未知原因") { FramePlayer.AddExp(exp, name); } - + /// + /// 调用后该实例会立刻无效
+ /// 调用后该实例会立刻无效
+ /// 调用后该实例会立刻无效 + ///
public virtual void Invalid() { FramePlayer = null; diff --git a/Players/FramePlayer.cs b/Players/FramePlayer.cs index 4638ac1..a0e79c4 100644 --- a/Players/FramePlayer.cs +++ b/Players/FramePlayer.cs @@ -124,6 +124,11 @@ internal FramePlayer(Player player) Events.Handlers.FramePlayer.OnFramePlayerCreated(new FramePlayerCreatedEventArgs(this)); } + /// + /// 添加经验 + /// + /// 数值 + /// 原因 public void AddExp(ulong exp, string name = "未知原因") { float globalExpMultiplier = YongAnFramePlugin.Instance.Config.GlobalExpMultiplier; diff --git a/Players/ICustomAlgorithm.cs b/Players/ICustomAlgorithm.cs index b0fe2ea..e1db85b 100644 --- a/Players/ICustomAlgorithm.cs +++ b/Players/ICustomAlgorithm.cs @@ -2,6 +2,11 @@ { public interface ICustomAlgorithm { + /// + /// 获取升级所需要的经验 + /// + /// + /// public ulong GetNeedUpLevel(ulong level); } } diff --git a/Roles/Properties/SkillProperties.cs b/Roles/Properties/SkillProperties.cs index 20995b3..728ecf6 100644 --- a/Roles/Properties/SkillProperties.cs +++ b/Roles/Properties/SkillProperties.cs @@ -1,6 +1,6 @@ namespace YongAnFrame.Roles.Properties { - public struct SkillProperties(string name, string statement, string description, float activeMaxTime, float burialMaxTime, ItemType useItem = ItemType.Coin) + public readonly struct SkillProperties(string name, string statement, string description, float activeMaxTime, float burialMaxTime, ItemType useItem = ItemType.Coin) { /// /// 技能名称 diff --git a/YongAnTool.cs b/YongAnTool.cs index 50eb8e1..af68928 100644 --- a/YongAnTool.cs +++ b/YongAnTool.cs @@ -39,15 +39,12 @@ public static FramePlayer ToFPlayer(this Player p) public static RefreshTeamType ToRefreshTeamType(this SpawnableTeamType stp) { - switch (stp) + return stp switch { - case SpawnableTeamType.ChaosInsurgency: - return RefreshTeamType.CI; - case SpawnableTeamType.NineTailedFox: - return RefreshTeamType.MTF; - default: - return RefreshTeamType.Start; - } + SpawnableTeamType.ChaosInsurgency => RefreshTeamType.CI, + SpawnableTeamType.NineTailedFox => RefreshTeamType.MTF, + _ => RefreshTeamType.Start, + }; } } }