import Func from '@/Engine/ECS/Function';
import SysPage from '@/Frameworks/SysPage';
import { PAGE_KEY } from '@/Project/constants';
import { FuncMainState } from '../FuncMain';

export enum FuncLoginState {
  idle,
}

export default class FuncLogin extends Func<FuncLoginState> {
  constructor(name: string) {
    super(name);
    super.initStates((sm) => {
      sm.addState(
        FuncLoginState.idle,
        this.onIdleStateIn,
        null,
        this.onIdleStateExit,
      );
    });
  }
  onIdleStateIn(): void {
    SysPage.add(PAGE_KEY.Login, {
      test: 11111,
      gotoA: () =>
        window.GT_APP.funcMain.changeState(FuncMainState.PlatformMenu),
    });
  }
  onIdleStateExit(): void {
    SysPage.removeByKey(PAGE_KEY.Login);
  }
}
