| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- // Learn cc.Class:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
- // Learn Attribute:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
- // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
- window.tip = {}
- cc.Class({
- extends: cc.Component,
- properties: {
- // foo: {
- // // ATTRIBUTES:
- // default: null, // The default value will be used only when the component attaching
- // // to a node for the first time
- // type: cc.SpriteFrame, // optional, default is typeof default
- // serializable: true, // optional, default is true
- // },
- // bar: {
- // get () {
- // return this._bar;
- // },
- // set (value) {
- // this._bar = value;
- // }
- // },
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this.task = 0;
- this.tiplayout = UtilsNode.getNode("tiplayout",this.node)
- this.tiptext = UtilsNode.getNode("tiptext",this.tiplayout)
- this.tiplayoutc = this.tiplayout.getComponent("tiplayout")
- this.tiptextc = this.tiptext.getComponent(cc.Label)
- tip = this;
- this.skip = UtilsNode.getNode("skip",this.node)
- this.skiptext = UtilsNode.getNode("skiptext",this.skip)
- this.tipend = UtilsNode.getNode("tipend",this.node)
- this.tipendc = this.tipend.getComponent("tipend")
- this.initTask();
- this.initClick();
- this.initListen();
- this.initTipText();
- },
- initTipText(){
- if (this.tasks[this.task]) {
- this.tiptextc.string = this.tasks[this.task]
- }
- },
- initTask(){
- this.tasks = [
- //0
- "欢迎来到打地鼠游戏接下来介绍一下游戏玩法!",
- //1
- "首先有三个洞这里面会出现地鼠我们尝试着打一下吧",
- //2
- "击打拳击球方向左侧",
- //3
- "击打拳击球方向中间",
- //4
- "击打拳击球方向右侧",
- //5
- "注意这是炸弹击打之后会让所有地鼠消失",
- //6
- "这里是倒计时当时间用尽游戏结束",
- //7
- "这是记录击打地鼠的分数连击越高分数越高",
- ];
- },
- start () {
- },
- initClick (){
- UtilsNode.setOn(this.skiptext,function () {
- Log.info("点了跳过教程")
- utils.toLoadScene("game");
- }.bind(this))
- },
- initListen(){
- this.tiplayoutc.setCallOutListen(function () {
- this.task++;
- if (this.TaskChangeLishen) {
- this.TaskChangeLishen(this.task);
- }
- // this.initTipText();
- if (this.tasks[this.task]){
- this.tiplayoutc.playIn();
- }
- }.bind(this))
- this.tiplayoutc.setCallInListen(function () {
- this.initTipText();
- }.bind(this))
- },
- setTaskChangeLishen(TaskChangeLishen){
- this.TaskChangeLishen = TaskChangeLishen;
- }
- // update (dt) {},
- });
|