|
@@ -1,6 +1,6 @@
|
|
import { _decorator, Component, Label, Node, Sprite } from 'cc';
|
|
import { _decorator, Component, Label, Node, Sprite } from 'cc';
|
|
import { base_ui } from '../fw/base_ui';
|
|
import { base_ui } from '../fw/base_ui';
|
|
-import { car_item_data } from '../data';
|
|
|
|
|
|
+import { car_item_data, car_type } from '../data';
|
|
import { imageCacheManager } from '../manager/imageCacheManager';
|
|
import { imageCacheManager } from '../manager/imageCacheManager';
|
|
import { userDataManager } from '../manager/userDataManager';
|
|
import { userDataManager } from '../manager/userDataManager';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
@@ -12,21 +12,57 @@ export class car_info extends base_ui {
|
|
@property(Node) img_car:Node = null
|
|
@property(Node) img_car:Node = null
|
|
@property(Node) lab_car_name:Node = null
|
|
@property(Node) lab_car_name:Node = null
|
|
@property(Node) lab_score:Node = null
|
|
@property(Node) lab_score:Node = null
|
|
|
|
+
|
|
|
|
+ @property(Node) lab_chongci:Node = null
|
|
|
|
+ @property(Node) lab_qiyou:Node = null
|
|
|
|
+ @property(Node) lab_dunpai:Node = null
|
|
|
|
+ @property(Node) lab_xingxing:Node = null
|
|
|
|
+ @property(Node) lab_citie:Node = null
|
|
|
|
+
|
|
start() {
|
|
start() {
|
|
this.onButtonListen(this.btn_close, ()=>{
|
|
this.onButtonListen(this.btn_close, ()=>{
|
|
this.close()
|
|
this.close()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- initView(data:car_item_data) {
|
|
|
|
- let xiangcha_score = data.unlock_points - userDataManager.user_car_list.max_integral
|
|
|
|
- if(xiangcha_score<0) {
|
|
|
|
- xiangcha_score = 0
|
|
|
|
|
|
+ initView(data:car_item_data, is_jiesuo:boolean) {
|
|
|
|
+ if(is_jiesuo) {
|
|
|
|
+ this.lab_car_name.active = false
|
|
|
|
+ this.lab_xiangcha_score.getComponent(Label).string = data.name
|
|
|
|
+ } else {
|
|
|
|
+ if(data.stype==car_type.score) {
|
|
|
|
+ let xiangcha_score = data.unlock_points - userDataManager.user_car_list.max_integral
|
|
|
|
+ if(xiangcha_score<0) {
|
|
|
|
+ xiangcha_score = 0
|
|
|
|
+ }
|
|
|
|
+ this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 分`
|
|
|
|
+ } else {
|
|
|
|
+ let xiangcha_score = 100
|
|
|
|
+ this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 碎片`
|
|
|
|
+ }
|
|
|
|
+ this.lab_car_name.active = true
|
|
|
|
+ this.lab_car_name.getComponent(Label).string = data.name
|
|
}
|
|
}
|
|
- this.lab_xiangcha_score.getComponent(Label).string = xiangcha_score + ''
|
|
|
|
- this.lab_car_name.getComponent(Label).string = data.name
|
|
|
|
|
|
+
|
|
this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.id)
|
|
this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.id)
|
|
- this.lab_score.getComponent(Label).string = data.unlock_points + '解锁'
|
|
|
|
|
|
+
|
|
|
|
+ if(data.stype==car_type.score) {
|
|
|
|
+ this.lab_score.getComponent(Label).string = data.unlock_points + '分解锁'
|
|
|
|
+ } else {
|
|
|
|
+ this.lab_score.getComponent(Label).string = `已集齐 ${0} / ${data.unlock_points}`
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(data.attribute.k_sprint_cd==0) { this.lab_chongci.active = false }
|
|
|
|
+ if(data.attribute.k_oil_number==0) { this.lab_qiyou.active = false }
|
|
|
|
+ if(data.attribute.n_shield_cd==0) { this.lab_dunpai.active = false }
|
|
|
|
+ if(data.attribute.n_star_cd==0) { this.lab_xingxing.active = false }
|
|
|
|
+ if(data.attribute.n_magnet_cd==0) { this.lab_citie.active = false }
|
|
|
|
+
|
|
|
|
+ this.lab_chongci.getComponent(Label).string = `+${data.attribute.k_sprint_cd}秒`
|
|
|
|
+ this.lab_qiyou.getComponent(Label).string = `+${data.attribute.k_oil_number}桶`
|
|
|
|
+ this.lab_dunpai.getComponent(Label).string = `+${data.attribute.n_shield_cd}秒`
|
|
|
|
+ this.lab_xingxing.getComponent(Label).string = `+${data.attribute.n_star_cd}秒`
|
|
|
|
+ this.lab_citie.getComponent(Label).string = `+${data.attribute.n_magnet_cd}秒`
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|