示例#1
0
        public void OnClickBtn()
        {
            for (int i = 0; i < objList.Count; i++)
            {
                Destroy(objList[i]);
            }
            objList.Clear();
            //UI_SelectFightArea sfight = UI_SelectFightArea.Inst;
            // char[] sfightList = sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot.ToString().ToCharArray();
            int difficultLv = ObjectSelf.GetInstance().CurChapterLevel;
            int chapterId   = ObjectSelf.GetInstance().GetCurChapterID();
            ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(chapterId);

            if (chapterT != null)
            {
                int total    = 0;
                int curstart = 0;

                StageModule.GetCurTotalStarsCount(chapterT, (EM_STAGE_DIFFICULTTYPE)difficultLv, out curstart, out total);
                if (total == curstart)
                {
                    //TODO 宝箱弹窗
                    //if (isReward(ObjectSelf.GetInstance().CurChapterLevel, sfight.iTotalCharpter[sfight.iChapterID].m_bRewardGot))
                    if (StageModule.isReward(ObjectSelf.GetInstance().CurChapterLevel, ObjectSelf.GetInstance().BattleStageData.GetRewardGot(chapterId)))
                    {
                        UI_HomeControler.Inst.ReMoveUI(gameObject);
                    }
                    else
                    {
                        //与服务器交互
                        CGetStageReward cStage = new CGetStageReward();
                        cStage.difficulttype = (byte)ObjectSelf.GetInstance().CurChapterLevel;
                        cStage.stageid       = (byte)chapterId;
                        IOControler.GetInstance().SendProtocol(cStage);
                        UI_HomeControler.Inst.ReMoveUI(gameObject);
                    }
                }
                else
                {
                    UI_HomeControler.Inst.ReMoveUI(gameObject);
                }
            }
            else
            {
                UI_HomeControler.Inst.ReMoveUI(gameObject);
            }
        }
    void BoxHandler(int idx)
    {
        ChapterinfoTemplate chapterT = StageModule.GetChapterinfoTemplateById(mCurChapterId);

        if (chapterT == null)
        {
            Debug.LogError("章节数据错误id=" + mCurChapterId);
            return;
        }

        //是否可以领取;
        int curStars   = 0;
        int totalStars = 0;

        if (StageModule.GetCurTotalStarsCount(chapterT, mDifficutType, out curStars, out totalStars))
        {
            //可领取;
            if (curStars >= chapterT.getStarnum()[idx])
            {
                //判断是否领取了;
                if (ObjectSelf.GetInstance().BattleStageData.GetRewardGot(mCurChapterId, idx))
                {
                    InterfaceControler.GetInst().AddMsgBox(GameUtils.getString("maoxianguanka5"));
                }
                else
                {
                    //与服务器交互
                    CGetStageReward cStage = new CGetStageReward();
                    cStage.stageid = (byte)mCurChapterId;
                    //cStage.difficulttype = (byte)ObjectSelf.GetInstance().CurChapterLevel;

                    //TODO::临时这么写;
                    cStage.difficulttype = (byte)idx;
                    IOControler.GetInstance().SendProtocol(cStage);
                }
            }
            else //不可领取;
            {
                int dropId = chapterT.getChapterDrop()[idx];

                UICommonManager.Inst.ShowRewardBox(dropId, chapterT.getStarnum()[idx]);
            }
        }
    }