// 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 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 () {}, start() { utils.isMobile(function () { Manager.layoutManager = this; }.bind(this)); this.initPlayer(); Global.layoutManager = this; }, initPlayer: function () { let player = this.player = UtilsPrefabs.getNode("player", this.node); let icmask = UtilsPrefabs.getNode("icmask", player); let ic = UtilsPrefabs.getNode("ic", icmask); //设置头像 utils.loadHttpSpriteFrame(UserInfo.Player.head, ic.getComponent(cc.Sprite)); //设置名字 let name = UtilsPrefabs.getNode("name", player); name.getComponent(cc.Label).string = UserInfo.Player.name; let dialog = this.dialog = UtilsPrefabs.getNode("dialog", this.node); let bg = UtilsPrefabs.getNode("bg", dialog); Global.strike.setOnGameoverCallBack(function () { console.log("游戏真的结束了"); Global.gameover = true; }.bind(this)); //游戏结束 // Global.strike.setOnGameoverCallBack(function () { // // // // // dialog.active = true; // // utils.isMobile(function () { // Manager.gameover(); // }.bind(this)); // }.bind(this)); UtilsPrefabs.setOn(bg, function () { // UtilsPrefabs.setOff(bg); this.showRankingList(); }.bind(this)) }, setGameOver : function(){ // this.dialog.active = true; // // utils.isMobile(function () { // Manager.gameover(); // }.bind(this)); this.dialog.active = false; utils.isMobile(function () { Manager.gameover(); //真的数据来了 就注释此行 // this.showRankingList(); }.bind(this)); utils.isWeb(function () { this.showRankingList(); }.bind(this)); // this.showRankingList(); }, //显示排行榜 showRankingList: function () { // if (this.dialog.active == false) { // return; // } //去分享页面 utils.toLoadScene("Multi_function"); } // update (dt) {}, });