//********************* // create by 流云 // time: Mon Nov 03 2025 // desc: //********************* import { _decorator, Component, Node, find, Label, sp } from 'cc'; import { Auto_ItemDetailBox } from './Auto_ItemDetailBox'; import { SpriteLoad } from 'db://assets/mx/components/SpriteLoad'; import { GPath, GBundle } from '../../game/ConfigRes'; const { ccclass, property } = _decorator; @ccclass('UIItemDetailBox') export class UIItemDetailBox extends Auto_ItemDetailBox { onLoad(): void { super.onLoad(); } onEnable(): void { super.onEnable(); } onDisable(): void { super.onDisable(); } onInit(): void { this.showOpenCenterEff() this.showOpenMaskEff(2); let data = this.prema if (data) { this.updateUI(data) } } updateUI(data) { let id = data.id let itemData = null; if (data.isFragment) { let conf = gg.data.project.getWeaponData(data.id); let suipianId = conf.scrapId itemData = gg.data.table.getItemData(suipianId) this.icon.getComponent(SpriteLoad).setSprite(GPath.Item(itemData.icon), GBundle.Items); } else { itemData = gg.data.table.getItemData(id) //let res = id; if (itemData.type == 8) { let conf = gg.data.project.getWeaponData(itemData.weapon_type); let suipianId = conf.scrapId itemData = gg.data.table.getItemData(suipianId) //res = id - 200 + 20; data.isFragment = true } this.icon.getComponent(SpriteLoad).setSprite(GPath.Item(itemData.icon), GBundle.Items); } this.pingjiKuang.getComponent(SpriteLoad).setSprite(GPath.PingjiKuang('品质'+itemData.quality), GBundle.Comm2); if (this.node.find("eff")) { let eff = this.node.find("eff"); eff.active = [3, 4].includes(itemData.quality); if (eff.active) { let anim = eff.getComponent(sp.Skeleton); let animName = ""; if (itemData.quality == 3) animName = "1紫色框"; if (itemData.quality == 4) animName = "2橙色框"; if (animName) anim.setAnimation(0, animName, true); } } if (data.isFragment) { this.nameLab.string = gg.lang.get(itemData.name) //名字去掉碎片两个字 this.suipianNode.active = false let isHaveWeaponEquipped = gg.data.project.isWeaponUnlocked(id); let desc = itemData.name.replace('碎片', '') this.nameLab.string = gg.lang.get(desc) this.descLab.string = gg.lang.get(itemData.desc2) this.numLab.string = 'x' + data.num if (isHaveWeaponEquipped) { this.desc2Lab.string = gg.lang.get('拥有数量:{1}',[1]) } else { this.desc2Lab.string = gg.lang.get('拥有数量:{1}',[0]) } } else { this.nameLab.string = gg.lang.get(itemData.name) //名字去掉碎片两个字 // let desc = itemData.name.replace('碎片', '') this.descLab.string = itemData.desc1 this.numLab.string = 'x' + data.num let haveNum = gg.data.getItemNum(data.id) this.desc2Lab.string = gg.lang.get('拥有数量:{1}',[haveNum]) if (this.suipianNode) { this.suipianNode.active = itemData.type == 10; } } } click_bgMask(): void { gg.audio.playEffect({ name: "点击音效" }); this.close(2) } }