|
@@ -1,12 +1,10 @@
|
|
|
import { _decorator, Canvas, Component, Label, Node, Size, Sprite, UITransform } from 'cc';
|
|
|
import { rankData } from '../../data';
|
|
|
import { tools } from '../../tools';
|
|
|
-import { imageCacheManager } from '../../manager/imageCacheManager';
|
|
|
import { base_ui } from '../../fw/base_ui';
|
|
|
import { uiManager } from '../../manager/uiManager';
|
|
|
import { config } from '../../config';
|
|
|
import { user_info_view } from '../user_info_view';
|
|
|
-import { userDataManager } from '../../manager/userDataManager';
|
|
|
import { GameManager } from '../../GameManager';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
@@ -17,18 +15,24 @@ export class rank_list_top extends base_ui {
|
|
|
@property(Node) one_img_avatar:Node = null;
|
|
|
@property(Node) one_lab_score:Node = null;
|
|
|
@property(Node) one_img_car:Node = null;
|
|
|
+ @property(Node) one_region_bg:Node = null;
|
|
|
+ @property(Node) one_lab_region:Node = null;
|
|
|
|
|
|
@property(Node) two_node = null;
|
|
|
@property(Node) two_lab_name:Node = null;
|
|
|
@property(Node) two_img_avatar:Node = null;
|
|
|
@property(Node) two_lab_score:Node = null;
|
|
|
@property(Node) two_img_car:Node = null;
|
|
|
+ @property(Node) two_region_bg:Node = null;
|
|
|
+ @property(Node) two_lab_region:Node = null;
|
|
|
|
|
|
@property(Node) three_node = null;
|
|
|
@property(Node) three_lab_name:Node = null;
|
|
|
@property(Node) three_img_avatar:Node = null;
|
|
|
@property(Node) three_lab_score:Node = null;
|
|
|
@property(Node) three_img_car:Node = null;
|
|
|
+ @property(Node) three_region_bg:Node = null;
|
|
|
+ @property(Node) three_lab_region:Node = null;
|
|
|
|
|
|
private m_one_data:rankData = null
|
|
|
private m_two_data:rankData = null
|
|
@@ -46,28 +50,31 @@ export class rank_list_top extends base_ui {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- initView(data_list:rankData[]) {
|
|
|
+ initView(data_list:rankData[], type:number) {
|
|
|
this.clearAll()
|
|
|
if(data_list.length>0) {
|
|
|
this.m_one_data = data_list[0]
|
|
|
- this.setLabName(this.one_lab_name, this.m_one_data)
|
|
|
+ this.setLabName(this.one_lab_name, this.m_one_data,7)
|
|
|
this.setImgAvatar(this.one_img_avatar, this.m_one_data)
|
|
|
this.setLabScore(this.one_lab_score, this.m_one_data)
|
|
|
this.setImgCar(this.one_img_car, this.m_one_data)
|
|
|
+ this.setRegion(this.one_region_bg, this.one_lab_region, this.m_one_data, type)
|
|
|
}
|
|
|
if(data_list.length>1) {
|
|
|
this.m_two_data = data_list[1]
|
|
|
- this.setLabName(this.two_lab_name, this.m_two_data)
|
|
|
+ this.setLabName(this.two_lab_name, this.m_two_data,6)
|
|
|
this.setImgAvatar(this.two_img_avatar, this.m_two_data)
|
|
|
this.setLabScore(this.two_lab_score, this.m_two_data)
|
|
|
this.setImgCar(this.two_img_car, this.m_two_data)
|
|
|
+ this.setRegion(this.two_region_bg, this.two_lab_region, this.m_two_data, type)
|
|
|
}
|
|
|
if(data_list.length>2) {
|
|
|
this.m_three_data = data_list[2]
|
|
|
- this.setLabName(this.three_lab_name, this.m_three_data)
|
|
|
+ this.setLabName(this.three_lab_name, this.m_three_data,5)
|
|
|
this.setImgAvatar(this.three_img_avatar, this.m_three_data)
|
|
|
this.setLabScore(this.three_lab_score, this.m_three_data)
|
|
|
this.setImgCar(this.three_img_car, this.m_three_data)
|
|
|
+ this.setRegion(this.three_region_bg, this.three_lab_region, this.m_three_data, type)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -76,20 +83,23 @@ export class rank_list_top extends base_ui {
|
|
|
this.one_img_avatar.getComponent(Sprite).spriteFrame = null
|
|
|
this.one_lab_score.getComponent(Label).string = ''
|
|
|
this.one_img_car.getComponent(Sprite).spriteFrame = null
|
|
|
+ this.one_lab_region.getComponent(Label).string = ''
|
|
|
|
|
|
this.two_lab_name.getComponent(Label).string = ''
|
|
|
this.two_img_avatar.getComponent(Sprite).spriteFrame = null
|
|
|
this.two_lab_score.getComponent(Label).string = ''
|
|
|
this.two_img_car.getComponent(Sprite).spriteFrame = null
|
|
|
+ this.two_lab_region.getComponent(Label).string = ''
|
|
|
|
|
|
this.three_lab_name.getComponent(Label).string = ''
|
|
|
this.three_img_avatar.getComponent(Sprite).spriteFrame = null
|
|
|
this.three_lab_score.getComponent(Label).string = ''
|
|
|
this.three_img_car.getComponent(Sprite).spriteFrame = null
|
|
|
+ this.three_lab_region.getComponent(Label).string = ''
|
|
|
}
|
|
|
|
|
|
- private setLabName(node:Node, data:rankData) {
|
|
|
- tools.labelCutString(node,data.nickName,4)
|
|
|
+ private setLabName(node:Node, data:rankData, cut_num:number) {
|
|
|
+ tools.labelCutString(node,data.nickName,cut_num)
|
|
|
}
|
|
|
|
|
|
private setImgAvatar(node:Node, data:rankData) {
|
|
@@ -106,6 +116,15 @@ export class rank_list_top extends base_ui {
|
|
|
node.getComponent(Sprite).spriteFrame = GameManager.getUserCarInfo(data.user_id,data.car_id).sf
|
|
|
}
|
|
|
|
|
|
+ private setRegion(bg_node:Node, node:Node, data:rankData, type:number) {
|
|
|
+ if(type==3) { // 市排行隐藏
|
|
|
+ bg_node.active = false
|
|
|
+ } else {
|
|
|
+ bg_node.active = true
|
|
|
+ }
|
|
|
+ node.getComponent(Label).string = data.city_name
|
|
|
+ }
|
|
|
+
|
|
|
private onClickRankGotoUserInfo(data:rankData) {
|
|
|
if(data == null) {
|
|
|
return
|