Load Template transitions
Some checks failed
E2E Testing / test (push) Failing after 1m39s

This commit is contained in:
Sebastian Böckelmann 2024-03-22 20:08:10 +01:00
parent 1052eeb047
commit 2f469bc66d
5 changed files with 18 additions and 7 deletions

View File

@ -204,7 +204,7 @@ export class AppComponent implements OnInit{
const gamesystemParser = new GamesystemParser(scriptAccounts);
const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems);
const characterParser = new CharacterParser(gamesystemParser.getAllParsedGamesystems(), scriptAccounts);
const characterParser = new CharacterParser(gamesystemParser.getAllParsedGamesystems(), scriptAccounts, gamesystemParser.parsedStates);
const characters = characterParser.parseCharacters(storedGameModel.storedCharacters);
gameModel.scriptAccounts = scriptAccounts

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {TemplateGamesystem} from "../../../../project/game-model/gamesystems/TemplateGamesystem";
import {AppModule} from "../../../../app.module";
import {animate, state, style, transition, trigger} from "@angular/animations";
@ -20,7 +20,7 @@ import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems
]),
],
})
export class TemplateTransitionEditorComponent {
export class TemplateTransitionEditorComponent implements OnChanges{
@Input() templateGamesystem: TemplateGamesystem | undefined
@Input() scriptAccounts: ScriptAccount[] = []
@ -31,6 +31,9 @@ export class TemplateTransitionEditorComponent {
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
expandedElement: SimpleTransition | null = null;
ngOnChanges() {
this.dataSource.data = this.templateGamesystem!.templateTransitions
}
applyFilter(event: KeyboardEvent) {
const filterValue = (event.target as HTMLInputElement).value;

View File

@ -3,14 +3,15 @@ import {Character} from "../../game-model/characters/Character";
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
import {TemplateParser} from "../templateParser/TemplateParser";
import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
export class CharacterParser {
private templateParser: TemplateParser
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[]) {
this.templateParser = new TemplateParser(gamesystems, scriptAccounts)
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[], states: SimpleState[]) {
this.templateParser = new TemplateParser(gamesystems, scriptAccounts, states)
}
public parseCharacters(characters: StoreComponent[]): Character[] {

View File

@ -6,11 +6,13 @@ import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
import {StateParser} from "./StateParser";
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
import {TransitionParser} from "./TransitionParser";
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
export class GamesystemParser {
private parsedParentGamesystems: ParsedParentGamesystems[] = []
private parsedGamesystems: Gamesystem<any, any>[] = []
parsedStates: SimpleState[] = []
private scriptAccounts: ScriptAccount[]
@ -46,6 +48,7 @@ export class GamesystemParser {
const stateParser = new StateParser(this.scriptAccounts);
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
this.parsedStates = this.parsedStates.concat(simpleGamesystem.states)
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)

View File

@ -4,15 +4,19 @@ import {TemplateGamesystem} from "../../game-model/gamesystems/TemplateGamesyste
import {StateParser} from "../gamesystemParser/StateParser";
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
import {TransitionParser} from "../gamesystemParser/TransitionParser";
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
export class TemplateParser {
private gamesystems: Gamesystem<any, any>[]
private stateParser: StateParser
private transitionParser: TransitionParser
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[]) {
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[], states: SimpleState[]) {
this.gamesystems = gamesystems;
this.stateParser = new StateParser(scriptAccounts);
this.transitionParser = new TransitionParser(states, scriptAccounts)
}
parseTemplateGamesystems(templateGamesystemData: any): TemplateGamesystem[] {
@ -35,7 +39,7 @@ export class TemplateParser {
const templateStates = this.stateParser.parseStates(templateGamesystemData.templateStates)
const templateSystem = new TemplateGamesystem(referencedGamesystem as SimpleGamesystem);
templateSystem.templateStates = templateStates
templateSystem.templateTransitions = this.transitionParser.parseTransitions(templateGamesystemData.templateTransitions);
return templateSystem
}