コード例 #1
0
ファイル: SkillTreeDlg.cs プロジェクト: rogeryuan99/Hello
    protected void setToSkipWrongDlg(CommonDlg dlg)
    {
        SkillTreeCell cell = selectedCell.GetComponent<SkillTreeCell>();

        dlg.setOneBtnDlg("CANCEL");

        dlg.ShowCommonStr(string.Format(Localization.instance.Get("UI_CommonDlg_SkipSkillTraining_NotEnoughCP"), cell.skillDef.name, Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds)));
        dlg.playErrorMusic();
        dlg.OnUpdateStr = () => {
            if (SkillLearnedData.LearnedState.LEARNING != cell.learnedData.State){
                dlg.OnUpdateStr = null;
                // descDlg.SetSkippingBtnVisible(false);
                Destroy(dlg.gameObject);
            }
            else{
                if (UserInfo.instance.getCommandPoints() >= Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds)){
                    setToSkipConfirmDlg(dlg);
                }
            }
        };
    }
コード例 #2
0
ファイル: SkillTreeDlg.cs プロジェクト: rogeryuan99/Hello
    protected void setToSkipConfirmDlg(CommonDlg dlg)
    {
        SkillTreeCell cell = selectedCell.GetComponent<SkillTreeCell>();

        dlg.setNormalDlg();
        dlg.OnUpdateStr = () => {
            if (SkillLearnedData.LearnedState.LEARNING != cell.learnedData.State){
                dlg.OnUpdateStr = null;
                // descDlg.SetSkippingBtnVisible(false);
                Destroy(dlg.gameObject);
            }
            else
                dlg.ShowCommonStr(string.Format(Localization.instance.Get("UI_CommonDlg_TrainSkillWithCP"), cell.skillDef.name,  Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds)));
        };
        dlg.onYes = () => {
            UserInfo.instance.consumeCommandPoints(Formulas.HowMuchToSkipSkillTraining(cell.learnedData.TotalSeconds));
            cell.learnedData.SkipLearningTime();
            descDlg.SetSkippingBtnVisible(false);
            dlg.OnUpdateStr = null;
            StartCoroutine(delayPlayRechargedMusic());
        };
        dlg.onNo = () => {
            MusicManager.playEffectMusic("SFX_UI_button_tap_2a");
        };
    }