diff --git a/src/app/editor/character-editor/character-editor.component.html b/src/app/editor/character-editor/character-editor.component.html
index 4e364f2..ae9343a 100644
--- a/src/app/editor/character-editor/character-editor.component.html
+++ b/src/app/editor/character-editor/character-editor.component.html
@@ -6,7 +6,9 @@
{{gamesystem.componentName}}
+
+
diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
index b7d13f0..229e455 100644
--- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
+++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html
@@ -1,10 +1,4 @@
-
- Templatetype
-
- None
- Character
-
-
-
+
diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
index de5ef89..05898bb 100644
--- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
+++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts
@@ -6,6 +6,7 @@ import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccou
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
import {SimpleTemplateGamesystem} from "../../project/game-model/gamesystems/SimpleTemplateGamesystem";
+import {Character} from "../../project/game-model/characters/Character";
@Component({
selector: 'app-gamesystem-editor',
@@ -16,6 +17,7 @@ export class GamesystemEditorComponent implements OnInit{
@Input() gamesystem: Gamesystem, Transition> | undefined
@Input() scriptAccounts: ScriptAccount[] = [];
+ @Input() templateReference: Character | undefined
@Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter();
ngOnInit() {
diff --git a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html
index 7d7dc52..717e165 100644
--- a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html
+++ b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.html
@@ -1,4 +1,4 @@
-
+
diff --git a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts
index abebbb8..328c2ee 100644
--- a/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts
+++ b/src/app/editor/gamesystem-editor/simple-gamesystem-editor/simple-gamesystem-editor.component.ts
@@ -3,6 +3,7 @@ import {MatTableDataSource} from "@angular/material/table";
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
import {SimpleTemplateGamesystem} from "../../../project/game-model/gamesystems/SimpleTemplateGamesystem";
+import {Character} from "../../../project/game-model/characters/Character";
@Component({
selector: 'app-simple-gamesystem-editor',
@@ -13,6 +14,7 @@ export class SimpleGamesystemEditorComponent implements OnInit{
@Input() simpleGamesystem: SimpleGamesystem | SimpleTemplateGamesystem | undefined
@Input() scriptAccunts: ScriptAccount[] = []
+ @Input() templateReference: Character | undefined
ngOnInit(): void {
console.log("SimpleGamesystem: ", this.simpleGamesystem)
diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html
index 4e74bda..bd9189d 100644
--- a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html
+++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html
@@ -27,7 +27,7 @@
diff --git a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts
index 049814c..802cac1 100644
--- a/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts
+++ b/src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts
@@ -6,6 +6,8 @@ import {SimpleState} from "../../../../project/game-model/gamesystems/states/Sim
import {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem";
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
+import {Character} from "../../../../project/game-model/characters/Character";
+import {SimpleTemplateState} from "../../../../project/game-model/gamesystems/states/SimpleTemplateState";
@Component({
selector: 'app-simple-state-editor',
@@ -24,6 +26,8 @@ export class SimpleStateEditorComponent implements OnInit{
@Input() states: SimpleState[] = [];
@Input() gamesystem: SimpleGamesystem | undefined
@Input() scriptAccounts: ScriptAccount[] = []
+ @Input() templateReference: Character | undefined
+
dataSource = new MatTableDataSource();
displayedColumns = ["name", "initial", "edit", "delete"];
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
@@ -96,11 +100,33 @@ export class SimpleStateEditorComponent implements OnInit{
}
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
- state.addScriptAccountCondition(condition);
+ if(this.templateReference instanceof Character) {
+ const templateState = state as SimpleTemplateState
+ console.log("CharacterRef: ", this.templateReference);
+ templateState.conditionMap.get(this.templateReference as Character)!.push(condition)
+ console.log(templateState)
+ } else {
+ state.addScriptAccountCondition(condition);
+ }
}
deleteCondition(state: SimpleState, condition: ScriptAccountCondition) {
state.removeScriptAccountCondition(condition.scriptAccount);
}
+
+ getStateConditions(state: SimpleState) {
+ if(state instanceof SimpleTemplateState) {
+ if(this.templateReference instanceof Character) {
+ const referenceSpecificConditions = state.conditionMap.get(this.templateReference as Character)
+ if(referenceSpecificConditions == undefined) {
+ return []
+ } else {
+ return referenceSpecificConditions;
+ }
+ }
+ }
+
+ return state.conditions;
+ }
}
diff --git a/src/app/project/parser/characterParser/CharacterParser.ts b/src/app/project/parser/characterParser/CharacterParser.ts
index 11b386d..6ded01a 100644
--- a/src/app/project/parser/characterParser/CharacterParser.ts
+++ b/src/app/project/parser/characterParser/CharacterParser.ts
@@ -19,21 +19,21 @@ export class CharacterParser {
private parseSingleCharacter(characterData: any): Character {
const character = new Character(characterData.componentName, characterData.componentDescription);
- character.characterSpecificGamesystems = this.parseCharacterSpecificGamesystems(characterData.characterSpecificGamesystems);
+ character.characterSpecificGamesystems = this.parseCharacterSpecificGamesystems(character, characterData.characterSpecificGamesystems);
console.log("Parsed Character", character)
return character;
}
- private parseCharacterSpecificGamesystems(characterSpecificGamesystems: any): SimpleTemplateGamesystem[] {
+ private parseCharacterSpecificGamesystems(character: Character, characterSpecificGamesystems: any): SimpleTemplateGamesystem[] {
const result: SimpleTemplateGamesystem[] = []
for(let i=0; i | undefined{
+ private parseSingleCharacterSpecificGamesystem(character: Character, characterSpecificGamesystem: any): SimpleTemplateGamesystem | undefined{
const referencedGamesystem = this.findCharacterSpecificGamesystem(characterSpecificGamesystem.componentName)
if(referencedGamesystem != undefined) {
@@ -41,7 +41,7 @@ export class CharacterParser {
const stateReference = characterSpecificGamesystem.states[i];
const state = this.findReferencedState(referencedGamesystem, stateReference.stateLabel)!
-
+ state.conditionMap.set(character, [])
}
}
diff --git a/src/app/project/serializer/CharacterSerializer.ts b/src/app/project/serializer/CharacterSerializer.ts
index 3cb00a2..09e1028 100644
--- a/src/app/project/serializer/CharacterSerializer.ts
+++ b/src/app/project/serializer/CharacterSerializer.ts
@@ -3,6 +3,7 @@ import {StoreComponent} from "../../../../app/storage/StoreComponent";
import {SerializeConstants} from "./SerializeConstants";
import {ModelComponentType} from "../game-model/ModelComponentType";
import {Gamesystem} from "../game-model/gamesystems/Gamesystem";
+import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
export class CharacterSerializer {
@@ -24,6 +25,14 @@ export class CharacterSerializer {
}
}
+ if(key === 'scriptAccount') {
+ return value.componentName
+ }
+
+ if(key === 'conditionMap') {
+ return value.get(character)
+ }
+
if(this.ignoredKeys.includes(key)) {
return undefined
} else {
diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json
index 8f3c8f5..30e3fe8 100644
--- a/testModel/characters/Hicks Haddock.json
+++ b/testModel/characters/Hicks Haddock.json
@@ -7,11 +7,17 @@
"states": [
{
"stateLabel": "Fröhlich",
- "conditionMap": {}
+ "conditionMap": [
+ {
+ "scriptAccount": "Luftfeuchtigkeit",
+ "minValue": 0,
+ "maxValue": "10"
+ }
+ ]
},
{
"stateLabel": "Wütend",
- "conditionMap": {}
+ "conditionMap": []
}
],
"transitions": []