Files
cocos4/templates/launcher/application.ejs
T
2023-01-13 14:02:46 +08:00

38 lines
1.1 KiB
Plaintext

<%- include(versionCheckTemplate, { version: '1.0.0'}) %>
let cc;
export class Application {
constructor () {
this.settingsPath = '<%= settingsJsonPath %>';
this.showFPS = <%= showFPS %>;
}
init (engine) {
cc = engine;
cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this));
cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this));
}
onPostInitBase () {
// cc.settings.overrideSettings('assets', 'server', '');
// do custom logic
}
onPostSystemInit () {
// do custom logic
}
start () {
return cc.game.init({
debugMode: <%= debugMode %> ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
settingsPath: this.settingsPath,
overrideSettings: {
// assets: {
// preloadBundles: [{ bundle: 'main', version: 'xxx' }],
// }
profiling: {
showFPS: this.showFPS,
}
}
}).then(() => cc.game.run());
}
}