import { Item } from "../../../../ItemList/Item" ; import { PrefabUrl } from "../../../../Manager/PrefabUrl" ; import { BattleSkillItemData } from "./BattleSkills" ; import BattleSkillDialog from "../BattleSkillDialog" ; import { Debug } from "../../../../Common/Debug" ; const { ccclass , property } = cc . _decorator ; @ ccclass export default class BattleSkillItem extends Item < BattleSkillItemData > { private index : number ; private _data : BattleSkillItemData ; @ property ( cc . Label ) public level : cc . Label ; @ property ( cc . Label ) public name_ : cc . Label ; @ property ( cc . Sprite ) public icon : cc . Sprite ; getData ( ) { return this . _data ; } showByData ( start = "talent_" ) { window . appContext . Pool . setSpriteFrameByUrl ( start + this . _data . talent_id . toString ( ) , this . icon ) ; this . name_ . string = this . _data . name ; this . level . string = this . _data . level . toString ( ) ; } bindData ( currentIndex , data ) { if ( data == null ) { this . reset ( currentIndex ) ; return ; } this . index = currentIndex ; this . _data = data ; this . showByData ( ) ; } reset ( currentIndex ) { } select ( selected ) { Debug . log ( "select:" + selected ) ; if ( ! selected ) { return ; } else { let BattleSkillDialog = window . appContext . UIManager . getDialog ( PrefabUrl . BattleSkillDialog ) ; BattleSkillDialog . set ( this . _data . talent_id ) ; } } getClickButton ( ) { return this . getComponent ( cc . Button ) ; } }