ZoneItem.ts 533 B

12345678910111213141516171819202122232425
  1. import i18n from "../../i18n/i18n";
  2. import { Zone } from "../Area";
  3. const {ccclass, property} = cc._decorator;
  4. @ccclass
  5. export default class ZoneItem extends cc.Component {
  6. @property(cc.Label)
  7. mZoneName: cc.Label = null;
  8. public zone:Zone;
  9. public callback:(item:ZoneItem)=>void;
  10. onLoad () {
  11. this.mZoneName.string = i18n.t(this.zone.name);
  12. }
  13. public setCallback(callback:(item:ZoneItem)=>void){
  14. this.callback = callback;
  15. }
  16. public onclick(){
  17. this.callback(this);
  18. }
  19. }