添加部分定义和接口

This commit is contained in:
Mili 2023-02-14 00:27:39 +08:00
parent 3e86bf15e8
commit acc6417370
17 changed files with 188 additions and 27 deletions

View File

@ -9,16 +9,16 @@ namespace Milimoe.FunGame.Core.Api.Factory
{ {
internal class ItemFactory 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; Milimoe.FunGame.Core.Entity.Item? item = null;
switch (type) switch (type)
{ {
case ItemType.Active: case ItemType.Active:
item = new Milimoe.FunGame.Core.Entity.ActiveItem(Name); item = new Milimoe.FunGame.Core.Entity.ActiveItem(id, name);
break; break;
case ItemType.Passive: case ItemType.Passive:
item = new Milimoe.FunGame.Core.Entity.PassiveItem(Name); item = new Milimoe.FunGame.Core.Entity.PassiveItem(id, name);
break; break;
} }
return item; return item;

View File

@ -57,14 +57,14 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// <summary> /// <summary>
/// 初始化ini模板文件 /// 初始化ini模板文件
/// </summary> /// </summary>
public static void Init(FunGameEnum.FunGame FunGameType) public static void Init(FunGameInfo.FunGame FunGameType)
{ {
switch (FunGameType) switch (FunGameType)
{ {
case FunGameEnum.FunGame.FunGame_Core: case FunGameInfo.FunGame.FunGame_Core:
case FunGameEnum.FunGame.FunGame_Core_Api: case FunGameInfo.FunGame.FunGame_Core_Api:
case FunGameEnum.FunGame.FunGame_Console: case FunGameInfo.FunGame.FunGame_Console:
case FunGameEnum.FunGame.FunGame_Desktop: case FunGameInfo.FunGame.FunGame_Desktop:
/** /**
* Config * Config
*/ */
@ -77,7 +77,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
WriteINI("Account", "Password", ""); WriteINI("Account", "Password", "");
WriteINI("Account", "AutoKey", ""); WriteINI("Account", "AutoKey", "");
break; break;
case FunGameEnum.FunGame.FunGame_Server: case FunGameInfo.FunGame.FunGame_Server:
/** /**
* Server * Server
*/ */

View File

@ -13,15 +13,20 @@ namespace Milimoe.FunGame.Core.Entity
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } = ""; public string Name { get; set; } = "";
public string FirstName { get; set; } = ""; public string FirstName { get; set; } = "";
public string NickName { get; set; } = "";
public User? User { get; set; } = null; public User? User { get; set; } = null;
public CharacterStatistics? Statistics { get; set; } = null; public CharacterStatistics? Statistics { get; set; } = null; // 角色统计数据
public MagicType MagicType { get; set; } // 魔法属性 public MagicType MagicType { get; set; } // 魔法属性
public RoleType FirstRoleType { get; set; } // 角色定位1 public RoleType FirstRoleType { get; set; } // 角色定位1
public RoleType SecondRoleType { get; set; } // 角色定位2 public RoleType SecondRoleType { get; set; } // 角色定位2
public RoleType ThirdRoleType { get; set; } // 角色定位3 public RoleType ThirdRoleType { get; set; } // 角色定位3
public RoleRating RoleRating { get; set; } // 角色评级
public int Promotion { get; set; } // 晋升点数
public int Level { get; set; } = 1; public int Level { get; set; } = 1;
public decimal EXP { get; set; } // 经验值 public decimal EXP { get; set; } // 经验值
public decimal BaseHP { get; set; } // 基础生命值
public decimal HP { get; set; } public decimal HP { get; set; }
public decimal BaseMP { get; set; } // 基础魔法值
public decimal MP { get; set; } public decimal MP { get; set; }
public decimal EP { get; set; } public decimal EP { get; set; }
public decimal BaseATK { 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 PDR { get; set; } // Physical Damage Reduction 物理伤害减免
public decimal MDF { get; set; } // Magical Defence 魔法抗性 public decimal MDF { get; set; } // Magical Defence 魔法抗性
public decimal PhysicalPenetration { get; set; } // Physical Penetration 物理穿透 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 HR { get; set; } = 0; // Health Regeneration 生命回复力
public decimal MR { get; set; } = 0; // Mana Regeneration 魔法回复力 public decimal MR { get; set; } = 0; // Mana Regeneration 魔法回复力
public decimal ER { get; set; } = 0; // Eenergy 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 STR { get; set; } // Strength 力量
public decimal AGI { get; set; } // Agility 敏捷 public decimal AGI { get; set; } // Agility 敏捷
public decimal INT { get; set; } // Intelligence 智力 public decimal INT { get; set; } // Intelligence 智力

View File

@ -1,8 +1,10 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Milimoe.FunGame.Core.Interface.Entity;
namespace Milimoe.FunGame.Core.Entity namespace Milimoe.FunGame.Core.Entity
{ {
@ -15,10 +17,18 @@ namespace Milimoe.FunGame.Core.Entity
Active = true; Active = true;
} }
internal ActiveItem(string Name) internal ActiveItem(int id, string name)
{ {
Active = true; 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;
} }
} }
} }

View File

@ -1,20 +1,25 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Milimoe.FunGame.Core.Interface.Entity;
namespace Milimoe.FunGame.Core.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 string Describe { get; set; } = "";
public decimal Price { get; set; } public decimal Price { get; set; }
public char Key { get; set; } public char Key { get; set; }
public bool Active { get; set; } public bool Active { get; set; }
public bool Enable { get; set; } public bool Enable { get; set; }
public Character? Character { get; set; } = null; public Character? Character { get; set; } = null;
public override IEnumerator<IEnumerable> GetEnumerator()
{
return GetEnumerator();
}
} }
} }

View File

@ -1,4 +1,6 @@
using System; using Milimoe.FunGame.Core.Interface.Entity;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -15,10 +17,18 @@ namespace Milimoe.FunGame.Core.Entity
Active = false; Active = false;
} }
internal PassiveItem(string Name) internal PassiveItem(int id, string name)
{ {
Active = false; 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;
} }
} }
} }

View File

@ -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<IEnumerable> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@ -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; }
}
}

View File

@ -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<IBaseEntity>, IEnumerable<IEnumerable>
{
public int Id { get; }
public Guid Guid { get; }
public string Name { get; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Milimoe.FunGame.Core.Library.Constant namespace Milimoe.FunGame.Core.Library.Constant
{ {
public class FunGameEnum public class FunGameInfo
{ {
public enum FunGame public enum FunGame
{ {
@ -37,7 +37,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
FunGame.FunGame_Server => FunGame_Server, 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";
} }
/** /**

View File

@ -151,13 +151,26 @@ namespace Milimoe.FunGame.Core.Library.Constant
public enum MagicType public enum MagicType
{ {
Starmark,
PurityNatural,
PurityContemporary,
Light,
Shadow,
Element,
Fleabane,
Particle
} }
public enum RoleType public enum RoleType
{ {
Core,
Guardian,
Vanguard,
Logistics,
Assistant
} }
public enum CharacterRankType
public enum RoleRating
{ {
X, X,
S, S,
@ -168,6 +181,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
D, D,
E E
} }
public enum ItemRankType public enum ItemRankType
{ {
X, X,
@ -179,6 +193,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
C, C,
D D
} }
public enum ItemQualityType public enum ItemQualityType
{ {
White, White,
@ -188,6 +203,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
Orange, Orange,
Red Red
} }
public enum ItemRarityType public enum ItemRarityType
{ {
OneStar, OneStar,

View File

@ -33,7 +33,7 @@ namespace Milimoe.FunGame.Desktop.Others
/** /**
* Game Configs * Game Configs
*/ */
public static int FunGameType { get; } = (int)FunGameEnum.FunGame.FunGame_Desktop; public static int FunGameType { get; } = (int)FunGameInfo.FunGame.FunGame_Desktop;
/** /**
* Socket Configs * Socket Configs

View File

@ -293,7 +293,7 @@ namespace Milimoe.FunGame.Desktop.UI
} }
else else
{ {
INIHelper.Init((FunGameEnum.FunGame)Others.Constant.FunGameType); INIHelper.Init((FunGameInfo.FunGame)Others.Constant.FunGameType);
WritelnGameInfo(">> 首次启动,已自动为你创建配置文件。"); WritelnGameInfo(">> 首次启动,已自动为你创建配置文件。");
GetFunGameConfig(); GetFunGameConfig();
} }
@ -787,7 +787,7 @@ namespace Milimoe.FunGame.Desktop.UI
/// </summary> /// </summary>
private void ShowFunGameInfo() private void ShowFunGameInfo()
{ {
WritelnGameInfo(FunGameEnum.GetInfo((FunGameEnum.FunGame)Others.Constant.FunGameType)); WritelnGameInfo(FunGameInfo.GetInfo((FunGameInfo.FunGame)Others.Constant.FunGameType));
} }
#endregion #endregion