From acc6417370a7ba65cfffcffd06950b1ea54bc9a3 Mon Sep 17 00:00:00 2001 From: Mili Date: Tue, 14 Feb 2023 00:27:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E5=88=86=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=92=8C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Core/Api/Factory/ItemFactory.cs | 6 ++--- FunGame.Core/Api/Utility/INIHelper.cs | 12 +++++----- FunGame.Core/Entity/Character/Character.cs | 12 ++++++++-- FunGame.Core/Entity/Item/ActiveItem.cs | 14 +++++++++-- FunGame.Core/Entity/Item/Item.cs | 11 ++++++--- FunGame.Core/Entity/Item/PassiveItem.cs | 16 ++++++++++--- FunGame.Core/Interface/Entity/BaseEntity.cs | 24 +++++++++++++++++++ .../Interface/Entity/IActiveEnable.cs | 14 +++++++++++ FunGame.Core/Interface/Entity/IBaseEntity.cs | 16 +++++++++++++ FunGame.Core/Interface/Entity/ICharacter.cs | 14 +++++++++++ FunGame.Core/Interface/Entity/IItem.cs | 16 +++++++++++++ .../Entity/Relationship/IRelateCharacter.cs | 14 +++++++++++ .../Entity/Relationship/IRelateUser.cs | 14 +++++++++++ .../{FunGameEnum.cs => FunGameInfo.cs} | 4 ++-- FunGame.Core/Library/Constant/TypeEnum.cs | 22 ++++++++++++++--- FunGame.Desktop/Others/Constant.cs | 2 +- FunGame.Desktop/UI/Main/Main.cs | 4 ++-- 17 files changed, 188 insertions(+), 27 deletions(-) create mode 100644 FunGame.Core/Interface/Entity/BaseEntity.cs create mode 100644 FunGame.Core/Interface/Entity/IActiveEnable.cs create mode 100644 FunGame.Core/Interface/Entity/IBaseEntity.cs create mode 100644 FunGame.Core/Interface/Entity/ICharacter.cs create mode 100644 FunGame.Core/Interface/Entity/IItem.cs create mode 100644 FunGame.Core/Interface/Entity/Relationship/IRelateCharacter.cs create mode 100644 FunGame.Core/Interface/Entity/Relationship/IRelateUser.cs rename FunGame.Core/Library/Constant/{FunGameEnum.cs => FunGameInfo.cs} (94%) diff --git a/FunGame.Core/Api/Factory/ItemFactory.cs b/FunGame.Core/Api/Factory/ItemFactory.cs index c5e9223..4c80600 100644 --- a/FunGame.Core/Api/Factory/ItemFactory.cs +++ b/FunGame.Core/Api/Factory/ItemFactory.cs @@ -9,16 +9,16 @@ namespace Milimoe.FunGame.Core.Api.Factory { internal class ItemFactory { - internal static Milimoe.FunGame.Core.Entity.Item? GetInstance(ItemType type, string Name) + internal static Milimoe.FunGame.Core.Entity.Item? GetInstance(ItemType type, int id, string name) { Milimoe.FunGame.Core.Entity.Item? item = null; switch (type) { case ItemType.Active: - item = new Milimoe.FunGame.Core.Entity.ActiveItem(Name); + item = new Milimoe.FunGame.Core.Entity.ActiveItem(id, name); break; case ItemType.Passive: - item = new Milimoe.FunGame.Core.Entity.PassiveItem(Name); + item = new Milimoe.FunGame.Core.Entity.PassiveItem(id, name); break; } return item; diff --git a/FunGame.Core/Api/Utility/INIHelper.cs b/FunGame.Core/Api/Utility/INIHelper.cs index 9555740..682125d 100644 --- a/FunGame.Core/Api/Utility/INIHelper.cs +++ b/FunGame.Core/Api/Utility/INIHelper.cs @@ -57,14 +57,14 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// 初始化ini模板文件 /// - public static void Init(FunGameEnum.FunGame FunGameType) + public static void Init(FunGameInfo.FunGame FunGameType) { switch (FunGameType) { - case FunGameEnum.FunGame.FunGame_Core: - case FunGameEnum.FunGame.FunGame_Core_Api: - case FunGameEnum.FunGame.FunGame_Console: - case FunGameEnum.FunGame.FunGame_Desktop: + case FunGameInfo.FunGame.FunGame_Core: + case FunGameInfo.FunGame.FunGame_Core_Api: + case FunGameInfo.FunGame.FunGame_Console: + case FunGameInfo.FunGame.FunGame_Desktop: /** * Config */ @@ -77,7 +77,7 @@ namespace Milimoe.FunGame.Core.Api.Utility WriteINI("Account", "Password", ""); WriteINI("Account", "AutoKey", ""); break; - case FunGameEnum.FunGame.FunGame_Server: + case FunGameInfo.FunGame.FunGame_Server: /** * Server */ diff --git a/FunGame.Core/Entity/Character/Character.cs b/FunGame.Core/Entity/Character/Character.cs index 6b4b1f8..7e466de 100644 --- a/FunGame.Core/Entity/Character/Character.cs +++ b/FunGame.Core/Entity/Character/Character.cs @@ -13,15 +13,20 @@ namespace Milimoe.FunGame.Core.Entity public int Id { get; set; } public string Name { get; set; } = ""; public string FirstName { get; set; } = ""; + public string NickName { get; set; } = ""; public User? User { get; set; } = null; - public CharacterStatistics? Statistics { get; set; } = null; + public CharacterStatistics? Statistics { get; set; } = null; // 角色统计数据 public MagicType MagicType { get; set; } // 魔法属性 public RoleType FirstRoleType { get; set; } // 角色定位1 public RoleType SecondRoleType { get; set; } // 角色定位2 public RoleType ThirdRoleType { get; set; } // 角色定位3 + public RoleRating RoleRating { get; set; } // 角色评级 + public int Promotion { get; set; } // 晋升点数 public int Level { get; set; } = 1; public decimal EXP { get; set; } // 经验值 + public decimal BaseHP { get; set; } // 基础生命值 public decimal HP { get; set; } + public decimal BaseMP { get; set; } // 基础魔法值 public decimal MP { get; set; } public decimal EP { get; set; } public decimal BaseATK { get; set; } // 基础攻击力 @@ -30,10 +35,13 @@ namespace Milimoe.FunGame.Core.Entity public decimal PDR { get; set; } // Physical Damage Reduction 物理伤害减免 public decimal MDF { get; set; } // Magical Defence 魔法抗性 public decimal PhysicalPenetration { get; set; } // Physical Penetration 物理穿透 - public decimal MagicPenetration { get; set; } // Magical Penetration 魔法穿透 + public decimal MagicalPenetration { get; set; } // Magical Penetration 魔法穿透 public decimal HR { get; set; } = 0; // Health Regeneration 生命回复力 public decimal MR { get; set; } = 0; // Mana Regeneration 魔法回复力 public decimal ER { get; set; } = 0; // Eenergy Regeneration 能量回复力 + public decimal BaseSTR { get; set; } // 基础力量 + public decimal BaseAGI { get; set; } // 基础敏捷 + public decimal BaseINT { get; set; } // 基础智力 public decimal STR { get; set; } // Strength 力量 public decimal AGI { get; set; } // Agility 敏捷 public decimal INT { get; set; } // Intelligence 智力 diff --git a/FunGame.Core/Entity/Item/ActiveItem.cs b/FunGame.Core/Entity/Item/ActiveItem.cs index af49f23..0864712 100644 --- a/FunGame.Core/Entity/Item/ActiveItem.cs +++ b/FunGame.Core/Entity/Item/ActiveItem.cs @@ -1,8 +1,10 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Milimoe.FunGame.Core.Interface.Entity; namespace Milimoe.FunGame.Core.Entity { @@ -15,10 +17,18 @@ namespace Milimoe.FunGame.Core.Entity Active = true; } - internal ActiveItem(string Name) + internal ActiveItem(int id, string name) { Active = true; - this.Name = Name; + Id = id; + Name = name; + } + + public override bool Equals(IBaseEntity? other) + { + if (other != null && other.Guid == this.Guid) + return true; + else return false; } } } diff --git a/FunGame.Core/Entity/Item/Item.cs b/FunGame.Core/Entity/Item/Item.cs index 97a209e..0dcb855 100644 --- a/FunGame.Core/Entity/Item/Item.cs +++ b/FunGame.Core/Entity/Item/Item.cs @@ -1,20 +1,25 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Milimoe.FunGame.Core.Interface.Entity; namespace Milimoe.FunGame.Core.Entity { - public abstract class Item + public abstract class Item : BaseEntity, IItem { - public int Id { get; set; } - public string Name { get; set; } = ""; public string Describe { get; set; } = ""; public decimal Price { get; set; } public char Key { get; set; } public bool Active { get; set; } public bool Enable { get; set; } public Character? Character { get; set; } = null; + + public override IEnumerator GetEnumerator() + { + return GetEnumerator(); + } } } diff --git a/FunGame.Core/Entity/Item/PassiveItem.cs b/FunGame.Core/Entity/Item/PassiveItem.cs index b10a3d4..204dc3f 100644 --- a/FunGame.Core/Entity/Item/PassiveItem.cs +++ b/FunGame.Core/Entity/Item/PassiveItem.cs @@ -1,4 +1,6 @@ -using System; +using Milimoe.FunGame.Core.Interface.Entity; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -15,10 +17,18 @@ namespace Milimoe.FunGame.Core.Entity Active = false; } - internal PassiveItem(string Name) + internal PassiveItem(int id, string name) { Active = false; - this.Name = Name; + Id = id; + Name = name; + } + + public override bool Equals(IBaseEntity? other) + { + if (other != null && other.Guid == this.Guid) + return true; + else return false; } } } diff --git a/FunGame.Core/Interface/Entity/BaseEntity.cs b/FunGame.Core/Interface/Entity/BaseEntity.cs new file mode 100644 index 0000000..5c691f2 --- /dev/null +++ b/FunGame.Core/Interface/Entity/BaseEntity.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public abstract class BaseEntity : IBaseEntity + { + public int Id { get; set; } = 0; + public Guid Guid { get; set; } = Guid.Empty; + public string Name { get; set; } = ""; + + public abstract bool Equals(IBaseEntity? other); + public abstract IEnumerator GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/FunGame.Core/Interface/Entity/IActiveEnable.cs b/FunGame.Core/Interface/Entity/IActiveEnable.cs new file mode 100644 index 0000000..2a9370a --- /dev/null +++ b/FunGame.Core/Interface/Entity/IActiveEnable.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface IActiveEnable + { + public bool Active { get; set; } + public bool Enable { get; set; } + } +} diff --git a/FunGame.Core/Interface/Entity/IBaseEntity.cs b/FunGame.Core/Interface/Entity/IBaseEntity.cs new file mode 100644 index 0000000..acd3b6f --- /dev/null +++ b/FunGame.Core/Interface/Entity/IBaseEntity.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface IBaseEntity : IEquatable, IEnumerable + { + public int Id { get; } + public Guid Guid { get; } + public string Name { get; } + } +} diff --git a/FunGame.Core/Interface/Entity/ICharacter.cs b/FunGame.Core/Interface/Entity/ICharacter.cs new file mode 100644 index 0000000..2f30dc0 --- /dev/null +++ b/FunGame.Core/Interface/Entity/ICharacter.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface ICharacter + { + public string FirstName { get; set; } + public string NickName { get; set; } + } +} diff --git a/FunGame.Core/Interface/Entity/IItem.cs b/FunGame.Core/Interface/Entity/IItem.cs new file mode 100644 index 0000000..cca2b73 --- /dev/null +++ b/FunGame.Core/Interface/Entity/IItem.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface IItem : IActiveEnable, IRelateCharacter + { + public string Describe { get; set; } + public decimal Price { get; set; } + public char Key { get; set; } + } +} diff --git a/FunGame.Core/Interface/Entity/Relationship/IRelateCharacter.cs b/FunGame.Core/Interface/Entity/Relationship/IRelateCharacter.cs new file mode 100644 index 0000000..de0f4c0 --- /dev/null +++ b/FunGame.Core/Interface/Entity/Relationship/IRelateCharacter.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface IRelateCharacter + { + public Character? Character { get; set; } + } +} diff --git a/FunGame.Core/Interface/Entity/Relationship/IRelateUser.cs b/FunGame.Core/Interface/Entity/Relationship/IRelateUser.cs new file mode 100644 index 0000000..a4e5538 --- /dev/null +++ b/FunGame.Core/Interface/Entity/Relationship/IRelateUser.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Core.Interface.Entity +{ + public interface IRelateUser + { + public User? User { get; set; } + } +} diff --git a/FunGame.Core/Library/Constant/FunGameEnum.cs b/FunGame.Core/Library/Constant/FunGameInfo.cs similarity index 94% rename from FunGame.Core/Library/Constant/FunGameEnum.cs rename to FunGame.Core/Library/Constant/FunGameInfo.cs index 836ccd9..40d3430 100644 --- a/FunGame.Core/Library/Constant/FunGameEnum.cs +++ b/FunGame.Core/Library/Constant/FunGameInfo.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Library.Constant { - public class FunGameEnum + public class FunGameInfo { public enum FunGame { @@ -37,7 +37,7 @@ namespace Milimoe.FunGame.Core.Library.Constant FunGame.FunGame_Server => FunGame_Server, _ => "" }; - return type + " [ 版本: " + FunGame_Version + FunGame_VersionPatch + " ]\n" + (type.Equals(FunGame_Desktop) ? "©" : "(C)") + "2022 Mili.cyou. 保留所有权利\n"; + return type + " [ 版本: " + FunGame_Version + FunGame_VersionPatch + " ]\n" + (type.Equals(FunGame_Desktop) ? "©" : "(C)") + "2023 Mili.cyou. 保留所有权利\n"; } /** diff --git a/FunGame.Core/Library/Constant/TypeEnum.cs b/FunGame.Core/Library/Constant/TypeEnum.cs index 4ec3ec3..72d6b03 100644 --- a/FunGame.Core/Library/Constant/TypeEnum.cs +++ b/FunGame.Core/Library/Constant/TypeEnum.cs @@ -151,13 +151,26 @@ namespace Milimoe.FunGame.Core.Library.Constant public enum MagicType { - + Starmark, + PurityNatural, + PurityContemporary, + Light, + Shadow, + Element, + Fleabane, + Particle } + public enum RoleType { - + Core, + Guardian, + Vanguard, + Logistics, + Assistant } - public enum CharacterRankType + + public enum RoleRating { X, S, @@ -168,6 +181,7 @@ namespace Milimoe.FunGame.Core.Library.Constant D, E } + public enum ItemRankType { X, @@ -179,6 +193,7 @@ namespace Milimoe.FunGame.Core.Library.Constant C, D } + public enum ItemQualityType { White, @@ -188,6 +203,7 @@ namespace Milimoe.FunGame.Core.Library.Constant Orange, Red } + public enum ItemRarityType { OneStar, diff --git a/FunGame.Desktop/Others/Constant.cs b/FunGame.Desktop/Others/Constant.cs index f39a6cf..d3ffbae 100644 --- a/FunGame.Desktop/Others/Constant.cs +++ b/FunGame.Desktop/Others/Constant.cs @@ -33,7 +33,7 @@ namespace Milimoe.FunGame.Desktop.Others /** * Game Configs */ - public static int FunGameType { get; } = (int)FunGameEnum.FunGame.FunGame_Desktop; + public static int FunGameType { get; } = (int)FunGameInfo.FunGame.FunGame_Desktop; /** * Socket Configs diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index c37c93b..86824ea 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -293,7 +293,7 @@ namespace Milimoe.FunGame.Desktop.UI } else { - INIHelper.Init((FunGameEnum.FunGame)Others.Constant.FunGameType); + INIHelper.Init((FunGameInfo.FunGame)Others.Constant.FunGameType); WritelnGameInfo(">> 首次启动,已自动为你创建配置文件。"); GetFunGameConfig(); } @@ -787,7 +787,7 @@ namespace Milimoe.FunGame.Desktop.UI /// private void ShowFunGameInfo() { - WritelnGameInfo(FunGameEnum.GetInfo((FunGameEnum.FunGame)Others.Constant.FunGameType)); + WritelnGameInfo(FunGameInfo.GetInfo((FunGameInfo.FunGame)Others.Constant.FunGameType)); } #endregion