예제 #1
0
    // 初始化数据
    private void Init()
    {
        BaseScene scene = SceneManager.Instance.GetCurScene();

        if (scene == null)
        {
            return;
        }

        if (!typeof(StageScene).IsAssignableFrom(scene.GetType()))
        {
            return;
        }

        StageScene stage = scene as StageScene;

        mRes = stage.GetStageRes();
        if (mRes == null)
        {
            return;
        }

        if (mModule == null)
        {
            mModule = ModuleManager.Instance.FindModule <StageBalanceModule>();
        }

        mOKBtn.SetActive(false);

        mNormalPanel.SetActive(false);
        mExtraPanel.SetActive(false);
        mAwardPanel.SetActive(false);
        mExtraAwardPanel.SetActive(false);
        mNormalEffectUI.Stop();
        mExtraEffectUI.Stop();

        // 不显示普通翻牌
        if (mRes.mRandomAwardTimes < 1 || mRes.mRandomAwardBoxId < 0)
        {
            mLeftAwardTimes = 0;
            mState          = UIState.STATE_3;
        }
        else
        {
            mNormalPanel.SetActive(true);
            mLeftAwardTimes = mRes.mRandomAwardTimes;
            mState          = UIState.STATE_0;
        }

        mNormalTimesLabel1.text = GetCardTypeText(mRes.mRandomAwardCostId);

        foreach (StageBalanceItemUI item in mItemNormalList)
        {
            item.SetCostId(mRes.mRandomAwardCostId);
            item.AddListener();
        }

        UpdateAwardTimes();
        //RandomAward();

        // 不显示钻石翻牌
        if (mRes.mExtraAwardTimes < 1 || mRes.mExtraAwardBoxId < 0)
        {
            mLeftExtraAwardTimes = 0;
            if (mState == UIState.STATE_3)
            {
                mState = UIState.STATE_DESTROY;
                mOKBtn.SetActive(true);
            }
        }
        else
        {
            mLeftExtraAwardTimes = mRes.mExtraAwardTimes;
        }

        mExtraTimesLabel1.text = GetCardTypeText(mRes.mExtraAwardCostId);

        foreach (StageBalanceItemUI item in mItemExtraList)
        {
            item.SetCostId(mRes.mExtraAwardCostId);
            item.AddListener();
        }

        UpdateExtraAwardTimes();
        //RandomExtraAward();
    }