//********************* // create by 流云 // time: Sat Nov 29 2025 // desc: //********************* import { _decorator, Component, Node, find, instantiate, Label, tween, v3, EventTouch, RichText, Vec3, UITransform, Vec2 } from 'cc'; import { Auto_pageDungeon } from './Auto_pageDungeon'; import { UIID } from '../../game/ConfigRes'; import { StatisticsType } from '../../game/GameData'; import { ChapterDataManager } from '../../manager/ChapterDataManager'; import { itemPic } from '../../com/itemPic'; import { ItemData } from '../../game/ConfigProjectData'; import { ConstReplicaEnum } from '../../manager/ConstReplicaManager'; const { ccclass, property } = _decorator; @ccclass('UIpageDungeon') export class UIpageDungeon extends Auto_pageDungeon { onLoad(): void { super.onLoad(); } onEnable(): void { super.onEnable(); } onDisable(): void { super.onDisable(); } onInit(): void { //this.nodeAnim(); } nodeAnim() { //item for (let i = 0; i < this.ui_content.children.length; i++) { let itemNode = this.ui_content.children[i] itemNode.scale = v3(0, 0, 1) tween(itemNode) .delay(i * 0.1) .call(() => { if (i == 0) { this.createItemNode1(); } else if (i == 1) { this.createItemNode2(); } else if (i == 2) { this.createItemNode3(); } else if (i == 3) { this.createItemNode4(); } else if (i == 4) { this.createItemNode5(); } else if (i == 5) { this.createItemNode6(); } }) .to(0.3, { scale: v3(1, 1, 1) }, { easing: 'elasticOut' }) .start() } } createItemNode1() { // let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.InfiniteChallengeID) let idFix = idFixStr.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.infiniteChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.infiniteUnlockChapter) this._create(this.itemNode1, this.ui_layNode, lockChapter, Number(idFix), StatisticsType.InfiniteChallengeCount, count) } createItemNode2() { let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.InfiniteChallengeID) let idFix = idFixStr.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.propChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.propUnlockChapter) this._create(this.itemNode2, this.ui_layNode2, lockChapter, Number(idFix), StatisticsType.PropChallengeCount, count) } createItemNode3() { //WeaponChallengeCount let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.WeaponChallengeID); let idFix = idFixStr.split('|')[0] let id = idFix.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.weaponChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.weaponUnlockChapter) this._create(this.itemNode3, this.ui_layNode3, lockChapter, Number(id), StatisticsType.WeaponChallengeCount, count) } createItemNode4() { //同一个场景 let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.BoxChallengeID); let idFix = idFixStr.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.boxChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.boxUnlockChapter) this._create(this.itemNode4, this.ui_layNode4, lockChapter, Number(idFix), StatisticsType.BoxChallengeCount, count) } createItemNode5() { //同一个场景 let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.GachaChallengeID); let idFix = idFixStr.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.gachaChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.gachaUnlockChapter) this._create(this.itemNode5, this.ui_layNode5, lockChapter, Number(idFix), StatisticsType.gachaChallengeModeCount, count) } createItemNode6() { //同一个场景 let idFixStr = gg.replicaManager.getConstStringById(ConstReplicaEnum.BossChallengeID); let idFix = idFixStr.split(',')[0] let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.bossChallengeCountMax) let lockChapter = gg.replicaManager.getConstValueById(ConstReplicaEnum.bossUnlockChapter) this._create(this.itemNode6, this.ui_layNode6, lockChapter, Number(idFix), StatisticsType.BossChallengeCount, count) } _create(itemNode, ui_layNode, chapterNum, idFix, StatisticsNum, challengeMaxTimes) { let chapterConfig: ITableChapter = ChapterDataManager.getChapterDataById(idFix) let InfiniteChallengeCount = gg.data.getStatistics(StatisticsNum); let tiaozhan_label = itemNode.getChildByName('lay').getChildByName('tiaozhan_label').getComponent(Label) tiaozhan_label.string = `(${(challengeMaxTimes - InfiniteChallengeCount)}/${challengeMaxTimes})` if (gg.data.doc.chapter <= chapterNum) { itemNode.getChildByName('lockNode').active = true itemNode.getChildByName('lay').active = false itemNode.getChildByName('lockNode').getChildByName('langRichLab').getComponent(RichText).string = gg.lang.get('通过第{1}章解锁', [chapterNum]) } else { itemNode.getChildByName('lockNode').active = false itemNode.getChildByName('lay').active = true //itemNode.getChildByName('lay').getChildByName('tiaozhan_label').active = true } //104,9|105,4|106,3|1,180 let array = chapterConfig.reward.split('|') //倒序一下 array.reverse() if (ui_layNode.children.length > 0) { return } for (let i = 0; i < array.length; i++) { let item = array[i] let itemNode = instantiate(this.ui_item) if(i==0){ itemNode.scale = new Vec3(1,1,1) }else{ itemNode.scale = new Vec3(0.7,0.7,0.7) itemNode.getComponent(UITransform).setContentSize(70,70) } itemNode.parent = ui_layNode itemNode.setPosition(0, 0) itemNode.active = true itemNode.getComponent(itemPic).setGoodId(Number(item.split(',')[0])) let str = itemNode.getChildByName('lb_num').getComponent(Label) let num = item.split(',')[1] str.string = 'x' + num let itemData = gg.data.table.getItemData(Number(item.split(',')[0])) itemNode.getChildByName('碎片').active = itemData.type == 10 itemNode.on(Node.EventType.TOUCH_START, (e: EventTouch) => { e.propagationStopped = true; let data = new ItemData(itemData.id, 1, itemData); gg.ui.openPanel(UIID.ItemDetailBox, { data: data }) }, this) } } click_itemNode1() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.infiniteUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开地牢宝箱弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.InfiniteChallengeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.infiniteChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'wujin' }); } click_itemNode2() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.propUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开地牢宝箱弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.PropChallengeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.propChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'daoju' }); } click_itemNode3() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.weaponUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开地牢宝箱弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.WeaponChallengeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.weaponChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'wuqi' }); } click_itemNode4() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.boxUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开地牢宝箱弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.BoxChallengeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.boxChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'baoxiang' }); } click_itemNode5() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.gachaUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开抽卡挑战弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.gachaChallengeModeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.gachaChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'chouka' }); } click_itemNode6() { // let chapterLock = gg.replicaManager.getConstValueById(ConstReplicaEnum.bossUnlockChapter) if (gg.data.doc.chapter <= chapterLock) { gg.ui.showToast(gg.lang.get('通关第{1}章节解锁', [chapterLock]), false); return; } // 打开抽卡挑战弹窗 let InfiniteChallengeCount = gg.data.getStatistics(StatisticsType.BossChallengeCount); let count = gg.replicaManager.getConstValueById(ConstReplicaEnum.bossChallengeCountMax) if (InfiniteChallengeCount >= count) { gg.ui.showToast('今日已到最大挑战次数,明天再来吧'); return; } gg.ui.openPanel(UIID.ReplicaBox, { data: 'boss' }); } }