From 9a51cb3a80d7b06c9d1723feadf8963cfff9a98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Thu, 11 Apr 2024 13:45:29 +0200 Subject: [PATCH] Beginning of Editor for Characterspecific Gamesystems --- src/app/app.module.ts | 8 ++++++-- .../character-editor.component.html | 13 ++++++++++++- .../character-editor/character-editor.component.ts | 6 +++++- src/app/editor/editor.component.html | 3 ++- src/app/editor/editor.component.ts | 7 +++++++ src/app/project/game-model/characters/Character.ts | 2 +- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7412843..eb7f6e2 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} 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} 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,10 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatHint, MatTooltip, MatCard, - MatCardContent + MatCardContent, + MatCardHeader, + MatAccordion, + MatExpansionPanel ], 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..1bdd02b 100644 --- a/src/app/editor/character-editor/character-editor.component.html +++ b/src/app/editor/character-editor/character-editor.component.html @@ -1 +1,12 @@ -

character-editor works!

+ + + 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 23e8438..cb49801 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 {GameModel} from "../../project/game-model/GameModel"; @Component({ selector: 'app-character-editor', @@ -7,4 +9,6 @@ import { Component } from '@angular/core'; }) export class CharacterEditorComponent { + @Input() character: Character | undefined + @Input() gameModel: GameModel | undefined } diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index b351774..e21bbcd 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -14,7 +14,8 @@ [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..6136245 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/project/game-model/characters/Character.ts b/src/app/project/game-model/characters/Character.ts index 9934a79..d1a1ed2 100644 --- a/src/app/project/game-model/characters/Character.ts +++ b/src/app/project/game-model/characters/Character.ts @@ -4,7 +4,7 @@ import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem" export class Character extends ModelComponent{ - private characterSpecificGamesystems: SimpleTemplateGamesystem[] = [] + characterSpecificGamesystems: SimpleTemplateGamesystem[] = [] constructor(componentName: string, componentDescription: string) { super(componentName, componentDescription, ModelComponentType.CHARACTER);