35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
|
import {GameModel} from "../../project/game-model/GameModel";
|
|
import {Item} from "../../project/game-model/inventory/Item";
|
|
import {MatActionList, MatListItem} from "@angular/material/list";
|
|
import {MatIcon} from "@angular/material/icon";
|
|
import {NgForOf} from "@angular/common";
|
|
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
|
|
|
@Component({
|
|
selector: 'app-inventory-item-overview',
|
|
templateUrl: './inventory-item-overview.component.html',
|
|
styleUrl: './inventory-item-overview.component.scss'
|
|
})
|
|
export class InventoryItemOverviewComponent {
|
|
|
|
@Input() gameModel: GameModel | undefined;
|
|
@Output() openItemEditor = new EventEmitter<Item>();
|
|
|
|
|
|
selectedItem: Item | undefined
|
|
|
|
onOpenItemEditor(item: Item) {
|
|
this.openItemEditor.emit(item)
|
|
}
|
|
|
|
|
|
selectItem(item: Item) {
|
|
if(this.selectedItem != undefined && this.selectedItem!.componentName === item.componentName) {
|
|
this.selectedItem = undefined
|
|
} else {
|
|
this.selectedItem = item
|
|
}
|
|
}
|
|
}
|