import { Item } from "../../../../ItemList/Item" ; import { Util } from "../../../../Common/Utils/Util" ; import { RankEquipmentData , UserRankData } from "./UserRankData" ; import RankEquipmentList from "./RankEquipmentList" ; const { ccclass , property } = cc . _decorator ; @ ccclass export default class UserRankItem extends Item < UserRankData > { private _data : UserRankData ; @ property ( cc . Sprite ) public head : cc . Sprite ; @ property ( cc . Sprite ) public frame : cc . Sprite ; @ property ( cc . Label ) public user_name : cc . Label ; @ property ( cc . Label ) public level : cc . Label ; @ property ( cc . Label ) public grade : cc . Label ; @ property ( RankEquipmentList ) public RankEquipmentList : RankEquipmentList ; getData ( ) { return this . _data ; } showByData ( ) { window . appContext . Pool . setSpriteFrameByUrl ( "head_" + this . _data . user_data . head , this . head ) ; window . appContext . Pool . setSpriteFrameByUrl ( "head_frame_" + this . _data . user_data . head_frame , this . frame ) ; this . user_name . string = this . _data . user_data . name ; this . level . string = window . appContext . ConfigManager . GetlevelById ( this . _data . user_data . level ) . name ; this . grade . string = this . _data . user_data . grade . toString ( ) ; let data_list = new Array ( ) ; for ( let x of this . _data . user_data . equipment ) { data_list . push ( new RankEquipmentData ( x ) ) ; } this . RankEquipmentList . ApplyData ( data_list ) ; } bindData ( currentIndex , data ) { if ( data == null ) { this . reset ( currentIndex ) ; return ; } this . _data = data ; this . showByData ( ) ; } reset ( currentIndex ) { } select ( selected ) { if ( ! selected ) { return ; } } getClickButton ( ) { return this . getComponent ( cc . Button ) ; } }