From 2658041178af842ec062a78cb1a0f0baa0aeec74 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: Thu, 11 Jul 2019 09:52:15 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E6=96=B0=E5=A2=9Eissue=E5=AE=8C=E6=88=90?= =?UTF-8?q?+=E6=96=B0=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index dd9a07d..7bdab09 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; using System.IO; using Microsoft.Xna.Framework; +using FairyGUI; namespace CLEngine.Core.framework { @@ -58,6 +59,9 @@ namespace CLEngine.Core.framework [DataMember] private int _id; [DataMember] private int _number; [DataMember] private int _maxNumber; + [DataMember] private int _salePrice; + [DataMember] private int _buyPrice; + [DataMember] private string _quality; [DataMember] private int _hp; [DataMember] private int _maxHp; [DataMember] private int _addMoveSpeed; @@ -68,8 +72,35 @@ namespace CLEngine.Core.framework [DataMember] private int _addReturnHp; [DataMember] private int _addReturnMp; [DataMember] private Dictionary _customProp; + [DataMember] private Image _guiIcon; + [DataMember] private bool _isGuiShow; [NonSerialized] private Texture2D _texture; + private int _positionInBag; + /// + /// 物品品质 + /// + public string Quality { get { return _quality; } set { _quality = value; } } + /// + /// 购买价格 + /// + public int BuyPrice { get { return _buyPrice; } set { _buyPrice = value; } } + /// + /// 出售价格 + /// + public int SalePrice { get { return _salePrice; } set { _salePrice = value; } } + /// + /// 是否gui显示 + /// + public bool IsGuiShow { get { return _isGuiShow; } set { _isGuiShow = value; } } + /// + /// GUI中的图标 + /// + public Image GuiIcon { get { return _guiIcon; } set { _guiIcon = value; } } + /// + /// 在背包内的位置 + /// + public int PositionInBag { get { return _positionInBag; }set { _positionInBag = value; } } /// /// 物品类型 /// -- Gitee From 2b986158e2707014e4787bc53be508bad0805b93 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: Thu, 11 Jul 2019 09:56:36 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BE=E5=88=86?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 7bdab09..27e2848 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -59,7 +59,7 @@ namespace CLEngine.Core.framework [DataMember] private int _id; [DataMember] private int _number; [DataMember] private int _maxNumber; - [DataMember] private int _salePrice; + [DataMember] private float _salePercent; [DataMember] private int _buyPrice; [DataMember] private string _quality; [DataMember] private int _hp; @@ -88,7 +88,7 @@ namespace CLEngine.Core.framework /// /// 出售价格 /// - public int SalePrice { get { return _salePrice; } set { _salePrice = value; } } + public float SalePercent { get { return _salePercent; } set { _salePercent = value; } } /// /// 是否gui显示 /// -- Gitee From 5d0b67aa9f63d58030992c8c1f6385ba6ef2379a 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: Thu, 11 Jul 2019 09:57:22 +0800 Subject: [PATCH 03/15] --- Engine/CLEngine.Core/framework/ItemObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 27e2848..01102a3 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -86,7 +86,7 @@ namespace CLEngine.Core.framework /// public int BuyPrice { get { return _buyPrice; } set { _buyPrice = value; } } /// - /// 出售价格 + /// 出售价格折算比 /// public float SalePercent { get { return _salePercent; } set { _salePercent = value; } } /// -- Gitee From 6a8ace6ac8ac0b39d37865b465c6d69161b362cf 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: Thu, 11 Jul 2019 10:00:18 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 01102a3..447804f 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -272,7 +272,8 @@ namespace CLEngine.Core.framework if (NumberChange != null) { NumberChange.Invoke(this, new ItemEventArgs(userId)); - } - } + } + } + } } -- Gitee From a6e2163ab006ce400ebca2a6bcd93a5910217c22 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: Thu, 11 Jul 2019 10:06:50 +0800 Subject: [PATCH 05/15] --- Engine/CLEngine.Core/framework/ItemObject.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 447804f..c4c4e10 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -274,6 +274,8 @@ namespace CLEngine.Core.framework NumberChange.Invoke(this, new ItemEventArgs(userId)); } } - + public ItemObject(){ + SalePercent = 1f; + } } } -- Gitee From 27d8b8d4345b9ac1de39165d2f9d9c58b1f343aa 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: Thu, 11 Jul 2019 10:08:32 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 67 ++++++++++---------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index c4c4e10..2900e78 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -59,9 +59,9 @@ namespace CLEngine.Core.framework [DataMember] private int _id; [DataMember] private int _number; [DataMember] private int _maxNumber; - [DataMember] private float _salePercent; - [DataMember] private int _buyPrice; - [DataMember] private string _quality; + [DataMember] private float _salePercent; + [DataMember] private int _buyPrice; + [DataMember] private string _quality; [DataMember] private int _hp; [DataMember] private int _maxHp; [DataMember] private int _addMoveSpeed; @@ -72,35 +72,35 @@ namespace CLEngine.Core.framework [DataMember] private int _addReturnHp; [DataMember] private int _addReturnMp; [DataMember] private Dictionary _customProp; - [DataMember] private Image _guiIcon; - [DataMember] private bool _isGuiShow; + [DataMember] private Image _guiIcon; + [DataMember] private bool _isGuiShow; [NonSerialized] private Texture2D _texture; - private int _positionInBag; - /// - /// 物品品质 - /// - public string Quality { get { return _quality; } set { _quality = value; } } - /// - /// 购买价格 - /// - public int BuyPrice { get { return _buyPrice; } set { _buyPrice = value; } } - /// - /// 出售价格折算比 - /// - public float SalePercent { get { return _salePercent; } set { _salePercent = value; } } - /// - /// 是否gui显示 - /// - public bool IsGuiShow { get { return _isGuiShow; } set { _isGuiShow = value; } } - /// - /// GUI中的图标 - /// - public Image GuiIcon { get { return _guiIcon; } set { _guiIcon = value; } } - /// - /// 在背包内的位置 - /// - public int PositionInBag { get { return _positionInBag; }set { _positionInBag = value; } } + private int _positionInBag; + /// + /// 物品品质 + /// + public string Quality { get { return _quality; } set { _quality = value; } } + /// + /// 购买价格 + /// + public int BuyPrice { get { return _buyPrice; } set { _buyPrice = value; } } + /// + /// 出售价格折算比 + /// + public float SalePercent { get { return _salePercent; } set { _salePercent = value; } } + /// + /// 是否gui显示 + /// + public bool IsGuiShow { get { return _isGuiShow; } set { _isGuiShow = value; } } + /// + /// GUI中的图标 + /// + public Image GuiIcon { get { return _guiIcon; } set { _guiIcon = value; } } + /// + /// 在背包内的位置 + /// + public int PositionInBag { get { return _positionInBag; } set { _positionInBag = value; } } /// /// 物品类型 /// @@ -272,9 +272,10 @@ namespace CLEngine.Core.framework if (NumberChange != null) { NumberChange.Invoke(this, new ItemEventArgs(userId)); - } - } - public ItemObject(){ + } + } + public ItemObject() + { SalePercent = 1f; } } -- Gitee From 5f8fe110fd7ebfcecfb57cbbf2f5d80be4950a48 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: Thu, 11 Jul 2019 10:11:36 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=93=81=E8=B4=A8?= =?UTF-8?q?=E4=B8=BA=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 2900e78..cf586a3 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -61,7 +61,7 @@ namespace CLEngine.Core.framework [DataMember] private int _maxNumber; [DataMember] private float _salePercent; [DataMember] private int _buyPrice; - [DataMember] private string _quality; + [DataMember] private int _color; [DataMember] private int _hp; [DataMember] private int _maxHp; [DataMember] private int _addMoveSpeed; @@ -80,7 +80,7 @@ namespace CLEngine.Core.framework /// /// 物品品质 /// - public string Quality { get { return _quality; } set { _quality = value; } } + public int Color { get { return _color; } set { _color = value; } } /// /// 购买价格 /// -- Gitee From f8b111e5d001efba06d13876d701898d4ddac9f4 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: Thu, 11 Jul 2019 10:17:27 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index cf586a3..cde8dfd 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -61,7 +61,7 @@ namespace CLEngine.Core.framework [DataMember] private int _maxNumber; [DataMember] private float _salePercent; [DataMember] private int _buyPrice; - [DataMember] private int _color; + [DataMember] private Color _color; [DataMember] private int _hp; [DataMember] private int _maxHp; [DataMember] private int _addMoveSpeed; @@ -80,7 +80,7 @@ namespace CLEngine.Core.framework /// /// 物品品质 /// - public int Color { get { return _color; } set { _color = value; } } + public Color ItemColor { get { return _color; } set { _color = value; } } /// /// 购买价格 /// -- Gitee From f5e2e3481be635a61d7616bd69995072dc670c94 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: Thu, 11 Jul 2019 10:33:57 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=83=8C=E5=8C=85?= =?UTF-8?q?=E5=BD=92=E5=B1=9E=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 3 +++ Engine/CLEngine.Core/framework/ItemObject.cs | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 3e8bbd7..0c058e7 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -14,6 +14,7 @@ namespace CLEngine.Core.framework /// 全局物品 /// private static Dictionary _worldItem; + private static List _get; /// /// 全局物品Id /// @@ -69,5 +70,7 @@ namespace CLEngine.Core.framework throw new Exception(e.Message); } } + public static void GetItemByName(string name){ + } } } \ No newline at end of file diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index cde8dfd..25d45ab 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -57,6 +57,7 @@ namespace CLEngine.Core.framework [DataMember] private string _type; [DataMember] private int _userId; [DataMember] private int _id; + [DataMember] private string _belongBag; [DataMember] private int _number; [DataMember] private int _maxNumber; [DataMember] private float _salePercent; @@ -78,7 +79,11 @@ namespace CLEngine.Core.framework private int _positionInBag; /// - /// 物品品质 + /// 属于哪个背包(名) + /// + public string BelongBag{ get { return _belongBag; }set{ _belongBag = value; } } + /// + /// 物品颜色级别 /// public Color ItemColor { get { return _color; } set { _color = value; } } /// -- Gitee From f054f506c107dd5fbb8f4c27704f418b06e71202 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: Thu, 11 Jul 2019 11:02:37 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 4 ++-- Engine/CLEngine.Core/framework/ItemObject.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 0c058e7..ceb392d 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -14,7 +14,7 @@ namespace CLEngine.Core.framework /// 全局物品 /// private static Dictionary _worldItem; - private static List _get; + private static List _playerItem; /// /// 全局物品Id /// @@ -70,7 +70,7 @@ namespace CLEngine.Core.framework throw new Exception(e.Message); } } - public static void GetItemByName(string name){ + public static void FindItemByName(string name){ } } } \ No newline at end of file diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 25d45ab..794996a 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -53,6 +53,7 @@ namespace CLEngine.Core.framework [DataMember] private string _iconPath; [DataMember] private string _name; + [DataMember] private string _showName; [DataMember] private string _description; [DataMember] private string _type; [DataMember] private int _userId; @@ -78,6 +79,7 @@ namespace CLEngine.Core.framework [NonSerialized] private Texture2D _texture; private int _positionInBag; + public string ShowName { get { return _showName; } set { _showName = value; } } /// /// 属于哪个背包(名) /// -- Gitee From f10759fbdf7ec405004cdc234ce4b24edeff7c58 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: Thu, 11 Jul 2019 11:22:48 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E5=93=81?= =?UTF-8?q?=E6=9F=A5=E6=89=BE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 96 ++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index ceb392d..9da0fb4 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -70,7 +70,101 @@ namespace CLEngine.Core.framework throw new Exception(e.Message); } } - public static void FindItemByName(string name){ + /// + /// 世界物品中通过名称找物品 + /// + /// + /// + public static ItemObject WorldFindItemByName(string name){ + return _worldItem[name]; + } + /// + /// 世界物品中通过编号找物品 + /// + /// + /// + public static ItemObject WorldFindItemById(int id){ + foreach(var item in _worldItem){ + if(item.Value.Id==id){ + return item.Value; + } + } + return null; + } + /// + /// 背包中通过名字找物品,返回第一个找到的 + /// + /// + /// + public static ItemObject BagFindItemByName(string name){ + int max = _playerItem.Count; + ItemObject item; + for(int i=0;i + /// 背包中通过名字找物品,返回所有符合的物品 + /// + /// + /// + public static List BagFindItemListByName(string name) + { + int max = _playerItem.Count; + List itemlist=new List(); + ItemObject item; + for (int i = 0; i < max; i++) + { + item = _playerItem[i]; + if (item.Name == name) + { + itemlist.Add(item); + } + } + return itemlist; + } + /// + /// 背包中通过编号找物品,返回第一个找到的 + /// + /// + /// + public static ItemObject BagFindItemById(int id) + { + int max = _playerItem.Count; + ItemObject item; + for (int i = 0; i < max; i++) + { + item = _playerItem[i]; + if (item.Id == id) + { + return item; + } + } + return null; + } + /// + /// 背包中通过编号找物品,返回所有找到的 + /// + /// + /// + public static List BagFindItemListById(int id) + { + int max = _playerItem.Count; + List itemlist = new List(); + ItemObject item; + for (int i = 0; i < max; i++) + { + item = _playerItem[i]; + if (item.Id == id) + { + itemlist.Add(item); + } + } + return itemlist; } } } \ No newline at end of file -- Gitee From a88309b0030b40759400766c8702deb9451751b7 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: Thu, 11 Jul 2019 11:24:35 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 9da0fb4..6460ca7 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -14,6 +14,9 @@ namespace CLEngine.Core.framework /// 全局物品 /// private static Dictionary _worldItem; + /// + /// 玩家背包 + /// private static List _playerItem; /// /// 全局物品Id -- Gitee From 5f23b8477e88c3df566a7e4499531424ae49afb8 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: Thu, 11 Jul 2019 11:38:25 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 6460ca7..19afc7a 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -115,7 +115,7 @@ namespace CLEngine.Core.framework /// /// /// - public static List BagFindItemListByName(string name) + public static List BagFindAllItemByName(string name) { int max = _playerItem.Count; List itemlist=new List(); @@ -154,7 +154,7 @@ namespace CLEngine.Core.framework /// /// /// - public static List BagFindItemListById(int id) + public static List BagFindAllItemById(int id) { int max = _playerItem.Count; List itemlist = new List(); @@ -169,5 +169,8 @@ namespace CLEngine.Core.framework } return itemlist; } + public static void GetItemById(int id){ + + } } } \ No newline at end of file -- Gitee From 767a4f5277effad7330532d18060f265c86c9170 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: Thu, 11 Jul 2019 12:47:38 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 58 ++++++++++++++++++- Engine/CLEngine.Core/framework/ItemObject.cs | 2 +- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 19afc7a..2c5b8ee 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -169,8 +169,62 @@ namespace CLEngine.Core.framework } return itemlist; } - public static void GetItemById(int id){ - + /// + /// 拾取物品时以编号作为获取参数 + /// + /// + /// + public static void GetItemById(int id,int number){ + var onget = WorldFindItemById(id); + ItemObject item = null; + int max = _playerItem.Count; + bool is_finish = false; + for(int i=0;i + /// 拾取物品时以名称作为获取参数 + /// + /// + /// + public static void GetItemByName(string name, int number) + { + var onget = _worldItem[name]; + ItemObject item = null; + int max = _playerItem.Count; + bool is_finish = false; + for (int i = 0; i < max; i++) + { + item = _playerItem[i]; + if (item.Name == name) + { + if (item.Number + number <= item.MaxNumber) + { + item.Number += number; + is_finish = true; + break; + } + } + } + if (!is_finish) + { + onget.Number = number; + _playerItem.Add(onget); + } + onget.GetItem(); } } } \ No newline at end of file diff --git a/Engine/CLEngine.Core/framework/ItemObject.cs b/Engine/CLEngine.Core/framework/ItemObject.cs index 794996a..8076d19 100644 --- a/Engine/CLEngine.Core/framework/ItemObject.cs +++ b/Engine/CLEngine.Core/framework/ItemObject.cs @@ -254,7 +254,7 @@ namespace CLEngine.Core.framework /// /// 获取物品 /// - public void getItem() + public void GetItem() { if (Get != null) { -- Gitee From d9dd4519492edc6876c6f8f935cf80c79346b1a5 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: Thu, 11 Jul 2019 12:55:54 +0800 Subject: [PATCH 15/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Engine/CLEngine.Core/framework/ItemManager.cs | 52 ++++++++++++------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/Engine/CLEngine.Core/framework/ItemManager.cs b/Engine/CLEngine.Core/framework/ItemManager.cs index 2c5b8ee..2e15076 100644 --- a/Engine/CLEngine.Core/framework/ItemManager.cs +++ b/Engine/CLEngine.Core/framework/ItemManager.cs @@ -78,7 +78,8 @@ namespace CLEngine.Core.framework /// /// /// - public static ItemObject WorldFindItemByName(string name){ + public static ItemObject WorldFindItemByName(string name) + { return _worldItem[name]; } /// @@ -86,9 +87,12 @@ namespace CLEngine.Core.framework /// /// /// - public static ItemObject WorldFindItemById(int id){ - foreach(var item in _worldItem){ - if(item.Value.Id==id){ + public static ItemObject WorldFindItemById(int id) + { + foreach (var item in _worldItem) + { + if (item.Value.Id == id) + { return item.Value; } } @@ -99,12 +103,15 @@ namespace CLEngine.Core.framework /// /// /// - public static ItemObject BagFindItemByName(string name){ - int max = _playerItem.Count; + public static ItemObject BagFindItemByName(string name) + { + var max = _playerItem.Count; ItemObject item; - for(int i=0;i public static List BagFindAllItemByName(string name) { - int max = _playerItem.Count; - List itemlist=new List(); + var max = _playerItem.Count; + var itemlist = new List(); ItemObject item; for (int i = 0; i < max; i++) { @@ -137,7 +144,7 @@ namespace CLEngine.Core.framework /// public static ItemObject BagFindItemById(int id) { - int max = _playerItem.Count; + var max = _playerItem.Count; ItemObject item; for (int i = 0; i < max; i++) { @@ -156,8 +163,8 @@ namespace CLEngine.Core.framework /// public static List BagFindAllItemById(int id) { - int max = _playerItem.Count; - List itemlist = new List(); + var max = _playerItem.Count; + var itemlist = new List(); ItemObject item; for (int i = 0; i < max; i++) { @@ -174,22 +181,27 @@ namespace CLEngine.Core.framework /// /// /// - public static void GetItemById(int id,int number){ + public static void GetItemById(int id, int number) + { var onget = WorldFindItemById(id); ItemObject item = null; int max = _playerItem.Count; bool is_finish = false; - for(int i=0;i