mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2026-02-14 12:22:42 +00:00
Added analytics
This commit is contained in:
@@ -7,6 +7,8 @@ import { AudioPlayer } from "../Services/AudioPlayer/AudioPlayer";
|
||||
import { SaveSystem } from "./SaveSystem";
|
||||
import { ModalWindowManager } from "../Services/ModalWindowSystem/ModalWindowManager";
|
||||
import { OpenCloseAnimator } from "../Utils/OpenCloseAnimator";
|
||||
import { Y8 } from "../../Plugins/Y8/Scripts/Y8";
|
||||
import { Analytics } from "./Analytics";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("AppRoot")
|
||||
@@ -18,12 +20,14 @@ export class AppRoot extends Component {
|
||||
@property(Camera) private mainCamera: Camera;
|
||||
@property(ModalWindowManager) private modalWindowManager: ModalWindowManager;
|
||||
@property(OpenCloseAnimator) private screenFader: OpenCloseAnimator;
|
||||
@property(Y8) private y8: Y8;
|
||||
|
||||
private static instance: AppRoot;
|
||||
private saveSystem: SaveSystem;
|
||||
|
||||
private liveUserData: UserData;
|
||||
private gameAssets: GameAssets;
|
||||
private analytics: Analytics;
|
||||
|
||||
public static get Instance(): AppRoot {
|
||||
return this.instance;
|
||||
@@ -61,6 +65,14 @@ export class AppRoot extends Component {
|
||||
return this.screenFader;
|
||||
}
|
||||
|
||||
public get Y8(): Y8 {
|
||||
return this.y8;
|
||||
}
|
||||
|
||||
public get Analytics(): Analytics {
|
||||
return this.analytics;
|
||||
}
|
||||
|
||||
public saveUserData(): void {
|
||||
this.saveSystem.save(this.liveUserData);
|
||||
}
|
||||
@@ -75,7 +87,11 @@ export class AppRoot extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
private init(): void {
|
||||
public update(deltaTime: number): void {
|
||||
if (this.analytics) this.analytics.update(deltaTime);
|
||||
}
|
||||
|
||||
private async init(): Promise<void> {
|
||||
this.saveSystem = new SaveSystem();
|
||||
this.liveUserData = this.saveSystem.load();
|
||||
|
||||
@@ -88,5 +104,9 @@ export class AppRoot extends Component {
|
||||
|
||||
this.screenFader.init();
|
||||
this.screenFader.node.active = false;
|
||||
|
||||
await this.y8.init();
|
||||
|
||||
this.analytics = new Analytics(this.y8);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user