// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
// 看视频提示
import User from "../../../../FrameWork/User/User";
import Common from "../../../../FrameWork/Util/Common";
import Common5 from "../../../../Platform/th/Common5";
import TTAPI from "../../../../Platform/tt/TTAPI";


const {ccclass, property} = cc._decorator;

@ccclass
export default class VideoTipScript extends cc.Component {
    @property(cc.Node)
    tipNode: cc.Node = null;

    @property(cc.Node)
    itemNode: cc.Node = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}
    curNode = null
    curData = null
    start () {
        this.setTipData()
    }

    setTipData(){
     
        this.refreshTipsCurView()
    }

    refreshTipView(){
        //1看了提示,2看了答案
        
    }

    setVd(node,isShow){
       let vdNode = node.getChildByName('Background').getChildByName('广告icon') 
        vdNode.active = isShow
    }

    showTipNodeClickEvent(event){
        Common5.playEffect("点击音效");
        let target = event.target

        this.curNode = this.tipNode
        this.curNode.active = true
        this.refreshTipsCurView()
    }


    closeCurNodeClickEvent(){
        Common5.playEffect("点击音效");
        this.node.removeFromParent()
    }


    refreshTipsCurView(){
        let layoutNode = this.tipNode.getChildByName('layoutNode')
        layoutNode.removeAllChildren()
        let data_ = Common.GameSubTipConfigs[Common.subLevel]

        console.log(data_,'refreshTipsCurView ++= data_++++++++++==')
        if(!data_){
            return
        }
        for(let i = 0; i<data_.tipsArray.length;i++){
            let item_ = cc.instantiate(this.itemNode)
            item_.active = true
            layoutNode.addChild(item_)
            item_.setPosition(cc.v2(0,0))

            let lab = item_.getChildByName('lab').getComponent(cc.Label)
            lab.string = data_.tipsArray[i]
        }


        this.refreshTipView()
    }



    // update (dt) {}
}