From 056764c7a410974e5d15a4f9fc8d9874445fc7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=94=E5=87=A4=E5=95=B8=E5=A4=A9?= <1379113792@qq.com> Date: Mon, 22 Jul 2019 12:44:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9Item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 6c1b7ae..bb0d8a1 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -105,11 +105,21 @@ namespace CLEngine.Core.framework [DataMember] private float _magicUseSpeed; [DataMember] private string _classification; [DataMember] private bool _onlyStoreOne; + [DataMember] private string _dropIconPath; [NonSerialized] private Image _guiIcon; [NonSerialized] private Texture2D _texture; + [NonSerialized] private Texture2D _dropIcon; private int _positionInBag; /// + /// 掉落图标路径 + /// + public string DropIconPath { get { return _dropIconPath; } set { _dropIconPath = value; } } + /// + /// 掉落图标 + /// + public Texture2D DropIcon { get { return _dropIcon; } set { _dropIcon = value; } } + /// /// 仓库唯一 /// public bool OnlyStoreOne { get { return _onlyStoreOne; } set { _onlyStoreOne = value; } } -- Gitee From 6bc07f99f8c30581ba8cd2b38f986689716b7289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=94=E5=87=A4=E5=95=B8=E5=A4=A9?= <1379113792@qq.com> Date: Mon, 22 Jul 2019 12:52:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 29 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index bb0d8a1..b361295 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -114,7 +114,30 @@ namespace CLEngine.Core.framework /// /// 掉落图标路径 /// - public string DropIconPath { get { return _dropIconPath; } set { _dropIconPath = value; } } + public string DropIconPath + { + get { return _dropIconPath; } + set + { + _dropIconPath = value; + if (string.IsNullOrEmpty(_dropIconPath)) + { + _dropIcon = null; + return; + } + var path = Path.Combine(SceneManager.GameProject.ProjectPath, _dropIconPath); + if (File.Exists(path)) + { + _dropIcon = TextureLoader.FromContent(_dropIconPath); + } + else + { + _dropIcon = null; + Console.WriteLine("文件" + _dropIconPath + "不存在"); + return; + } + } + } /// /// 掉落图标 /// @@ -285,7 +308,7 @@ namespace CLEngine.Core.framework } else { - throw new Exception("文件" + path + "不存在"); + Console.WriteLine("文件" + path + "不存在"); } } } @@ -374,7 +397,7 @@ namespace CLEngine.Core.framework { if (_customProp.ContainsKey(name)) { - throw new Exception("自定义值" + name + "不允许重复"); + Console.WriteLine("自定义值" + name + "不允许重复"); } _customProp[name] = customprop; } -- Gitee