示例#1
0
    private void InitUI()
    {
        mRankItemList = new List <ChaRankItemUI>();
        //关卡按钮
        for (int i = 1; i <= PlayerChallengeData.MAX_FLOOR_COUNT; i++)
        {
            var tempItem = GameObject.Instantiate(mExamChallengeBtn) as GameObject;
            tempItem.SetActive(true);
            tempItem.transform.parent     = mGridFloor.gameObject.transform;
            tempItem.transform.localScale = new Vector3(1, 1, 1);

            var ci = new ChallengeItemUI(tempItem);
            ci.mFloorID        = i;
            ci.mIndex          = i - 1;
            ci.OnClickCallback = OnClickChallengeBtn;

            if (i < 10)
            {
                ci.mLabelFloorIcon.text = "0" + i;
                tempItem.name           = "0" + i;
            }
            else
            {
                ci.mLabelFloorIcon.text = i.ToString();
                tempItem.name           = i.ToString();
            }

            ci.mLabel.text = String.Format(StringHelper.GetString("floornum"), i);
            mChallengeBtn.Add(ci);
        }

        mGridFloor.Reposition();
    }
示例#2
0
    private void OnClickChallengeBtn(ChallengeItemUI go)
    {
        if (go == null)
        {
            return;
        }

        ChangeSelectFloor(go.mFloorID);
        mChalModule.SetDoingFloor(mSelectFloor);
    }