diff --git a/app/main.ts b/app/main.ts index 45b1f1a..13f4633 100644 --- a/app/main.ts +++ b/app/main.ts @@ -64,9 +64,20 @@ function createWindow(): BrowserWindow { submenu: [ { label: "Gamesystem", - click: () => { - win!.webContents.send('context-menu', "new-gamesystem"); - } + submenu: [ + { + label: "Normal", + click: () => { + win!.webContents.send('context-menu', "new-gamesystem-normal"); + } + }, + { + label: "Characterspecific", + click: () => { + win!.webContents.send('context-menu', "new-gamesystem-character"); + } + } + ] }, { label: "ScriptAccount", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fbdd765..221fe57 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -24,6 +24,8 @@ import {Character} from "./project/game-model/characters/Character"; import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component"; import {CharacterSerializer} from "./project/serializer/CharacterSerializer"; import {CharacterParser} from "./project/parser/characterParser/CharacterParser"; +import {TemplateType} from "./project/game-model/TemplateType"; +import {TemplateTypeUtilities} from "./project/game-model/TemplateTypeUtilities"; @Component({ selector: 'app-root', @@ -76,8 +78,13 @@ export class AppComponent implements OnInit{ } else if(message.startsWith("new")) { const splittedMessage = message.split("-"); const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]); + let templateType: TemplateType = TemplateType.NORMAL + if(splittedMessage.length > 2) { + templateType = TemplateTypeUtilities.fromString(splittedMessage[2]); + } + if(modelComponentType != undefined) { - this.onCreateModelComponent(modelComponentType); + this.onCreateModelComponent(modelComponentType, templateType); } else { console.log("[ERROR] [App-Component] Unknown Context-Menu Command!") } @@ -127,10 +134,10 @@ export class AppComponent implements OnInit{ }) } - private onCreateModelComponent(modelComponentType: ModelComponentType) { + private onCreateModelComponent(modelComponentType: ModelComponentType, templateType: TemplateType) { switch (modelComponentType) { case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break - case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(); break + case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(templateType); break case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break } } @@ -144,7 +151,7 @@ export class AppComponent implements OnInit{ } } - private onCreateNewGamesystem() { + private onCreateNewGamesystem(templateType: TemplateType) { let parentGamesystemName = undefined if(this.openContent != ModelComponentType.GAMESYTEM) { this.openGamesystemsOverview(); @@ -153,7 +160,7 @@ export class AppComponent implements OnInit{ } - const createdGamesystem = this.gameModel!.createGamesystem("New Gamesystem", parentGamesystemName); + const createdGamesystem = this.gameModel!.createGamesystem("New Gamesystem "+ templateType, parentGamesystemName, templateType); if(createdGamesystem != undefined) { this.gamesystemOverview!.refresh(); this.editor?.openGameModelComponent(createdGamesystem); @@ -204,7 +211,7 @@ export class AppComponent implements OnInit{ const gamesystemParser = new GamesystemParser(scriptAccounts); const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems); - const characterParser = new CharacterParser(gamesystemParser.getAllParsedGamesystems(), scriptAccounts, gamesystemParser.parsedStates); + const characterParser = new CharacterParser(gamesystemParser.getParsedTemplateGamesystems(TemplateType.CHARACTER), scriptAccounts); const characters = characterParser.parseCharacters(storedGameModel.storedCharacters); gameModel.scriptAccounts = scriptAccounts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 277acd2..30af657 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -61,7 +61,7 @@ import { ProductStateEditorComponent } from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component"; import {MatTooltip} from "@angular/material/tooltip"; -import {MatCard, MatCardContent} from "@angular/material/card"; +import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card"; import { ScriptaccountActionEditorComponent } from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component"; @@ -70,21 +70,8 @@ import { } from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component"; import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component"; import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component"; -import { - TemplateGamesystemEditorComponent -} from "./editor/gamesystem-editor/template-gamesystem-editor/template-gamesystem-editor.component"; -import { - TemplateStateEditorComponent -} from "./editor/gamesystem-editor/template-gamesystem-editor/template-state-editor/template-state-editor.component"; -import { - MatAccordion, - MatExpansionPanel, - MatExpansionPanelHeader, - MatExpansionPanelTitle -} from "@angular/material/expansion"; -import { - TemplateTransitionEditorComponent -} from "./editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component"; +import {MatAccordion, MatExpansionPanel, MatExpansionPanelHeader} from "@angular/material/expansion"; +import {TemplateCreatorComponent} from "./editor/gamesystem-editor/template-creator/template-creator.component"; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -109,9 +96,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl ScriptaccountConditionEditorComponent, CharacterOverviewComponent, CharacterEditorComponent, - TemplateGamesystemEditorComponent, - TemplateStateEditorComponent, - TemplateTransitionEditorComponent + TemplateCreatorComponent ], imports: [ BrowserModule, @@ -169,16 +154,13 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatTooltip, MatCard, MatCardContent, + MatCardHeader, MatAccordion, MatExpansionPanel, - MatExpansionPanelTitle, + MatCardTitle, MatExpansionPanelHeader ], providers: [], - exports: [ - ProductGamesystemEditorComponent, - SimpleTransitionEditorComponent - ], bootstrap: [AppComponent] }) export class AppModule {} diff --git a/src/app/editor/character-editor/character-editor.component.html b/src/app/editor/character-editor/character-editor.component.html index aa7c41a..ae9343a 100644 --- a/src/app/editor/character-editor/character-editor.component.html +++ b/src/app/editor/character-editor/character-editor.component.html @@ -1,11 +1,15 @@ - - - - {{templateGamesystem.referenceGamesystem.componentName}} - - - - - + + + Characterspecific Gamesystems + + + + + {{gamesystem.componentName}} + + + + + + + diff --git a/src/app/editor/character-editor/character-editor.component.ts b/src/app/editor/character-editor/character-editor.component.ts index e40f347..42e61ff 100644 --- a/src/app/editor/character-editor/character-editor.component.ts +++ b/src/app/editor/character-editor/character-editor.component.ts @@ -1,50 +1,33 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, Input} from '@angular/core'; import {Character} from "../../project/game-model/characters/Character"; -import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem"; -import {TemplateGamesystem} from "../../project/game-model/gamesystems/TemplateGamesystem"; -import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; -import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; -import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; +import {GameModel} from "../../project/game-model/GameModel"; +import {MatDialog} from "@angular/material/dialog"; +import {TemplateCreatorComponent} from "../gamesystem-editor/template-creator/template-creator.component"; +import {TemplateType} from "../../project/game-model/TemplateType"; @Component({ selector: 'app-character-editor', templateUrl: './character-editor.component.html', styleUrl: './character-editor.component.scss' }) -export class CharacterEditorComponent implements OnInit{ +export class CharacterEditorComponent { @Input() character: Character | undefined - @Input() referenceGamesystems: Gamesystem[] = [] - @Input() scriptAccounts: ScriptAccount[] = [] + @Input() gameModel: GameModel | undefined - templateSimpleGamesystems: TemplateGamesystem[] = [] - templateProductGamesystems: ProductGamesystem[] = [] + constructor(private dialog: MatDialog) { + } - ngOnInit() { - this.referenceGamesystems.forEach(referenceGamesystem => { - if(referenceGamesystem instanceof SimpleGamesystem) { - const characterSpecificGamesystem = this.findReferencedGamesystemInCharacter(referenceGamesystem.componentName) - if(characterSpecificGamesystem != undefined) { - this.templateSimpleGamesystems.push(characterSpecificGamesystem) - } else { - this.templateSimpleGamesystems.push(new TemplateGamesystem(referenceGamesystem)) - } - } else { - this.templateProductGamesystems.push(referenceGamesystem as ProductGamesystem) + onOpenTemplateCreator() { + const dialogRef = this.dialog.open(TemplateCreatorComponent, { + data: this.gameModel!.listGamesystems(TemplateType.CHARACTER), + minWidth: "400px" + }) + + dialogRef.afterClosed().subscribe(res => { + if(res != undefined) { + this.character!.addCharacterSpecificGamesystem(res) } }) } - - private findReferencedGamesystemInCharacter(referenceGamesystemName: string) { - return this.character!.characterSpecificGamesystems.find(system => system.referenceGamesystem.componentName === referenceGamesystemName) - } - - onUnspecifyTemplate(templateGamesystem: TemplateGamesystem) { - this.character!.removeCharacterSpecificGamesystem(templateGamesystem) - } - - onSpecifyTemplate(templateGamesystem: TemplateGamesystem) { - this.character!.addCharacterSpecificGamesystem(templateGamesystem) - } - } diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index c8ad774..e21bbcd 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -15,9 +15,7 @@ (onOpenGamesystemEditor)="openGameModelComponent($event)" [scriptAccounts]="gameModel!.scriptAccounts"> + [gameModel]="gameModel!" [character]="convertModelComponentToCharacter(modelComponent)"> diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index efba596..6136245 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -7,8 +7,6 @@ import {State} from "../project/game-model/gamesystems/states/State"; import {Transition} from "../project/game-model/gamesystems/transitions/Transition"; import {ModelComponentType} from "../project/game-model/ModelComponentType"; import {Character} from "../project/game-model/characters/Character"; -import {TemplateType} from "../project/game-model/gamesystems/TemplateType"; -import {load} from "@angular-devkit/build-angular/src/utils/server-rendering/esm-in-memory-loader/loader-hooks"; @Component({ @@ -47,20 +45,16 @@ export class EditorComponent { } } - convertModelComponentToCharacter(modelComponent: ModelComponent) { - if(modelComponent instanceof Character) { - return modelComponent as Character - } - } - onModelNameUpdate() { this.onModelNameUpdateEmitter.emit(true); } - loadCharacterSpecificGamesystems() { - return this.gameModel!.gamesystems.filter(gamesystem => gamesystem.template == TemplateType.CHARACTER); - } - protected readonly ModelComponentType = ModelComponentType; + + convertModelComponentToCharacter(modelComponent: ModelComponent) { + if(modelComponent instanceof Character) { + return modelComponent as Character; + } + } } diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html index 598d904..229e455 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1,11 +1,4 @@ - - Template - - None - Character - Location - - - + diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts index 17e5dad..05898bb 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts @@ -5,7 +5,8 @@ import { Transition } from '../../project/game-model/gamesystems/transitions/Tra import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; -import {TemplateType} from "../../project/game-model/gamesystems/TemplateType"; +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() { @@ -23,11 +25,11 @@ export class GamesystemEditorComponent implements OnInit{ } isSimpleGamesystem() { - return this.gamesystem instanceof SimpleGamesystem; + return this.gamesystem instanceof SimpleGamesystem || this.gamesystem instanceof SimpleTemplateGamesystem; } convertGamesystemToSimpleGamesystem() { - if(this.gamesystem instanceof SimpleGamesystem) { + if(!(this.gamesystem instanceof ProductGamesystem)) { return this.gamesystem as SimpleGamesystem; } } @@ -41,6 +43,4 @@ export class GamesystemEditorComponent implements OnInit{ onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { this.openGamesystemEmitter.emit(gamesystem); } - - protected readonly TemplateType = TemplateType; } 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 36af424..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 @@ -1,17 +1,24 @@ -import {Component, Input} from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; 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', templateUrl: './simple-gamesystem-editor.component.html', styleUrl: './simple-gamesystem-editor.component.scss' }) -export class SimpleGamesystemEditorComponent { +export class SimpleGamesystemEditorComponent implements OnInit{ - @Input() simpleGamesystem: SimpleGamesystem | undefined + @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 25af9af..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 0091c19..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 @@ -1,4 +1,4 @@ -import {Component, EventEmitter, Input, OnChanges, OnInit, Output} from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import {MatTableDataSource} from "@angular/material/table"; import {animate, state, style, transition, trigger} from "@angular/animations"; import {MatSnackBar} from "@angular/material/snack-bar"; @@ -6,7 +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 {TemplateGamesystem} from "../../../../project/game-model/gamesystems/TemplateGamesystem"; +import {Character} from "../../../../project/game-model/characters/Character"; +import {SimpleTemplateState} from "../../../../project/game-model/gamesystems/states/SimpleTemplateState"; @Component({ selector: 'app-simple-state-editor', @@ -20,12 +21,13 @@ import {TemplateGamesystem} from "../../../../project/game-model/gamesystems/Tem ]), ], }) -export class SimpleStateEditorComponent implements OnInit, OnChanges{ +export class SimpleStateEditorComponent implements OnInit{ @Input() states: SimpleState[] = []; - @Input() gamesystem: SimpleGamesystem | undefined + @Input() gamesystem: SimpleGamesystem | undefined @Input() scriptAccounts: ScriptAccount[] = [] - @Output() onExtractReferenceState = new EventEmitter() + @Input() templateReference: Character | undefined + dataSource = new MatTableDataSource(); displayedColumns = ["name", "initial", "edit", "delete"]; columnsToDisplayWithExpand = [...this.displayedColumns, 'expand']; @@ -42,30 +44,13 @@ export class SimpleStateEditorComponent implements OnInit, OnChanges{ this.dataSource.filterPredicate = (data: SimpleState, filter: string) => { return data.stateLabel.toLowerCase().includes(filter); } - - if(this.gamesystem == undefined) { - this.displayedColumns = this.displayedColumns.slice(0, -1); - this.columnsToDisplayWithExpand = [... this.displayedColumns, 'expand'] - } - } - - ngOnChanges() { - this.dataSource.data = this.states; - this.dataSource.filterPredicate = (data: SimpleState, filter: string) => { - return data.stateLabel.toLowerCase().includes(filter); - } - console.log(this.states.length) } editState(state: SimpleState) { - if(this.gamesystem == undefined) { - this.onExtractReferenceState.emit(state) + if(this.editedElement === state) { + this.editedElement = null; } else { - if(this.editedElement === state) { - this.editedElement = null; - } else { - this.editedElement = state; - } + this.editedElement = state; } } @@ -115,11 +100,33 @@ export class SimpleStateEditorComponent implements OnInit, OnChanges{ } 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/editor/gamesystem-editor/template-creator/template-creator.component.html b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.html new file mode 100644 index 0000000..feb02e7 --- /dev/null +++ b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.html @@ -0,0 +1,13 @@ +

Specify Gamesystem

+
+ + Referencesystem + + {{gamesystem.componentName}} + + +
+
+ + +
diff --git a/src/app/editor/gamesystem-editor/template-creator/template-creator.component.scss b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/editor/gamesystem-editor/template-creator/template-creator.component.spec.ts b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.spec.ts new file mode 100644 index 0000000..354ea63 --- /dev/null +++ b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TemplateCreatorComponent } from './template-creator.component'; + +describe('TemplateCreatorComponent', () => { + let component: TemplateCreatorComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [TemplateCreatorComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(TemplateCreatorComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/editor/gamesystem-editor/template-creator/template-creator.component.ts b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.ts new file mode 100644 index 0000000..ef9d86a --- /dev/null +++ b/src/app/editor/gamesystem-editor/template-creator/template-creator.component.ts @@ -0,0 +1,26 @@ +import {Component, Inject} from '@angular/core'; +import {MAT_DIALOG_DATA, MatDialogRef, MatDialogTitle} from "@angular/material/dialog"; +import {SimpleTemplateGamesystem} from "../../../project/game-model/gamesystems/SimpleTemplateGamesystem"; +import {FormControl, Validators} from "@angular/forms"; + +@Component({ + selector: 'app-template-creator', + templateUrl: './template-creator.component.html', + styleUrl: './template-creator.component.scss' +}) +export class TemplateCreatorComponent { + + templateCtrl = new FormControl('', [Validators.required]); + + constructor(@Inject(MAT_DIALOG_DATA) public templateGamesystems: SimpleTemplateGamesystem[], + private dialogRef: MatDialogRef) { + } + + cancel() { + this.dialogRef.close(); + } + + save() { + this.dialogRef.close(this.templateCtrl.value) + } +} diff --git a/src/app/project/game-model/GameModel.ts b/src/app/project/game-model/GameModel.ts index 8497737..2fb19a5 100644 --- a/src/app/project/game-model/GameModel.ts +++ b/src/app/project/game-model/GameModel.ts @@ -5,9 +5,11 @@ import {State} from "./gamesystems/states/State"; import {ProductGamesystem} from "./gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem"; import {Character} from "./characters/Character"; -import {ModelComponentType} from "./ModelComponentType"; +import {TemplateType} from "./TemplateType"; +import {SimpleTemplateGamesystem} from "./gamesystems/SimpleTemplateGamesystem"; export class GameModel { + gameModelName: string gamesystems: Gamesystem[] = []; @@ -45,9 +47,14 @@ export class GameModel { return undefined; } - createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined) { + createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined, templateType: TemplateType) { if(gamesystemName != undefined && this.findGamesystem(gamesystemName) == undefined) { - const simpleGamesystem = new SimpleGamesystem(gamesystemName, ""); + let simpleGamesystem = new SimpleGamesystem(gamesystemName, ""); + if(templateType == TemplateType.CHARACTER) { + simpleGamesystem = new SimpleTemplateGamesystem(gamesystemName, "") + } + + if(parentGamesystemName != undefined) { const parentGamesystem = this.findGamesystem(parentGamesystemName); if(parentGamesystem instanceof SimpleGamesystem) { @@ -115,4 +122,25 @@ export class GameModel { } }) } + + listGamesystems(templateType: TemplateType): SimpleTemplateGamesystem[] { + const gamesystemList: SimpleTemplateGamesystem[] = [] + const gamesystemQueue: Gamesystem[] = this.gamesystems.concat() + while(gamesystemQueue.length > 0) { + const currentGamesystem = gamesystemQueue.shift()!; + + if(currentGamesystem.templateType === templateType) { + gamesystemList.push(currentGamesystem as SimpleTemplateGamesystem) + } + + if(currentGamesystem instanceof ProductGamesystem) { + currentGamesystem.innerGamesystems.forEach(innerGamesystem => { + gamesystemQueue.push(innerGamesystem) + }) + } + } + + console.log(gamesystemList) + return gamesystemList; + } } diff --git a/src/app/project/game-model/TemplateType.ts b/src/app/project/game-model/TemplateType.ts new file mode 100644 index 0000000..c7dd90a --- /dev/null +++ b/src/app/project/game-model/TemplateType.ts @@ -0,0 +1,3 @@ +export enum TemplateType { + NORMAL, CHARACTER +} diff --git a/src/app/project/game-model/TemplateTypeUtilities.ts b/src/app/project/game-model/TemplateTypeUtilities.ts new file mode 100644 index 0000000..39deafa --- /dev/null +++ b/src/app/project/game-model/TemplateTypeUtilities.ts @@ -0,0 +1,11 @@ +import {TemplateType} from "./TemplateType"; + +export class TemplateTypeUtilities { + static fromString(value: string) { + if(value === 'character') { + return TemplateType.CHARACTER + } else { + return TemplateType.NORMAL + } + } +} diff --git a/src/app/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index 8e6b864..d1a1ed2 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -1,20 +1,24 @@ import {ModelComponent} from "../ModelComponent"; import {ModelComponentType} from "../ModelComponentType"; -import {TemplateGamesystem} from "../gamesystems/TemplateGamesystem"; +import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"; export class Character extends ModelComponent{ - characterSpecificGamesystems: TemplateGamesystem[] = [] + characterSpecificGamesystems: SimpleTemplateGamesystem[] = [] constructor(componentName: string, componentDescription: string) { super(componentName, componentDescription, ModelComponentType.CHARACTER); } - addCharacterSpecificGamesystem(gamesystem: TemplateGamesystem) { - this.characterSpecificGamesystems.push(gamesystem) + addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem) { + if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) { + this.characterSpecificGamesystems.push(templateGamesystem); + templateGamesystem.addReferenceKey(this); + } } - removeCharacterSpecificGamesystem(gamesystem: TemplateGamesystem) { - this.characterSpecificGamesystems = this.characterSpecificGamesystems.filter(templateSystem => templateSystem.referenceGamesystem.componentName !== gamesystem.referenceGamesystem.componentName) + private isGamesystemCharacterSpecific(gamesystemName: string) { + const characterSpecificGamesystem = this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName); + return characterSpecificGamesystem != undefined } } diff --git a/src/app/project/game-model/gamesystems/Gamesystem.ts b/src/app/project/game-model/gamesystems/Gamesystem.ts index 1dc3788..e41d1a0 100644 --- a/src/app/project/game-model/gamesystems/Gamesystem.ts +++ b/src/app/project/game-model/gamesystems/Gamesystem.ts @@ -1,7 +1,8 @@ +import {SimpleGamesystem} from "./SimpleGamesystem"; import {ProductGamesystem} from "./ProductGamesystem"; import {ModelComponent} from "../ModelComponent"; import {ModelComponentType} from "../ModelComponentType"; -import {TemplateType} from "./TemplateType"; +import {TemplateType} from "../TemplateType"; export abstract class Gamesystem extends ModelComponent{ @@ -9,7 +10,9 @@ export abstract class Gamesystem extends ModelComponent{ transitions: T[] = []; parentGamesystem: ProductGamesystem | undefined - template: TemplateType = TemplateType.NONE + templateType: TemplateType = TemplateType.NORMAL + + constructor(gamesystemName: string, gamesystemDescription: string) { super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM); } diff --git a/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts new file mode 100644 index 0000000..022a703 --- /dev/null +++ b/src/app/project/game-model/gamesystems/SimpleTemplateGamesystem.ts @@ -0,0 +1,70 @@ +import {SimpleTemplateState} from "./states/SimpleTemplateState"; +import {Gamesystem} from "./Gamesystem"; +import {SimpleState} from "./states/SimpleState"; +import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition"; +import {TemplateType} from "../TemplateType"; + +export class SimpleTemplateGamesystem extends Gamesystem, SimpleTemplateTransition> { + createState(label: string, description: string): SimpleState | undefined { + if(label == null) { + return undefined; + } + + if(description == null) { + description = ""; + } + + const state = new SimpleTemplateState(label, description); + if(this.states.find(s => s.stateLabel == label) == undefined) { + this.states.push(state); + return state; + } else { + return undefined + } + } + + createTransition(startingState: SimpleTemplateState, endingState: SimpleTemplateState): SimpleTemplateTransition | undefined { + if((startingState == null || endingState == null) || startingState === endingState) { + return undefined; + } + + const transition = new SimpleTemplateTransition(startingState, endingState); + if(this.transitions.find(t => t.startingState === startingState && t.endingState === endingState) == undefined) { + this.transitions.push(transition) + return transition; + } else { + startingState.removeOutgoingTransition(transition); + endingState.removeIncomingTransition(transition); + return undefined + } + } + + removeState(state: SimpleTemplateState): boolean { + const updatedStates = this.states.filter(s => s !== state); + const updated = updatedStates.length != this.states.length; + this.states = updatedStates; + + this.transitions = this.transitions.filter(t => t.startingState !== state && t.endingState !== state); + + return updated; + } + + addReferenceKey(reference: ReferenceType) { + this.states.forEach(state => { + if(!state.conditionMap.has(reference)) { + state.conditionMap.set(reference, state.conditions.concat()) + } + }) + + this.transitions.forEach(transition => { + if(!transition.conditions.has(reference)) { + transition.conditions.set(reference, transition.scriptAccountConditions.concat()) + } + + if(!transition.actions.has(reference)) { + transition.actions.set(reference, transition.scriptAccountActions.concat()) + } + }) + } + +} diff --git a/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts b/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts new file mode 100644 index 0000000..52bb80c --- /dev/null +++ b/src/app/project/game-model/gamesystems/states/SimpleTemplateState.ts @@ -0,0 +1,8 @@ +import {SimpleState} from "./SimpleState"; +import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition"; + +export class SimpleTemplateState extends SimpleState { + + conditionMap: Map = new Map() + +} diff --git a/src/app/project/game-model/gamesystems/transitions/SimpleTemplateTransition.ts b/src/app/project/game-model/gamesystems/transitions/SimpleTemplateTransition.ts new file mode 100644 index 0000000..72d267a --- /dev/null +++ b/src/app/project/game-model/gamesystems/transitions/SimpleTemplateTransition.ts @@ -0,0 +1,9 @@ +import {SimpleTransition} from "./SimpleTransition"; +import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition"; +import {ScriptAccountAction} from "../actions/ScriptAccountAction"; + +export class SimpleTemplateTransition extends SimpleTransition { + + conditions: Map = new Map(); + actions: Map = new Map(); +} diff --git a/src/app/project/parser/characterParser/CharacterParser.ts b/src/app/project/parser/characterParser/CharacterParser.ts index dbb6661..d1323f9 100644 --- a/src/app/project/parser/characterParser/CharacterParser.ts +++ b/src/app/project/parser/characterParser/CharacterParser.ts @@ -1,17 +1,19 @@ import {StoreComponent} from "../../../../../app/storage/StoreComponent"; import {Character} from "../../game-model/characters/Character"; +import {SimpleTemplateGamesystem} from "../../game-model/gamesystems/SimpleTemplateGamesystem"; 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"; +import {ScriptAccountParser} from "../ScriptAccountParser"; +import {ScriptAccountConditionParser} from "../gamesystemParser/ScriptAccountConditionParser"; export class CharacterParser { - private templateParser: TemplateParser + characterSpecificGamesystems: SimpleTemplateGamesystem[] + scriptAccountConditionParser: ScriptAccountConditionParser - constructor(gamesystems: Gamesystem[], scriptAccounts: ScriptAccount[], states: SimpleState[]) { - this.templateParser = new TemplateParser(gamesystems, scriptAccounts, states) + constructor(characterSpecificGamesystems: SimpleTemplateGamesystem[], scriptAccounts: ScriptAccount[]) { + this.characterSpecificGamesystems = characterSpecificGamesystems; + this.scriptAccountConditionParser = new ScriptAccountConditionParser(scriptAccounts) } public parseCharacters(characters: StoreComponent[]): Character[] { @@ -22,8 +24,40 @@ export class CharacterParser { private parseSingleCharacter(characterData: any): Character { const character = new Character(characterData.componentName, characterData.componentDescription); - character.characterSpecificGamesystems = this.templateParser.parseTemplateGamesystems(characterData.characterSpecificGamesystems) - console.log(character.characterSpecificGamesystems) + character.characterSpecificGamesystems = this.parseCharacterSpecificGamesystems(character, characterData.characterSpecificGamesystems); return character; } + + private parseCharacterSpecificGamesystems(character: Character, characterSpecificGamesystems: any): SimpleTemplateGamesystem[] { + const result: SimpleTemplateGamesystem[] = [] + for(let i=0; i | undefined{ + const referencedGamesystem = this.findCharacterSpecificGamesystem(characterSpecificGamesystem.componentName) + + if(referencedGamesystem != undefined) { + for(let i=0; i | undefined{ + return this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === componentName) + } + + private findReferencedState(gamesystem: SimpleTemplateGamesystem, stateLabel: string) { + return gamesystem.states.find(state => state.stateLabel === stateLabel); + } } diff --git a/src/app/project/parser/gamesystemParser/GamesystemParser.ts b/src/app/project/parser/gamesystemParser/GamesystemParser.ts index 5c26a3e..eec11c1 100644 --- a/src/app/project/parser/gamesystemParser/GamesystemParser.ts +++ b/src/app/project/parser/gamesystemParser/GamesystemParser.ts @@ -6,13 +6,14 @@ 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"; +import {TemplateType} from "../../game-model/TemplateType"; +import {SimpleTemplateGamesystem} from "../../game-model/gamesystems/SimpleTemplateGamesystem"; +import {Character} from "../../game-model/characters/Character"; export class GamesystemParser { private parsedParentGamesystems: ParsedParentGamesystems[] = [] private parsedGamesystems: Gamesystem[] = [] - parsedStates: SimpleState[] = [] private scriptAccounts: ScriptAccount[] @@ -38,20 +39,24 @@ export class GamesystemParser { } else { parsedSystem = this.parseSimpleGamesystem(parsedGamesystemData) } - parsedSystem.template = parsedGamesystemData.template - this.parsedGamesystems.push(parsedSystem); } parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem { - const simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) + const templateType = gamesystemData.templateType + let simpleGamesystem = new SimpleGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) + if(templateType == TemplateType.CHARACTER) { + simpleGamesystem = new SimpleTemplateGamesystem(gamesystemData.componentName, gamesystemData.componentDescription) + simpleGamesystem.templateType = TemplateType.CHARACTER + } const stateParser = new StateParser(this.scriptAccounts); - simpleGamesystem.states = stateParser.parseStates(gamesystemData.states) - this.parsedStates = this.parsedStates.concat(simpleGamesystem.states) + simpleGamesystem.states = stateParser.parseStates(gamesystemData.states, templateType) const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts) simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions) + + return simpleGamesystem } @@ -89,7 +94,8 @@ export class GamesystemParser { return undefined } - getAllParsedGamesystems() { - return this.parsedGamesystems + getParsedTemplateGamesystems(templateType: TemplateType) { + const templateGamesystems = this.parsedGamesystems.filter(gamesystem => gamesystem.templateType === templateType); + return templateGamesystems.map(gamesystem => gamesystem as SimpleTemplateGamesystem) } } diff --git a/src/app/project/parser/gamesystemParser/StateParser.ts b/src/app/project/parser/gamesystemParser/StateParser.ts index 8da602a..fce00ce 100644 --- a/src/app/project/parser/gamesystemParser/StateParser.ts +++ b/src/app/project/parser/gamesystemParser/StateParser.ts @@ -2,6 +2,9 @@ import {SimpleState} from "../../game-model/gamesystems/states/SimpleState"; import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount"; import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition"; import {ScriptAccountConditionParser} from "./ScriptAccountConditionParser"; +import {TemplateType} from "../../game-model/TemplateType"; +import {SimpleTemplateState} from "../../game-model/gamesystems/states/SimpleTemplateState"; +import {Character} from "../../game-model/characters/Character"; export class StateParser { @@ -12,23 +15,29 @@ export class StateParser { this.conditionParser = new ScriptAccountConditionParser(scriptAccounts) } - public parseStates(stateData: any): SimpleState[] { + public parseStates(stateData: any, templateType: TemplateType): SimpleState[] { const parsedStates: SimpleState[] = [] for(let i=0; i(stateLabel, stateDescription); + } + simpleState.initial = initial; simpleState.conditions = conditions; diff --git a/src/app/project/serializer/CharacterSerializer.ts b/src/app/project/serializer/CharacterSerializer.ts index 9b63ef3..09e1028 100644 --- a/src/app/project/serializer/CharacterSerializer.ts +++ b/src/app/project/serializer/CharacterSerializer.ts @@ -2,10 +2,12 @@ import {Character} from "../game-model/characters/Character"; 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 { - private static IGNORED_SIMPLE_ATTRIBUTES = ['incomingTransitions', "outgoingTransitions", "unsaved", "type", "stateDescription"] + private static ignoredKeys: string[] = ['unsaved', 'type', 'incomingTransitions', 'outgoingTransitions', 'initial', 'conditions', 'stateDescription', 'templateType'] public static serializeCharacters(characters: Character[]): StoreComponent[] { const storedCharacters: StoreComponent[] = [] @@ -16,14 +18,24 @@ export class CharacterSerializer { private static serializeSingleCharacter(character: Character): StoreComponent{ const fileName = character.componentName const jsonString = JSON.stringify(character, (key, value) => { - if(this.IGNORED_SIMPLE_ATTRIBUTES.includes(key)) { + if(value instanceof Gamesystem) { + return { + ...value, + componentDescription: undefined + } + } + + if(key === 'scriptAccount') { + return value.componentName + } + + if(key === 'conditionMap') { + return value.get(character) + } + + if(this.ignoredKeys.includes(key)) { return undefined } else { - if(key === 'referenceGamesystem' || key === 'scriptAccount') { - return value.componentName - } else if(key === 'startingState' || key === 'endingState') { - return value.stateLabel - } return value; } }, SerializeConstants.JSON_INDENT) diff --git a/src/app/project/serializer/GamesystemSerializer.ts b/src/app/project/serializer/GamesystemSerializer.ts index 8ffcafc..717da47 100644 --- a/src/app/project/serializer/GamesystemSerializer.ts +++ b/src/app/project/serializer/GamesystemSerializer.ts @@ -4,10 +4,11 @@ import {SimpleGamesystem} from "../game-model/gamesystems/SimpleGamesystem"; import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem"; import {SerializeConstants} from "./SerializeConstants"; import {ModelComponentType} from "../game-model/ModelComponentType"; +import {SimpleTemplateGamesystem} from "../game-model/gamesystems/SimpleTemplateGamesystem"; export class GamesystemSerializer { - private static IGNORED_SIMPLE_ATTRIBUTES = ["parentGamesystem", 'incomingTransitions', "outgoingTransitions", "unsaved", "type"] + private static IGNORED_SIMPLE_ATTRIBUTES = ["parentGamesystem", 'incomingTransitions', "outgoingTransitions", "unsaved", "type", "conditionMap"] public static serializeGamesystems(gamesystems: Gamesystem[]): StoreComponent[] { let storedGamesystems: StoreComponent[] = [] @@ -16,7 +17,7 @@ export class GamesystemSerializer { } private static serializeSingleGamesystem(gamesystem: Gamesystem): StoreComponent[] { - if(gamesystem instanceof SimpleGamesystem) { + if(gamesystem instanceof SimpleGamesystem || gamesystem instanceof SimpleTemplateGamesystem) { console.log("Simple Gamesystem") return [this.serializeSimpleGamesystem(gamesystem as SimpleGamesystem)] } else { diff --git a/testModel/characters/Astrid Hofferson.json b/testModel/characters/Astrid Hofferson.json index c0c32fc..c5a973f 100644 --- a/testModel/characters/Astrid Hofferson.json +++ b/testModel/characters/Astrid Hofferson.json @@ -1,5 +1,4 @@ { "componentName": "Astrid Hofferson", - "componentDescription": "", "characterSpecificGamesystems": [] } \ No newline at end of file diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json index 5d27eca..30e3fe8 100644 --- a/testModel/characters/Hicks Haddock.json +++ b/testModel/characters/Hicks Haddock.json @@ -1,41 +1,26 @@ { "componentName": "Hicks Haddock", - "componentDescription": "", + "componentDescription": "Das ist ein Test", "characterSpecificGamesystems": [ { - "templateStates": [ + "componentName": "Characterstimmung", + "states": [ { - "initial": false, - "conditions": [ + "stateLabel": "Fröhlich", + "conditionMap": [ { "scriptAccount": "Luftfeuchtigkeit", "minValue": 0, "maxValue": "10" } - ], - "stateLabel": "Wütend" - } - ], - "templateTransitions": [ + ] + }, { - "scriptAccountActions": [ - { - "changingValue": 10, - "scriptAccount": "Luftfeuchtigkeit" - } - ], - "scriptAccountConditions": [ - { - "scriptAccount": "New ScriptAccount", - "minValue": 0, - "maxValue": "10" - } - ], - "startingState": "Glücklich", - "endingState": "Traurig" + "stateLabel": "Wütend", + "conditionMap": [] } ], - "referenceGamesystem": "Characterstimmung" + "transitions": [] } ] } \ No newline at end of file diff --git a/testModel/gamesystems/Characterstimmung.json b/testModel/gamesystems/Characterstimmung.json index eb0d4d4..fe49734 100644 --- a/testModel/gamesystems/Characterstimmung.json +++ b/testModel/gamesystems/Characterstimmung.json @@ -1,11 +1,11 @@ { "componentName": "Characterstimmung", - "componentDescription": "Mit diesem Characterspezifischen System soll die Grundstimmung eines Characters modelliert werden. Mit diesem System kann bspw. beschrieben werden, ob ein Character gerade glücklich, wütend, traurig etc. ist", + "componentDescription": "", "states": [ { "initial": true, "conditions": [], - "stateLabel": "Glücklich", + "stateLabel": "Fröhlich", "stateDescription": "" }, { @@ -13,51 +13,8 @@ "conditions": [], "stateLabel": "Wütend", "stateDescription": "" - }, - { - "initial": false, - "conditions": [], - "stateLabel": "Traurig", - "stateDescription": "" } ], - "transitions": [ - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Glücklich", - "endingState": "Wütend" - }, - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Glücklich", - "endingState": "Traurig" - }, - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Wütend", - "endingState": "Traurig" - }, - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Wütend", - "endingState": "Glücklich" - }, - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Traurig", - "endingState": "Glücklich" - }, - { - "scriptAccountActions": [], - "scriptAccountConditions": [], - "startingState": "Traurig", - "endingState": "Wütend" - } - ], - "template": 1 + "transitions": [], + "templateType": 1 } \ No newline at end of file diff --git a/testModel/gamesystems/Testsystem.json b/testModel/gamesystems/Testsystem.json new file mode 100644 index 0000000..9c53926 --- /dev/null +++ b/testModel/gamesystems/Testsystem.json @@ -0,0 +1,38 @@ +{ + "componentName": "Testsystem", + "componentDescription": "", + "states": [ + { + "initial": false, + "conditions": [], + "stateLabel": "A", + "stateDescription": "" + }, + { + "initial": false, + "conditions": [], + "stateLabel": "B", + "stateDescription": "" + } + ], + "transitions": [ + { + "scriptAccountActions": [ + { + "changingValue": 5, + "scriptAccount": "New ScriptAccount" + } + ], + "scriptAccountConditions": [ + { + "scriptAccount": "Temperature", + "minValue": 0, + "maxValue": "10" + } + ], + "startingState": "A", + "endingState": "B" + } + ], + "templateType": 0 +} \ No newline at end of file diff --git a/testModel/gamesystems/Weathersystem/Season.json b/testModel/gamesystems/Weathersystem/Season.json index 0d38734..246c9ab 100644 --- a/testModel/gamesystems/Weathersystem/Season.json +++ b/testModel/gamesystems/Weathersystem/Season.json @@ -77,5 +77,5 @@ "endingState": "Frühling" } ], - "template": 0 + "templateType": 0 } \ No newline at end of file diff --git a/testModel/gamesystems/Weathersystem/Weather.json b/testModel/gamesystems/Weathersystem/Weather.json index 39afb9f..4a0388d 100644 --- a/testModel/gamesystems/Weathersystem/Weather.json +++ b/testModel/gamesystems/Weathersystem/Weather.json @@ -77,5 +77,5 @@ "endingState": "Wolke" } ], - "template": 0 + "templateType": 0 } \ No newline at end of file