issue-15 #21
@ -3,7 +3,8 @@
|
||||
"ignorePatterns": [
|
||||
"app/**/*", // ignore nodeJs files
|
||||
"dist/**/*",
|
||||
"release/**/*"
|
||||
"release/**/*",
|
||||
"src/**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
|
@ -153,7 +153,9 @@ export class AppComponent implements OnInit{
|
||||
|
||||
onLoadProject(storedGameModel: StoredGameModel) {
|
||||
const gameModel = new GameModel(storedGameModel.gameModelName)
|
||||
const gamesystemParser = new GamesystemParser();
|
||||
|
||||
|
||||
//const gamesystemParser = new GamesystemParser();
|
||||
storedGameModel.loadedModels.forEach(storedComponent => {
|
||||
switch (storedComponent.componentType) {
|
||||
case ModelComponentType.SCRIPTACCOUNT: {
|
||||
@ -161,14 +163,14 @@ export class AppComponent implements OnInit{
|
||||
gameModel.addScriptAccount(scriptAccount);
|
||||
} break
|
||||
case ModelComponentType.GAMESYTEM: {
|
||||
gamesystemParser.parseGamesystem(storedComponent);
|
||||
//gamesystemParser.parseGamesystem(storedComponent);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
gamesystemParser.computeGamesystemStructure().forEach(topGamesystem => {
|
||||
/*gamesystemParser.computeGamesystemStructure().forEach(topGamesystem => {
|
||||
gameModel.addGamesystem(topGamesystem)
|
||||
})
|
||||
})*/
|
||||
|
||||
this.gameModel = gameModel;
|
||||
}
|
||||
|
@ -3,11 +3,21 @@ import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
|
||||
import {ParsedParentGamesystems} from "./ParsedParentGamesystems";
|
||||
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
||||
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
||||
import {StateParser} from "./StateParser";
|
||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||
|
||||
export class GamesystemParser {
|
||||
|
||||
parsedParentGamesystems: ParsedParentGamesystems[] = []
|
||||
parsedGamesystems: Gamesystem<any, any>[] = []
|
||||
|
||||
private stateParser: StateParser
|
||||
|
||||
|
||||
constructor(scriptAccounts: ScriptAccount[]) {
|
||||
this.stateParser = new StateParser(scriptAccounts)
|
||||
}
|
||||
|
||||
public parseGamesystem(storedGamesystem: StoreComponent) {
|
||||
const parsedGamesystemData = JSON.parse(storedGamesystem.jsonString)
|
||||
let parsedSystem: Gamesystem<any, any>
|
||||
@ -21,7 +31,8 @@ export class GamesystemParser {
|
||||
|
||||
parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem {
|
||||
const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription)
|
||||
|
||||
const states = this.stateParser.parseStates(gamesystemData)
|
||||
simpleGamesystem.states = states
|
||||
return simpleGamesystem
|
||||
}
|
||||
|
||||
|
34
src/app/project/parser/gamesystemParser/StateParser.ts
Normal file
34
src/app/project/parser/gamesystemParser/StateParser.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||
import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||
|
||||
export class StateParser {
|
||||
|
||||
private scriptAccounts: ScriptAccount[]
|
||||
|
||||
|
||||
constructor(scriptAccounts: ScriptAccount[]) {
|
||||
this.scriptAccounts = scriptAccounts;
|
||||
}
|
||||
|
||||
public parseStates(gamesystemData: any): SimpleState[] {
|
||||
const parsedStates: SimpleState[] = []
|
||||
for(let i=0; i<gamesystemData.states.length; i++) {
|
||||
parsedStates.push(this.parseState(gamesystemData.states[i]))
|
||||
}
|
||||
|
||||
return parsedStates;
|
||||
}
|
||||
|
||||
private parseState(stateData: any): SimpleState {
|
||||
const initial = stateData.initial
|
||||
const stateLabel = stateData.stateLabel
|
||||
const stateDescription = stateData.stateDescription
|
||||
|
||||
const simpleState = new SimpleState(stateLabel, stateDescription);
|
||||
simpleState.initial = initial;
|
||||
return simpleState;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user