Example #1
0
    /// <summary>
    /// 刷新可能合成晶体
    /// </summary>
    /// <param name="notification"></param>
    private void GemRefresh(INotification notification)
    {
        if (GUIManager.HasView("gemcompoundpanel"))
        {
            int  type = GameConvert.IntConvert((notification.Body as List <object>)[0]);
            Item data = (notification.Body as List <object>)[1] as Item;
            Item item = GetListItemData(data);
            if (item == null)
            {
                return;
            }

            BagChangeType change_type = (BagChangeType)Enum.Parse(typeof(Equip_Pos), (type).ToString());

            ItemInfo info = ItemManager.GetItemInfo(item.itemID);
            if (info.tabType != (int)ItemType.Gem)
            {
                return;
            }
            if (item.amount < 3 || change_type == BagChangeType.Remove)
            {
                panel.chooseGrid.DeleteCustomData(item, true);
            }
            else if (change_type == BagChangeType.Update && item.amount > 2)
            {
                panel.chooseGrid.UpdateCustomData(item);
            }
            else if (change_type == BagChangeType.Add)
            {
                panel.chooseGrid.AddCustomData(item);
                panel.chooseGrid.UpdateCustomView();
            }
        }
    }
Example #2
0
    public void onGetItemInfo(Dictionary <string, object> list)
    {
        Item info = new Item();

        info.uuid   = list["UUID"].ToString();
        info.itemID = list["itemID"].ToString();
        info.amount = int.Parse(list["amount"].ToString());
        BagChangeType type = BagChangeType.Null;

        if (BagMediator.ItemList.ContainsKey(info.uuid))
        {
            if (info.amount == 0)
            {
                BagMediator.ItemList.Remove(info.uuid);
                type = BagChangeType.Remove;
            }
            else
            {
                BagMediator.ItemList[info.uuid] = info;
                type = BagChangeType.Update;
            }
        }
        else
        {
            BagMediator.ItemList.Add(info.uuid, info);
            type = BagChangeType.Add;
        }
        if (BagMediator.bagMediator != null)
        {
            BagMediator.bagMediator.UpdateBagSize();
        }

        //刷新背包装备数据
        ItemInfo item = ItemManager.GetItemInfo(info.itemID);

        if (item.tabType == (int)ItemType.Equip)
        {
            EquipProxy.Instance.GetquipList(0);
        }

        List <object> bag_data = new List <object>();

        bag_data.Add(type);
        bag_data.Add(info);

        Facade.SendNotification(NotificationID.BagRefresh, bag_data);
    }