62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
var NetManage = require("NetManage")
|
|
|
|
cc.Class({
|
|
extends: cc.Component,
|
|
|
|
properties: {
|
|
lb_count: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
lb_tolv: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
lb_cost: {
|
|
default: null,
|
|
type: cc.Label
|
|
},
|
|
},
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
onLoad () {
|
|
cc.Notifier.on("onSeasonCardInfo", this, this.onclose.bind(this));
|
|
},
|
|
onDestroy(){
|
|
cc.Notifier.off("onSeasonCardInfo", this);
|
|
},
|
|
initdata(lv) {
|
|
this.startlv = lv
|
|
this.maxcount = cc.seasonmaxlv-lv
|
|
this.count = 1
|
|
this.refreshcount()
|
|
},
|
|
refreshcount(){
|
|
this.count=Math.min( Math.max(1,this.count),this.maxcount)
|
|
|
|
this.lb_count.string = this.count
|
|
this.lb_cost.string = this.count*cc.seasonbuy_level_price
|
|
|
|
this.lb_tolv.string = this.startlv +this.count
|
|
|
|
},
|
|
|
|
|
|
clickadd(){
|
|
this.count++;
|
|
this.refreshcount()
|
|
},
|
|
clickjian(){
|
|
this.count--;
|
|
this.refreshcount()
|
|
},
|
|
onclose(){
|
|
this.node.destroy()
|
|
},
|
|
onok(){
|
|
NetManage.buyseadonlevel(this.count)
|
|
},
|
|
|
|
// update (dt) {},
|
|
}); |