| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- // Learn cc.Class:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
- // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
- // Learn Attribute:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
- // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
- // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
- cc.Class({
- extends: cc.Component,
- properties: {
- new_layout: cc.Node
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start() {
- //测试这样用 正式注释就行了
- // this.init();
- },
- init: function () {
- this._parent = this.new_layout;
- this.Allows = this.getNode("Allows");
- this.Forbiddens = this.getNode("Forbiddens");
- this.RivalTip = this.getNode("RivalTip");
- this.SelfTip = this.getNode("SelfTip");
- this.Hand = this.getNode("Hand");
- this.LifeTip1 = this.getNode("LifeTip1");
- this.LifeTip2 = this.getNode("LifeTip2");
- this.LifeTip3 = this.getNode("LifeTip3");
- this.process1();
- },
- // 显示 下面三个箭头 和上面的 提示板
- process1: function () {
- this.Allows.active = true;
- var childrens = this.Allows.children;
- for (var i = 0; i < childrens.length; i++) {
- var actionTo1 = cc.scaleTo(1, 1.25, 1.25);
- var actionTo2 = cc.scaleTo(1, 1, 1);
- var rep = cc.repeat(cc.sequence(actionTo1, actionTo2), 5);
- childrens[i].runAction(rep);
- var move1 = cc.moveBy(1, 0, 50);
- // var spawn = cc.spawn(move1, rep);
- var move2 = cc.moveBy(1, 0, 0);
- var move3 = cc.moveBy(1, 0, -50);
- var move4 = cc.moveBy(1, 0, 0);
- var r = cc.repeat(cc.sequence(move1, move2, move3, move4), 5);
- childrens[i].runAction(r);
- }
- var showAllowsCallback = function () {
- this.SelfTip.active = true;
- this.process2();
- }
- this.scheduleOnce(showAllowsCallback, 5)
- },
- // 隐藏 三个箭头 和 我方提示板
- process2: function () {
- var hintAllowsCallback = function () {
- this.SelfTip.active = false;
- this.Allows.active = false;
- this.process3();
- }
- this.scheduleOnce(hintAllowsCallback, 5)
- },
- // 显示 三个禁止 和 对方方提示板
- process3: function () {
- this.Forbiddens.active = true;
- var childrens = this.Forbiddens.children;
- for (var i = 0; i < childrens.length; i++) {
- var actionTo1 = cc.scaleTo(1, 0.6, 0.6);
- var actionTo2 = cc.scaleTo(1, 0.45, 0.45);
- var rep = cc.repeat(cc.sequence(actionTo1, actionTo2), 5);
- childrens[i].runAction(rep);
- }
- var showAllowsCallback = function () {
- this.RivalTip.active = true;
- this.process4();
- }
- this.scheduleOnce(showAllowsCallback, 5)
- },
- // 隐藏 所有
- process4: function () {
- this.Forbiddens.active = false;
- var hintAllowsCallback = function () {
- this.process5();
- }
- this.scheduleOnce(hintAllowsCallback, 5)
- },
- process5: function () {
- this.RivalTip.active = false;
- this.Hand.active = true;
- var Hands = this.Hand.children;
- for (var i = 0; i < Hands.length; i++) {
- var actionTo1 = cc.scaleTo(1, 1.5, 1.5);
- var actionTo2 = cc.scaleTo(1, 1, 1);
- var rep = cc.repeat(cc.sequence(actionTo1, actionTo2), 5);
- Hands[i].runAction(rep);
- }
- var hintAllowsCallback = function () {
- this.process6();
- }
- this.scheduleOnce(hintAllowsCallback, 5)
- },
- process6: function () {
- this.Hand.active = false;
- var hintAllowsCallback = function () {
- this.process7();
- }
- this.scheduleOnce(hintAllowsCallback, 1)
- },
- process7: function () {
- this.LifeTip1.active = true;
- var hintAllowsCallback = function () {
- this.LifeTip1.active = false;
- this.process8();
- }
- this.scheduleOnce(hintAllowsCallback, 4)
- },
- process8: function () {
- this.LifeTip2.active = true;
- var hintAllowsCallback = function () {
- this.LifeTip2.active = false;
- this.process9();
- }
- this.scheduleOnce(hintAllowsCallback, 4)
- },
- process9: function () {
- this.LifeTip3.active = true;
- var hintAllowsCallback = function () {
- this.LifeTip3.active = false;
- this.processLast();
- }
- this.scheduleOnce(hintAllowsCallback, 4)
- },
- // 隐藏 所有
- processLast: function () {
- var hintAllowsCallback = function () {
- // this.Forbiddens.active = false;
- // this.RivalTip.active = false;
- this.processEnd();
- }
- this.scheduleOnce(hintAllowsCallback, 1)
- },
- processEnd: function () {
- console.log("准备去倒计时");
- if (this.processCallback != null) {
- this.processCallback();
- }
- },
- setProcessCallback: function (processCallback) {
- this.processCallback = processCallback;
- },
- processCallback: function () {
- },
- getNode: function (name, parent) {
- if (parent == null) {
- return this._parent.getChildByName(name);
- } else {
- return parent.getChildByName(name);
- }
- },
- // update (dt) {},
- });
|