public bool GetConsumeGiftPoint()
    {
        bool result = false;
        Ac   aC     = this.GetAC(Ac.AcType.Type.Cost);

        if (aC == null || aC.acItemInfo == null)
        {
            return(result);
        }
        List <AcItemInfo> acItemInfo = aC.acItemInfo;

        acItemInfo.Sort(new Comparison <AcItemInfo>(ConsumeRechargeManager.SortCompare));
        int num   = -1;
        int count = acItemInfo.get_Count();

        if (acItemInfo.get_Item(0).status == 2)
        {
            num = acItemInfo.get_Item(0).targetVal;
        }
        else
        {
            for (int i = count - 1; i >= 0; i--)
            {
                if (acItemInfo.get_Item(i).status != 2)
                {
                    num = acItemInfo.get_Item(i).targetVal;
                    break;
                }
            }
        }
        if (num == -1)
        {
            return(result);
        }
        AcItemInfo acItemInfo2 = null;

        for (int j = 0; j < acItemInfo.get_Count(); j++)
        {
            if (acItemInfo.get_Item(j).targetVal == num)
            {
                acItemInfo2 = acItemInfo.get_Item(j);
                break;
            }
        }
        if (acItemInfo2.status == 1)
        {
            result = true;
        }
        return(result);
    }
    public static int SortCompare(AcItemInfo ac1, AcItemInfo ac2)
    {
        int result = 0;

        if (ac1.targetVal > ac2.targetVal)
        {
            result = -1;
        }
        else if (ac1.targetVal < ac2.targetVal)
        {
            result = 1;
        }
        return(result);
    }
Example #3
0
    public void ShowRewardList(int targetValue)
    {
        AcItemInfo acItemInfo = null;

        for (int i = 0; i < this.boxListInfo.get_Count(); i++)
        {
            if (this.boxListInfo.get_Item(i).targetVal == targetValue)
            {
                acItemInfo = this.boxListInfo.get_Item(i);
                break;
            }
        }
        if (acItemInfo == null)
        {
            Debug.LogError("Thers is no exist targetValue:" + targetValue);
            return;
        }
        this.ClearRewardItems();
        this.SetBtnGet(acItemInfo.status, acItemInfo.targetVal);
        string text = acItemInfo.targetVal.ToString();

        this.conditionText.set_text("累计充值" + text + "钻石可获得奖励:");
        Vector2 sizeDelta = new Vector2((float)(105 * acItemInfo.items.get_Count()), 110f);

        this.rewardList.GetComponent <RectTransform>().set_sizeDelta(sizeDelta);
        for (int j = 0; j < acItemInfo.items.get_Count(); j++)
        {
            int        itemId             = acItemInfo.items.get_Item(j).itemCfgId;
            int        itemNum            = acItemInfo.items.get_Item(j).itemNum;
            GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("GiftRewardItem");
            this.RewardItems.Add(instantiate2Prefab);
            Transform transform = instantiate2Prefab.get_transform();
            transform.SetParent(this.rewardList.get_transform(), false);
            instantiate2Prefab.SetActive(true);
            ResourceManager.SetSprite(transform.FindChild("Frame").GetComponent <Image>(), GameDataUtils.GetItemFrame(itemId));
            ResourceManager.SetSprite(transform.FindChild("Icon").GetComponent <Image>(), GameDataUtils.GetItemIcon(itemId));
            transform.FindChild("Name").GetComponent <Text>().set_text(GameDataUtils.GetItemName(itemId, true, 0L));
            transform.FindChild("Num").GetComponent <Text>().set_text(itemNum.ToString());
            transform.GetComponent <ButtonCustom>().get_onClick().AddListener(delegate
            {
                this.OnClickItem(itemId);
            });
        }
    }