Exemplo n.º 1
0
 private bool CheckItemEnough(List <NpcExchangeInfo> data)
 {
     for (int i = 0; i < data.get_Count(); i++)
     {
         int  cfgId = data.get_Item(i).cfgId;
         long num   = long.Parse(data.get_Item(i).count.ToString());
         long num2;
         if (cfgId == -1)
         {
             EquipParamInfo         equipParams       = data.get_Item(i).equipParams;
             List <EquipSimpleInfo> nPCShopEquipsData = EquipGlobal.GetNPCShopEquipsData(equipParams.step, equipParams.quality, equipParams.position, equipParams.betterQuality);
             num2 = long.Parse(nPCShopEquipsData.get_Count().ToString());
         }
         else
         {
             num2 = BackpackManager.Instance.OnGetGoodCount(cfgId);
         }
         if (num2 < num)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
    private void UpdateItemInfo(int i, NpcExchangeInfo itemData)
    {
        i++;
        string text = "ExchangeItem" + i.ToString();

        if (base.FindTransform("ExchangePanel").FindChild(text) != null)
        {
            Transform transform = base.FindTransform("ExchangePanel").FindChild(text);
            transform.get_gameObject().SetActive(true);
            transform.FindChild("SItemIcon").FindChild("ImageState1").get_gameObject().SetActive(false);
            transform.FindChild("SItemIcon").FindChild("ImageState2").get_gameObject().SetActive(false);
            transform.FindChild("SItemIcon").FindChild("ImageState3").get_gameObject().SetActive(false);
            int  num = itemData.cfgId;
            long num2;
            if (itemData.cfgId == -1)
            {
                EquipParamInfo         equipParams       = itemData.equipParams;
                List <EquipSimpleInfo> nPCShopEquipsData = EquipGlobal.GetNPCShopEquipsData(equipParams.step, equipParams.quality, equipParams.position, equipParams.betterQuality);
                num2 = long.Parse(nPCShopEquipsData.get_Count().ToString());
                if (num2 > 0L)
                {
                    num = int.Parse(nPCShopEquipsData.get_Item(0).equipId.ToString());
                }
                else
                {
                    List <zZhuangBeiPeiZhiBiao> dataList = DataReader <zZhuangBeiPeiZhiBiao> .DataList;
                    for (int j = 0; j < dataList.get_Count(); j++)
                    {
                        if (dataList.get_Item(j).occupation == EntityWorld.Instance.EntSelf.TypeID && dataList.get_Item(j).step == equipParams.step && dataList.get_Item(j).position == equipParams.position)
                        {
                            Items items = DataReader <Items> .Get(dataList.get_Item(j).id);

                            if (items != null && items.color == equipParams.quality)
                            {
                                num = dataList.get_Item(j).id;
                                break;
                            }
                        }
                    }
                }
            }
            else
            {
                num2 = BackpackManager.Instance.OnGetGoodCount(num);
            }
            string text2 = string.Format("({0}/{1})", itemData.count, num2);
            transform.FindChild("Count").GetComponent <Text>().set_text(text2);
            transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image1").get_gameObject().SetActive(false);
            transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image2").get_gameObject().SetActive(false);
            transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image3").get_gameObject().SetActive(false);
            if (num > 0)
            {
                Transform transform2 = transform.FindChild("SItemIcon").FindChild("SImageIcon").get_transform();
                if (transform2.get_childCount() > 0)
                {
                    for (int k = 0; k < transform2.get_childCount(); k++)
                    {
                        Object.Destroy(transform2.GetChild(k).get_gameObject());
                    }
                }
                ItemShow.ShowItem(transform2, num, -1L, false, null, 2001);
                if (itemData.equipParams != null)
                {
                    transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image1").get_gameObject().SetActive(itemData.equipParams.betterQuality >= 1);
                    transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image2").get_gameObject().SetActive(itemData.equipParams.betterQuality >= 2);
                    transform.FindChild("SItemIcon").FindChild("ExcellentAttrIconList").FindChild("Image3").get_gameObject().SetActive(itemData.equipParams.betterQuality >= 3);
                }
                transform.FindChild("SItemIcon").GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickBtnDetal);
            }
            this.UpdateItemIdData(text, num);
            if (num2 < (long)itemData.count)
            {
                transform.FindChild("SItemIcon").FindChild("ImageState1").get_gameObject().SetActive(true);
            }
            else
            {
                transform.FindChild("SItemIcon").FindChild("ImageState1").get_gameObject().SetActive(false);
            }
            transform.FindChild("SItemIcon").FindChild("ImageState2").get_gameObject().SetActive(false);
            transform.FindChild("SItemIcon").FindChild("ImageState3").get_gameObject().SetActive(false);
        }
    }
Exemplo n.º 3
0
    public void UpdateExchangeItem(NpcExchangeInfo itemData)
    {
        this.HideGY();
        this.IconItemId = itemData.cfgId;
        long num;

        if (itemData.cfgId == -1)
        {
            EquipParamInfo         equipParams       = itemData.equipParams;
            List <EquipSimpleInfo> nPCShopEquipsData = EquipGlobal.GetNPCShopEquipsData(equipParams.step, equipParams.quality, equipParams.position, equipParams.betterQuality);
            num = long.Parse(nPCShopEquipsData.get_Count().ToString());
            if (num > 0L)
            {
                this.IconItemId = int.Parse(nPCShopEquipsData.get_Item(0).equipId.ToString());
            }
            else
            {
                List <zZhuangBeiPeiZhiBiao> dataList = DataReader <zZhuangBeiPeiZhiBiao> .DataList;
                for (int i = 0; i < dataList.get_Count(); i++)
                {
                    if (dataList.get_Item(i).occupation == EntityWorld.Instance.EntSelf.TypeID && dataList.get_Item(i).step == equipParams.step && dataList.get_Item(i).position == equipParams.position)
                    {
                        Items items = DataReader <Items> .Get(dataList.get_Item(i).id);

                        if (items != null && items.color == equipParams.quality)
                        {
                            this.IconItemId = dataList.get_Item(i).id;
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            num = BackpackManager.Instance.OnGetGoodCount(this.IconItemId);
        }
        string text = "背包剩余:" + num.ToString();
        long   num2 = long.Parse(itemData.count.ToString());

        this.TextCount.set_text(text);
        this.TextNeedCount.set_text(itemData.count.ToString());
        this.TextReputation.set_text(string.Empty);
        if (this.IconItemId > 0)
        {
            for (int j = 0; j < this.ImgIconGameObject.get_childCount(); j++)
            {
                Object.Destroy(this.ImgIconGameObject.GetChild(j).get_gameObject());
            }
            GameObject gameObject = ItemShow.ShowItem(this.ImgIconGameObject, this.IconItemId, -1L, false, null, 2001);
            if (itemData.equipParams != null)
            {
                this.ShowGY(itemData.equipParams.betterQuality);
            }
            this.TextName.set_text(GameDataUtils.GetItemName(this.IconItemId, false, 0L));
        }
        this.IsCanClick = false;
        if (num < num2)
        {
            this.ImageState1.SetActive(true);
        }
        else
        {
            this.ImageState1.SetActive(false);
        }
        this.ImageState2.SetActive(false);
        this.ImageState3.SetActive(false);
    }