import { Item } from "../../../../ItemList/Item" ; import { PrefabUrl } from "../../../../Manager/PrefabUrl" ; import AvatarDialog from "../AvatarDialog" ; import { FrameData } from "./AvatarData" ; const { ccclass , property } = cc . _decorator ; @ ccclass export class FrameItem extends Item < FrameData > { private index : number ; public bool_selected : boolean ; private data_ : FrameData ; @ property ( cc . Node ) public lock : cc . Node ; @ property ( cc . Sprite ) public frame : cc . Sprite ; @ property ( cc . Sprite ) public selected : cc . Sprite ; getData ( ) { return this . data_ ; } showByData ( ) { window . appContext . Pool . setSpriteFrameByUrl ( "head_frame_" + this . data_ . avatar_id , this . frame ) ; this . lock . active = ! this . data_ . activated ; this . selected . node . active = this . data_ . selected ; } bindData ( currentIndex , data ) { if ( data == null ) { this . reset ( currentIndex ) ; return ; } this . index = currentIndex ; this . data_ = data ; this . showByData ( ) ; } reset ( currentIndex ) { } select ( selected ) { if ( selected ) { let avatar = window . appContext . UIManager . getDialog ( PrefabUrl . AvatarDialog ) ; avatar . refresh ( false , this . data_ ) ; } } getClickButton ( ) { return this . getComponent ( cc . Button ) ; } }