From 080d546a97660298386e9fdccf3b937cf50b22ce Mon Sep 17 00:00:00 2001 From: milimoe <110188673+milimoe@users.noreply.github.com> Date: Sun, 23 Nov 2025 02:18:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8D=E6=B3=95=E4=BF=AE=E6=AD=A3=E5=92=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B8=85=E7=90=86=20(#143)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Utility/NovelConfig.cs | 8 ++++---- Api/Utility/Singleton.cs | 2 +- Api/Utility/TextReader.cs | 2 +- Entity/Character/Character.cs | 10 +++++----- Entity/Character/Shield.cs | 2 +- Entity/Explore/Region.cs | 1 - Entity/Item/Item.cs | 5 ++--- Entity/Skill/Effect.cs | 7 +++---- Entity/Skill/NormalAttack.cs | 4 ++-- Entity/Skill/Skill.cs | 6 +++--- Entity/System/RoundRecord.cs | 2 +- Entity/Trade/Goods.cs | 2 +- Interface/Base/IGamingQueue.cs | 2 +- Library/Common/Addon/GameMap.cs | 6 +++--- Library/Common/Addon/WebAPIPlugin.cs | 2 +- Library/Constant/General.cs | 2 +- Library/Constant/ResultEnum.cs | 2 +- Library/SQLScript/Entity/MarketItemsQuery.cs | 2 +- Library/SQLScript/Entity/RoomQuery.cs | 2 +- Library/SQLScript/Entity/UserQuery.cs | 4 ++-- Model/EquilibriumConstant.cs | 2 +- Model/GamingQueue.cs | 10 +++++----- Model/RoomList.cs | 2 +- 23 files changed, 42 insertions(+), 45 deletions(-) diff --git a/Api/Utility/NovelConfig.cs b/Api/Utility/NovelConfig.cs index a7591b1..5bb3814 100644 --- a/Api/Utility/NovelConfig.cs +++ b/Api/Utility/NovelConfig.cs @@ -110,7 +110,7 @@ namespace Milimoe.FunGame.Core.Api.Utility } // 确保目录存在 - ExistsDirectoryAndCreate(novelName); + DirectoryExistsAndCreate(novelName); // 复制文件内容 string json = File.ReadAllText(path, General.DefaultEncoding); @@ -276,7 +276,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// /// - public static bool ExistsDirectory(string novelName) + public static bool DirectoryExists(string novelName) { string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; return Directory.Exists(dpath); @@ -287,7 +287,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// /// - public static bool ExistsDirectoryAndCreate(string novelName) + public static bool DirectoryExistsAndCreate(string novelName) { string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; bool result = Directory.Exists(dpath); @@ -304,7 +304,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// /// - public static bool ExistsFile(string novelName, string fileName) + public static bool FileExists(string novelName, string fileName) { string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; string fpath = $@"{dpath}/{fileName}.json"; diff --git a/Api/Utility/Singleton.cs b/Api/Utility/Singleton.cs index 3451e8a..a492f6e 100644 --- a/Api/Utility/Singleton.cs +++ b/Api/Utility/Singleton.cs @@ -15,7 +15,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// 单例对象 /// - public static bool IsExist(object single) + public static bool Exists(object single) { Type type = single.GetType(); string name = type.FullName ?? type.ToString(); diff --git a/Api/Utility/TextReader.cs b/Api/Utility/TextReader.cs index f6382d0..f0cad4d 100644 --- a/Api/Utility/TextReader.cs +++ b/Api/Utility/TextReader.cs @@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// 文件名,缺省为FunGame.ini /// 是否存在 - public static bool ExistINIFile(string FileName = DefaultFileName) => File.Exists($@"{AppDomain.CurrentDomain.BaseDirectory}{FileName}"); + public static bool INIFileExists(string FileName = DefaultFileName) => File.Exists($@"{AppDomain.CurrentDomain.BaseDirectory}{FileName}"); /// /// 初始化ini模板文件 diff --git a/Entity/Character/Character.cs b/Entity/Character/Character.cs index a8afe01..da3056c 100644 --- a/Entity/Character/Character.cs +++ b/Entity/Character/Character.cs @@ -243,7 +243,7 @@ namespace Milimoe.FunGame.Core.Entity /// [InitRequired] public bool HasMP { get; set; } = true; - + /// /// 初始魔法值 [ 初始设定 ] /// @@ -788,7 +788,7 @@ namespace Milimoe.FunGame.Core.Entity /// 额外攻击距离 [ 与技能和物品相关 ] [ 单位:格(半径) ] /// public int ExATR { get; set; } = 0; - + /// /// 行动力/可移动距离 [ 与第一定位相关 ] [ 单位:格(半径) ] /// @@ -812,12 +812,12 @@ namespace Milimoe.FunGame.Core.Entity return Math.Max(1, baseMOV + ExMOV); } } - + /// /// 行动力/可移动距离 [ 与技能和物品相关 ] [ 单位:格(半径) ] /// public int ExMOV { get; set; } = 0; - + /// /// 暴击率(%) = [ 与敏捷相关 ] + 额外暴击率(%) /// @@ -1900,7 +1900,7 @@ namespace Milimoe.FunGame.Core.Entity return builder.ToString(); } - + /// /// 获取角色背包信息 /// diff --git a/Entity/Character/Shield.cs b/Entity/Character/Shield.cs index 66a8a06..19ccd83 100644 --- a/Entity/Character/Shield.cs +++ b/Entity/Character/Shield.cs @@ -66,7 +66,7 @@ namespace Milimoe.FunGame.Core.Entity /// 混合护盾 /// public double Mix { get; set; } = 0; - + /// /// 总计混合护盾 /// diff --git a/Entity/Explore/Region.cs b/Entity/Explore/Region.cs index e6d005b..86f8dc5 100644 --- a/Entity/Explore/Region.cs +++ b/Entity/Explore/Region.cs @@ -1,7 +1,6 @@ using System.Text; using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Core.Model; namespace Milimoe.FunGame.Core.Entity { diff --git a/Entity/Item/Item.cs b/Entity/Item/Item.cs index 5d3cfbb..754ae68 100644 --- a/Entity/Item/Item.cs +++ b/Entity/Item/Item.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Text; +using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Interface.Base; using Milimoe.FunGame.Core.Interface.Entity; @@ -190,7 +189,7 @@ namespace Milimoe.FunGame.Core.Entity /// 所属的玩家 /// public User? User { get; set; } = null; - + /// /// 物品拥有的技能 /// diff --git a/Entity/Skill/Effect.cs b/Entity/Skill/Effect.cs index 4528c10..9292f49 100644 --- a/Entity/Skill/Effect.cs +++ b/Entity/Skill/Effect.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Text; +using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Interface.Base; using Milimoe.FunGame.Core.Interface.Entity; @@ -260,7 +259,7 @@ namespace Milimoe.FunGame.Core.Entity { return 0; } - + /// /// 在应用真实伤害前修改伤害 [ 允许取消伤害 ] /// @@ -1058,7 +1057,7 @@ namespace Milimoe.FunGame.Core.Entity { GamingQueue?.SetCharactersToAIControl(true, cancel, characters); } - + /// /// 检查角色是否在 AI 控制状态 /// diff --git a/Entity/Skill/NormalAttack.cs b/Entity/Skill/NormalAttack.cs index 6623f85..1118581 100644 --- a/Entity/Skill/NormalAttack.cs +++ b/Entity/Skill/NormalAttack.cs @@ -162,7 +162,7 @@ namespace Milimoe.FunGame.Core.Entity /// 额外硬直时间 [ 技能和物品相关 ] /// public double ExHardnessTime { get; set; } = 0; - + /// /// 额外硬直时间% [ 技能和物品相关 ] /// @@ -266,7 +266,7 @@ namespace Milimoe.FunGame.Core.Entity selectable.Add(character); } } - + foreach (Character character in teammates) { if (CanSelectTeammate) diff --git a/Entity/Skill/Skill.cs b/Entity/Skill/Skill.cs index da26940..83d2ce2 100644 --- a/Entity/Skill/Skill.cs +++ b/Entity/Skill/Skill.cs @@ -94,7 +94,7 @@ namespace Milimoe.FunGame.Core.Entity /// 是否无视施法距离(全图施法),魔法默认为 true,战技默认为 false /// public virtual bool CastAnywhere { get; set; } = false; - + /// /// 施法距离 [ 单位:格 ] /// @@ -145,7 +145,7 @@ namespace Milimoe.FunGame.Core.Entity /// 如果为 false,表示必须选取一个角色作为目标,当 > 0 时,技能作用范围将根据目标位置覆盖 形状的区域;= 0 时正常选取目标。 /// public virtual bool IsNonDirectional { get; set; } = false; - + /// /// 作用范围形状 /// - 菱形。默认的曼哈顿距离正方形 @@ -383,7 +383,7 @@ namespace Milimoe.FunGame.Core.Entity selectable.Add(character); } } - + foreach (Character character in teammates) { IEnumerable effects = character.Effects.Where(e => e.IsInEffect); diff --git a/Entity/System/RoundRecord.cs b/Entity/System/RoundRecord.cs index 66866b0..5a96bcc 100644 --- a/Entity/System/RoundRecord.cs +++ b/Entity/System/RoundRecord.cs @@ -68,7 +68,7 @@ namespace Milimoe.FunGame.Core.Entity if (ActorContinuousKilling.Count > 0) builder.AppendLine($"{string.Join("\r\n", ActorContinuousKilling)}"); if (Assists.Count > 0) builder.AppendLine($"本回合助攻:[ {string.Join(" ] / [ ", Assists)} ]"); } - + if (ActionType == CharacterActionType.PreCastSkill && Skill != null) { if (Skill.IsMagic) diff --git a/Entity/Trade/Goods.cs b/Entity/Trade/Goods.cs index 8a0d112..6ac479b 100644 --- a/Entity/Trade/Goods.cs +++ b/Entity/Trade/Goods.cs @@ -43,7 +43,7 @@ namespace Milimoe.FunGame.Core.Entity { return ToString(null); } - + public string ToString(User? user = null) { StringBuilder builder = new(); diff --git a/Interface/Base/IGamingQueue.cs b/Interface/Base/IGamingQueue.cs index 515f08c..ea4b6c0 100644 --- a/Interface/Base/IGamingQueue.cs +++ b/Interface/Base/IGamingQueue.cs @@ -224,7 +224,7 @@ namespace Milimoe.FunGame.Core.Interface.Base /// /// public void SetCharactersToAIControl(bool bySystem = true, bool cancel = false, params IEnumerable characters); - + /// /// 检查角色是否在 AI 控制状态 /// diff --git a/Library/Common/Addon/GameMap.cs b/Library/Common/Addon/GameMap.cs index b054f40..42f01f3 100644 --- a/Library/Common/Addon/GameMap.cs +++ b/Library/Common/Addon/GameMap.cs @@ -51,12 +51,12 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon /// 格子集 /// public Dictionary Grids { get; } = []; - + /// /// 格子集(基于坐标) /// public Dictionary<(int x, int y, int z), Grid> GridsByCoordinate { get; } = []; - + /// /// 角色集 /// @@ -560,7 +560,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon { } - + /// /// 在事件流逝后处理 /// diff --git a/Library/Common/Addon/WebAPIPlugin.cs b/Library/Common/Addon/WebAPIPlugin.cs index 203ef0c..f9e68f0 100644 --- a/Library/Common/Addon/WebAPIPlugin.cs +++ b/Library/Common/Addon/WebAPIPlugin.cs @@ -98,7 +98,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon { return true; } - + /// /// 当 Web API 服务启动完成后触发 /// diff --git a/Library/Constant/General.cs b/Library/Constant/General.cs index afd3213..6c59658 100644 --- a/Library/Constant/General.cs +++ b/Library/Constant/General.cs @@ -56,7 +56,7 @@ namespace Milimoe.FunGame.Core.Library.Constant /// yyyy年MM月dd日 HH:mm:ss /// public static string GeneralDateTimeFormatChinese => "yyyy年MM月dd日 HH:mm:ss"; - + /// /// HH:mm:ss /// diff --git a/Library/Constant/ResultEnum.cs b/Library/Constant/ResultEnum.cs index b3930de..94e185d 100644 --- a/Library/Constant/ResultEnum.cs +++ b/Library/Constant/ResultEnum.cs @@ -48,7 +48,7 @@ namespace Milimoe.FunGame.Core.Library.Constant Fail, NotFound, SQLError, - IsExist + Exists } public enum MailSendResult diff --git a/Library/SQLScript/Entity/MarketItemsQuery.cs b/Library/SQLScript/Entity/MarketItemsQuery.cs index 52ddb9a..39b2f2a 100644 --- a/Library/SQLScript/Entity/MarketItemsQuery.cs +++ b/Library/SQLScript/Entity/MarketItemsQuery.cs @@ -53,7 +53,7 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity SQLHelper.Parameters["@Price"] = Price; return $"{Command_Update} {TableName} {Command_Set} {Column_Price} = @Price {Command_Where} {Column_ItemGuid} = @ItemGuid"; } - + public static string Update_MarketItemStock(SQLHelper SQLHelper, Guid ItemGuid, double Stock) { SQLHelper.Parameters["@ItemGuid"] = ItemGuid.ToString(); diff --git a/Library/SQLScript/Entity/RoomQuery.cs b/Library/SQLScript/Entity/RoomQuery.cs index 5ad4331..c27a2de 100644 --- a/Library/SQLScript/Entity/RoomQuery.cs +++ b/Library/SQLScript/Entity/RoomQuery.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity public const string Select_Rooms = $"{Command_Select} {TableName}.{Command_All}, {UserQuery.TableName}.{UserQuery.Column_Username} {Command_As} {Column_RoomMasterName} " + $"{Command_From} {TableName} {Command_LeftJoin} {UserQuery.TableName} {Command_On} {UserQuery.TableName}.{UserQuery.Column_Id} = {TableName}.{Column_RoomMaster}"; - public static string Select_IsExistRoom(SQLHelper SQLHelper, string Roomid) + public static string Select_RoomByRoomId(SQLHelper SQLHelper, string Roomid) { SQLHelper.Parameters["@Roomid"] = Roomid; return $"{Command_Select} {Command_All} {Command_From} {TableName} {Command_Where} {Column_Roomid} = @Roomid"; diff --git a/Library/SQLScript/Entity/UserQuery.cs b/Library/SQLScript/Entity/UserQuery.cs index 33b5713..4e583d9 100644 --- a/Library/SQLScript/Entity/UserQuery.cs +++ b/Library/SQLScript/Entity/UserQuery.cs @@ -33,13 +33,13 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity return $"{Select_Users} {Command_Where} {Column_Id} = @Id"; } - public static string Select_IsExistEmail(SQLHelper SQLHelper, string Email) + public static string Select_UserByEmail(SQLHelper SQLHelper, string Email) { SQLHelper.Parameters["@Email"] = Email; return $"{Select_Users} {Command_Where} {Column_Email} = @Email"; } - public static string Select_IsExistUsername(SQLHelper SQLHelper, string Username) + public static string Select_UserByUsername(SQLHelper SQLHelper, string Username) { SQLHelper.Parameters["@Username"] = Username; return $"{Select_Users} {Command_Where} {Column_Username} = @Username"; diff --git a/Model/EquilibriumConstant.cs b/Model/EquilibriumConstant.cs index e58db8b..5769138 100644 --- a/Model/EquilibriumConstant.cs +++ b/Model/EquilibriumConstant.cs @@ -299,7 +299,7 @@ namespace Milimoe.FunGame.Core.Model /// 单手剑的基础伤害倍率 /// public double OneHandedSwordBaseMultiplier { get; set; } = 1.0; - + /// /// 单手剑的基础伤害倍率成长 /// diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs index 32a9cea..8d78495 100644 --- a/Model/GamingQueue.cs +++ b/Model/GamingQueue.cs @@ -180,7 +180,7 @@ namespace Milimoe.FunGame.Core.Model /// 角色是否在 AI 控制下 [ 系统控制 ] /// protected readonly HashSet _charactersInAIBySystem = []; - + /// /// 角色是否在 AI 控制下 [ 玩家手动设置 ] /// @@ -3313,7 +3313,7 @@ namespace Milimoe.FunGame.Core.Model } } } - + /// /// 设置角色为 AI 控制 [ 玩家手动设置 ] /// @@ -3323,7 +3323,7 @@ namespace Milimoe.FunGame.Core.Model { SetCharactersToAIControl(false, cancel, characters); } - + /// /// 检查角色是否在 AI 控制状态 /// @@ -3610,7 +3610,7 @@ namespace Milimoe.FunGame.Core.Model { return await (SelectTargetGrid?.Invoke(this, character, enemys, teammates, map, moveRange) ?? Task.FromResult(Grid.Empty)); } - + public delegate Task> SelectSkillTargetsEventHandler(GamingQueue queue, Character caster, Skill skill, List enemys, List teammates, List castRange); /// /// 选取技能目标事件 @@ -3681,7 +3681,7 @@ namespace Milimoe.FunGame.Core.Model { return await (DeathCalculation?.Invoke(this, killer, death) ?? Task.FromResult(true)); } - + public delegate Task DeathCalculationByTeammateEventHandler(GamingQueue queue, Character killer, Character death); /// /// 死亡结算(击杀队友)事件 diff --git a/Model/RoomList.cs b/Model/RoomList.cs index 0570963..73d83ba 100644 --- a/Model/RoomList.cs +++ b/Model/RoomList.cs @@ -98,7 +98,7 @@ namespace Milimoe.FunGame.Core.Model public Room GetRoom(string roomid) => _List.TryGetValue(roomid, out Room? room) ? room : General.HallInstance; - public bool IsExist(string roomid) => _List.ContainsKey(roomid); + public bool Exists(string roomid) => _List.ContainsKey(roomid); public void SetRoomMaster(string roomid, User user) {