You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.2 KiB
102 lines
3.2 KiB
|
|
//*********************
|
|
// create by 流云
|
|
// time: Mon Nov 17 2025
|
|
// desc:
|
|
//*********************
|
|
import { _decorator, Component, Node , find, Label, ProgressBar} from 'cc';
|
|
import { Auto_pageUserLevelupDetail } from './Auto_pageUserLevelupDetail';
|
|
import List from 'db://assets/mx/components/list/List';
|
|
import { IRoleLevelData, TableNames } from '../../game/ConfigTableData';
|
|
|
|
import { LevelupIcon } from '../pageUserLevelup/LevelupIcon';
|
|
import { OtherDataType } from '../../game/GameData';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('UIpageUserLevelupDetail')
|
|
export class UIpageUserLevelupDetail extends Auto_pageUserLevelupDetail {
|
|
|
|
@property(List)
|
|
listV: List = null;
|
|
LevelUpData = []
|
|
curMyLevel = 0
|
|
|
|
onLoad(): void {
|
|
super.onLoad();
|
|
}
|
|
|
|
onEnable(): void {
|
|
super.onEnable();
|
|
}
|
|
|
|
onDisable(): void {
|
|
super.onDisable();
|
|
}
|
|
|
|
onInit(): void {
|
|
let curData = gg.data.getStringData(OtherDataType.UserLevelupData).split('&')
|
|
this.curMyLevel = Number(curData[0])
|
|
|
|
this.setMyItem()
|
|
}
|
|
|
|
setMyItem(){
|
|
let suiPianShopList = gg.data.table.getTableList<IRoleLevelData>(TableNames.Role)
|
|
let maxLevel = suiPianShopList.length*30
|
|
let dataLeng = maxLevel/10
|
|
for(let i = 0;i<dataLeng;i++){
|
|
|
|
this.LevelUpData.push((i+1)*10)
|
|
}
|
|
this.listV.numItems = this.LevelUpData.length;
|
|
let tenNum = Math.floor(this.curMyLevel/10)
|
|
this.listV.scrollTo(tenNum,0.3)
|
|
}
|
|
|
|
onListRender(item: Node, index: number){
|
|
let curMyLevel = this.curMyLevel
|
|
|
|
//取10的倍数,和个位数
|
|
let tenNum = Math.floor(curMyLevel/10)*10
|
|
let oneNum = curMyLevel-tenNum
|
|
|
|
let levelLab = item.getChildByName('levelLab').getComponent(Label)
|
|
levelLab.string ='lv'+ this.LevelUpData[index].toString()
|
|
if(index == 0){
|
|
item.getChildByName('竖向进度框底端').active = true
|
|
item.getChildByName('竖向进度框顶端').active = false
|
|
}else if(index == this.LevelUpData.length-1){
|
|
item.getChildByName('竖向进度框底端').active = false
|
|
item.getChildByName('竖向进度框顶端').active = true
|
|
}else {
|
|
item.getChildByName('竖向进度框底端').active = false
|
|
item.getChildByName('竖向进度框顶端').active = false
|
|
}
|
|
let pro = item.getChildByName('ProgressBar').getComponent(ProgressBar)
|
|
//小于等于tenNum,进度1
|
|
if(this.LevelUpData[index] <= tenNum){
|
|
pro.progress = 1
|
|
}else{
|
|
//大于tenNum,进度0-1
|
|
if(oneNum > 0){
|
|
if(this.LevelUpData[index]-curMyLevel>0 && this.LevelUpData[index]-curMyLevel<=10){
|
|
pro.progress = oneNum/10
|
|
}else{
|
|
pro.progress = 0
|
|
}
|
|
|
|
}else {
|
|
pro.progress = 0
|
|
}
|
|
}
|
|
let jiangli = item.getChildByName('奖励1')
|
|
jiangli.getComponent(LevelupIcon).setLevel(this.LevelUpData[index], false)
|
|
|
|
}
|
|
|
|
click_bgMask() {
|
|
gg.audio.playEffect({ name: "点击音效"});
|
|
this.close()
|
|
}
|
|
}
|
|
|