120 lines
2.9 KiB
JavaScript
120 lines
2.9 KiB
JavaScript
var gameConfig = require("gameConfig")
|
|
var NetManage = require("NetManage")
|
|
cc.Class({
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
lb_name: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
lb_score: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
lb_condtion: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
pr_score: {
|
|
default: null,
|
|
type: cc.ProgressBar,
|
|
},
|
|
sp_icon: {
|
|
default: null,
|
|
type: cc.Sprite
|
|
},
|
|
sp_icon1: {
|
|
default: null,
|
|
type: cc.Sprite
|
|
},
|
|
sp_icon2: {
|
|
default: null,
|
|
type: cc.Sprite
|
|
},
|
|
lb_condtion2: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
nd_states: {
|
|
default: [],
|
|
type: cc.Node
|
|
},
|
|
|
|
nd_bar: {
|
|
default: null,
|
|
type: cc.Node
|
|
},
|
|
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {
|
|
|
|
// },
|
|
// onDestroy(){
|
|
|
|
// },
|
|
onRefresh() {
|
|
var cfg = cc.playerData.season
|
|
|
|
this.lb_name.string = cfg.season_id
|
|
this.lb_score.string = cfg.score + "/" + cfg.max_score
|
|
this.pr_score.progress = cfg.score / cfg.max_score
|
|
|
|
var rankcfg = gameConfig.rank[cfg.rank]
|
|
|
|
cc.loader.loadRes("textures/rankIcon/" + rankcfg.icon, cc.SpriteFrame, function(err, res) {
|
|
if (!err && this.isValid) {
|
|
this.sp_icon.spriteFrame = res;
|
|
}
|
|
}.bind(this));
|
|
cc.loader.loadRes("textures/rankIcon/" + rankcfg.label, cc.SpriteFrame, function(err, res) {
|
|
if (!err && this.isValid) {
|
|
this.sp_icon1.spriteFrame = res;
|
|
}
|
|
}.bind(this));
|
|
cc.loader.loadRes("textures/rankIcon/" + rankcfg.level, cc.SpriteFrame, function(err, res) {
|
|
if (!err && this.isValid) {
|
|
this.sp_icon2.spriteFrame = res;
|
|
}
|
|
}.bind(this));
|
|
var mission = cfg.mission
|
|
for (var i = 0; i < 3; i++) {
|
|
this.nd_states[i].active = false
|
|
}
|
|
this.nd_states[mission.state].active = true
|
|
|
|
|
|
if(cfg.noshow_score_bar){
|
|
this.nd_bar.active = false
|
|
}else{
|
|
this.nd_bar.active = true
|
|
}
|
|
|
|
|
|
|
|
},
|
|
start() {
|
|
this.onRefresh()
|
|
},
|
|
onclose() {
|
|
this.node.destroy()
|
|
},
|
|
onclickget() {
|
|
var self = this
|
|
var cb = function() {
|
|
for (var i = 0; i < 3; i++) {
|
|
self.nd_states[i].active = false
|
|
}
|
|
self.nd_states[1].active = true
|
|
}
|
|
|
|
NetManage.getSeasonReward(cb)
|
|
},
|
|
onclickRank() {
|
|
cc.uiMain.callrank()
|
|
},
|
|
// update (dt) {},
|
|
}); |