示例#1
0
    public void Initialize(BeastEvolve beastEvo)
    {
        summonCardEvo   = beastEvo;
        cardImage.color = new Color(0.1f, 0.1f, 0.1f, 1);
        nextBeast       = summonCardEvo.getNextBeast();
        cardImage.gameObject.SetActive(true);
        ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.CARDIMAGEPATH, nextBeast, cardImage);
        sample = beastEvo.getExchangeBySids(nextBeast.sid);
        int moneyNum = UserManager.Instance.self.getMoney();

        conditionButton.textLabel.text = beastEvo.checkPremises(summonCardEvo);

        int index = 0;

        foreach (ExchangeCondition each in sample.conditions[0])
        {
            if (each.costType == PrizeType.PRIZE_MONEY)
            {
                needMoney.text = each.num.ToString();
                userMoney.text = (moneyNum < each.num ? Colors.RED : "") + moneyNum;
                continue;
            }
            else
            {
                if (index >= buttons.Length)
                {
                    continue;
                }
                buttons [index].updateButton(each, ButtonExchange.BEASTSUMMON);
                index += 1;
            }
        }

        //前提条件是否达成
        if (!beastEvo.isCheckAllPremises(summonCardEvo))
        {
            changeButton(false);
            return;
        }

        //兑换条件是否达成
        if (!ExchangeManagerment.Instance.isCheckConditions(summonCardEvo.getExchangeBySids(nextBeast.sid)))
        {
            changeButton(false);
            return;
        }

        changeButton(true);
    }
    private void showCondition()
    {
        ExchangeSample sample = selectedEvolve.getExchangeBySids(selectedEvolve.getNextBeast().sid);

        UI_Condition.text = selectedEvolve.checkPremises(selectedEvolve);

        int index = 0;

        foreach (ExchangeCondition each in sample.conditions[0])
        {
            if (each.costType == PrizeType.PRIZE_MONEY)
            {
                UI_haveMoney.text    = UserManager.Instance.self.getMoney().ToString();
                UI_ConsumeMoney.text = each.num.ToString();

//				if(UserManager.Instance.self.getMoney()<each.num){
//					UI_ConsumeMoney.text = "[FF0000]"+each.num.ToString ();
//				}else{
//					UI_ConsumeMoney.text = each.num.ToString ();
//				}
                continue;
            }
            else
            {
                if (index >= UI_ConsumeGoods.Length)
                {
                    continue;
                }
                UI_ConsumeGoods[index].updateButton(each, ButtonExchange.BEASTSUMMON);
                if (UI_ConsumeGoods[index].needValue != null)
                {
                    UI_ConsumeGoods[index].needValue.text = each.num.ToString();
                }
                ArrayList list = StorageManagerment.Instance.getPropsBySid(each.costSid);

                int count = 0;
                foreach (Prop tmp in list)
                {
                    count += tmp.getNum();
                }
                if (UI_ConsumeGoods[index].haveValue != null)
                {
                    UI_ConsumeGoods[index].haveValue.text = count.ToString();
                }
                index += 1;
            }
        }

        //前提条件是否达成
        if (!selectedEvolve.isCheckAllPremises(selectedEvolve))
        {
            UI_OkBtn.disableButton(true);
            return;
        }

        //兑换条件是否达成
        if (!ExchangeManagerment.Instance.isCheckConditions(selectedEvolve.getExchangeBySids(selectedEvolve.getNextBeast().sid)))
        {
            UI_OkBtn.disableButton(true);
            return;
        }
    }