import { _decorator, Component, Node } from 'cc'; import JNScrollViewItem from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollViewItem'; import { TB } from '../../config/data/schema'; import { Label } from 'cc'; import GBattleModeManager, { BattleMode } from '../../battle/GBattleModeManager'; import { app, TD } from '../../App'; import { GUI } from '../UIConfig'; import { PlayerResourceShow } from '../Consts/Resource/PlayerResourceShow'; import ResourceData from '../../data/ResourceData'; import DungeonData from '../../data/DungeonData'; const { ccclass, property } = _decorator; @ccclass('DungeonShowItem') export class DungeonShowItem extends JNScrollViewItem { //副本名称 @property(Label) title:Label; //资源 @property(PlayerResourceShow) resource:PlayerResourceShow; async onInit(){ this.resource.type = this.data.consume.id; this.resource.onUpdateView(); await this.onUpdateView(); } async onUpdateView(){ this.title.string = `${this.data.name} (${await DungeonData.getIns().getInfoProcess(this.data.id)} / ${DungeonData.getIns().getMaxProcess(this.data.id)})`; } //点击副本 async onClickDungeon(){ if(ResourceData.getIns().getValue(this.data.consume.id) >= this.data.consume.value){ //打开副本 GBattleModeManager.getIns().Open(BattleMode[`${this.data.type}`],true,{ dungeonId:this.data.id, dungeonItemId:await DungeonData.getIns().getInfoProcess(this.data.id), data:TD[`${this.data.tigs}`].getDataList()[0].data }); app.layer.Close(GUI.DungeonView); }else{ app.layer.Open(GUI.Tips,{text:"没有钥匙了.."}); } } }