From a54a6523587836b5fedcc5c683232f5030b16ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 22 Mar 2024 10:27:04 +0100 Subject: [PATCH] Introduce Template attribute for gamesystems and define basic Characterstimmung Gamesystem --- .../gamesystem-editor.component.html | 8 +++ .../gamesystem-editor.component.ts | 3 + .../game-model/gamesystems/Gamesystem.ts | 4 +- .../game-model/gamesystems/TemplateType.ts | 5 ++ .../gamesystemParser/GamesystemParser.ts | 2 + testModel/gamesystems/Characterstimmung.json | 63 +++++++++++++++++++ testModel/gamesystems/Testsystem.json | 37 ----------- .../gamesystems/Weathersystem/Season.json | 3 +- .../gamesystems/Weathersystem/Weather.json | 3 +- 9 files changed, 88 insertions(+), 40 deletions(-) create mode 100644 src/app/project/game-model/gamesystems/TemplateType.ts create mode 100644 testModel/gamesystems/Characterstimmung.json delete mode 100644 testModel/gamesystems/Testsystem.json diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html index 2eb564e..598d904 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1,3 +1,11 @@ + + 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 f14dda3..17e5dad 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts @@ -5,6 +5,7 @@ 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"; @Component({ selector: 'app-gamesystem-editor', @@ -40,4 +41,6 @@ export class GamesystemEditorComponent implements OnInit{ onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { this.openGamesystemEmitter.emit(gamesystem); } + + protected readonly TemplateType = TemplateType; } diff --git a/src/app/project/game-model/gamesystems/Gamesystem.ts b/src/app/project/game-model/gamesystems/Gamesystem.ts index 2e94174..1dc3788 100644 --- a/src/app/project/game-model/gamesystems/Gamesystem.ts +++ b/src/app/project/game-model/gamesystems/Gamesystem.ts @@ -1,13 +1,15 @@ -import {SimpleGamesystem} from "./SimpleGamesystem"; import {ProductGamesystem} from "./ProductGamesystem"; import {ModelComponent} from "../ModelComponent"; import {ModelComponentType} from "../ModelComponentType"; +import {TemplateType} from "./TemplateType"; export abstract class Gamesystem extends ModelComponent{ states: S[] = []; transitions: T[] = []; parentGamesystem: ProductGamesystem | undefined + + template: TemplateType = TemplateType.NONE constructor(gamesystemName: string, gamesystemDescription: string) { super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM); } diff --git a/src/app/project/game-model/gamesystems/TemplateType.ts b/src/app/project/game-model/gamesystems/TemplateType.ts new file mode 100644 index 0000000..2338ef5 --- /dev/null +++ b/src/app/project/game-model/gamesystems/TemplateType.ts @@ -0,0 +1,5 @@ +export enum TemplateType { + NONE, + CHARACTER, + LOCATION +} diff --git a/src/app/project/parser/gamesystemParser/GamesystemParser.ts b/src/app/project/parser/gamesystemParser/GamesystemParser.ts index e085bba..e40fa92 100644 --- a/src/app/project/parser/gamesystemParser/GamesystemParser.ts +++ b/src/app/project/parser/gamesystemParser/GamesystemParser.ts @@ -36,6 +36,8 @@ export class GamesystemParser { } else { parsedSystem = this.parseSimpleGamesystem(parsedGamesystemData) } + parsedSystem.template = parsedGamesystemData.template + this.parsedGamesystems.push(parsedSystem); } diff --git a/testModel/gamesystems/Characterstimmung.json b/testModel/gamesystems/Characterstimmung.json new file mode 100644 index 0000000..eb0d4d4 --- /dev/null +++ b/testModel/gamesystems/Characterstimmung.json @@ -0,0 +1,63 @@ +{ + "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", + "states": [ + { + "initial": true, + "conditions": [], + "stateLabel": "Glücklich", + "stateDescription": "" + }, + { + "initial": false, + "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 +} \ No newline at end of file diff --git a/testModel/gamesystems/Testsystem.json b/testModel/gamesystems/Testsystem.json deleted file mode 100644 index 654df19..0000000 --- a/testModel/gamesystems/Testsystem.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "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" - } - ] -} \ No newline at end of file diff --git a/testModel/gamesystems/Weathersystem/Season.json b/testModel/gamesystems/Weathersystem/Season.json index a815ccb..0d38734 100644 --- a/testModel/gamesystems/Weathersystem/Season.json +++ b/testModel/gamesystems/Weathersystem/Season.json @@ -76,5 +76,6 @@ "startingState": "Winter", "endingState": "Frühling" } - ] + ], + "template": 0 } \ No newline at end of file diff --git a/testModel/gamesystems/Weathersystem/Weather.json b/testModel/gamesystems/Weathersystem/Weather.json index b9de825..39afb9f 100644 --- a/testModel/gamesystems/Weathersystem/Weather.json +++ b/testModel/gamesystems/Weathersystem/Weather.json @@ -76,5 +76,6 @@ "startingState": "Schnee", "endingState": "Wolke" } - ] + ], + "template": 0 } \ No newline at end of file