/*
 * @Author: dgflash
 * @Date: 2021-07-03 16:13:17
 * @LastEditors: dgflash
 * @LastEditTime: 2022-08-05 18:25:56
 */
import { profiler, _decorator } from 'cc';
import { DEBUG } from 'cc/env';
import { oops } from '../../extensions/oops-plugin-framework/assets/core/Oops';
import { Root } from '../../extensions/oops-plugin-framework/assets/core/Root';
import { ecs } from '../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
import { UIConfigData } from './game/common/config/GameUIConfig';
import { smc } from './game/common/SingletonModuleComp';
import { EcsInitializeSystem, Initialize } from './game/initialize/Initialize';
import { EcsPositionSystem } from './game/common/ecs/position/EcsPositonSystem';
import { EcsAccountSystem } from './game/account/Account';
import { EcsCheckpointSystem } from './game/checkpoint/Checkpoint';
import { EcsPuppetSystem } from './game/puppet/puppet';
import { EcsPathFindSystem } from './game/common/ecs/path/EcsPathFindSystem';
import { EcsVehicleSystem } from './game/vehicle/Vehicle';
import { AdManager } from './platform/ad/AdManager';
import { EcsSubwaySystem } from './game/subway/Subway';
import { LaunchManager } from './platform/launch/LaunchManager';
import { ttZtSdk } from './game/common/utils/ttztsdk';

const { ccclass, property } = _decorator;

@ccclass('Main')
export class Main extends Root {
    start() {
        if (DEBUG) profiler.showStats();
    }

    protected run() {
        smc.initialize = ecs.getEntity<Initialize>(Initialize);
        ttZtSdk.reportActive()
        AdManager.getInstance().initRewardVideoAd();
        LaunchManager.getInstance().onShow()
   
    }

    protected initGui() {
        oops.gui.init(UIConfigData);
    }

    protected initEcsSystem() {
        oops.ecs.add(new EcsPositionSystem());
        oops.ecs.add(new EcsPathFindSystem());
        oops.ecs.add(new EcsAccountSystem());
        oops.ecs.add(new EcsCheckpointSystem());
        oops.ecs.add(new EcsInitializeSystem());
        oops.ecs.add(new EcsPuppetSystem());
        oops.ecs.add(new EcsVehicleSystem());
        oops.ecs.add(new EcsSubwaySystem());
    }
}
