import { _decorator, Component, Button, Node } from 'cc'; import { GameManager } from '../core/GameManager'; const { ccclass, property } = _decorator; /** * MapScene 世界地图/区域/副本入口与世界脉动面板。 */ @ccclass('MapScene') export class MapScene extends Component { @property({ type: Button }) public backButton: Button | null = null; @property({ type: Node }) public eventLayer: Node | null = null; onLoad() { this.backButton?.node.on(Button.EventType.CLICK, this.onBack, this); this.loadRegion(); this.loadWorldEvents(); } private async loadRegion() { // TODO: MapService/GetRegion } private async loadWorldEvents() { // TODO: MapService/ListWorldEvents } public onEnterInstance(instanceId: string) { // TODO: MapService/EnterInstance,成功后跳 BattleScene 或副本结算 console.log('enter instance', instanceId); } private onBack() { GameManager.getInstance().switchScene('LobbyScene'); } onDestroy() { this.backButton?.node.off(Button.EventType.CLICK, this.onBack, this); } }