import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; import {GameModel} from "../../game-model/GameModel"; import {Gamesystem} from "../../game-model/gamesystems/Gamesystem"; import {State} from "../../game-model/gamesystems/states/State"; import {Transition} from "../../game-model/gamesystems/transitions/Transition"; import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem"; import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem"; import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-gamesystem-editor', templateUrl: './gamesystem-editor.component.html', styleUrl: './gamesystem-editor.component.scss' }) export class GamesystemEditorComponent implements OnInit{ @Input() gamesystem: Gamesystem, Transition> | undefined @Input() scriptAccounts: ScriptAccount[] = []; @Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter(); ngOnInit() { console.log("GamesystemEditor: ", this.scriptAccounts.length) } isSimpleGamesystem() { return this.gamesystem instanceof SimpleGamesystem; } convertGamesystemToSimpleGamesystem() { if(this.gamesystem instanceof SimpleGamesystem) { return this.gamesystem as SimpleGamesystem; } } convertGamesystemToProductGamesystem() { if(this.gamesystem instanceof ProductGamesystem) { return this.gamesystem as ProductGamesystem; } } onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { this.openGamesystemEmitter.emit(gamesystem); } }