diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs
index 497fab66a88eecfb764d1b94abfdf66e63bf868f..84992e99ca3ec243219e5733e0a59a7ce7d8e971 100644
--- a/Engine/CLEngine.Core/framework/ItemObject.cs
+++ b/Engine/CLEngine.Core/framework/ItemObject.cs
@@ -4,6 +4,9 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
+using System.Collections;
+using Microsoft.Xna.Framework.Graphics;
+using System.IO;
namespace CLEngine.Core.framework
{
@@ -15,6 +18,10 @@ namespace CLEngine.Core.framework
userId = user;
}
}
+#if WIN
+ [Serializable]
+#endif
+ [DataContract]
public class ItemObject
{
///
@@ -52,6 +59,8 @@ namespace CLEngine.Core.framework
[DataMember] private int _addHeroMp;
[DataMember] private int _addReturnHp;//回血
[DataMember] private int _addReturnMp;//回蓝
+ [DataMember] private Dictionary customProp;
+ [NonSerialized] private Texture2D _texture;
///
/// 物品类型
///
@@ -67,7 +76,32 @@ namespace CLEngine.Core.framework
///
/// 物品图标路径
///
- public string IconPath { get { return _iconPath; } set { _iconPath = value; } }
+ public string IconPath {
+ get { return _iconPath; }
+ set {
+ _iconPath = value;
+ if (string.IsNullOrEmpty(_iconPath))
+ {
+ IconTex = null;
+ }
+ else if (File.Exists(_iconPath))
+ {
+ IconTex = TextureLoader.FromContent(_iconPath);
+ }
+ else
+ {
+ throw new Exception("文件"+_iconPath+"不存在");
+ }
+ }
+ }
+ ///
+ /// 图标图片
+ ///
+ public Texture2D IconTex
+ {
+ get { return _texture; }
+ set { _texture = value; }
+ }
///
/// 持有者id
///
@@ -121,6 +155,28 @@ namespace CLEngine.Core.framework
///
public int AddReturnMp { get { return _addReturnMp; } set { _addReturnMp = value; } }
///
+ /// 设置自定义值
+ ///
+ ///
+ ///
+ public void SetcustomProp(string name, object customprop)
+ {
+ if (customProp.ContainsKey(name))
+ {
+ throw new Exception("自定义值" + name + "不允许重复");
+ }
+ customProp[name] = customprop;
+ }
+ ///
+ /// 获取自定义值
+ ///
+ ///
+ ///
+ public object GetcustomProp(string name)
+ {
+ return customProp[name];
+ }
+ ///
/// 使用物品
///
public void UseItem()