Delete existing Items
All checks were successful
E2E Testing / test (push) Successful in 1m33s

This commit is contained in:
Sebastian Böckelmann 2024-04-20 17:12:03 +02:00
parent 3b00a46c25
commit 11ad91f573
3 changed files with 16 additions and 6 deletions

View File

@ -29,6 +29,10 @@ import {TemplateTypeUtilities} from "./project/game-model/templates/TemplateType
import {SimpleTemplateGamesystem} from "./project/game-model/templates/simpleGamesystem/SimpleTemplateGamesystem";
import {ItemSerializer} from "./project/serializer/ItemSerializer";
import {ItemParser} from "./project/parser/ItemParser";
import {
InventoryItemOverviewComponent
} from "./side-overviews/inventory-item-overview/inventory-item-overview.component";
import {Item} from "./project/game-model/inventory/Item";
@Component({
selector: 'app-root',
@ -43,6 +47,7 @@ export class AppComponent implements OnInit{
@ViewChild('scriptAccountOverview') scriptAccountOverview: ScriptAccountOverviewComponent | undefined
@ViewChild('gamesystemOverview') gamesystemOverview: GamescriptOverviewComponent | undefined
@ViewChild('characterOverview') characterOverview: CharacterOverviewComponent | undefined
@ViewChild('itemOverview') itemOverview: InventoryItemOverviewComponent | undefined
gameModel: GameModel | undefined
@ -128,6 +133,8 @@ export class AppComponent implements OnInit{
this.gamesystemOverview!.refresh()
} else if(affectedModelComponent instanceof Character) {
this.gameModel!.removeCharacter(affectedModelComponent)
} else if(affectedModelComponent instanceof Item) {
this.gameModel!.removeItem(affectedModelComponent);
}
}
})
@ -208,6 +215,13 @@ export class AppComponent implements OnInit{
} else {
console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
}
} else if(this.openContent == ModelComponentType.ITEM) {
if(this.itemOverview != undefined) {
console.log("Test")
return this.itemOverview.selectedItem;
} else {
console.log("[WARN] [App.component] ItemOverview is undefined")
}
}
return undefined;
}

View File

@ -166,7 +166,7 @@ export class GameModel {
}
removeItem(item: Item) {
this.inventoryItems = this.inventoryItems.filter(i => i.componentName === item.componentName)
this.inventoryItems = this.inventoryItems.filter(i => i.componentName !== item.componentName)
}
findGamesystem(gamesystemName: string) {

View File

@ -25,10 +25,6 @@ export class InventoryItemOverviewComponent {
selectItem(item: Item) {
if(this.selectedItem != undefined && this.selectedItem!.componentName === item.componentName) {
this.selectedItem = undefined
} else {
this.selectedItem = item
}
}
}