Ejemplo n.º 1
0
 public void SetItem(List <KeyValuePair <int, long> > allItems, string nullText = "")
 {
     if (allItems == null || allItems.get_Count() == 0)
     {
         if (!this.BattleBackpackUISRTip.get_gameObject().get_activeSelf())
         {
             this.BattleBackpackUISRTip.get_gameObject().SetActive(true);
         }
         this.BattleBackpackUISRTip.set_text(nullText);
     }
     else
     {
         if (this.BattleBackpackUISRTip.get_gameObject().get_activeSelf())
         {
             this.BattleBackpackUISRTip.get_gameObject().SetActive(false);
         }
         int num = (allItems.get_Count() >= 20) ? ((allItems.get_Count() % 5 != 0) ? ((allItems.get_Count() / 5 + 1) * 5) : allItems.get_Count()) : 20;
         this.listPool.Create(num, delegate(int index)
         {
             if (index < this.listPool.Items.get_Count())
             {
                 BattleBackpackItemUnit component = this.listPool.Items.get_Item(index).GetComponent <BattleBackpackItemUnit>();
                 if (index < allItems.get_Count())
                 {
                     component.SetData(index, true, allItems.get_Item(index).get_Key(), allItems.get_Item(index).get_Value(), string.Empty);
                 }
                 else
                 {
                     component.SetData(index, true, 0, 0L, string.Empty);
                 }
             }
         });
     }
 }
Ejemplo n.º 2
0
    public void SetItem(List <KeyValuePair <int, long> > allItems, XDict <int, int> lockInfo, string nullText = "")
    {
        int num         = (EntityWorld.Instance.EntSelf != null) ? EntityWorld.Instance.EntSelf.VipLv : 2147483647;
        int unlockCount = 0;

        for (int i = 0; i < lockInfo.Count; i++)
        {
            if (num >= lockInfo.Keys.get_Item(i))
            {
                unlockCount = lockInfo.Values.get_Item(i);
            }
        }
        int allGridCount = lockInfo.Values.get_Item(lockInfo.Count - 1);

        if (allGridCount == 0)
        {
            if (!this.BattleBackpackUISRTip.get_gameObject().get_activeSelf())
            {
                this.BattleBackpackUISRTip.get_gameObject().SetActive(true);
            }
            this.BattleBackpackUISRTip.set_text(nullText);
        }
        else
        {
            if (this.BattleBackpackUISRTip.get_gameObject().get_activeSelf())
            {
                this.BattleBackpackUISRTip.get_gameObject().SetActive(false);
            }
            this.listPool.Create(allGridCount, delegate(int index)
            {
                if (index < this.listPool.Items.get_Count() && index < allGridCount)
                {
                    BattleBackpackItemUnit component = this.listPool.Items.get_Item(index).GetComponent <BattleBackpackItemUnit>();
                    if (index < unlockCount)
                    {
                        if (index < allItems.get_Count())
                        {
                            component.SetData(index, true, allItems.get_Item(index).get_Key(), allItems.get_Item(index).get_Value(), string.Empty);
                        }
                        else
                        {
                            component.SetData(index, true, 0, 0L, string.Empty);
                        }
                    }
                    else
                    {
                        for (int j = lockInfo.Count - 1; j >= 0; j--)
                        {
                            if (index >= lockInfo.Values.get_Item(j))
                            {
                                if (j == lockInfo.Count - 1)
                                {
                                    Debug.LogError("Logic Error!!!");
                                }
                                else
                                {
                                    component.SetData(index, false, 0, 0L, string.Format(GameDataUtils.GetChineseContent(511613, false), lockInfo.Keys.get_Item(j + 1)));
                                }
                                break;
                            }
                        }
                    }
                }
            });
        }
    }