diff --git a/Entity/Item/Item.cs b/Entity/Item/Item.cs
index 2e88668..83875dc 100644
--- a/Entity/Item/Item.cs
+++ b/Entity/Item/Item.cs
@@ -221,6 +221,15 @@ namespace Milimoe.FunGame.Core.Entity
internal Item() { }
+ ///
+ /// Id.Name
+ ///
+ ///
+ public string GetIdName()
+ {
+ return Id + "." + Name;
+ }
+
///
/// 显示物品的详细信息
///
diff --git a/Entity/Skill/Skill.cs b/Entity/Skill/Skill.cs
index 4969903..5576c6a 100644
--- a/Entity/Skill/Skill.cs
+++ b/Entity/Skill/Skill.cs
@@ -289,6 +289,15 @@ namespace Milimoe.FunGame.Core.Entity
return builder.ToString();
}
+ ///
+ /// Id.Name
+ ///
+ ///
+ public string GetIdName()
+ {
+ return Id + "." + Name;
+ }
+
///
/// 判断两个技能是否相同 检查Id.Name
///
diff --git a/Library/Common/Addon/Example/ExampleGameModule.cs b/Library/Common/Addon/Example/ExampleGameModule.cs
index 474ee80..3dee2f4 100644
--- a/Library/Common/Addon/Example/ExampleGameModule.cs
+++ b/Library/Common/Addon/Example/ExampleGameModule.cs
@@ -336,6 +336,12 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon.Example
return list;
}
}
+
+ public override Skill? GetSkill(long id, string name)
+ {
+ // 此方法将根据id和name,返回一个你继承实现了的类对象。
+ return Factory.GetSkill();
+ }
}
///
@@ -356,12 +362,15 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon.Example
get
{
List- list = [];
- Item i = Factory.GetItem();
- i.Name = "Example Item";
- i.Price = 20;
- list.Add(i);
+ // 物品应该在GameModule中新建类继承Item实现,再自行构造。
return list;
}
}
+
+ public override Item? GetItem(long id, string name)
+ {
+ // 此方法将根据id和name,返回一个你继承实现了的类对象。
+ return Factory.GetItem();
+ }
}
}
diff --git a/Library/Common/Addon/ItemModule.cs b/Library/Common/Addon/ItemModule.cs
index e79a6b1..0de6167 100644
--- a/Library/Common/Addon/ItemModule.cs
+++ b/Library/Common/Addon/ItemModule.cs
@@ -35,6 +35,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
///
private bool IsLoaded = false;
+ ///
+ /// 必须重写此方法,用于还原物品后获取还原详细信息
+ ///
+ ///
+ ///
+ ///
+ public abstract Item? GetItem(long id, string name);
+
///
/// 加载模组
///
diff --git a/Library/Common/Addon/SkillModule.cs b/Library/Common/Addon/SkillModule.cs
index 2292c5b..62f7da0 100644
--- a/Library/Common/Addon/SkillModule.cs
+++ b/Library/Common/Addon/SkillModule.cs
@@ -35,6 +35,14 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
///
private bool IsLoaded = false;
+ ///
+ /// 必须重写此方法,用于还原技能后获取还原详细信息
+ ///
+ ///
+ ///
+ ///
+ public abstract Skill? GetSkill(long id, string name);
+
///
/// 加载模组
///