inventory-slots #49

Merged
sebastian merged 13 commits from inventory-slots into main 2024-05-11 15:36:10 +02:00
Showing only changes of commit bd243fc080 - Show all commits

View File

@ -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) {