Beispiel #1
0
    private void Init()
    {
        mModule.State = StageEndModule.UIState.STATE_ORIGINAL;
        mLevelUp.SetActive(false);
        mGradeS.gameObject.SetActive(false);
        mGradeS.ResetToBeginning();
        mGradeA.gameObject.SetActive(false);
        mGradeA.ResetToBeginning();
        mGradeB.gameObject.SetActive(false);
        mGradeB.ResetToBeginning();
        mGradeC.gameObject.SetActive(false);
        mGradeC.ResetToBeginning();
        mTitle0.alpha      = 0.0f;
        mTitle1.alpha      = 0.0f;
        mBottomPanel.alpha = 0.0f;
        mBallBk.alpha      = 0.0f;
        mInfoPanel0.alpha  = 0.0f;
        mInfoPanel1.alpha  = 0.0f;
        mInfoPanel2.alpha  = 0.0f;
        mTopPanel.alpha    = 0.0f;
        mBackground.alpha  = 0.6f;
        mInfoPanel.gameObject.transform.localPosition = new Vector3(mInfoPanel.gameObject.transform.localPosition.x, mInfoPosY, mInfoPanel.gameObject.transform.localPosition.z);
        mBallBk.gameObject.transform.localPosition    = new Vector3(mBallBk.gameObject.transform.localPosition.x, mBallPosY, mBallBk.gameObject.transform.localPosition.z);
        mBallBk.gameObject.transform.localScale       = Vector3.one;
        mWidget.topAnchor.relative    = 2.0f;
        mWidget.bottomAnchor.relative = 1.0f;

        mCurExp   = mPlayerModule.GetExp();
        mAddExp   = mModule.GetExp();
        mMaxExp   = GetMaxExp();
        mExpSpeed = (int)(mAddExp / StageEndModule.STATETIME_9);
        UpdateExp();

        mGradeAni.Reset();
        mGradeAni.gameObject.SetActive(false);
        mInfoAni0.Reset();
        mInfoAni0.gameObject.SetActive(false);
        mInfoAni1.Reset();
        mInfoAni1.gameObject.SetActive(false);
        mInfoAni2.Reset();
        mInfoAni2.gameObject.SetActive(false);
        mBorderAni.Reset();
        mBorderAni.gameObject.SetActive(false);

        //mUIPanel.alpha = 0.0f;

        mTimer = 0.0f;

        mInfoValue2.text       = mModule.GetPassTimeStr();
        mInfoRecordValue2.text = mInfoValue2.text;

        if (mGradeMap == null)
        {
            mGradeMap = new Dictionary <StageGrade, UITweener>();
            mGradeMap.Add(StageGrade.StageGrade_S, mGradeS);
            mGradeMap.Add(StageGrade.StageGrade_A, mGradeA);
            mGradeMap.Add(StageGrade.StageGrade_B, mGradeB);
            mGradeMap.Add(StageGrade.StageGrade_C, mGradeC);
        }
    }
Beispiel #2
0
    private void UpdatePlayerData()
    {
        PlayerPropertyModule propertyModule = ModuleManager.Instance.FindModule <PlayerPropertyModule>();

        PlayerDataModule dataModule = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (propertyModule == null || dataModule == null)
        {
            return;
        }
        PropertyOperation op = propertyModule.GetPlayerProperty();
        int hp = (int)op.GetPro((int)PropertyTypeEnum.PropertyTypeMaxHP);

        mHp.text = hp.ToString();
        int mp = (int)op.GetPro((int)PropertyTypeEnum.PropertyTypeMaxMana);

        mMp.text = mp.ToString();
        int damage = (int)op.GetPro((int)PropertyTypeEnum.PropertyTypeDamage);

        mDamage.text = damage.ToString();
        int defence = (int)op.GetPro((int)PropertyTypeEnum.PropertyTypeDefance);

        mDefence.text = defence.ToString();
        int crit = (int)op.GetPro((int)PropertyTypeEnum.PropertyTypeCrticalLV);

        mCritLv.text = crit.ToString();

        mZhanli1.text = dataModule.GetGrade().ToString();
        mZhanli2.text = "战斗力:" + dataModule.GetGrade().ToString();

        mExp.text = dataModule.GetExp().ToString() + "/" + dataModule.GetMaxExp().ToString();

        mName.text = dataModule.GetName();

        mRoleName.text = "Lv " + dataModule.GetLevel().ToString() + "." + dataModule.GetName();

        SetCropsInfo(mMainCrops, mSubCrops);
    }
Beispiel #3
0
    private static bool CheckCondition(int questid, QuestConditionParam qcp)
    {
        uint             rst = UInt32.MaxValue;
        PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>();

        switch (qcp.mConditionType)
        {
        case QuestConditionType.Level:
            rst = (uint)pdm.GetLevel();
            break;

        case QuestConditionType.Money_:
            rst = pdm.GetProceeds((ProceedsType)qcp.mArg1);
            break;

        case QuestConditionType.Exp:
            rst = (uint)pdm.GetExp();
            break;

        case QuestConditionType.Item:
            rst = 0;
            break;

        case QuestConditionType.Stage_Unlock:
            rst = Convert.ToUInt32(pdm.IsStageUnlock(qcp.mArg1) ? 1 : 0);
            break;

        case QuestConditionType.Stage_Grade:
            rst = (uint)pdm.GetStageGrade(qcp.mArg1);
            break;

        case QuestConditionType.Battle_Score:
            rst = pdm.GetGrade();
            break;

        case QuestConditionType.Wing_Level:
            rst = pdm.GetWingLevel(qcp.mArg1);
            break;

        case QuestConditionType.Cost_Diamond:
            rst = pdm.GetRMBUsed();
            break;

        case QuestConditionType.Passted_Stage:
            rst = pdm.GetStagePassTimes(qcp.mArg1);
            if (rst > 0)
            {
                GameDebug.Log("Passted_Stage:" + rst);
            }
            break;

        case QuestConditionType.Passted_Zone:
            rst = pdm.GetZonePassTimes(qcp.mArg1);
            break;

        case QuestConditionType.Quest:

            rst = Convert.ToUInt32(pdm.IsQuestFinish(qcp.mArg1) ? 1 : 0);
            break;

        case QuestConditionType.Top_Level:
        {
            return(pdm.GetLevel() <= qcp.mValue);
        }

        case QuestConditionType.Tower_Floor:
        {
            GameDebug.Log("Tower_Floor" + pdm.GetChallengMaxFloor());
            return(pdm.GetChallengMaxFloor() >= qcp.mArg1);
        }

        default:
        {
            int totalProgress = pdm.GetQuestTotalProgress(questid);
            int progress      = pdm.getQuestProgress(questid);
            if (totalProgress != 0 && progress != 0)
            {
                if (totalProgress == progress)
                {
                    return(true);
                }
                if (totalProgress < progress)
                {
                    GameDebug.LogError("任务当前进度大于总进度 任务ID = " + questid);
                    return(false);
                }
            }
        }
        break;
        }

        if (UInt32.MaxValue == rst || qcp.mValue < 0)
        {
            return(false);
        }
        return(rst >= (uint)qcp.mValue);
    }
    /// <summary>
    /// 得到某条件的当前值,返回是否满足条件
    /// </summary>
    /// <param name="type">条件类型</param>
    /// <param name="param1">条件参数1</param>
    /// <param name="param2">条件参数2</param>
    /// <param name="value">传出当前值</param>
    /// <returns></returns>
    public bool GetCurrentConditionValue(ConditionType type, int param1, int param2, ref int value)
    {
        PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>();

        if (module == null)
        {
            return(false);
        }

        switch (type)
        {
        // 等级
        case ConditionType.LEVEL:
        {
            value = module.GetLevel();
        }
        break;

        // 货币
        case ConditionType.MONEY:
        {
            value = (int)module.GetProceeds((ProceedsType)param1);
        }
        break;

        // 经验
        case ConditionType.EXP:
        {
            value = module.GetExp();
        }
        break;

        // 道具
        case ConditionType.ITEM:
        {
            //TODO
            value = 0;
        }
        break;

        // 关卡解锁
        case ConditionType.STAGE_UNLOCK:
        {
            value = module.IsStageUnlock(param1) ? 1 : 0;
        }
        break;

        // 关卡评价
        case ConditionType.STAGE_GRADE:
        {
            value = (int)module.GetStageGrade(param1);
        }
        break;

        // 接受任务
        case ConditionType.QUEST_ACCEPT:
        {
            if (module.IsQuestAccepted(param1))
            {
                value = 1;
            }
            else
            {
                value = 0;
            }
        }
        break;

        default:
            return(false);
        }

        return(true);
    }