| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- // 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() {
- //进度条 要做 人头像 和进度条联动
- let progressBar = this.progressBar = UtilsPrefabs.getNode("progressBar", this.node);
- //打击次数
- let powcountlayout = this.powcountlayout = UtilsPrefabs.getNode("powcountlayout", this.node);
- let bar = UtilsPrefabs.getNode("bar", progressBar);
- let icmask =this.icmask = UtilsPrefabs.getNode("icmask", bar);
- let icmaskic =this.icmaskic = UtilsPrefabs.getNode("icmaskic", icmask);
- let ic =this.ic = UtilsPrefabs.getNode("ic", icmaskic);
- //设置头像
- utils.loadHttpSpriteFrame(UserInfo.Player.head, ic.getComponent(cc.Sprite));
- },
- //设置 打击次数 的变化
- setPowcount : function (callback) {
- let count = 0;
- // console.log("里面是什么",this.powcountlayout.children);
- // for (var i = this.powcountlayout.children.length-1; i >=0; i--) {
- for (var i = 0; i <this.powcountlayout.children.length; i++) {
- let temp = this.powcountlayout.children[i];
- if (temp.mytag == null) {
- // temp.children[0].active = false;
- temp.children[0].getComponent(cc.Animation).play();
- let thisOneScoreLabel = UtilsPrefabs.getNode("Score", temp.children[1]);
- thisOneScoreLabel.getComponent(cc.Label).string = Math.floor(this.thisOneScore);
- let showdata = UtilsPrefabs.getNode("showdata", temp.children[1]);
- UtilsPrefabs.getNode("der", showdata).getComponent(cc.Label).string = this.showData.der;
- UtilsPrefabs.getNode("pianyi", showdata).getComponent(cc.Label).string = this.showData.pianyi;
- UtilsPrefabs.getNode("power", showdata).getComponent(cc.Label).string = this.showData.power;
- UtilsPrefabs.getNode("ballSpeed", showdata).getComponent(cc.Label).string = this.showData.ballSpeed;
- //测试数据显示隐藏
- showdata.active = false;
- // utils.loadResSpriteFrame("kuang",function (texture) {
- // temp.getComponent(cc.Sprite).spriteFrame = texture;
- //
- // }.bind(this));
- temp.mytag = 1;
- break;
- }
- count++;
- }
- if (count == this.powcountlayout.children.length-1) {
- if (callback != null) {
- callback();
- }
- }
- },
- //设定飞行距离的变化
- setFlyKM : function (progress) {
- // console.log("设置了",progress);
- this.progressBar.getComponent(cc.ProgressBar).progress =progress;
- let bar = UtilsPrefabs.getNode("bar", this.progressBar);
- let wi = bar.height;
- this.icmask.y = wi;
- // Global.layoutManager.player.y= wi;
- },
- getFlyKM : function () {
- return this.progressBar.getComponent(cc.ProgressBar).progress;
- }
-
- // update (dt) {},
- });
|