ConceptCreator/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
Sebastian Böckelmann b5e3b8ee53
All checks were successful
E2E Testing / test (push) Successful in 1m31s
Visualize and Edit Actions for Transitions
2024-02-17 17:05:46 +01:00

45 lines
1.6 KiB
TypeScript

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<State<any>, Transition<any>> | undefined
@Input() scriptAccounts: ScriptAccount[] = [];
@Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter<SimpleGamesystem>();
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);
}
}