import { Debug } from "../../../../Common/Debug" ; import { EquipmentData , ItemData } from "../../../../Common/JsonData/JsonData" ; import { Item } from "../../../../ItemList/Item" ; import { PrefabUrl } from "../../../../Manager/PrefabUrl" ; import MailDialog from "../MailDialog" ; import { MailData } from "./MailData" ; const { ccclass , property } = cc . _decorator ; @ ccclass export class Mail extends Item < MailData > { private index : number ; private bool_selected = false ; private _data : MailData ; @ property ( cc . Sprite ) public bg : cc . Sprite ; @ property ( cc . Sprite ) public bg_selected : cc . Sprite ; getData ( ) { return this . _data ; } showByData ( ) { this . bg . enabled = ! this . bool_selected ; this . bg_selected . enabled = this . bool_selected ; } 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 ) { this . bool_selected = false ; this . showByData ( ) ; return ; } else { this . bool_selected = true ; this . showByData ( ) ; let Mail = window . appContext . UIManager . getDialog ( PrefabUrl . MailDialog ) ; if ( Mail ) { Mail . showBySelected ( this . index ) ; } } } getClickButton ( ) { return this . getComponent ( cc . Button ) ; } }