import { Item } from "../../../../ItemList/Item" ; import { QualityData } from "./RecoverData" ; const { ccclass , property } = cc . _decorator ; @ ccclass export class QualityItem extends Item < QualityData > { private index : number ; public bool_selected : boolean ; private data_ : QualityData ; @ property ( cc . Label ) public text : cc . Label ; @ property ( cc . Sprite ) public selected : cc . Sprite ; getData ( ) { return this . data_ ; } showByData ( ) { this . text . string = this . data_ . quality ; this . selected . node . active = this . bool_selected ; } bindData ( currentIndex , data ) { if ( data == null ) { this . reset ( currentIndex ) ; return ; } this . index = currentIndex ; this . bool_selected = data . bool_selected ; this . data_ = data ; this . showByData ( ) ; } reset ( currentIndex ) { } select ( selected ) { if ( selected ) { this . bool_selected = ! this . bool_selected ; this . showByData ( ) ; } } getClickButton ( ) { return this . getComponent ( cc . Button ) ; } }