| 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
- 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) {},
- });
|