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 bdd70ac..e3b6fc9 100644 --- a/src/app/editor/items/item-editor/item-editor.component.html +++ b/src/app/editor/items/item-editor/item-editor.component.html @@ -9,9 +9,9 @@ {{itemgroup.componentName}} {{itemgroup.componentDescription}} - +
- +
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 553bc9a..d5a13fc 100644 --- a/src/app/editor/items/item-editor/item-editor.component.ts +++ b/src/app/editor/items/item-editor/item-editor.component.ts @@ -4,6 +4,7 @@ import {ItemGroup} from "../../../project/game-model/inventory/ItemGroup"; import {GameModel} from "../../../project/game-model/GameModel"; import {MatDialog} from "@angular/material/dialog"; import {ItemgroupInheritorComponent} from "./itemgroup-inheritor/itemgroup-inheritor.component"; +import {ItemgroupUtilities} from "../../../project/game-model/utils/ItemgroupUtilities"; @Component({ selector: 'app-item-editor', @@ -35,4 +36,8 @@ export class ItemEditorComponent { deleteInheritedItemgroup(itemgroup: ItemGroup) { this.item!.inheritedGroups = this.item!.inheritedGroups.filter(group => group.componentName !== itemgroup.componentName); } + + get automaticallyInheritedItemgroups() { + return ItemgroupUtilities.findItemgroupPathToItem(this.item!.componentName, this.gameModel!.itemgroups); + } } diff --git a/src/app/project/game-model/utils/ItemgroupUtilities.ts b/src/app/project/game-model/utils/ItemgroupUtilities.ts index cbd7745..25c9533 100644 --- a/src/app/project/game-model/utils/ItemgroupUtilities.ts +++ b/src/app/project/game-model/utils/ItemgroupUtilities.ts @@ -1,9 +1,20 @@ import {GameModel} from "../GameModel"; import {ItemGroup} from "../inventory/ItemGroup"; import {AbstractItemGroup} from "../inventory/AbstractItemGroup"; +import {ConcreteItemGroup} from "../inventory/ConcreteItemGroup"; export class ItemgroupUtilities { + public static findItemgroupPathToItem(searchedItemName: string, itemgroups: ItemGroup[]): ItemGroup[] { + for(let i=0; i 0) { + return found_path; + } + } + return []; + } + public static findItemgroupPathToItemgroup(searchedItemgroupName: string, itemgroups: ItemGroup[]): ItemGroup[] { for(let i=0; i item.componentName === searchedItemName) + if(searchedItem != undefined) { + return path; + } + } else if(root instanceof AbstractItemGroup) { + for(let i=0; i 0) { + return found_path; + } + } + } + return []; + } + }