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

141 lines
4.3 KiB

1 week ago
//*********************
// create by 流云
// time: Mon Nov 03 2025
// desc:
//*********************
import { _decorator, Component, Node, find, Label, instantiate } from 'cc';
import { Auto_boxLevelupDetail } from './Auto_boxLevelupDetail';
import { IBoxLevelData, TableNames } from '../../game/ConfigTableData';
import { SpriteLoad } from 'db://assets/mx/components/SpriteLoad';
import { GBundle } from '../../game/ConfigRes';
const { ccclass, property } = _decorator;
@ccclass('UIboxLevelupDetail')
export class UIboxLevelupDetail extends Auto_boxLevelupDetail {
curChooseIndex = 0
onLoad(): void {
super.onLoad();
}
onEnable(): void {
super.onEnable();
}
onDisable(): void {
super.onDisable();
}
onInit(): void {
//
let curBoxLevel = gg.data.getCurBoxLevel();
this.showOpenMaskEff(2)
//更新视图
this.curChooseIndex = curBoxLevel
this.updataView(this.curChooseIndex)
}
updataView(curBoxLevel) {
this.lb_boxLevel.string = curBoxLevel.toString();
//拿出配置
let boxTabList = gg.data.table.getTableList<IBoxLevelData>(TableNames.Box).filter(x => x.type == 1);
let boxLevelData = boxTabList.find(x => x.level == curBoxLevel);
let fragment = boxLevelData.fragment;
let boxTabList2 = gg.data.table.getTableList<IBoxLevelData>(TableNames.Box).filter(x => x.type == 2);
let boxLevelData2 = boxTabList2.find(x => x.level == curBoxLevel);
let fragment2 = boxLevelData2.fragment;
let fragmentList = fragment.split(':')
let fragmentList2 = fragment2.split(':')
this.showLay(this.ui_lay1, fragmentList)
this.showLay(this.ui_lay2, fragmentList2)
}
showLay(ui_lay, fragmentList) {
ui_lay.active = true
for (let i = 0; i < ui_lay.children.length; i++) {
ui_lay.children[i].active = false
}
for (let i = 0; i < fragmentList.length; i++) {
let str = fragmentList[i];
let n: Node = null;
if (i < ui_lay.children.length) {
n = ui_lay.children[i]
} else {
n = instantiate(this.ui_itemNode);
ui_lay.addChild(n);
}
n.active = true;
let [id, num] = str.split(',');
let labNum = n.getChildByName('labNum')?.getComponent(Label)
let spNode = n.getChildByName('icon');
labNum.string = num;
let itemdata = gg.data.table.getItemData(Number(id));
let sName = "橙色";
if (itemdata.quality == 1) sName = "绿色";
if (itemdata.quality == 2) sName = "蓝色";
if (itemdata.quality == 3) sName = "紫色";
if (itemdata.quality == 4) sName = "橙色";
spNode.getComponent(SpriteLoad).setSprite("texture/" + sName + "?", GBundle.Shop);
}
// ui_lay.children.forEach((item, index) => {
// item.active = index < fragmentList.length
// if (item.active) {
// let [id, num] = fragmentList[index].split(',');
// let labNum = item.getChildByName('labNum')?.getComponent(Label)
// labNum.string = num
// }
// })
}
click_bgMask() {
gg.audio.playEffect({ name: "点击音效" });
//点击背景关闭
this.close()
}
click_leftBtn() {
gg.audio.playEffect({ name: "点击音效" });
//点击左箭头返回
//当前等级--
if (this.curChooseIndex <= 1) {
return
}
this.curChooseIndex--
if (this.curChooseIndex <= 1) {
this.leftBtn.active = false
this.rightBtn.active = true
} else {
this.leftBtn.active = true
}
this.updataView(this.curChooseIndex)
}
click_rightBtn() {
gg.audio.playEffect({ name: "点击音效" });
//点击右箭头升级
//当前等级++
if (this.curChooseIndex >= 20) {
return
}
this.curChooseIndex++
if (this.curChooseIndex >= 20) {
this.rightBtn.active = false
this.leftBtn.active = true
} else {
this.leftBtn.active = true
}
this.updataView(this.curChooseIndex)
}
}