This commit is contained in:
parent
1052eeb047
commit
2f469bc66d
@ -204,7 +204,7 @@ export class AppComponent implements OnInit{
|
|||||||
const gamesystemParser = new GamesystemParser(scriptAccounts);
|
const gamesystemParser = new GamesystemParser(scriptAccounts);
|
||||||
const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems);
|
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);
|
const characters = characterParser.parseCharacters(storedGameModel.storedCharacters);
|
||||||
|
|
||||||
gameModel.scriptAccounts = scriptAccounts
|
gameModel.scriptAccounts = scriptAccounts
|
||||||
|
@ -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 {TemplateGamesystem} from "../../../../project/game-model/gamesystems/TemplateGamesystem";
|
||||||
import {AppModule} from "../../../../app.module";
|
import {AppModule} from "../../../../app.module";
|
||||||
import {animate, state, style, transition, trigger} from "@angular/animations";
|
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() templateGamesystem: TemplateGamesystem | undefined
|
||||||
@Input() scriptAccounts: ScriptAccount[] = []
|
@Input() scriptAccounts: ScriptAccount[] = []
|
||||||
@ -31,6 +31,9 @@ export class TemplateTransitionEditorComponent {
|
|||||||
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
||||||
expandedElement: SimpleTransition | null = null;
|
expandedElement: SimpleTransition | null = null;
|
||||||
|
|
||||||
|
ngOnChanges() {
|
||||||
|
this.dataSource.data = this.templateGamesystem!.templateTransitions
|
||||||
|
}
|
||||||
|
|
||||||
applyFilter(event: KeyboardEvent) {
|
applyFilter(event: KeyboardEvent) {
|
||||||
const filterValue = (event.target as HTMLInputElement).value;
|
const filterValue = (event.target as HTMLInputElement).value;
|
||||||
|
@ -3,14 +3,15 @@ import {Character} from "../../game-model/characters/Character";
|
|||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
import {TemplateParser} from "../templateParser/TemplateParser";
|
import {TemplateParser} from "../templateParser/TemplateParser";
|
||||||
import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
|
import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
|
||||||
|
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
||||||
|
|
||||||
|
|
||||||
export class CharacterParser {
|
export class CharacterParser {
|
||||||
|
|
||||||
private templateParser: TemplateParser
|
private templateParser: TemplateParser
|
||||||
|
|
||||||
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[]) {
|
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[], states: SimpleState[]) {
|
||||||
this.templateParser = new TemplateParser(gamesystems, scriptAccounts)
|
this.templateParser = new TemplateParser(gamesystems, scriptAccounts, states)
|
||||||
}
|
}
|
||||||
|
|
||||||
public parseCharacters(characters: StoreComponent[]): Character[] {
|
public parseCharacters(characters: StoreComponent[]): Character[] {
|
||||||
|
@ -6,11 +6,13 @@ import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
|||||||
import {StateParser} from "./StateParser";
|
import {StateParser} from "./StateParser";
|
||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
import {TransitionParser} from "./TransitionParser";
|
import {TransitionParser} from "./TransitionParser";
|
||||||
|
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
||||||
|
|
||||||
export class GamesystemParser {
|
export class GamesystemParser {
|
||||||
|
|
||||||
private parsedParentGamesystems: ParsedParentGamesystems[] = []
|
private parsedParentGamesystems: ParsedParentGamesystems[] = []
|
||||||
private parsedGamesystems: Gamesystem<any, any>[] = []
|
private parsedGamesystems: Gamesystem<any, any>[] = []
|
||||||
|
parsedStates: SimpleState[] = []
|
||||||
|
|
||||||
private scriptAccounts: ScriptAccount[]
|
private scriptAccounts: ScriptAccount[]
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ export class GamesystemParser {
|
|||||||
|
|
||||||
const stateParser = new StateParser(this.scriptAccounts);
|
const stateParser = new StateParser(this.scriptAccounts);
|
||||||
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
|
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
|
||||||
|
this.parsedStates = this.parsedStates.concat(simpleGamesystem.states)
|
||||||
|
|
||||||
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
|
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
|
||||||
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
|
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
|
||||||
|
@ -4,15 +4,19 @@ import {TemplateGamesystem} from "../../game-model/gamesystems/TemplateGamesyste
|
|||||||
import {StateParser} from "../gamesystemParser/StateParser";
|
import {StateParser} from "../gamesystemParser/StateParser";
|
||||||
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
||||||
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
||||||
|
import {TransitionParser} from "../gamesystemParser/TransitionParser";
|
||||||
|
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
||||||
|
|
||||||
export class TemplateParser {
|
export class TemplateParser {
|
||||||
private gamesystems: Gamesystem<any, any>[]
|
private gamesystems: Gamesystem<any, any>[]
|
||||||
private stateParser: StateParser
|
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.gamesystems = gamesystems;
|
||||||
this.stateParser = new StateParser(scriptAccounts);
|
this.stateParser = new StateParser(scriptAccounts);
|
||||||
|
this.transitionParser = new TransitionParser(states, scriptAccounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
parseTemplateGamesystems(templateGamesystemData: any): TemplateGamesystem[] {
|
parseTemplateGamesystems(templateGamesystemData: any): TemplateGamesystem[] {
|
||||||
@ -35,7 +39,7 @@ export class TemplateParser {
|
|||||||
const templateStates = this.stateParser.parseStates(templateGamesystemData.templateStates)
|
const templateStates = this.stateParser.parseStates(templateGamesystemData.templateStates)
|
||||||
const templateSystem = new TemplateGamesystem(referencedGamesystem as SimpleGamesystem);
|
const templateSystem = new TemplateGamesystem(referencedGamesystem as SimpleGamesystem);
|
||||||
templateSystem.templateStates = templateStates
|
templateSystem.templateStates = templateStates
|
||||||
|
templateSystem.templateTransitions = this.transitionParser.parseTransitions(templateGamesystemData.templateTransitions);
|
||||||
return templateSystem
|
return templateSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user