mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-01-19 14:08:22 +00:00
词法修正和代码清理 (#143)
This commit is contained in:
parent
774e26240b
commit
080d546a97
@ -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
|
||||
/// </summary>
|
||||
/// <param name="novelName"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="novelName"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
/// <param name="novelName"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
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";
|
||||
|
||||
@ -15,7 +15,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// </summary>
|
||||
/// <param name="single">单例对象</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExist(object single)
|
||||
public static bool Exists(object single)
|
||||
{
|
||||
Type type = single.GetType();
|
||||
string name = type.FullName ?? type.ToString();
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// </summary>
|
||||
/// <param name="FileName">文件名,缺省为FunGame.ini</param>
|
||||
/// <returns>是否存在</returns>
|
||||
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}");
|
||||
|
||||
/// <summary>
|
||||
/// 初始化ini模板文件
|
||||
|
||||
@ -243,7 +243,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// </summary>
|
||||
[InitRequired]
|
||||
public bool HasMP { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 初始魔法值 [ 初始设定 ]
|
||||
/// </summary>
|
||||
@ -788,7 +788,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 额外攻击距离 [ 与技能和物品相关 ] [ 单位:格(半径) ]
|
||||
/// </summary>
|
||||
public int ExATR { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 行动力/可移动距离 [ 与第一定位相关 ] [ 单位:格(半径) ]
|
||||
/// </summary>
|
||||
@ -812,12 +812,12 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
return Math.Max(1, baseMOV + ExMOV);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 行动力/可移动距离 [ 与技能和物品相关 ] [ 单位:格(半径) ]
|
||||
/// </summary>
|
||||
public int ExMOV { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 暴击率(%) = [ 与敏捷相关 ] + 额外暴击率(%)
|
||||
/// </summary>
|
||||
@ -1900,7 +1900,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色背包信息
|
||||
/// </summary>
|
||||
|
||||
@ -66,7 +66,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 混合护盾
|
||||
/// </summary>
|
||||
public double Mix { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 总计混合护盾
|
||||
/// </summary>
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
/// 所属的玩家
|
||||
/// </summary>
|
||||
public User? User { get; set; } = null;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物品拥有的技能
|
||||
/// </summary>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 在应用真实伤害前修改伤害 [ 允许取消伤害 ]
|
||||
/// </summary>
|
||||
@ -1058,7 +1057,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
GamingQueue?.SetCharactersToAIControl(true, cancel, characters);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查角色是否在 AI 控制状态
|
||||
/// </summary>
|
||||
|
||||
@ -162,7 +162,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 额外硬直时间 [ 技能和物品相关 ]
|
||||
/// </summary>
|
||||
public double ExHardnessTime { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 额外硬直时间% [ 技能和物品相关 ]
|
||||
/// </summary>
|
||||
@ -266,7 +266,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
selectable.Add(character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (Character character in teammates)
|
||||
{
|
||||
if (CanSelectTeammate)
|
||||
|
||||
@ -94,7 +94,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 是否无视施法距离(全图施法),魔法默认为 true,战技默认为 false
|
||||
/// </summary>
|
||||
public virtual bool CastAnywhere { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 施法距离 [ 单位:格 ]
|
||||
/// </summary>
|
||||
@ -145,7 +145,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 如果为 false,表示必须选取一个角色作为目标,当 <see cref="CanSelectTargetRange"/> > 0 时,技能作用范围将根据目标位置覆盖 <see cref="SkillRangeType"/> 形状的区域;= 0 时正常选取目标。
|
||||
/// </summary>
|
||||
public virtual bool IsNonDirectional { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 作用范围形状<para/>
|
||||
/// <see cref="SkillRangeType.Diamond"/> - 菱形。默认的曼哈顿距离正方形<para/>
|
||||
@ -383,7 +383,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
selectable.Add(character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (Character character in teammates)
|
||||
{
|
||||
IEnumerable<Effect> effects = character.Effects.Where(e => e.IsInEffect);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
{
|
||||
return ToString(null);
|
||||
}
|
||||
|
||||
|
||||
public string ToString(User? user = null)
|
||||
{
|
||||
StringBuilder builder = new();
|
||||
|
||||
@ -224,7 +224,7 @@ namespace Milimoe.FunGame.Core.Interface.Base
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void SetCharactersToAIControl(bool bySystem = true, bool cancel = false, params IEnumerable<Character> characters);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查角色是否在 AI 控制状态
|
||||
/// </summary>
|
||||
|
||||
@ -51,12 +51,12 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
/// 格子集
|
||||
/// </summary>
|
||||
public Dictionary<long, Grid> Grids { get; } = [];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 格子集(基于坐标)
|
||||
/// </summary>
|
||||
public Dictionary<(int x, int y, int z), Grid> GridsByCoordinate { get; } = [];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色集
|
||||
/// </summary>
|
||||
@ -560,7 +560,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 在事件流逝后处理
|
||||
/// </summary>
|
||||
|
||||
@ -98,7 +98,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当 Web API 服务启动完成后触发
|
||||
/// </summary>
|
||||
|
||||
@ -56,7 +56,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
/// yyyy年MM月dd日 HH:mm:ss
|
||||
/// </summary>
|
||||
public static string GeneralDateTimeFormatChinese => "yyyy年MM月dd日 HH:mm:ss";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// HH:mm:ss
|
||||
/// </summary>
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
|
||||
Fail,
|
||||
NotFound,
|
||||
SQLError,
|
||||
IsExist
|
||||
Exists
|
||||
}
|
||||
|
||||
public enum MailSendResult
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -299,7 +299,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
/// 单手剑的基础伤害倍率
|
||||
/// </summary>
|
||||
public double OneHandedSwordBaseMultiplier { get; set; } = 1.0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单手剑的基础伤害倍率成长
|
||||
/// </summary>
|
||||
|
||||
@ -180,7 +180,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
/// 角色是否在 AI 控制下 [ 系统控制 ]
|
||||
/// </summary>
|
||||
protected readonly HashSet<Character> _charactersInAIBySystem = [];
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色是否在 AI 控制下 [ 玩家手动设置 ]
|
||||
/// </summary>
|
||||
@ -3313,7 +3313,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置角色为 AI 控制 [ 玩家手动设置 ]
|
||||
/// </summary>
|
||||
@ -3323,7 +3323,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
SetCharactersToAIControl(false, cancel, characters);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查角色是否在 AI 控制状态
|
||||
/// </summary>
|
||||
@ -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<List<Character>> SelectSkillTargetsEventHandler(GamingQueue queue, Character caster, Skill skill, List<Character> enemys, List<Character> teammates, List<Grid> castRange);
|
||||
/// <summary>
|
||||
/// 选取技能目标事件
|
||||
@ -3681,7 +3681,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
{
|
||||
return await (DeathCalculation?.Invoke(this, killer, death) ?? Task.FromResult(true));
|
||||
}
|
||||
|
||||
|
||||
public delegate Task<bool> DeathCalculationByTeammateEventHandler(GamingQueue queue, Character killer, Character death);
|
||||
/// <summary>
|
||||
/// 死亡结算(击杀队友)事件
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user