import { config } from "./constants/config"
import { LevelManager } from "./models/LevelManager"
import { StorageManager } from "./models/StorageManager"

const { regClass, property } = Laya

@regClass()
export class Main extends Laya.Script {
  @property(Boolean)
  public debug: boolean = false

  onAwake() {
    console.log("Game onAwake")
    config.DEBUG = this.debug
    LevelManager.getInstance().init()
    StorageManager.getInstance().init()
  }

  onLateUpdate(): void {
    StorageManager.getInstance().saveUser()
    StorageManager.getInstance().saveStage()
  }
}
