private void HandleUseItemFeedback(byte[] data)
        {
            UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal);
            UseItemS2C feedback = ProtobufUtils.Deserialize <UseItemS2C>(data);

            if (feedback.result)
            {
                PlayerBagInfo bagInfo = DataManager.GetInstance().GetPlayerBag(useItemType);
                ItemInfo      item    = bagInfo.itemList.Find(p => p.itemId == useItemId);
                if (item.count <= useItemCount)
                {
                    bagInfo.itemList.Remove(item);
                }
                else
                {
                    item.count -= useItemCount;
                }
            }
        }
示例#2
0
        private void HandleUseItemFeedback(byte[] data)
        {
            UseItemS2C feedback = ProtobufUtils.Deserialize <UseItemS2C>(data);

            if (feedback.result)
            {
                PlayerBagInfo bagInfo = DataManager.GetInstance().GetPlayerBag(currentBagType);
                ItemInfo      item    = bagInfo.itemList.Find(p => p.itemId == currentItemId);
                if (item.count <= currentCount)
                {
                    bagInfo.itemList.Remove(item);
                }
                else
                {
                    item.count -= currentCount;
                }

                view.RefreshBagItem();
            }
        }