| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- // 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: {
- readgo: cc.Node,
- canvas: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start() {
- // this.init();
- },
- init : function(){
- this.ready();
- this.canvas.getComponent("dadishu").setRestartCallBack(function () {
- console.log("重新开始给android");
- utils.isMobile(function () {
- //给数据到设备
- manager_android_js.restStartGame();
- }.bind(this));
- this.ready(function () {
- }.bind(this));
- }.bind(this));
- },
- ready: function (callback) {
- if (callback != null) {
- // this.canvas.getComponent("dadishu").重新开始();
- }
- this.readgo.active = true;
- this.readgo.getChildByName("readyGo").getComponent(dragonBones.ArmatureDisplay).playAnimation("animation", 1);
- this.readgo.getChildByName("readyGoBg").getComponent(cc.Animation).play();
- this.readgo.getComponent(cc.AudioSource).volume = MySetting.sound_value;
- this.readgo.getComponent(cc.AudioSource).play();
- this.scheduleOnce(function () {
- this.readgo.active = false;
- if (callback != null) {
- this.canvas.getComponent("dadishu").初始化();
- } else {
- this.canvas.getComponent("dadishu").countDownTime();
- }
- }.bind(this), 2)
- }
- // update (dt) {},
- });
|