import Func from '@/Engine/ECS/Function';
import SysPage from '@/Frameworks/SysPage';
import { PAGE_KEY } from '@/Project/constants';
import { FuncMainState } from '../FuncMain';
import FuncMap from './FuncMap';
export enum FuncPlatformMenuState {
  PlatformMenu,
}

export default class FuncPlatformMenu extends Func<FuncPlatformMenuState> {
  constructor(name: string) {
    super(name);
    super.initStates((sm) => {
      sm.addState(
        FuncPlatformMenuState.PlatformMenu,
        this.onStateIn,
        null,
        this.onStateExit,
      );
    });
  }
  onStateIn(): void {
    const handleMapPage = (state: FuncMainState): void => {
      window.GT_APP.funcMain.changeState(state);
    };
    SysPage.add(PAGE_KEY.PlatformMenu, { handleMapPage });
  }
  onStateExit(): void {
    SysPage.removeByKey(PAGE_KEY.PlatformMenu);
  }
}
