2024-01-27 11:07:40 +01:00
|
|
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
2024-01-27 10:34:41 +01:00
|
|
|
import {ElectronService} from './core/services';
|
|
|
|
import {APP_CONFIG} from '../environments/environment';
|
|
|
|
import {ModelComponentType} from "./game-model/ModelComponentType";
|
|
|
|
import {MatDrawerContainer} from "@angular/material/sidenav";
|
|
|
|
import {ModelComponentTypeUtillities} from "./game-model/ModelComponentTypeUtillities";
|
2024-01-27 11:07:40 +01:00
|
|
|
import {GameModel} from "./game-model/GameModel";
|
|
|
|
import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount";
|
2024-01-27 11:25:02 +01:00
|
|
|
import {EditorComponent} from "./editor/editor.component";
|
|
|
|
import {ModelComponent} from "./game-model/ModelComponent";
|
2024-01-26 23:07:40 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.css']
|
|
|
|
})
|
2024-01-27 11:07:40 +01:00
|
|
|
export class AppComponent implements OnInit{
|
2024-01-27 10:34:41 +01:00
|
|
|
|
|
|
|
openContent : ModelComponentType | undefined = undefined;
|
|
|
|
@ViewChild('drawer') drawer: MatDrawerContainer|undefined
|
2024-01-27 11:25:02 +01:00
|
|
|
@ViewChild('editor') editor: EditorComponent|undefined
|
2024-01-27 10:34:41 +01:00
|
|
|
|
2024-01-27 11:07:40 +01:00
|
|
|
gameModel: GameModel | undefined
|
|
|
|
|
2024-01-26 23:07:40 +01:00
|
|
|
constructor(
|
|
|
|
private electronService: ElectronService,
|
|
|
|
) {
|
|
|
|
console.log('APP_CONFIG', APP_CONFIG);
|
|
|
|
|
|
|
|
if (electronService.isElectron) {
|
|
|
|
console.log(process.env);
|
|
|
|
console.log('Run in electron');
|
|
|
|
console.log('Electron ipcRenderer', this.electronService.ipcRenderer);
|
|
|
|
console.log('NodeJS childProcess', this.electronService.childProcess);
|
|
|
|
} else {
|
|
|
|
console.log('Run in browser');
|
|
|
|
}
|
|
|
|
}
|
2024-01-27 10:34:41 +01:00
|
|
|
|
2024-01-27 11:07:40 +01:00
|
|
|
ngOnInit() {
|
|
|
|
this.gameModel = new GameModel("No More");
|
|
|
|
this.gameModel.addScriptAccount(new ScriptAccount("Temperature", ""));
|
|
|
|
this.gameModel.addScriptAccount(new ScriptAccount("Luftfeuchtigkeit", ""));
|
|
|
|
}
|
|
|
|
|
2024-01-27 10:34:41 +01:00
|
|
|
openScriptAccountsOverview() {
|
|
|
|
this.openContent = ModelComponentType.SCRIPTACCOUNT
|
|
|
|
this.drawer!.open();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected readonly ModelComponentType = ModelComponentType;
|
|
|
|
|
|
|
|
closeContentOverview() {
|
|
|
|
this.drawer!.close();
|
|
|
|
this.openContent = undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected readonly ModelComponentTypeUtillities = ModelComponentTypeUtillities;
|
2024-01-27 11:25:02 +01:00
|
|
|
|
|
|
|
openModelComponent(modelComponent: ModelComponent) {
|
|
|
|
if(this.editor != undefined) {
|
|
|
|
this.editor.openGameModelComponent(modelComponent);
|
|
|
|
} else {
|
|
|
|
console.log("[WARN] [App.Component] Editor is undefined")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2024-01-26 23:07:40 +01:00
|
|
|
}
|