Introduce Template attribute for gamesystems and define basic Characterstimmung Gamesystem
All checks were successful
E2E Testing / test (push) Successful in 1m37s

This commit is contained in:
Sebastian Böckelmann 2024-03-22 10:27:04 +01:00
parent e890d89cc8
commit a54a652358
9 changed files with 88 additions and 40 deletions

View File

@ -1,3 +1,11 @@
<mat-form-field appearance="fill">
<mat-label>Template</mat-label>
<mat-select [(ngModel)]="gamesystem!.template">
<mat-option [value]="TemplateType.NONE">None</mat-option>
<mat-option [value]="TemplateType.CHARACTER">Character</mat-option>
<mat-option [value]="TemplateType.LOCATION">Location</mat-option>
</mat-select>
</mat-form-field>
<app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor> <app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"></app-simple-gamesystem-editor>
<app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [gamesystem]="convertGamesystemToProductGamesystem()" <app-product-gamesystem-editor *ngIf="!isSimpleGamesystem()" [gamesystem]="convertGamesystemToProductGamesystem()"
(onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor> (onOpenGamesystemEditor)="onOpenGamesystemEditor($event)"></app-product-gamesystem-editor>

View File

@ -5,6 +5,7 @@ import { Transition } from '../../project/game-model/gamesystems/transitions/Tra
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
import {TemplateType} from "../../project/game-model/gamesystems/TemplateType";
@Component({ @Component({
selector: 'app-gamesystem-editor', selector: 'app-gamesystem-editor',
@ -40,4 +41,6 @@ export class GamesystemEditorComponent implements OnInit{
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) { onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
this.openGamesystemEmitter.emit(gamesystem); this.openGamesystemEmitter.emit(gamesystem);
} }
protected readonly TemplateType = TemplateType;
} }

View File

@ -1,13 +1,15 @@
import {SimpleGamesystem} from "./SimpleGamesystem";
import {ProductGamesystem} from "./ProductGamesystem"; import {ProductGamesystem} from "./ProductGamesystem";
import {ModelComponent} from "../ModelComponent"; import {ModelComponent} from "../ModelComponent";
import {ModelComponentType} from "../ModelComponentType"; import {ModelComponentType} from "../ModelComponentType";
import {TemplateType} from "./TemplateType";
export abstract class Gamesystem<S, T> extends ModelComponent{ export abstract class Gamesystem<S, T> extends ModelComponent{
states: S[] = []; states: S[] = [];
transitions: T[] = []; transitions: T[] = [];
parentGamesystem: ProductGamesystem | undefined parentGamesystem: ProductGamesystem | undefined
template: TemplateType = TemplateType.NONE
constructor(gamesystemName: string, gamesystemDescription: string) { constructor(gamesystemName: string, gamesystemDescription: string) {
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM); super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
} }

View File

@ -0,0 +1,5 @@
export enum TemplateType {
NONE,
CHARACTER,
LOCATION
}

View File

@ -36,6 +36,8 @@ export class GamesystemParser {
} else { } else {
parsedSystem = this.parseSimpleGamesystem(parsedGamesystemData) parsedSystem = this.parseSimpleGamesystem(parsedGamesystemData)
} }
parsedSystem.template = parsedGamesystemData.template
this.parsedGamesystems.push(parsedSystem); this.parsedGamesystems.push(parsedSystem);
} }

View File

@ -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
}

View File

@ -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"
}
]
}

View File

@ -76,5 +76,6 @@
"startingState": "Winter", "startingState": "Winter",
"endingState": "Frühling" "endingState": "Frühling"
} }
] ],
"template": 0
} }

View File

@ -76,5 +76,6 @@
"startingState": "Schnee", "startingState": "Schnee",
"endingState": "Wolke" "endingState": "Wolke"
} }
] ],
"template": 0
} }