Load Templatetransition as TemplateTransition and not as SimpleTransition
All checks were successful
E2E Testing / test (push) Successful in 1m56s
All checks were successful
E2E Testing / test (push) Successful in 1m56s
This commit is contained in:
parent
5f59726bdd
commit
b9b5384ca4
@ -54,7 +54,7 @@ export class GamesystemParser {
|
||||
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states, templateType)
|
||||
|
||||
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
|
||||
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
|
||||
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions, templateType)
|
||||
|
||||
|
||||
return simpleGamesystem
|
||||
|
@ -3,6 +3,8 @@ import {ScriptAccountConditionParser} from "./ScriptAccountConditionParser";
|
||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||
import {SimpleTransition} from "../../game-model/gamesystems/transitions/SimpleTransition";
|
||||
import {ScriptAccountActionParser} from "./ScriptAccountActionParser";
|
||||
import {TemplateType} from "../../game-model/TemplateType";
|
||||
import {SimpleTemplateTransition} from "../../game-model/gamesystems/transitions/SimpleTemplateTransition";
|
||||
|
||||
|
||||
export class TransitionParser {
|
||||
@ -18,10 +20,10 @@ export class TransitionParser {
|
||||
this.actionParser = new ScriptAccountActionParser(scriptAccounts)
|
||||
}
|
||||
|
||||
public parseTransitions(transitionData: any): SimpleTransition[] {
|
||||
public parseTransitions(transitionData: any, templateType: TemplateType): SimpleTransition[] {
|
||||
const transitions: SimpleTransition[] = []
|
||||
for(let i=0; i<transitionData.length; i++) {
|
||||
const parsedTransition = this.parseSingleTransition(transitionData[i]);
|
||||
const parsedTransition = this.parseSingleTransition(transitionData[i], templateType);
|
||||
if(parsedTransition != undefined) {
|
||||
transitions.push(parsedTransition)
|
||||
}
|
||||
@ -29,7 +31,7 @@ export class TransitionParser {
|
||||
return transitions
|
||||
}
|
||||
|
||||
private parseSingleTransition(transitionData: any): SimpleTransition | undefined{
|
||||
private parseSingleTransition(transitionData: any, templateType: TemplateType): SimpleTransition | undefined{
|
||||
const startingState = this.findStateByLabel(transitionData.startingState)
|
||||
const endingState = this.findStateByLabel(transitionData.endingState);
|
||||
|
||||
@ -37,7 +39,11 @@ export class TransitionParser {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const simpleTransition = new SimpleTransition(startingState, endingState)
|
||||
let simpleTransition = new SimpleTransition(startingState, endingState);
|
||||
if(templateType === TemplateType.CHARACTER) {
|
||||
simpleTransition = new SimpleTemplateTransition(startingState, endingState);
|
||||
}
|
||||
|
||||
simpleTransition.scriptAccountConditions = this.conditionParser.parseStoredConditions(transitionData.scriptAccountConditions)
|
||||
simpleTransition.scriptAccountActions = this.actionParser.parseActions(transitionData.scriptAccountActions);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user