inventory-slots #49
@ -6,6 +6,7 @@ import {MatTable, MatTableDataSource} from "@angular/material/table";
|
|||||||
import {
|
import {
|
||||||
InventoryCharacteristic
|
InventoryCharacteristic
|
||||||
} from "../../../../project/game-model/inventory/intentory-slots/InventoryCharacteristic";
|
} from "../../../../project/game-model/inventory/intentory-slots/InventoryCharacteristic";
|
||||||
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-inventory-slot-characteristic-editor',
|
selector: 'app-inventory-slot-characteristic-editor',
|
||||||
@ -23,6 +24,9 @@ export class InventorySlotCharacteristicEditorComponent implements OnInit{
|
|||||||
displayedColumns: string[] = ['increasing', 'decreasing', 'edit', 'delete']
|
displayedColumns: string[] = ['increasing', 'decreasing', 'edit', 'delete']
|
||||||
editedCharacteristic: InventoryCharacteristic | null = null;
|
editedCharacteristic: InventoryCharacteristic | null = null;
|
||||||
|
|
||||||
|
constructor(private snackbar: MatSnackBar) {
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.itemgroups.forEach(itemgroup => {
|
this.itemgroups.forEach(itemgroup => {
|
||||||
this.availableCharacteristics = this.availableCharacteristics.concat(itemgroup.itemGroupCharacteristics);
|
this.availableCharacteristics = this.availableCharacteristics.concat(itemgroup.itemGroupCharacteristics);
|
||||||
@ -38,7 +42,11 @@ export class InventorySlotCharacteristicEditorComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
finishEditing() {
|
finishEditing() {
|
||||||
|
if(this.editedCharacteristic != null && this.editedCharacteristic.isValid()) {
|
||||||
this.editedCharacteristic = null;
|
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) {
|
onSelectIncreasingCharacteristic(selectedCharacteristic: ItemGroupCharacteristic, slotCharacteristic: InventoryCharacteristic) {
|
||||||
|
Loading…
Reference in New Issue
Block a user