import User from "../../FrameWork/User/User";
import AppPlatform from "../../FrameWork/Util/AppPlatform";
import Common5 from "../../Platform/th/Common5";


const {ccclass, property} = cc._decorator;

@ccclass
export default class TaskFail extends cc.Component {
    @property(cc.Label)
    contentStr: cc.Label = null;

    finishCallFunc = null
    start () {
        
    }
    initView(str,finishCallFunc){
        this.finishCallFunc = finishCallFunc

        this.contentStr.string = str
    }
    onBtnFuHuoClick(){
        let tab = {
            onClose: (finish)=>{
                if (finish) {
                    Common5.ReportDY("inLevel", '游戏任务失败-AD-复活');
                    this.finishCallFunc && this.finishCallFunc()
                    this.node.removeFromParent()
                }
                else{
                    Common5.showTips_custom("广告未观看完");
                }
            },onFailed:()=>{

            }
        }
        AppPlatform.playVideo_custom(tab)
    }
    onBtnRestart(){
        User.restartGame()
        this.node.removeFromParent()
        cc.director.loadScene("MainScene");
    }
}