From 6eff107282416dc6d18d9040cc4b11a7faaea184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Tue, 7 May 2024 14:58:27 +0200 Subject: [PATCH] Delete Inherited Itemgroups and Introduce ItemgroupCharacteristicValue --- .../items/item-editor/item-editor.component.html | 8 ++++---- .../items/item-editor/item-editor.component.scss | 3 +++ .../items/item-editor/item-editor.component.ts | 5 +++-- .../item-group-editor.component.ts | 1 - src/app/project/game-model/inventory/Item.ts | 2 ++ src/app/project/game-model/inventory/ItemGroup.ts | 1 - .../project/game-model/inventory/ItemQuality.ts | 10 ---------- .../inventory/ItemgroupCharacteristicValue.ts | 14 ++++++++++++++ 8 files changed, 26 insertions(+), 18 deletions(-) delete mode 100644 src/app/project/game-model/inventory/ItemQuality.ts create mode 100644 src/app/project/game-model/inventory/ItemgroupCharacteristicValue.ts diff --git a/src/app/editor/items/item-editor/item-editor.component.html b/src/app/editor/items/item-editor/item-editor.component.html index 003ee47..bdd70ac 100644 --- a/src/app/editor/items/item-editor/item-editor.component.html +++ b/src/app/editor/items/item-editor/item-editor.component.html @@ -9,12 +9,12 @@ {{itemgroup.componentName}} {{itemgroup.componentDescription}} - + +
+ +
-
- -
diff --git a/src/app/editor/items/item-editor/item-editor.component.scss b/src/app/editor/items/item-editor/item-editor.component.scss index e69de29..6fd81c6 100644 --- a/src/app/editor/items/item-editor/item-editor.component.scss +++ b/src/app/editor/items/item-editor/item-editor.component.scss @@ -0,0 +1,3 @@ +.panel-actions { + float: right; +} diff --git a/src/app/editor/items/item-editor/item-editor.component.ts b/src/app/editor/items/item-editor/item-editor.component.ts index 1ea90ce..553bc9a 100644 --- a/src/app/editor/items/item-editor/item-editor.component.ts +++ b/src/app/editor/items/item-editor/item-editor.component.ts @@ -32,6 +32,7 @@ export class ItemEditorComponent { }) } - - + deleteInheritedItemgroup(itemgroup: ItemGroup) { + this.item!.inheritedGroups = this.item!.inheritedGroups.filter(group => group.componentName !== itemgroup.componentName); + } } 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 ba7578f..f973998 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,7 +1,6 @@ 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"; import {Item} from "../../../project/game-model/inventory/Item"; diff --git a/src/app/project/game-model/inventory/Item.ts b/src/app/project/game-model/inventory/Item.ts index f1d055f..e978f12 100644 --- a/src/app/project/game-model/inventory/Item.ts +++ b/src/app/project/game-model/inventory/Item.ts @@ -1,9 +1,11 @@ import {ModelComponent} from "../ModelComponent"; import {ItemGroup} from "./ItemGroup"; +import {ItemgroupCharacteristicValue} from "./ItemgroupCharacteristicValue"; export class Item extends ModelComponent { inheritedGroups: ItemGroup[] = [] + itemCharacteristics: ItemgroupCharacteristicValue[] = [] addInheritedGroup(itemgroup: ItemGroup) { if(this.findItemgroupByName(itemgroup.componentName) == undefined) { diff --git a/src/app/project/game-model/inventory/ItemGroup.ts b/src/app/project/game-model/inventory/ItemGroup.ts index 4e02669..471aa9e 100644 --- a/src/app/project/game-model/inventory/ItemGroup.ts +++ b/src/app/project/game-model/inventory/ItemGroup.ts @@ -1,5 +1,4 @@ import {ModelComponent} from "../ModelComponent"; -import {ItemQuality} from "./ItemQuality"; import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic"; export abstract class ItemGroup extends ModelComponent { diff --git a/src/app/project/game-model/inventory/ItemQuality.ts b/src/app/project/game-model/inventory/ItemQuality.ts deleted file mode 100644 index fa6abe1..0000000 --- a/src/app/project/game-model/inventory/ItemQuality.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class ItemQuality { - - key: string - value: number - - constructor(key: string, value: number) { - this.key = key; - this.value = value; - } -} diff --git a/src/app/project/game-model/inventory/ItemgroupCharacteristicValue.ts b/src/app/project/game-model/inventory/ItemgroupCharacteristicValue.ts new file mode 100644 index 0000000..436d3b7 --- /dev/null +++ b/src/app/project/game-model/inventory/ItemgroupCharacteristicValue.ts @@ -0,0 +1,14 @@ +import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic"; + +export class ItemgroupCharacteristicValue { + key: ItemGroupCharacteristic + value: number + + + constructor(key: ItemGroupCharacteristic, value: number) { + this.key = key; + this.value = value; + } + + +}