diff --git a/src/app/app.module.ts b/src/app/app.module.ts index da60456..4675df6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -110,7 +110,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl CharacterEditorComponent, TemplateSpecificatorComponent, StateInitialCellComponent, - ItemOverviewComponent + ItemOverviewComponent, + ItemGroupEditorComponent ], imports: [ BrowserModule, @@ -173,8 +174,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl MatExpansionPanel, MatExpansionPanelTitle, MatCardTitle, - MatExpansionPanelHeader, - ItemGroupEditorComponent + MatExpansionPanelHeader ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index 985647c..669de3c 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -20,6 +20,6 @@ > - + diff --git a/src/app/editor/editor.component.ts b/src/app/editor/editor.component.ts index 50f44b9..9f5576d 100644 --- a/src/app/editor/editor.component.ts +++ b/src/app/editor/editor.component.ts @@ -7,6 +7,7 @@ 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"; +import {ItemGroup} from "../project/game-model/inventory/ItemGroup"; @Component({ @@ -57,4 +58,11 @@ export class EditorComponent { return modelComponent as Character return undefined; } + + convertModelComponentToItemGroup(modelComponent: ModelComponent) { + if(modelComponent instanceof ItemGroup) { + return modelComponent as ItemGroup + } + return undefined; + } } diff --git a/src/app/editor/items/item-group-editor/item-group-editor.component.html b/src/app/editor/items/item-group-editor/item-group-editor.component.html index a42a279..155fd28 100644 --- a/src/app/editor/items/item-group-editor/item-group-editor.component.html +++ b/src/app/editor/items/item-group-editor/item-group-editor.component.html @@ -1 +1,21 @@ -

item-group-editor works!

+ + + + + + + + + + + + + + + + + + + + +
Characteristic {{element.characteristicName}} Description {{element.characteristicDescription}}
diff --git a/src/app/editor/items/item-group-editor/item-group-editor.component.scss b/src/app/editor/items/item-group-editor/item-group-editor.component.scss index e69de29..906202f 100644 --- a/src/app/editor/items/item-group-editor/item-group-editor.component.scss +++ b/src/app/editor/items/item-group-editor/item-group-editor.component.scss @@ -0,0 +1,3 @@ +.mat-column-edit, .mat-column-delete { + width: 32px; +} diff --git a/src/app/editor/items/item-group-editor/item-group-editor.component.ts b/src/app/editor/items/item-group-editor/item-group-editor.component.ts index ecccb74..201ec33 100644 --- a/src/app/editor/items/item-group-editor/item-group-editor.component.ts +++ b/src/app/editor/items/item-group-editor/item-group-editor.component.ts @@ -1,12 +1,29 @@ -import { Component } from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; +import {ItemGroup} from "../../../project/game-model/inventory/ItemGroup"; +import {MatColumnDef, MatTable, MatTableDataSource} from "@angular/material/table"; +import {ItemQuality} from "../../../project/game-model/inventory/ItemQuality"; +import {ItemGroupCharacteristic} from "../../../project/game-model/inventory/ItemgroupCharacteristic"; @Component({ selector: 'app-item-group-editor', - standalone: true, - imports: [], templateUrl: './item-group-editor.component.html', styleUrl: './item-group-editor.component.scss' }) -export class ItemGroupEditorComponent { +export class ItemGroupEditorComponent implements OnInit{ + @Input() itemgroup: ItemGroup | undefined + + itemQualityDatasource: MatTableDataSource = new MatTableDataSource(); + displayedColumns: string[] = ["Characteristic", "Description", 'edit', 'delete'] + + + ngOnInit(): void { + this.itemgroup!.itemGroupCharacteristics.push(new ItemGroupCharacteristic("Inventory", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.")) + this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics; + } + + deleteItemgroupCharacteristic(characteristic: ItemGroupCharacteristic) { + this.itemgroup!.itemGroupCharacteristics = this.itemgroup!.itemGroupCharacteristics.filter(igc => igc.characteristicName !== characteristic.characteristicName); + this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics; + } } diff --git a/src/app/project/game-model/inventory/ItemGroup.ts b/src/app/project/game-model/inventory/ItemGroup.ts index ab21f62..4e02669 100644 --- a/src/app/project/game-model/inventory/ItemGroup.ts +++ b/src/app/project/game-model/inventory/ItemGroup.ts @@ -1,7 +1,9 @@ import {ModelComponent} from "../ModelComponent"; import {ItemQuality} from "./ItemQuality"; +import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic"; export abstract class ItemGroup extends ModelComponent { - requiredItemQualities: ItemQuality[] = [] + itemGroupCharacteristics: ItemGroupCharacteristic[] = [] + } diff --git a/src/app/project/game-model/inventory/ItemgroupCharacteristic.ts b/src/app/project/game-model/inventory/ItemgroupCharacteristic.ts new file mode 100644 index 0000000..11fdda6 --- /dev/null +++ b/src/app/project/game-model/inventory/ItemgroupCharacteristic.ts @@ -0,0 +1,10 @@ +export class ItemGroupCharacteristic { + characteristicName: string; + characteristicDescription: string + + + constructor(characteristicName: string, characteristicDescription: string) { + this.characteristicName = characteristicName; + this.characteristicDescription = characteristicDescription; + } +}