Example #1
0
    public void updateAwardItem(ChapterAwardSample _chapterAward, WindowBase fatherWindow, bool _isGet, int myStar)
    {
        this.chapterAward = _chapterAward;
        this.isGet        = _isGet;
        receivedSprite.gameObject.SetActive(false);
        awardButton.gameObject.SetActive(false);
        awardButton.fatherWindow = fatherWindow;

//		int count = chapterAward.prizes.Length;
//		if (count > awardButtons.Length)
//			count = awardButtons.Length;
//
//		for (int i = 0; i < count; i++) {
//			awardButtons [i].gameObject.SetActive (true);
//			awardButtons [i].cleanData ();
//			awardButtons [i].updateButton (chapterAward.prizes [i]);
//			awardButtons[i].fatherWindow = fatherWindow;
//		}

        if (offsexGoods.transform.childCount > 0)
        {
            Utils.DestoryChilds(offsexGoods);
        }
        if (chapterAward.prizes != null && chapterAward.prizes.Length > 0)
        {
            GoodsView obj;
            for (int i = 0; i < chapterAward.prizes.Length; i++)
            {
                obj = NGUITools.AddChild(offsexGoods, goodsPerfab).GetComponent <GoodsView> ();
                obj.init(chapterAward.prizes[i]);
                obj.fatherWindow            = fatherWindow;
                obj.transform.localPosition = new Vector3(i * 120, 0, 0);
            }
        }

        if (isGet)
        {
            receivedSprite.gameObject.SetActive(true);
            awardButton.gameObject.SetActive(false);
        }
        else
        {
            awardButton.gameObject.SetActive(true);
            if (myStar < chapterAward.needStarNum)
            {
                awardButton.disableButton(true);
            }
            else
            {
                awardButton.disableButton(false);
            }
        }

        needStarTitle.text = chapterAward.needStarNum.ToString();
    }
Example #2
0
    public PrizeSample[] prizes = null; //星星奖励

    public override void copy(object destObj)
    {
        base.copy(destObj);
        ChapterAwardSample dest = destObj as ChapterAwardSample;

        if (this.prizes != null)
        {
            dest.prizes = new PrizeSample[this.prizes.Length];
            for (int i = 0; i < this.prizes.Length; i++)
            {
                dest.prizes [i] = this.prizes [i].Clone() as PrizeSample;
            }
        }
    }
Example #3
0
    private void parsePrizes(string str)
    {
        if (str == "0")
        {
            return;
        }
        //131203*4*3,71054,5#131204*10*2,0,50$4,35007,1
        //131203*4*3,71054,5
        //131204*10*2,0,50$4,35007,1
        string[] strArr = str.Split('#');
        int      max    = strArr.Length;

        if (max == 0)
        {
            return;
        }
        prizes = new ChapterAwardSample[max];
        for (int i = 0; i < max; i++)
        {
            prizes [i] = new ChapterAwardSample(strArr [i]);
        }
    }