消消方块阵换皮表情
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.
 
 
 

766 lines
28 KiB

//*********************
// create by 流云
// time: Tue Nov 11 2025
// desc:
//*********************
import { _decorator, Component, Node, find, ProgressBar, Label, tween, instantiate, sp, Tween, Prefab, easing, Asset, Sorting2D, Animation } from 'cc';
import { Auto_pageUserLevelup } from './Auto_pageUserLevelup';
import { ItemNumType, OtherDataType, StatisticsType, StatusType, TaskType } from '../../game/GameData';
import { IRoleLevelData, TableNames } from '../../game/ConfigTableData';
import { GBundle, UIID } from '../../game/ConfigRes';
import { LevelupIcon } from './LevelupIcon';
import { GEvent } from 'db://assets/mx/module/event/GEvent';
import { TargetTaskType } from '../../manager/TargetTaskManager';
import { NewFunType } from '../../newFun/NewFun';
const { ccclass, property } = _decorator;
enum addType {
Att = 0,
Baoji = 1,
Lengque = 2,
}
@ccclass('UIpageUserLevelup')
export class UIpageUserLevelup extends Auto_pageUserLevelup {
// getResPkg() {
// let ress = [];
// // 获取当前角色的所有皮肤
// let allSkin = gg.skin.allSkin;
// for (let skin of allSkin) {
// ress.push({
// name: `角色页待机`,
// bundle: GBundle.Items,
// path: `skin/${skin.id}/`,
// type: Prefab
// });
// }
// let pkg = {
// name: "角色页面",
// isReleaseable: true,
// ress: ress
// }
// return pkg;
// }
curData = ''
curProgressNode1 = null
curProgressNode2 = null
suiPianShopList: IRoleLevelData[] = []
curProgressNodeArray = []
maxLavelFix = 0
recoveryPosi: boolean = false;
onLoad(): void {
super.onLoad();
}
onEnable(): void {
super.onEnable();
//GEvent.Ins.on(GEvent.CHANGE_SKIN, this.updateSkin, this);
}
showGuide() {
if (gg.data.getStatistics(StatisticsType.homeGuideIndex) == 5) {
let toggle = this.shengjikuangBtnAtt
gg.ui.openPanel(UIID.NewGuideMask, {
data: [
[toggle],
[''],
() => {
gg.data.setStatistics(StatisticsType.homeGuideIndex, 6)
this.scheduleOnce(()=>{
GEvent.Ins.emit(GEvent.homeGuideIndexEventNew, 6)
},0.2)
},
true,
255
]
})
}
}
onDisable(): void {
this.unscheduleAllCallbacks();
super.onDisable();
//GEvent.Ins.off(GEvent.CHANGE_SKIN, this.updateSkin, this);
}
onInit(): void {
this.unscheduleAllCallbacks()
this.btnChangeSkin.active = false;
if (!this.isValid || !this.ui_ProgressBar1?.isValid || !this.ui_ProgressBar2?.isValid || !this.ui_levelBg?.isValid) {
return;
}
this.suiPianShopList = gg.data.table.getTableList<IRoleLevelData>(TableNames.Role)
this.maxLavelFix = this.suiPianShopList.length * 30
let curData = gg.data.getStringData(OtherDataType.UserLevelupData)
if (curData == '') {
gg.data.setStringData(OtherDataType.UserLevelupData, '0&10&0&0&0&0&0')
}
//
let curDataArr = curData.split('&')
let roleLevel = Number(curDataArr[0])
if (roleLevel > 0 && roleLevel % 30 == 0 && roleLevel < this.maxLavelFix) {
//小阶段等级都满10级重新开始
if (curDataArr[4] == '10' && curDataArr[5] == '10' && curDataArr[6] == '10') {
curDataArr[4] = '0'
curDataArr[5] = '0'
curDataArr[6] = '0'
curDataArr[0] = String(Number(curDataArr[0]) + 1)
gg.data.setStringData(OtherDataType.UserLevelupData, curDataArr.join('&'))
}
}
this.curProgressNode1 = this.ui_ProgressBar1
this.curProgressNode2 = this.ui_ProgressBar2
this.curProgressNodeArray = [this.ui_ProgressBar1, this.ui_ProgressBar2]
this.refreshUI()
this.refreshProgressBarAnim()
this.scheduleOnce(() => {
this.showGuide()
}, 0.3)
//this.updateSkin();
}
protected start(): void {
}
//进度条动画
refreshProgressBarAnim() {
//this.ui_levelBg 进行移动 -320到320
// this.curProgressNode1 精度条进行变化移到
//最大进行次数10次
//总时间0.5s
//progress
let maxLevelFix = 20
let curDataArr = this.curData.split('&')
let progress = Number(curDataArr[0]) % 20 / maxLevelFix
if (progress == 0) {
return
}
if (progress > 1) {
//超过1的减去整数保留小数
let intProgress = Math.floor(progress)
progress -= intProgress
}
// let maxIndexFix = 10
let timeFix = 0.3
// if(progress>0.5){
// timeFix = 0.3
// maxIndexFix = 10
// }else{
// timeFix = 0.3
// }
//进度值
let time = timeFix / 10
let addProgress = progress / 10
let curProgress = this.curProgressNodeArray[0].getComponent(ProgressBar).progress
let endPosx = 320 * 2 * progress
let addCurPosx = endPosx / 10
let startPox = this.ui_levelBg.position.x
// let indexadd = 0
this.schedule(() => {
curProgress += addProgress
this.curProgressNodeArray[0].getComponent(ProgressBar).progress = curProgress
startPox += addCurPosx
this.ui_levelBg.setPosition(startPox, -56)
// indexadd++
// console.log('indexadd', indexadd)
}, time, 10 - 1);
}
//玩家升级数据: 玩家等级,玩家攻击力,玩家暴击率系数,玩家冷却系数
//玩家攻击力等级,玩家暴击率系数等级,玩家冷却系数等级, 等级奖励
//1&10&0&0&1&1&1
refreshUI() {
if (!this.isValid || !this.curProgressNode1?.isValid || !this.curProgressNode2?.isValid || !this.ui_levelBg?.isValid) {
return;
}
//精度条
this.curData = gg.data.getStringData(OtherDataType.UserLevelupData)
let curDataArr = this.curData.split('&')
let roleLevel = curDataArr[0]
let _index = Math.floor(Number(roleLevel) / 30)
if (_index >= this.suiPianShopList.length) {
_index = this.suiPianShopList.length - 1
}
let curListData = this.suiPianShopList[_index]
//console.log('curListData', curListData)
//20级一个阶段
//当前阶段数目最大的等级
let index2 = Math.floor(Number(roleLevel) / 20)
let curMaxLevel = (index2 + 1) * 20
let maxLevel1 = curMaxLevel - 10
let maxLevel2 = curMaxLevel
let maxLevel3 = curMaxLevel + 10
let maxLevel4 = curMaxLevel + 20
this.curProgressNode1.setPosition(0, -56)
this.curProgressNode2.setPosition(675, -56)
//两条进度条
let maxLevelFix = 20
this.curProgressNode1.getComponent(ProgressBar).progress = 0//Number(curDataArr[0]) / maxLevelFix
this.curProgressNode2.getComponent(ProgressBar).progress = 0
this.curProgressNode1.getChildByName('level1').getComponent(Label).string = maxLevel1 + '级'
this.curProgressNode1.getChildByName('level2').getComponent(Label).string = maxLevel2 + '级'
this.curProgressNode2.getChildByName('level1').getComponent(Label).string = maxLevel3 + '级'
this.curProgressNode2.getChildByName('level2').getComponent(Label).string = maxLevel4 + '级'
//-320到290 百分制分割
this.ui_levelBg.setPosition(-320, -51)
this.ui_levelBg.getChildByName('levelLab').getComponent(Label).string = roleLevel + '级'
this.refreshBtnNode(this.shengjikuangBtnAtt, addType.Att)
this.refreshBtnNode(this.shengjikuangBtnBaoji, addType.Baoji)
this.refreshBtnNode(this.shengjikuangBtnLengque, addType.Lengque)
this.curProgressNode1.getChildByName('奖励1').getComponent(LevelupIcon).setLevel(maxLevel1)
this.curProgressNode1.getChildByName('奖励2').getComponent(LevelupIcon).setLevel(maxLevel2)
this.curProgressNode2.getChildByName('奖励1').getComponent(LevelupIcon).setLevel(maxLevel3)
this.curProgressNode2.getChildByName('奖励2').getComponent(LevelupIcon).setLevel(maxLevel4)
}
click_yulanBtn() {
gg.audio.playEffect({ name: "点击音效" });
gg.ui.openPanel(UIID.pageUserLevelupDetail)
}
click_shengjikuangBtnAtt() {
gg.audio.playEffect({ name: "点击音效" });
this.shengjiClick(this.shengjikuangBtnAtt, addType.Att, 4)
}
click_shengjikuangBtnBaoji() {
gg.audio.playEffect({ name: "点击音效" });
let manji = this.shengjikuangBtnBaoji.getChildByName('满级')
if (manji.active) {
gg.ui.showToast('已满级,请先升级其他属性')
return
}
this.shengjiClick(this.shengjikuangBtnBaoji, addType.Baoji, 5)
}
click_shengjikuangBtnLengque() {
gg.audio.playEffect({ name: "点击音效" });
let manji = this.shengjikuangBtnLengque.getChildByName('满级')
if (manji.active) {
gg.ui.showToast('已满级,请先升级其他属性')
return
}
this.shengjiClick(this.shengjikuangBtnLengque, addType.Lengque, 6)
}
shengjiClick(nodeBtn, type, index) {
if (this.recoveryPosi == true) {
return
}
let myMoney = gg.data.getItemNum(ItemNumType.money)
let spendMoney = nodeBtn.getChildByName('lay').getChildByName('money').getComponent(Label).string
let spendMoney2 = Number(spendMoney)
if (myMoney < spendMoney2) {
gg.ui.showToast('金币不足')
return
}
let manji = nodeBtn.getChildByName('满级')
if (manji.active) {
gg.ui.showToast('已满级,请先升级其他属性')
return
}
let curDataArr = this.curData.split('&')
if (Number(curDataArr[0]) > this.maxLavelFix) {
gg.ui.showToast('已满级')
return
}
//升级统计
gg.targetTaskManager.statisticalData(TargetTaskType.roleEvolve, 1);
gg.audio.playEffect({ name: "升级" });
gg.data.subItemNum(ItemNumType.money, spendMoney2)
gg.data.addDayTaskProgressData(TaskType.roleUpgrade, 1)
//总等级也需要增加
let roleLevel = Number(curDataArr[0]) + 1
curDataArr[0] = roleLevel + ''
if (roleLevel % 5 == 0) {
gg.sdk.reportDY("inLevel", `章节${gg.data.doc.chapter}-主角${roleLevel}`)
gg.sdk.reportDY("inLevel", `角色升级-主角${roleLevel}`)
}
if (roleLevel > 0 && roleLevel % 10 == 0) {
//getLevelUpReward
this.curProgressNodeArray[0].getChildByName('奖励1').getComponent(LevelupIcon).getLevelUpReward(roleLevel)
this.curProgressNodeArray[0].getChildByName('奖励2').getComponent(LevelupIcon).getLevelUpReward(roleLevel)
this.curProgressNodeArray[1].getChildByName('奖励1').getComponent(LevelupIcon).getLevelUpReward(roleLevel)
this.curProgressNodeArray[1].getChildByName('奖励2').getComponent(LevelupIcon).getLevelUpReward(roleLevel)
}
let _index = Math.floor(Number(curDataArr[0]) / 30)
if (_index >= this.suiPianShopList.length) {
_index = this.suiPianShopList.length - 1
}
let curListData = this.suiPianShopList[_index]
let levelUp = Number(curDataArr[index]) + 1
if (levelUp > 10) {
console.log('升级出错,设置到10级')
levelUp = 10
}
curDataArr[index] = levelUp + ''
//小阶段等级都满10级重新开始
//但是总等级不能大于this.maxLavelFix级
if (roleLevel > 0 && roleLevel % 30 == 0 && roleLevel < this.maxLavelFix) {
//小阶段等级都满10级重新开始
curDataArr[4] = '0'
curDataArr[5] = '0'
curDataArr[6] = '0'
}
if (type == addType.Att) {
//攻击力增加记录
let levelNum = Number(curDataArr[4])
let curxishu = curListData.initial_att + curListData.coefficient_att * levelNum
curDataArr[1] = curxishu + ''
} else if (type == addType.Baoji) {
//暴击率系数等级
let levelNum = Number(curDataArr[5])
let curxishu = curListData.initial_crt + curListData.coefficient_crt * levelNum
curDataArr[2] = curxishu + ''
} else if (type == addType.Lengque) {
//冷却系数等级
let levelNum = Number(curDataArr[6])
let curxishu = curListData.initial_cd + curListData.coefficient_cd * levelNum
curDataArr[3] = curxishu + ''
}
this.ui_levelBg.getChildByName('levelLab').getComponent(Label).string = roleLevel + 'lv'
this.curData = curDataArr.join('&')
gg.data.setStringData(OtherDataType.UserLevelupData, this.curData)
//升级
if (roleLevel > 0 && roleLevel % 30 == 0 && roleLevel < this.maxLavelFix) {
this.refreshBtnNode(this.shengjikuangBtnAtt, addType.Att)
this.refreshBtnNode(this.shengjikuangBtnBaoji, addType.Baoji)
this.refreshBtnNode(this.shengjikuangBtnLengque, addType.Lengque)
} else {
//红点刷新
this.refreshBtnNode(this.shengjikuangBtnAtt, addType.Att)
this.refreshBtnNode(this.shengjikuangBtnBaoji, addType.Baoji)
this.refreshBtnNode(this.shengjikuangBtnLengque, addType.Lengque)
}
if (Number(curDataArr[0]) % 20 == 0) {
this.recoveryPosi = true
}
GEvent.Ins.emit(GEvent.UpdateCombatPower);
this.playProAnim(nodeBtn)
this.playAddAnim(nodeBtn, type)
this.playRoleAnim();
}
playAddAnim(nodeBtn, type) {
//角色加成动画
//levelBgItemCopy动画
let curDataArr = this.curData.split('&')
//levelBgItemCopy动画2
let copyNode = instantiate(this.ui_levelBgItemCopy);
copyNode.parent = this.ui_center;
const startPos = nodeBtn.position.clone(); // 保存起始位置
copyNode.setPosition(startPos);
copyNode.active = true;
//动画配置
let time22 = 0.3; // 总动画时间
let times = 30; // 总帧数
let oneTime = time22 / times; // 每帧间隔时间
let currentFrame = 0; // 当前帧数计数器
//保存调度器ID以便后续可能需要取消
const schedulerId = this.schedule(() => {
currentFrame++;
// 计算动画进度 (0~1)
const progress = Math.min(currentFrame / times, 1);
// 实时获取目标节点的最新位置
const targetPos = this.ui_levelBg.position;
// 计算当前应该在的位置(线性插值)
const currentX = startPos.x + (targetPos.x - startPos.x) * progress;
const currentY = startPos.y + (targetPos.y - startPos.y) * progress;
// 动画结束时销毁节点
if (progress >= 1) {
this.unschedule(schedulerId); // 取消调度
copyNode.destroy(); // 销毁节点
} else {
// 更新节点位置
copyNode.setPosition(currentX, currentY);
}
}, oneTime, times - 1);
// let copyJueseAdd = instantiate(this.ui_Role)
// copyJueseAdd.parent = this.ui_Role.parent
// copyJueseAdd.active = true
let lay = find('lay', this.ui_Role)
let descLab = find('lay/descLab', this.ui_Role).getComponent(Label)
let addLab = find('lay/addLab', this.ui_Role).getComponent(Label)
let addxishu = 0
let addxishuStr = ''
let _index = Math.floor(Number(curDataArr[0]) / 30)
if (_index >= this.suiPianShopList.length) {
_index = this.suiPianShopList.length - 1
}
let curListData = this.suiPianShopList[_index]
//console.log('curListData', curListData)
let powerNum = gg.data.getCurPower()
if (type == addType.Att) {
descLab.string = gg.lang.get('战力')
addxishu = curListData.coefficient_att
addxishuStr = '' + powerNum
} else if (type == addType.Baoji) {
descLab.string = gg.lang.get('战力')
addxishu = curListData.coefficient_crt / 10000
//暴击率系数是万分比 保留一位小数
addxishu = addxishu * 100
//保留一位小数
//保留一位小数
addxishu = Number(addxishu.toFixed(1))
addxishuStr = '' + powerNum + ''
} else if (type == addType.Lengque) {
descLab.string = gg.lang.get('战力')
addxishu = curListData.coefficient_cd / 10000
//冷却系数是万分比 保留一位小数
addxishu = addxishu * 100
//保留一位小数
addxishu = Number(addxishu.toFixed(1))
addxishuStr = '' + powerNum + ''
}
addLab.string = addxishuStr
Tween.stopAllByTarget(this.ui_Role)
this.ui_Role.getComponent(sp.Skeleton).setAnimation(0, 'animation', false)
lay.active = false
this.ui_Role.active = true
tween(this.ui_Role)
.delay(0.3)
.call(() => {
lay.active = true
})
.delay(1.7)
.call(() => {
this.ui_Role.active = false
})
.start()
// lay.active = true
// copyJueseAdd.getComponent(sp.Skeleton).setAnimation(0, 'animation', false)
// this.scheduleOnce(()=>{
// lay.active = true
// tween(copyJueseAdd)
// .delay(2)
// .call(()=>{
// copyJueseAdd.destroy()
// })
// .start()
// }, 0.3)
//animation
}
playProAnim(nodeBtn) {
//进度条动画 一次的动画
let maxLevelFix = 20
let curDataArr = this.curData.split('&')
let progress = Number(curDataArr[0]) % 20 / maxLevelFix
progress = progress - this.curProgressNodeArray[0].getComponent(ProgressBar).progress
if (progress == 0) {
return
}
if (progress > 1) {
//超过1的减去整数保留小数
let intProgress = Math.floor(progress)
progress -= intProgress
}
let maxIndexFix = 10
let timeFix = 0.1
//进度值
let time = timeFix / 10
let addProgress = progress / 10
let curProgress = this.curProgressNodeArray[0].getComponent(ProgressBar).progress
let endPosx = 320 * 2 * progress
let addCurPosx = endPosx / 10
let startPox = this.ui_levelBg.position.x
this.schedule(() => {
curProgress += addProgress
this.curProgressNodeArray[0].getComponent(ProgressBar).progress = curProgress
startPox += addCurPosx
this.ui_levelBg.setPosition(startPox, -56)
}, time, 10 - 1);
if (Number(curDataArr[0]) % 10 == 0) {
//奖励弹窗有奖励
//奖励领取,如果三个阶段都已经满10级
this.showRewardPop()
}
if (Number(curDataArr[0]) % 20 == 0) {
this.recoveryPosi = true
//2进度条同步往左移动,动画完成左边进度条位置放到最右边
for (let i = 0; i < this.curProgressNodeArray.length; i++) {
let proNode = this.curProgressNodeArray[i]
let posix = proNode.x
tween(proNode)
.to(0.3, { x: posix - 675 })
.call(() => {
if (i == this.curProgressNodeArray.length - 1) {
//动画完成后,把第一个进度条放到最后面
let firstProNode = this.curProgressNodeArray[0]
firstProNode.setPosition(675, -56)
firstProNode.getComponent(ProgressBar).progress = 0
//this.curProgressNodeArray两个进度条互相换索引
let temp = this.curProgressNodeArray[0]
this.curProgressNodeArray[0] = this.curProgressNodeArray[1]
this.curProgressNodeArray[1] = temp
//更新等级数据
let index2 = Math.floor(Number(curDataArr[0]) / 20)
let curMaxLevel = (index2 + 1) * 20
let maxLevel1 = curMaxLevel - 10
let maxLevel2 = curMaxLevel
let maxLevel3 = curMaxLevel + 10
let maxLevel4 = curMaxLevel + 20
this.curProgressNodeArray[0].getChildByName('level1').getComponent(Label).string = maxLevel1 + 'lv'
this.curProgressNodeArray[0].getChildByName('level2').getComponent(Label).string = maxLevel2 + 'lv'
this.curProgressNodeArray[1].getChildByName('level1').getComponent(Label).string = maxLevel3 + 'lv'
this.curProgressNodeArray[1].getChildByName('level2').getComponent(Label).string = maxLevel4 + 'lv'
//更新奖励图标
this.curProgressNodeArray[0].getChildByName('奖励1').getComponent(LevelupIcon).setLevel(maxLevel1)
this.curProgressNodeArray[0].getChildByName('奖励2').getComponent(LevelupIcon).setLevel(maxLevel2)
this.curProgressNodeArray[1].getChildByName('奖励1').getComponent(LevelupIcon).setLevel(maxLevel3)
this.curProgressNodeArray[1].getChildByName('奖励2').getComponent(LevelupIcon).setLevel(maxLevel4)
}
})
.start()
}
//levelBgNode重新标记位置
tween(this.ui_levelBg)
.to(0.3, { x: -320 })
.call(() => {
this.ui_levelBg.setPosition(-320, -56)
this.recoveryPosi = false
})
.start()
// this.scheduleOnce(() => {
// }, 0.35)
} else {
}
}
playRoleAnim() {
this.ui_upLevel.active = true
this.scheduleOnce(() => {
if (this.ui_upLevel.isValid) {
this.ui_upLevel.active = false
}
}, 1);
}
click_btnPet(): void {
let conf = gg.newFun.getNewFunData(NewFunType.MainPageBtn, 6);
if (gg.data.doc.chapter <= conf.chapter) {
gg.ui.showToast(gg.lang.get(conf.desc, [conf.chapter]), false)
return
}
this.btnPet.find("红点").active = false;
gg.ui.openPanel(UIID.petLayer);
}
updateSkin() {
this.ui_skin.destroyAllChildren();
let n = gg.res.getNode(`skin/${gg.skin.CurrentSkin}/`, "角色页待机", GBundle.Items);
this.ui_skin.addChild(n);
n.y = 500;
n.getComponent(Sorting2D).enabled = false
tween(n)
.to(0.2, { y: 0 }, { easing: easing.backOut })
.start()
this.refreshBtnNode(this.shengjikuangBtnAtt, addType.Att);
GEvent.Ins.emit(GEvent.UpdateCombatPower);
}
showRewardPop() {
}
refreshBtnNode(bode, type) {
//重新更新
if (!this.suiPianShopList || this.suiPianShopList.length === 0) {
return;
}
if (!this.curData) {
this.curData = '0&10&0&0&0&0&0';
}
let curDataArr = this.curData.split('&')
if (curDataArr.length < 7) {
this.curData = '0&10&0&0&0&0&0';
curDataArr = this.curData.split('&');
}
const roleLevelNum = Number(curDataArr[0])
let _index = Math.floor((Number.isFinite(roleLevelNum) ? roleLevelNum : 0) / 30)
if (_index < 0) {
_index = 0
}
if (_index >= this.suiPianShopList.length) {
_index = this.suiPianShopList.length - 1
}
let curListData = this.suiPianShopList[_index] || this.suiPianShopList[0]
if (!curListData) {
return;
}
//console.log('curListData', curListData)
let levelNum = 0
let myMoney = gg.data.getItemNum(ItemNumType.money)
let manji = bode.getChildByName('满级')
let redPoint = bode.getChildByName('红点')
let nameLab = bode.getChildByName('nameLab').getComponent(Label)
redPoint.active = false
let lay = bode.getChildByName('lay')
let lay2 = bode.getChildByName('lay2')
let moneyLab = lay.getChildByName('money').getComponent(Label)
let curShuXing = bode.getChildByName('lab2').getComponent(Label)
let addShuxing = lay2.getChildByName('lab3').getComponent(Label)
let addxishu = 0
let addxishuStr = ''
let curxishu = 0
let curShuXingStr = ''
let spendMoney = 0
if (type == addType.Att) {
levelNum = Number(curDataArr[4])
addxishu = curListData.coefficient_att
addxishuStr = '+' + addxishu
curxishu = curListData.initial_att + curListData.coefficient_att * levelNum;
curxishu = Math.floor(curxishu );
curDataArr[1] = curxishu + ''
//保留一位小数
curShuXingStr = curxishu + ''
spendMoney = curListData.initial_coin1 + curListData.coefficient_coin1 * levelNum
} else if (type == addType.Baoji) {
levelNum = Number(curDataArr[5])
addxishu = curListData.coefficient_crt / 10000
//暴击率系数是万分比 保留一位小数
addxishu = addxishu * 100
//保留一位小数
//保留一位小数
addxishu = Number(addxishu.toFixed(1))
addxishuStr = '+' + addxishu + '%'
curxishu = curListData.initial_crt + curListData.coefficient_crt * levelNum
curxishu = Math.floor(curxishu );
//保存数据
curDataArr[2] = curxishu + ''
//保留一位小数但是不包括0
//保留一位小数但是不包括0
const formattedNum = (curxishu / 10000) * 100;
curShuXingStr = formattedNum % 1 === 0 ? formattedNum.toString() : formattedNum.toFixed(1);
//保留一位小数但是不包括0
curShuXingStr = curShuXingStr + '%'
spendMoney = curListData.initial_coin2 + curListData.coefficient_coin2 * levelNum
} else if (type == addType.Lengque) {
levelNum = Number(curDataArr[6])
//冷却系数是万分比 保留一位小数
addxishu = curListData.coefficient_cd / 10000
//冷却系数是万分比 保留一位小数
addxishu = addxishu * 100
//保留一位小数
addxishu = Number(addxishu.toFixed(1))
addxishuStr = '+' + addxishu + '%'
curxishu = curListData.initial_cd + curListData.coefficient_cd * levelNum
curxishu = Math.floor(curxishu );
//保存数据
curDataArr[3] = curxishu + ''
//保留一位小数但是特殊情况比如0.0就取消小数后面的.0显示整数就可以
const formattedNum = (curxishu / 10000) * 100;
curShuXingStr = formattedNum % 1 === 0 ? formattedNum.toString() : formattedNum.toFixed(1);
curShuXingStr = curShuXingStr + '%'
spendMoney = curListData.initial_coin3 + curListData.coefficient_coin3 * levelNum
}
if (levelNum >= 10) {
//当前阶段满级
manji.active = true
let lab2 = manji.getChildByName('lay2').getChildByName('lab2').getComponent(Label)
lab2.string = curShuXingStr
} else {
manji.active = false
if (myMoney >= spendMoney) {
redPoint.active = true
}
}
nameLab.string = gg.lang.get('等级') + levelNum
addShuxing.string = addxishuStr
curShuXing.string = curShuXingStr
moneyLab.string = spendMoney + ''
}
}