diff --git a/src/app/editor/character-editor/inventory-slot-editor/inventory-slot-characteristic-editor/inventory-slot-characteristic-editor.component.ts b/src/app/editor/character-editor/inventory-slot-editor/inventory-slot-characteristic-editor/inventory-slot-characteristic-editor.component.ts index 12ed5b4..ce6640e 100644 --- a/src/app/editor/character-editor/inventory-slot-editor/inventory-slot-characteristic-editor/inventory-slot-characteristic-editor.component.ts +++ b/src/app/editor/character-editor/inventory-slot-editor/inventory-slot-characteristic-editor/inventory-slot-characteristic-editor.component.ts @@ -6,6 +6,7 @@ import {MatTable, MatTableDataSource} from "@angular/material/table"; import { InventoryCharacteristic } from "../../../../project/game-model/inventory/intentory-slots/InventoryCharacteristic"; +import {MatSnackBar} from "@angular/material/snack-bar"; @Component({ selector: 'app-inventory-slot-characteristic-editor', @@ -23,6 +24,9 @@ export class InventorySlotCharacteristicEditorComponent implements OnInit{ displayedColumns: string[] = ['increasing', 'decreasing', 'edit', 'delete'] editedCharacteristic: InventoryCharacteristic | null = null; + constructor(private snackbar: MatSnackBar) { + } + ngOnInit() { this.itemgroups.forEach(itemgroup => { this.availableCharacteristics = this.availableCharacteristics.concat(itemgroup.itemGroupCharacteristics); @@ -38,7 +42,11 @@ export class InventorySlotCharacteristicEditorComponent implements OnInit{ } finishEditing() { - this.editedCharacteristic = null; + if(this.editedCharacteristic != null && this.editedCharacteristic.isValid()) { + this.editedCharacteristic = null; + } else if(this.editedCharacteristic != null) { + this.snackbar.open("Please select a valid increasing and decreasing Characterstic", "", {duration: 2000}); + } } onSelectIncreasingCharacteristic(selectedCharacteristic: ItemGroupCharacteristic, slotCharacteristic: InventoryCharacteristic) {