Merge branch 'refs/heads/alt-templatesystem-impl' into characters
All checks were successful
E2E Testing / test (push) Successful in 1m52s
All checks were successful
E2E Testing / test (push) Successful in 1m52s
# Conflicts: # src/app/app.component.ts # src/app/app.module.ts # src/app/editor/character-editor/character-editor.component.html # src/app/editor/character-editor/character-editor.component.ts # src/app/editor/editor.component.html # src/app/editor/editor.component.ts # src/app/editor/gamesystem-editor/gamesystem-editor.component.html # src/app/editor/gamesystem-editor/gamesystem-editor.component.ts # src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.html # src/app/editor/gamesystem-editor/state-editor/simple-state-editor/simple-state-editor.component.ts # src/app/project/game-model/characters/Character.ts # src/app/project/game-model/gamesystems/Gamesystem.ts # src/app/project/parser/characterParser/CharacterParser.ts # src/app/project/parser/gamesystemParser/GamesystemParser.ts # src/app/project/serializer/CharacterSerializer.ts # testModel/characters/Astrid Hofferson.json # testModel/characters/Hicks Haddock.json # testModel/gamesystems/Characterstimmung.json # testModel/gamesystems/Testsystem.json # testModel/gamesystems/Weathersystem/Season.json # testModel/gamesystems/Weathersystem/Weather.json
This commit is contained in:
commit
f7eadfa04d
17
app/main.ts
17
app/main.ts
@ -64,9 +64,20 @@ function createWindow(): BrowserWindow {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "Gamesystem",
|
label: "Gamesystem",
|
||||||
click: () => {
|
submenu: [
|
||||||
win!.webContents.send('context-menu', "new-gamesystem");
|
{
|
||||||
}
|
label: "Normal",
|
||||||
|
click: () => {
|
||||||
|
win!.webContents.send('context-menu', "new-gamesystem-normal");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Characterspecific",
|
||||||
|
click: () => {
|
||||||
|
win!.webContents.send('context-menu', "new-gamesystem-character");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "ScriptAccount",
|
label: "ScriptAccount",
|
||||||
|
@ -24,6 +24,8 @@ import {Character} from "./project/game-model/characters/Character";
|
|||||||
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
||||||
import {CharacterSerializer} from "./project/serializer/CharacterSerializer";
|
import {CharacterSerializer} from "./project/serializer/CharacterSerializer";
|
||||||
import {CharacterParser} from "./project/parser/characterParser/CharacterParser";
|
import {CharacterParser} from "./project/parser/characterParser/CharacterParser";
|
||||||
|
import {TemplateType} from "./project/game-model/TemplateType";
|
||||||
|
import {TemplateTypeUtilities} from "./project/game-model/TemplateTypeUtilities";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -76,8 +78,13 @@ export class AppComponent implements OnInit{
|
|||||||
} else if(message.startsWith("new")) {
|
} else if(message.startsWith("new")) {
|
||||||
const splittedMessage = message.split("-");
|
const splittedMessage = message.split("-");
|
||||||
const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]);
|
const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]);
|
||||||
|
let templateType: TemplateType = TemplateType.NORMAL
|
||||||
|
if(splittedMessage.length > 2) {
|
||||||
|
templateType = TemplateTypeUtilities.fromString(splittedMessage[2]);
|
||||||
|
}
|
||||||
|
|
||||||
if(modelComponentType != undefined) {
|
if(modelComponentType != undefined) {
|
||||||
this.onCreateModelComponent(modelComponentType);
|
this.onCreateModelComponent(modelComponentType, templateType);
|
||||||
} else {
|
} else {
|
||||||
console.log("[ERROR] [App-Component] Unknown Context-Menu Command!")
|
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) {
|
switch (modelComponentType) {
|
||||||
case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break
|
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
|
case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +151,7 @@ export class AppComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onCreateNewGamesystem() {
|
private onCreateNewGamesystem(templateType: TemplateType) {
|
||||||
let parentGamesystemName = undefined
|
let parentGamesystemName = undefined
|
||||||
if(this.openContent != ModelComponentType.GAMESYTEM) {
|
if(this.openContent != ModelComponentType.GAMESYTEM) {
|
||||||
this.openGamesystemsOverview();
|
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) {
|
if(createdGamesystem != undefined) {
|
||||||
this.gamesystemOverview!.refresh();
|
this.gamesystemOverview!.refresh();
|
||||||
this.editor?.openGameModelComponent(createdGamesystem);
|
this.editor?.openGameModelComponent(createdGamesystem);
|
||||||
@ -204,7 +211,7 @@ export class AppComponent implements OnInit{
|
|||||||
const gamesystemParser = new GamesystemParser(scriptAccounts);
|
const gamesystemParser = new GamesystemParser(scriptAccounts);
|
||||||
const gamesystems = gamesystemParser.parseStoredGamesystems(storedGameModel.storedGamesystems);
|
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);
|
const characters = characterParser.parseCharacters(storedGameModel.storedCharacters);
|
||||||
|
|
||||||
gameModel.scriptAccounts = scriptAccounts
|
gameModel.scriptAccounts = scriptAccounts
|
||||||
|
@ -61,7 +61,7 @@ import {
|
|||||||
ProductStateEditorComponent
|
ProductStateEditorComponent
|
||||||
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
|
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
|
||||||
import {MatTooltip} from "@angular/material/tooltip";
|
import {MatTooltip} from "@angular/material/tooltip";
|
||||||
import {MatCard, MatCardContent} from "@angular/material/card";
|
import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card";
|
||||||
import {
|
import {
|
||||||
ScriptaccountActionEditorComponent
|
ScriptaccountActionEditorComponent
|
||||||
} from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
|
} 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";
|
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
|
||||||
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
||||||
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
|
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
|
||||||
import {
|
import {MatAccordion, MatExpansionPanel, MatExpansionPanelHeader} from "@angular/material/expansion";
|
||||||
TemplateGamesystemEditorComponent
|
import {TemplateCreatorComponent} from "./editor/gamesystem-editor/template-creator/template-creator.component";
|
||||||
} 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";
|
|
||||||
|
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||||
@ -109,9 +96,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
|
|||||||
ScriptaccountConditionEditorComponent,
|
ScriptaccountConditionEditorComponent,
|
||||||
CharacterOverviewComponent,
|
CharacterOverviewComponent,
|
||||||
CharacterEditorComponent,
|
CharacterEditorComponent,
|
||||||
TemplateGamesystemEditorComponent,
|
TemplateCreatorComponent
|
||||||
TemplateStateEditorComponent,
|
|
||||||
TemplateTransitionEditorComponent
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -169,16 +154,13 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
|
|||||||
MatTooltip,
|
MatTooltip,
|
||||||
MatCard,
|
MatCard,
|
||||||
MatCardContent,
|
MatCardContent,
|
||||||
|
MatCardHeader,
|
||||||
MatAccordion,
|
MatAccordion,
|
||||||
MatExpansionPanel,
|
MatExpansionPanel,
|
||||||
MatExpansionPanelTitle,
|
MatCardTitle,
|
||||||
MatExpansionPanelHeader
|
MatExpansionPanelHeader
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
exports: [
|
|
||||||
ProductGamesystemEditorComponent,
|
|
||||||
SimpleTransitionEditorComponent
|
|
||||||
],
|
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
<mat-accordion>
|
<mat-card>
|
||||||
<mat-expansion-panel *ngFor="let templateGamesystem of templateSimpleGamesystems">
|
<mat-card-header>
|
||||||
<mat-expansion-panel-header>
|
<mat-card-title>Characterspecific Gamesystems</mat-card-title>
|
||||||
<mat-panel-title>{{templateGamesystem.referenceGamesystem.componentName}}</mat-panel-title>
|
</mat-card-header>
|
||||||
</mat-expansion-panel-header>
|
<mat-card-content>
|
||||||
<app-template-gamesystem-editor [gamesystem]="templateGamesystem" [scriptAccunts]="scriptAccounts"
|
<mat-accordion>
|
||||||
(onSpecifyTemplate)="onSpecifyTemplate($event)"
|
<mat-expansion-panel *ngFor="let gamesystem of character!.characterSpecificGamesystems">
|
||||||
(onUnspecifyTemplate)="onUnspecifyTemplate($event)">
|
<mat-expansion-panel-header>{{gamesystem.componentName}}</mat-expansion-panel-header>
|
||||||
</app-template-gamesystem-editor>
|
<app-gamesystem-editor [scriptAccounts]="gameModel!.scriptAccounts" [gamesystem]="gamesystem" [templateReference]="character!"></app-gamesystem-editor>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
|
||||||
|
</mat-accordion>
|
||||||
|
<button mat-stroked-button style="width: 100%; margin-top: 10px" (click)="onOpenTemplateCreator()">Add Gamesystem</button>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
@ -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 {Character} from "../../project/game-model/characters/Character";
|
||||||
import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem";
|
import {GameModel} from "../../project/game-model/GameModel";
|
||||||
import {TemplateGamesystem} from "../../project/game-model/gamesystems/TemplateGamesystem";
|
import {MatDialog} from "@angular/material/dialog";
|
||||||
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
|
import {TemplateCreatorComponent} from "../gamesystem-editor/template-creator/template-creator.component";
|
||||||
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
|
import {TemplateType} from "../../project/game-model/TemplateType";
|
||||||
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-character-editor',
|
selector: 'app-character-editor',
|
||||||
templateUrl: './character-editor.component.html',
|
templateUrl: './character-editor.component.html',
|
||||||
styleUrl: './character-editor.component.scss'
|
styleUrl: './character-editor.component.scss'
|
||||||
})
|
})
|
||||||
export class CharacterEditorComponent implements OnInit{
|
export class CharacterEditorComponent {
|
||||||
|
|
||||||
@Input() character: Character | undefined
|
@Input() character: Character | undefined
|
||||||
@Input() referenceGamesystems: Gamesystem<any, any>[] = []
|
@Input() gameModel: GameModel | undefined
|
||||||
@Input() scriptAccounts: ScriptAccount[] = []
|
|
||||||
|
|
||||||
templateSimpleGamesystems: TemplateGamesystem[] = []
|
constructor(private dialog: MatDialog) {
|
||||||
templateProductGamesystems: ProductGamesystem[] = []
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
onOpenTemplateCreator() {
|
||||||
this.referenceGamesystems.forEach(referenceGamesystem => {
|
const dialogRef = this.dialog.open(TemplateCreatorComponent, {
|
||||||
if(referenceGamesystem instanceof SimpleGamesystem) {
|
data: this.gameModel!.listGamesystems(TemplateType.CHARACTER),
|
||||||
const characterSpecificGamesystem = this.findReferencedGamesystemInCharacter(referenceGamesystem.componentName)
|
minWidth: "400px"
|
||||||
if(characterSpecificGamesystem != undefined) {
|
})
|
||||||
this.templateSimpleGamesystems.push(characterSpecificGamesystem)
|
|
||||||
} else {
|
dialogRef.afterClosed().subscribe(res => {
|
||||||
this.templateSimpleGamesystems.push(new TemplateGamesystem(referenceGamesystem))
|
if(res != undefined) {
|
||||||
}
|
this.character!.addCharacterSpecificGamesystem(res)
|
||||||
} else {
|
|
||||||
this.templateProductGamesystems.push(referenceGamesystem as ProductGamesystem)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
(onOpenGamesystemEditor)="openGameModelComponent($event)"
|
(onOpenGamesystemEditor)="openGameModelComponent($event)"
|
||||||
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
|
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
|
||||||
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
|
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
|
||||||
[referenceGamesystems]="loadCharacterSpecificGamesystems()"
|
[gameModel]="gameModel!" [character]="convertModelComponentToCharacter(modelComponent)">
|
||||||
[character]="convertModelComponentToCharacter(modelComponent)"
|
|
||||||
[scriptAccounts]="gameModel!.scriptAccounts">
|
|
||||||
|
|
||||||
</app-character-editor>
|
</app-character-editor>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
@ -7,8 +7,6 @@ import {State} from "../project/game-model/gamesystems/states/State";
|
|||||||
import {Transition} from "../project/game-model/gamesystems/transitions/Transition";
|
import {Transition} from "../project/game-model/gamesystems/transitions/Transition";
|
||||||
import {ModelComponentType} from "../project/game-model/ModelComponentType";
|
import {ModelComponentType} from "../project/game-model/ModelComponentType";
|
||||||
import {Character} from "../project/game-model/characters/Character";
|
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({
|
@Component({
|
||||||
@ -47,20 +45,16 @@ export class EditorComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
convertModelComponentToCharacter(modelComponent: ModelComponent) {
|
|
||||||
if(modelComponent instanceof Character) {
|
|
||||||
return modelComponent as Character
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onModelNameUpdate() {
|
onModelNameUpdate() {
|
||||||
this.onModelNameUpdateEmitter.emit(true);
|
this.onModelNameUpdateEmitter.emit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCharacterSpecificGamesystems() {
|
|
||||||
return this.gameModel!.gamesystems.filter(gamesystem => gamesystem.template == TemplateType.CHARACTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected readonly ModelComponentType = ModelComponentType;
|
protected readonly ModelComponentType = ModelComponentType;
|
||||||
|
|
||||||
|
convertModelComponentToCharacter(modelComponent: ModelComponent) {
|
||||||
|
if(modelComponent instanceof Character) {
|
||||||
|
return modelComponent as Character;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
<mat-form-field appearance="fill">
|
<app-simple-gamesystem-editor *ngIf="isSimpleGamesystem()" [simpleGamesystem]="convertGamesystemToSimpleGamesystem()" [scriptAccunts]="scriptAccounts"
|
||||||
<mat-label>Template</mat-label>
|
[templateReference]="templateReference"></app-simple-gamesystem-editor>
|
||||||
<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-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>
|
||||||
|
@ -5,7 +5,8 @@ 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";
|
import {SimpleTemplateGamesystem} from "../../project/game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
|
import {Character} from "../../project/game-model/characters/Character";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gamesystem-editor',
|
selector: 'app-gamesystem-editor',
|
||||||
@ -16,6 +17,7 @@ export class GamesystemEditorComponent implements OnInit{
|
|||||||
|
|
||||||
@Input() gamesystem: Gamesystem<State<any>, Transition<any>> | undefined
|
@Input() gamesystem: Gamesystem<State<any>, Transition<any>> | undefined
|
||||||
@Input() scriptAccounts: ScriptAccount[] = [];
|
@Input() scriptAccounts: ScriptAccount[] = [];
|
||||||
|
@Input() templateReference: Character | undefined
|
||||||
@Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter<SimpleGamesystem>();
|
@Output('onOpenGamesystemEditor') openGamesystemEmitter = new EventEmitter<SimpleGamesystem>();
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -23,11 +25,11 @@ export class GamesystemEditorComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
isSimpleGamesystem() {
|
isSimpleGamesystem() {
|
||||||
return this.gamesystem instanceof SimpleGamesystem;
|
return this.gamesystem instanceof SimpleGamesystem || this.gamesystem instanceof SimpleTemplateGamesystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertGamesystemToSimpleGamesystem() {
|
convertGamesystemToSimpleGamesystem() {
|
||||||
if(this.gamesystem instanceof SimpleGamesystem) {
|
if(!(this.gamesystem instanceof ProductGamesystem)) {
|
||||||
return this.gamesystem as SimpleGamesystem;
|
return this.gamesystem as SimpleGamesystem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,6 +43,4 @@ export class GamesystemEditorComponent implements OnInit{
|
|||||||
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
|
onOpenGamesystemEditor(gamesystem: SimpleGamesystem) {
|
||||||
this.openGamesystemEmitter.emit(gamesystem);
|
this.openGamesystemEmitter.emit(gamesystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly TemplateType = TemplateType;
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts"></app-simple-state-editor>
|
<app-simple-state-editor [states]="simpleGamesystem!.states" [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts" [templateReference]="templateReference"></app-simple-state-editor>
|
||||||
<div id="transition-editor">
|
<div id="transition-editor">
|
||||||
<app-simple-transition-editor [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts"></app-simple-transition-editor>
|
<app-simple-transition-editor [gamesystem]="simpleGamesystem" [scriptAccounts]="scriptAccunts"></app-simple-transition-editor>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
import {MatTableDataSource} from "@angular/material/table";
|
||||||
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
|
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({
|
@Component({
|
||||||
selector: 'app-simple-gamesystem-editor',
|
selector: 'app-simple-gamesystem-editor',
|
||||||
templateUrl: './simple-gamesystem-editor.component.html',
|
templateUrl: './simple-gamesystem-editor.component.html',
|
||||||
styleUrl: './simple-gamesystem-editor.component.scss'
|
styleUrl: './simple-gamesystem-editor.component.scss'
|
||||||
})
|
})
|
||||||
export class SimpleGamesystemEditorComponent {
|
export class SimpleGamesystemEditorComponent implements OnInit{
|
||||||
|
|
||||||
@Input() simpleGamesystem: SimpleGamesystem | undefined
|
@Input() simpleGamesystem: SimpleGamesystem | SimpleTemplateGamesystem<any> | undefined
|
||||||
@Input() scriptAccunts: ScriptAccount[] = []
|
@Input() scriptAccunts: ScriptAccount[] = []
|
||||||
|
@Input() templateReference: Character | undefined
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log("SimpleGamesystem: ", this.simpleGamesystem)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="long-form">
|
<div class="long-form">
|
||||||
<app-scriptaccount-condition-editor [conditions]="element.conditions" [scriptAccounts]="scriptAccounts" [enableEditiong]="gamesystem != undefined"
|
<app-scriptaccount-condition-editor [conditions]="getStateConditions(element)" [scriptAccounts]="scriptAccounts" [enableEditiong]="true"
|
||||||
(onCreateCondition)="onCreateCondition(element, $event)" (onDeleteCondition)="deleteCondition(element, $event)"></app-scriptaccount-condition-editor>
|
(onCreateCondition)="onCreateCondition(element, $event)" (onDeleteCondition)="deleteCondition(element, $event)"></app-scriptaccount-condition-editor>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -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 {MatTableDataSource} from "@angular/material/table";
|
||||||
import {animate, state, style, transition, trigger} from "@angular/animations";
|
import {animate, state, style, transition, trigger} from "@angular/animations";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
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 {SimpleGamesystem} from "../../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
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({
|
@Component({
|
||||||
selector: 'app-simple-state-editor',
|
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() states: SimpleState[] = [];
|
||||||
@Input() gamesystem: SimpleGamesystem | undefined
|
@Input() gamesystem: SimpleGamesystem | undefined
|
||||||
@Input() scriptAccounts: ScriptAccount[] = []
|
@Input() scriptAccounts: ScriptAccount[] = []
|
||||||
@Output() onExtractReferenceState = new EventEmitter<SimpleState>()
|
@Input() templateReference: Character | undefined
|
||||||
|
|
||||||
dataSource = new MatTableDataSource<SimpleState>();
|
dataSource = new MatTableDataSource<SimpleState>();
|
||||||
displayedColumns = ["name", "initial", "edit", "delete"];
|
displayedColumns = ["name", "initial", "edit", "delete"];
|
||||||
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
columnsToDisplayWithExpand = [...this.displayedColumns, 'expand'];
|
||||||
@ -42,30 +44,13 @@ export class SimpleStateEditorComponent implements OnInit, OnChanges{
|
|||||||
this.dataSource.filterPredicate = (data: SimpleState, filter: string) => {
|
this.dataSource.filterPredicate = (data: SimpleState, filter: string) => {
|
||||||
return data.stateLabel.toLowerCase().includes(filter);
|
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) {
|
editState(state: SimpleState) {
|
||||||
if(this.gamesystem == undefined) {
|
if(this.editedElement === state) {
|
||||||
this.onExtractReferenceState.emit(state)
|
this.editedElement = null;
|
||||||
} else {
|
} else {
|
||||||
if(this.editedElement === state) {
|
this.editedElement = state;
|
||||||
this.editedElement = null;
|
|
||||||
} else {
|
|
||||||
this.editedElement = state;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,11 +100,33 @@ export class SimpleStateEditorComponent implements OnInit, OnChanges{
|
|||||||
}
|
}
|
||||||
|
|
||||||
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
|
onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) {
|
||||||
state.addScriptAccountCondition(condition);
|
if(this.templateReference instanceof Character) {
|
||||||
|
const templateState = state as SimpleTemplateState<Character>
|
||||||
|
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) {
|
deleteCondition(state: SimpleState, condition: ScriptAccountCondition) {
|
||||||
state.removeScriptAccountCondition(condition.scriptAccount);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
<h1 mat-dialog-title>Specify Gamesystem</h1>
|
||||||
|
<div matDialogContent>
|
||||||
|
<mat-form-field appearance="outline" style="width: 100%">
|
||||||
|
<mat-label>Referencesystem</mat-label>
|
||||||
|
<mat-select [formControl]="templateCtrl">
|
||||||
|
<mat-option *ngFor="let gamesystem of templateGamesystems" [value]="gamesystem">{{gamesystem.componentName}}</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div matDialogActions align="end">
|
||||||
|
<button mat-stroked-button (click)="cancel()">Cancel</button>
|
||||||
|
<button mat-raised-button color="accent" (click)="save()">Specify</button>
|
||||||
|
</div>
|
@ -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<TemplateCreatorComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [TemplateCreatorComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(TemplateCreatorComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -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<any>[],
|
||||||
|
private dialogRef: MatDialogRef<TemplateCreatorComponent>) {
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
this.dialogRef.close(this.templateCtrl.value)
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,11 @@ import {State} from "./gamesystems/states/State";
|
|||||||
import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
|
||||||
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
||||||
import {Character} from "./characters/Character";
|
import {Character} from "./characters/Character";
|
||||||
import {ModelComponentType} from "./ModelComponentType";
|
import {TemplateType} from "./TemplateType";
|
||||||
|
import {SimpleTemplateGamesystem} from "./gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
export class GameModel {
|
export class GameModel {
|
||||||
|
|
||||||
gameModelName: string
|
gameModelName: string
|
||||||
|
|
||||||
gamesystems: Gamesystem<any, any>[] = [];
|
gamesystems: Gamesystem<any, any>[] = [];
|
||||||
@ -45,9 +47,14 @@ export class GameModel {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined) {
|
createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined, templateType: TemplateType) {
|
||||||
if(gamesystemName != undefined && this.findGamesystem(gamesystemName) == undefined) {
|
if(gamesystemName != undefined && this.findGamesystem(gamesystemName) == undefined) {
|
||||||
const simpleGamesystem = new SimpleGamesystem(gamesystemName, "");
|
let simpleGamesystem = new SimpleGamesystem(gamesystemName, "");
|
||||||
|
if(templateType == TemplateType.CHARACTER) {
|
||||||
|
simpleGamesystem = new SimpleTemplateGamesystem<Character>(gamesystemName, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(parentGamesystemName != undefined) {
|
if(parentGamesystemName != undefined) {
|
||||||
const parentGamesystem = this.findGamesystem(parentGamesystemName);
|
const parentGamesystem = this.findGamesystem(parentGamesystemName);
|
||||||
if(parentGamesystem instanceof SimpleGamesystem) {
|
if(parentGamesystem instanceof SimpleGamesystem) {
|
||||||
@ -115,4 +122,25 @@ export class GameModel {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listGamesystems(templateType: TemplateType): SimpleTemplateGamesystem<any>[] {
|
||||||
|
const gamesystemList: SimpleTemplateGamesystem<any>[] = []
|
||||||
|
const gamesystemQueue: Gamesystem<any, any>[] = this.gamesystems.concat()
|
||||||
|
while(gamesystemQueue.length > 0) {
|
||||||
|
const currentGamesystem = gamesystemQueue.shift()!;
|
||||||
|
|
||||||
|
if(currentGamesystem.templateType === templateType) {
|
||||||
|
gamesystemList.push(currentGamesystem as SimpleTemplateGamesystem<any>)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(currentGamesystem instanceof ProductGamesystem) {
|
||||||
|
currentGamesystem.innerGamesystems.forEach(innerGamesystem => {
|
||||||
|
gamesystemQueue.push(innerGamesystem)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(gamesystemList)
|
||||||
|
return gamesystemList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
3
src/app/project/game-model/TemplateType.ts
Normal file
3
src/app/project/game-model/TemplateType.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export enum TemplateType {
|
||||||
|
NORMAL, CHARACTER
|
||||||
|
}
|
11
src/app/project/game-model/TemplateTypeUtilities.ts
Normal file
11
src/app/project/game-model/TemplateTypeUtilities.ts
Normal file
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,24 @@
|
|||||||
import {ModelComponent} from "../ModelComponent";
|
import {ModelComponent} from "../ModelComponent";
|
||||||
import {ModelComponentType} from "../ModelComponentType";
|
import {ModelComponentType} from "../ModelComponentType";
|
||||||
import {TemplateGamesystem} from "../gamesystems/TemplateGamesystem";
|
import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
export class Character extends ModelComponent{
|
export class Character extends ModelComponent{
|
||||||
|
|
||||||
characterSpecificGamesystems: TemplateGamesystem[] = []
|
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
|
||||||
|
|
||||||
constructor(componentName: string, componentDescription: string) {
|
constructor(componentName: string, componentDescription: string) {
|
||||||
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCharacterSpecificGamesystem(gamesystem: TemplateGamesystem) {
|
addCharacterSpecificGamesystem(templateGamesystem: SimpleTemplateGamesystem<Character>) {
|
||||||
this.characterSpecificGamesystems.push(gamesystem)
|
if(!this.isGamesystemCharacterSpecific(templateGamesystem.componentName)) {
|
||||||
|
this.characterSpecificGamesystems.push(templateGamesystem);
|
||||||
|
templateGamesystem.addReferenceKey(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCharacterSpecificGamesystem(gamesystem: TemplateGamesystem) {
|
private isGamesystemCharacterSpecific(gamesystemName: string) {
|
||||||
this.characterSpecificGamesystems = this.characterSpecificGamesystems.filter(templateSystem => templateSystem.referenceGamesystem.componentName !== gamesystem.referenceGamesystem.componentName)
|
const characterSpecificGamesystem = this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === gamesystemName);
|
||||||
|
return characterSpecificGamesystem != undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
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";
|
import {TemplateType} from "../TemplateType";
|
||||||
|
|
||||||
export abstract class Gamesystem<S, T> extends ModelComponent{
|
export abstract class Gamesystem<S, T> extends ModelComponent{
|
||||||
|
|
||||||
@ -9,7 +10,9 @@ export abstract class Gamesystem<S, T> extends ModelComponent{
|
|||||||
transitions: T[] = [];
|
transitions: T[] = [];
|
||||||
parentGamesystem: ProductGamesystem | undefined
|
parentGamesystem: ProductGamesystem | undefined
|
||||||
|
|
||||||
template: TemplateType = TemplateType.NONE
|
templateType: TemplateType = TemplateType.NORMAL
|
||||||
|
|
||||||
|
|
||||||
constructor(gamesystemName: string, gamesystemDescription: string) {
|
constructor(gamesystemName: string, gamesystemDescription: string) {
|
||||||
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
|
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
|
||||||
}
|
}
|
||||||
|
@ -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<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> {
|
||||||
|
createState(label: string, description: string): SimpleState | undefined {
|
||||||
|
if(label == null) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(description == null) {
|
||||||
|
description = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const state = new SimpleTemplateState<ReferenceType>(label, description);
|
||||||
|
if(this.states.find(s => s.stateLabel == label) == undefined) {
|
||||||
|
this.states.push(state);
|
||||||
|
return state;
|
||||||
|
} else {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
createTransition(startingState: SimpleTemplateState<ReferenceType>, endingState: SimpleTemplateState<ReferenceType>): SimpleTemplateTransition<ReferenceType> | undefined {
|
||||||
|
if((startingState == null || endingState == null) || startingState === endingState) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
const transition = new SimpleTemplateTransition<ReferenceType>(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<ReferenceType>): 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())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
import {SimpleState} from "./SimpleState";
|
||||||
|
import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition";
|
||||||
|
|
||||||
|
export class SimpleTemplateState<ReferenceType> extends SimpleState {
|
||||||
|
|
||||||
|
conditionMap: Map<ReferenceType, ScriptAccountCondition[]> = new Map<ReferenceType, ScriptAccountCondition[]>()
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
import {SimpleTransition} from "./SimpleTransition";
|
||||||
|
import {ScriptAccountCondition} from "../conditions/ScriptAccountCondition";
|
||||||
|
import {ScriptAccountAction} from "../actions/ScriptAccountAction";
|
||||||
|
|
||||||
|
export class SimpleTemplateTransition<ReferenceType> extends SimpleTransition {
|
||||||
|
|
||||||
|
conditions: Map<ReferenceType, ScriptAccountCondition[]> = new Map();
|
||||||
|
actions: Map<ReferenceType, ScriptAccountAction[]> = new Map();
|
||||||
|
}
|
@ -1,17 +1,19 @@
|
|||||||
import {StoreComponent} from "../../../../../app/storage/StoreComponent";
|
import {StoreComponent} from "../../../../../app/storage/StoreComponent";
|
||||||
import {Character} from "../../game-model/characters/Character";
|
import {Character} from "../../game-model/characters/Character";
|
||||||
|
import {SimpleTemplateGamesystem} from "../../game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
import {TemplateParser} from "../templateParser/TemplateParser";
|
import {ScriptAccountParser} from "../ScriptAccountParser";
|
||||||
import {Gamesystem} from "../../game-model/gamesystems/Gamesystem";
|
import {ScriptAccountConditionParser} from "../gamesystemParser/ScriptAccountConditionParser";
|
||||||
import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
|
||||||
|
|
||||||
|
|
||||||
export class CharacterParser {
|
export class CharacterParser {
|
||||||
|
|
||||||
private templateParser: TemplateParser
|
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[]
|
||||||
|
scriptAccountConditionParser: ScriptAccountConditionParser
|
||||||
|
|
||||||
constructor(gamesystems: Gamesystem<any, any>[], scriptAccounts: ScriptAccount[], states: SimpleState[]) {
|
constructor(characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[], scriptAccounts: ScriptAccount[]) {
|
||||||
this.templateParser = new TemplateParser(gamesystems, scriptAccounts, states)
|
this.characterSpecificGamesystems = characterSpecificGamesystems;
|
||||||
|
this.scriptAccountConditionParser = new ScriptAccountConditionParser(scriptAccounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
public parseCharacters(characters: StoreComponent[]): Character[] {
|
public parseCharacters(characters: StoreComponent[]): Character[] {
|
||||||
@ -22,8 +24,40 @@ export class CharacterParser {
|
|||||||
|
|
||||||
private parseSingleCharacter(characterData: any): Character {
|
private parseSingleCharacter(characterData: any): Character {
|
||||||
const character = new Character(characterData.componentName, characterData.componentDescription);
|
const character = new Character(characterData.componentName, characterData.componentDescription);
|
||||||
character.characterSpecificGamesystems = this.templateParser.parseTemplateGamesystems(characterData.characterSpecificGamesystems)
|
character.characterSpecificGamesystems = this.parseCharacterSpecificGamesystems(character, characterData.characterSpecificGamesystems);
|
||||||
console.log(character.characterSpecificGamesystems)
|
|
||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private parseCharacterSpecificGamesystems(character: Character, characterSpecificGamesystems: any): SimpleTemplateGamesystem<Character>[] {
|
||||||
|
const result: SimpleTemplateGamesystem<Character>[] = []
|
||||||
|
for(let i=0; i<characterSpecificGamesystems.length; i++) {
|
||||||
|
const characterSpecificGamesystem = characterSpecificGamesystems[i];
|
||||||
|
result.push(this.parseSingleCharacterSpecificGamesystem(character, characterSpecificGamesystem)!)
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseSingleCharacterSpecificGamesystem(character: Character, characterSpecificGamesystem: any): SimpleTemplateGamesystem<Character> | undefined{
|
||||||
|
const referencedGamesystem = this.findCharacterSpecificGamesystem(characterSpecificGamesystem.componentName)
|
||||||
|
|
||||||
|
if(referencedGamesystem != undefined) {
|
||||||
|
for(let i=0; i<characterSpecificGamesystem.states.length; i++) {
|
||||||
|
const stateReference = characterSpecificGamesystem.states[i];
|
||||||
|
const state = this.findReferencedState(referencedGamesystem, stateReference.stateLabel)!
|
||||||
|
|
||||||
|
const conditions = this.scriptAccountConditionParser.parseStoredConditions(stateReference.conditionMap);
|
||||||
|
|
||||||
|
state.conditionMap.set(character, conditions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return referencedGamesystem;
|
||||||
|
}
|
||||||
|
private findCharacterSpecificGamesystem(componentName: string): SimpleTemplateGamesystem<Character> | undefined{
|
||||||
|
return this.characterSpecificGamesystems.find(gamesystem => gamesystem.componentName === componentName)
|
||||||
|
}
|
||||||
|
|
||||||
|
private findReferencedState(gamesystem: SimpleTemplateGamesystem<Character>, stateLabel: string) {
|
||||||
|
return gamesystem.states.find(state => state.stateLabel === stateLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,14 @@ import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
|||||||
import {StateParser} from "./StateParser";
|
import {StateParser} from "./StateParser";
|
||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
import {TransitionParser} from "./TransitionParser";
|
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 {
|
export class GamesystemParser {
|
||||||
|
|
||||||
private parsedParentGamesystems: ParsedParentGamesystems[] = []
|
private parsedParentGamesystems: ParsedParentGamesystems[] = []
|
||||||
private parsedGamesystems: Gamesystem<any, any>[] = []
|
private parsedGamesystems: Gamesystem<any, any>[] = []
|
||||||
parsedStates: SimpleState[] = []
|
|
||||||
|
|
||||||
private scriptAccounts: ScriptAccount[]
|
private scriptAccounts: ScriptAccount[]
|
||||||
|
|
||||||
@ -38,20 +39,24 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
parseSimpleGamesystem(gamesystemData: any): SimpleGamesystem {
|
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<Character>(gamesystemData.componentName, gamesystemData.componentDescription)
|
||||||
|
simpleGamesystem.templateType = TemplateType.CHARACTER
|
||||||
|
}
|
||||||
|
|
||||||
const stateParser = new StateParser(this.scriptAccounts);
|
const stateParser = new StateParser(this.scriptAccounts);
|
||||||
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states)
|
simpleGamesystem.states = stateParser.parseStates(gamesystemData.states, templateType)
|
||||||
this.parsedStates = this.parsedStates.concat(simpleGamesystem.states)
|
|
||||||
|
|
||||||
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
|
const transitionParser = new TransitionParser(simpleGamesystem.states, this.scriptAccounts)
|
||||||
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
|
simpleGamesystem.transitions = transitionParser.parseTransitions(gamesystemData.transitions)
|
||||||
|
|
||||||
|
|
||||||
return simpleGamesystem
|
return simpleGamesystem
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +94,8 @@ export class GamesystemParser {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllParsedGamesystems() {
|
getParsedTemplateGamesystems(templateType: TemplateType) {
|
||||||
return this.parsedGamesystems
|
const templateGamesystems = this.parsedGamesystems.filter(gamesystem => gamesystem.templateType === templateType);
|
||||||
|
return templateGamesystems.map(gamesystem => gamesystem as SimpleTemplateGamesystem<any>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ import {SimpleState} from "../../game-model/gamesystems/states/SimpleState";
|
|||||||
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../game-model/scriptAccounts/ScriptAccount";
|
||||||
import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
import {ScriptAccountCondition} from "../../game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
import {ScriptAccountConditionParser} from "./ScriptAccountConditionParser";
|
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 {
|
export class StateParser {
|
||||||
|
|
||||||
@ -12,23 +15,29 @@ export class StateParser {
|
|||||||
this.conditionParser = new ScriptAccountConditionParser(scriptAccounts)
|
this.conditionParser = new ScriptAccountConditionParser(scriptAccounts)
|
||||||
}
|
}
|
||||||
|
|
||||||
public parseStates(stateData: any): SimpleState[] {
|
public parseStates(stateData: any, templateType: TemplateType): SimpleState[] {
|
||||||
const parsedStates: SimpleState[] = []
|
const parsedStates: SimpleState[] = []
|
||||||
for(let i=0; i<stateData.length; i++) {
|
for(let i=0; i<stateData.length; i++) {
|
||||||
parsedStates.push(this.parseState(stateData[i]))
|
parsedStates.push(this.parseState(stateData[i], templateType))
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedStates;
|
return parsedStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseState(stateData: any): SimpleState {
|
private parseState(stateData: any, templateType: TemplateType): SimpleState {
|
||||||
const initial = stateData.initial
|
const initial = stateData.initial
|
||||||
const stateLabel = stateData.stateLabel
|
const stateLabel = stateData.stateLabel
|
||||||
const stateDescription = stateData.stateDescription
|
const stateDescription = stateData.stateDescription
|
||||||
|
|
||||||
const conditions = this.conditionParser.parseStoredConditions(stateData.conditions)
|
const conditions = this.conditionParser.parseStoredConditions(stateData.conditions)
|
||||||
|
|
||||||
const simpleState = new SimpleState(stateLabel, stateDescription);
|
let simpleState;
|
||||||
|
if(templateType === TemplateType.NORMAL) {
|
||||||
|
simpleState = new SimpleState(stateLabel, stateDescription);
|
||||||
|
} else {
|
||||||
|
simpleState = new SimpleTemplateState<Character>(stateLabel, stateDescription);
|
||||||
|
}
|
||||||
|
|
||||||
simpleState.initial = initial;
|
simpleState.initial = initial;
|
||||||
simpleState.conditions = conditions;
|
simpleState.conditions = conditions;
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@ import {Character} from "../game-model/characters/Character";
|
|||||||
import {StoreComponent} from "../../../../app/storage/StoreComponent";
|
import {StoreComponent} from "../../../../app/storage/StoreComponent";
|
||||||
import {SerializeConstants} from "./SerializeConstants";
|
import {SerializeConstants} from "./SerializeConstants";
|
||||||
import {ModelComponentType} from "../game-model/ModelComponentType";
|
import {ModelComponentType} from "../game-model/ModelComponentType";
|
||||||
|
import {Gamesystem} from "../game-model/gamesystems/Gamesystem";
|
||||||
|
import {ScriptAccount} from "../game-model/scriptAccounts/ScriptAccount";
|
||||||
|
|
||||||
export class CharacterSerializer {
|
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[] {
|
public static serializeCharacters(characters: Character[]): StoreComponent[] {
|
||||||
const storedCharacters: StoreComponent[] = []
|
const storedCharacters: StoreComponent[] = []
|
||||||
@ -16,14 +18,24 @@ export class CharacterSerializer {
|
|||||||
private static serializeSingleCharacter(character: Character): StoreComponent{
|
private static serializeSingleCharacter(character: Character): StoreComponent{
|
||||||
const fileName = character.componentName
|
const fileName = character.componentName
|
||||||
const jsonString = JSON.stringify(character, (key, value) => {
|
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
|
return undefined
|
||||||
} else {
|
} else {
|
||||||
if(key === 'referenceGamesystem' || key === 'scriptAccount') {
|
|
||||||
return value.componentName
|
|
||||||
} else if(key === 'startingState' || key === 'endingState') {
|
|
||||||
return value.stateLabel
|
|
||||||
}
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}, SerializeConstants.JSON_INDENT)
|
}, SerializeConstants.JSON_INDENT)
|
||||||
|
@ -4,10 +4,11 @@ import {SimpleGamesystem} from "../game-model/gamesystems/SimpleGamesystem";
|
|||||||
import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../game-model/gamesystems/ProductGamesystem";
|
||||||
import {SerializeConstants} from "./SerializeConstants";
|
import {SerializeConstants} from "./SerializeConstants";
|
||||||
import {ModelComponentType} from "../game-model/ModelComponentType";
|
import {ModelComponentType} from "../game-model/ModelComponentType";
|
||||||
|
import {SimpleTemplateGamesystem} from "../game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
export class GamesystemSerializer {
|
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<any, any>[]): StoreComponent[] {
|
public static serializeGamesystems(gamesystems: Gamesystem<any, any>[]): StoreComponent[] {
|
||||||
let storedGamesystems: StoreComponent[] = []
|
let storedGamesystems: StoreComponent[] = []
|
||||||
@ -16,7 +17,7 @@ export class GamesystemSerializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static serializeSingleGamesystem(gamesystem: Gamesystem<any, any>): StoreComponent[] {
|
private static serializeSingleGamesystem(gamesystem: Gamesystem<any, any>): StoreComponent[] {
|
||||||
if(gamesystem instanceof SimpleGamesystem) {
|
if(gamesystem instanceof SimpleGamesystem || gamesystem instanceof SimpleTemplateGamesystem) {
|
||||||
console.log("Simple Gamesystem")
|
console.log("Simple Gamesystem")
|
||||||
return [this.serializeSimpleGamesystem(gamesystem as SimpleGamesystem)]
|
return [this.serializeSimpleGamesystem(gamesystem as SimpleGamesystem)]
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"componentName": "Astrid Hofferson",
|
"componentName": "Astrid Hofferson",
|
||||||
"componentDescription": "",
|
|
||||||
"characterSpecificGamesystems": []
|
"characterSpecificGamesystems": []
|
||||||
}
|
}
|
@ -1,41 +1,26 @@
|
|||||||
{
|
{
|
||||||
"componentName": "Hicks Haddock",
|
"componentName": "Hicks Haddock",
|
||||||
"componentDescription": "",
|
"componentDescription": "Das ist ein Test",
|
||||||
"characterSpecificGamesystems": [
|
"characterSpecificGamesystems": [
|
||||||
{
|
{
|
||||||
"templateStates": [
|
"componentName": "Characterstimmung",
|
||||||
|
"states": [
|
||||||
{
|
{
|
||||||
"initial": false,
|
"stateLabel": "Fröhlich",
|
||||||
"conditions": [
|
"conditionMap": [
|
||||||
{
|
{
|
||||||
"scriptAccount": "Luftfeuchtigkeit",
|
"scriptAccount": "Luftfeuchtigkeit",
|
||||||
"minValue": 0,
|
"minValue": 0,
|
||||||
"maxValue": "10"
|
"maxValue": "10"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"stateLabel": "Wütend"
|
},
|
||||||
}
|
|
||||||
],
|
|
||||||
"templateTransitions": [
|
|
||||||
{
|
{
|
||||||
"scriptAccountActions": [
|
"stateLabel": "Wütend",
|
||||||
{
|
"conditionMap": []
|
||||||
"changingValue": 10,
|
|
||||||
"scriptAccount": "Luftfeuchtigkeit"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"scriptAccountConditions": [
|
|
||||||
{
|
|
||||||
"scriptAccount": "New ScriptAccount",
|
|
||||||
"minValue": 0,
|
|
||||||
"maxValue": "10"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"startingState": "Glücklich",
|
|
||||||
"endingState": "Traurig"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"referenceGamesystem": "Characterstimmung"
|
"transitions": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"componentName": "Characterstimmung",
|
"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": [
|
"states": [
|
||||||
{
|
{
|
||||||
"initial": true,
|
"initial": true,
|
||||||
"conditions": [],
|
"conditions": [],
|
||||||
"stateLabel": "Glücklich",
|
"stateLabel": "Fröhlich",
|
||||||
"stateDescription": ""
|
"stateDescription": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -13,51 +13,8 @@
|
|||||||
"conditions": [],
|
"conditions": [],
|
||||||
"stateLabel": "Wütend",
|
"stateLabel": "Wütend",
|
||||||
"stateDescription": ""
|
"stateDescription": ""
|
||||||
},
|
|
||||||
{
|
|
||||||
"initial": false,
|
|
||||||
"conditions": [],
|
|
||||||
"stateLabel": "Traurig",
|
|
||||||
"stateDescription": ""
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"transitions": [
|
"transitions": [],
|
||||||
{
|
"templateType": 1
|
||||||
"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
|
|
||||||
}
|
}
|
38
testModel/gamesystems/Testsystem.json
Normal file
38
testModel/gamesystems/Testsystem.json
Normal file
@ -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
|
||||||
|
}
|
@ -77,5 +77,5 @@
|
|||||||
"endingState": "Frühling"
|
"endingState": "Frühling"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"template": 0
|
"templateType": 0
|
||||||
}
|
}
|
@ -77,5 +77,5 @@
|
|||||||
"endingState": "Wolke"
|
"endingState": "Wolke"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"template": 0
|
"templateType": 0
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user