diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7412843..ab95304 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,7 +29,7 @@ import {ModelComponentEditorComponent} from "./editor/model-component-editor/mod import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component"; import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog"; import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component"; -import {MatTree, MatTreeModule} from "@angular/material/tree"; +import { MatTreeModule} from "@angular/material/tree"; import {GamesystemEditorComponent} from "./editor/gamesystem-editor/gamesystem-editor.component"; import { SimpleGamesystemEditorComponent @@ -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} from "@angular/material/card"; import { ScriptaccountActionEditorComponent } from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component"; @@ -70,6 +70,7 @@ 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 {MatAccordion, MatExpansionPanel, MatExpansionPanelTitle} from "@angular/material/expansion"; // AoT requires an exported function for factories const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json'); @@ -150,7 +151,11 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatHint, MatTooltip, MatCard, - MatCardContent + MatCardContent, + MatCardHeader, + MatAccordion, + MatExpansionPanel, + MatExpansionPanelTitle ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/character-editor/character-editor.component.html b/src/app/editor/character-editor/character-editor.component.html index 4750ae3..648137c 100644 --- a/src/app/editor/character-editor/character-editor.component.html +++ b/src/app/editor/character-editor/character-editor.component.html @@ -1 +1,15 @@ -

character-editor works!

+ + + Charactersystems + + + + + + {{characterSystem.componentName}} + + + + + + diff --git a/src/app/editor/character-editor/character-editor.component.ts b/src/app/editor/character-editor/character-editor.component.ts index 23e8438..8eba0b2 100644 --- a/src/app/editor/character-editor/character-editor.component.ts +++ b/src/app/editor/character-editor/character-editor.component.ts @@ -1,4 +1,6 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; +import { Character } from '../../project/game-model/characters/Character'; +import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-character-editor', @@ -7,4 +9,6 @@ import { Component } from '@angular/core'; }) export class CharacterEditorComponent { + @Input() character: Character | undefined + @Input() scriptAccounts: ScriptAccount[] = [] } diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index b351774..acf4c2e 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -14,7 +14,9 @@ [gamesystem]="convertModelComponentToGamesystem(modelComponent)" (onOpenGamesystemEditor)="openGameModelComponent($event)" [scriptAccounts]="gameModel!.scriptAccounts"> - + diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index 887f4d8..3c8325a 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -6,6 +6,7 @@ import {Gamesystem} from "../project/game-model/gamesystems/Gamesystem"; 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"; @Component({ @@ -50,4 +51,10 @@ export class EditorComponent { } 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 2eb564e..7dbcecd 100644 --- a/src/app/editor/gamesystem-editor/gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/gamesystem-editor.component.html @@ -1,3 +1,10 @@ + + + Templatetype + None + Character + + diff --git a/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts b/src/app/editor/gamesystem-editor/gamesystem-editor.component.ts index 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..41e13f1 100644 --- a/src/app/project/game-model/gamesystems/Gamesystem.ts +++ b/src/app/project/game-model/gamesystems/Gamesystem.ts @@ -2,12 +2,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..6f4f6e8 --- /dev/null +++ b/src/app/project/game-model/gamesystems/TemplateType.ts @@ -0,0 +1,4 @@ +export enum TemplateType { + NONE, + CHARACTER +} diff --git a/testModel/characters/Astrid Hofferson.json b/testModel/characters/Astrid Hofferson.json index 0678c2b..c0c32fc 100644 --- a/testModel/characters/Astrid Hofferson.json +++ b/testModel/characters/Astrid Hofferson.json @@ -1,4 +1,5 @@ { "componentName": "Astrid Hofferson", - "componentDescription": "" + "componentDescription": "", + "characterSpecificGamesystems": [] } \ No newline at end of file diff --git a/testModel/characters/Hicks Haddock.json b/testModel/characters/Hicks Haddock.json index 1e611d7..e11ab14 100644 --- a/testModel/characters/Hicks Haddock.json +++ b/testModel/characters/Hicks Haddock.json @@ -1,4 +1,5 @@ { "componentName": "Hicks Haddock", - "componentDescription": "" + "componentDescription": "", + "characterSpecificGamesystems": [] } \ No newline at end of file diff --git a/testModel/gamesystems/Testsystem.json b/testModel/gamesystems/Testsystem.json index 654df19..71ada4d 100644 --- a/testModel/gamesystems/Testsystem.json +++ b/testModel/gamesystems/Testsystem.json @@ -33,5 +33,6 @@ "startingState": "A", "endingState": "B" } - ] + ], + "template": 0 } \ 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