Exemple #1
0
 /** 更新花费图标 */
 private void updateCostIcon()
 {
     LuckyCostIcon.setToolCostIconName(lucky.ways [0], costIcon);
     LuckyCostIcon.setToolCostIconName(lucky.ways [0], icon1Cost);
     LuckyCostIcon.setToolCostIconName(lucky.ways [0], icon2Cost);
 }
    public void updateLuckyDraw(LuckyDraw luckyDraw)
    {
        this.luckyDraw = luckyDraw;
        //根据不同的类型显示不同的文字

        /*
         * if (luckyDraw.getDrawNum () > 0)
         *      numLabel.text = (luckyDraw.getDrawNum () - luckyDraw.getCostDrawNum ()) + "/" + luckyDraw.getDrawNum ();
         * else
         *      numLabel.text = "0";
         */
        //

//		if (luckyDraw.getTimeInfo () != "")
//			timeLabel.text = luckyDraw.getTimeInfo ();
//		else
//			timeLabel.transform.parent.gameObject.SetActive (false);

        showFreeBg();
        bottomLabel.text = "x " + luckyDraw.getShowCostNum();

        costLabel.text = luckyDraw.getCostNumInfo();
        LuckyCostIcon.setToolCostIconName(luckyDraw.ways [0], costIcon);
        LuckyCostIcon.setToolCostIconName(luckyDraw.ways [0], havaIcon);
        ResourcesManager.Instance.LoadAssetBundleTexture("texture/luckydraw/luckyPic_" + luckyDraw.getIconId(), bgIcon);          //+ goods.getIconId (), itemIcon);

        //jordenwu 提示可以购买次数
        //拥有对应
        //是否有免费的
//		if(luckyDraw.sid==81001){
//			//钻石召唤 不提示次数
//			tipNumObj.SetActive(false);
//		}else{

        bool ishavafree = luckyDraw.getFreeNum() > 0 ? true : false;

        if (ishavafree)
        {
            //直接提示免费次数
            int num = luckyDraw.getFreeNum();
            if (num <= 0)
            {
                tipNumObj.SetActive(false);
            }
            else
            {
                tipNumObj.SetActive(true);
                tipNumLabel.text = luckyDraw.getFreeNum().ToString();
            }
        }
        else
        {
            //提示可以购买次数
            int own      = luckyDraw.getShowCostNum();
            int needCost = luckyDraw.getCostNum();
            int num      = (own / needCost);
            if (num <= 0)
            {
                tipNumObj.SetActive(false);
            }
            else
            {
                tipNumObj.SetActive(true);
                tipNumLabel.text = num.ToString();
            }
        }
//		}
    }
 //初始化花费图标
 private void setCostIcon()
 {
     LuckyCostIcon.setToolCostIconName(lucky.ways[0], costIcon);
     LuckyCostIcon.setToolCostIconName(lucky.ways [0], button1CostIcon);
     LuckyCostIcon.setToolCostIconName(lucky.ways [0], button2CostIcon);
 }