private void SetRewardItem(List <DropItem> itemList)
    {
        this.Items.Clear();
        this.Item2s.Clear();
        if (itemList == null)
        {
            return;
        }
        int num = itemList.get_Count() / 2;

        for (int i = 0; i < itemList.get_Count(); i++)
        {
            int   typeId             = itemList.get_Item(i).typeId;
            long  count              = itemList.get_Item(i).count;
            Items item               = BackpackManager.Instance.GetItem(typeId);
            OOBattlePassUIDropItem o = new OOBattlePassUIDropItem
            {
                ItemId  = item.id,
                Icon    = GameDataUtils.GetIcon(item.icon),
                IconBg  = GameDataUtils.GetItemFrame(item.id),
                GoodNum = count.ToString()
            };
            if (itemList.get_Count() <= 4)
            {
                this.Items.Add(o);
            }
            else if (i < num)
            {
                this.Items.Add(o);
            }
            else
            {
                this.Item2s.Add(o);
            }
        }
    }
    protected void SetRewardItem(List <KeyValuePair <int, long> > item)
    {
        this.Items.Clear();
        this.Item2s.Clear();
        if (item == null)
        {
            return;
        }
        int num = item.get_Count() / 2;

        for (int i = 0; i < item.get_Count(); i++)
        {
            int   key   = item.get_Item(i).get_Key();
            long  value = item.get_Item(i).get_Value();
            Items item2 = BackpackManager.Instance.GetItem(key);
            OOBattlePassUIDropItem o = new OOBattlePassUIDropItem
            {
                ItemId  = item2.id,
                Icon    = GameDataUtils.GetIcon(item2.icon),
                IconBg  = GameDataUtils.GetItemFrame(item2.id),
                GoodNum = value.ToString()
            };
            if (item.get_Count() <= 4)
            {
                this.Items.Add(o);
            }
            else if (i < num)
            {
                this.Items.Add(o);
            }
            else
            {
                this.Item2s.Add(o);
            }
        }
    }
Beispiel #3
0
    private void SetDropItems()
    {
        this.Items.Clear();
        this.Item2s.Clear();
        this.ObtainCoins = 0L;
        this.ObtainExps  = 0L;
        List <ItemBriefInfo> dropGoods = GlobalManager.Instance.DropGoods;

        if (dropGoods == null)
        {
            return;
        }
        List <ItemBriefInfo> list = new List <ItemBriefInfo>();

        for (int i = 0; i < dropGoods.get_Count(); i++)
        {
            int   cfgId = dropGoods.get_Item(i).cfgId;
            long  count = dropGoods.get_Item(i).count;
            Items item  = BackpackManager.Instance.GetItem(cfgId);
            if (item != null)
            {
                if (item.secondType == 15)
                {
                    this.ObtainCoins = count;
                }
                else if (item.secondType == 16)
                {
                    this.ObtainExps = count;
                }
                else
                {
                    list.Add(dropGoods.get_Item(i));
                }
            }
        }
        int num = list.get_Count() / 2;

        for (int j = 0; j < list.get_Count(); j++)
        {
            int   cfgId2             = list.get_Item(j).cfgId;
            long  count2             = list.get_Item(j).count;
            Items item2              = BackpackManager.Instance.GetItem(cfgId2);
            OOBattlePassUIDropItem o = new OOBattlePassUIDropItem
            {
                ItemId  = item2.id,
                Icon    = GameDataUtils.GetIcon(item2.icon),
                IconBg  = GameDataUtils.GetItemFrame(item2.id),
                GoodNum = count2.ToString()
            };
            if (list.get_Count() <= 4)
            {
                this.Items.Add(o);
            }
            else if (j < num)
            {
                this.Items.Add(o);
            }
            else
            {
                this.Item2s.Add(o);
            }
        }
    }