inventory-items-2 #44

Closed
sebastian wants to merge 32 commits from inventory-items-2 into inventory
8 changed files with 26 additions and 18 deletions
Showing only changes of commit 6eff107282 - Show all commits

View File

@ -9,12 +9,12 @@
<mat-panel-title>{{itemgroup.componentName}}</mat-panel-title> <mat-panel-title>{{itemgroup.componentName}}</mat-panel-title>
<mat-panel-description>{{itemgroup.componentDescription}}</mat-panel-description> <mat-panel-description>{{itemgroup.componentDescription}}</mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div class="panel-actions">
<button mat-raised-button color="warn" (click)="deleteInheritedItemgroup(itemgroup)">Delete</button>
</div>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
<div>
</div>
<button mat-stroked-button style="width: 100%" (click)="onAddNewInheritedItemgroup()">Add Itemgroup</button> <button mat-stroked-button style="width: 100%" (click)="onAddNewInheritedItemgroup()">Add Itemgroup</button>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -0,0 +1,3 @@
.panel-actions {
float: right;
}

View File

@ -32,6 +32,7 @@ export class ItemEditorComponent {
}) })
} }
deleteInheritedItemgroup(itemgroup: ItemGroup) {
this.item!.inheritedGroups = this.item!.inheritedGroups.filter(group => group.componentName !== itemgroup.componentName);
}
} }

View File

@ -1,7 +1,6 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import {ItemGroup} from "../../../project/game-model/inventory/ItemGroup"; import {ItemGroup} from "../../../project/game-model/inventory/ItemGroup";
import {MatColumnDef, MatTable, MatTableDataSource} from "@angular/material/table"; import {MatColumnDef, MatTable, MatTableDataSource} from "@angular/material/table";
import {ItemQuality} from "../../../project/game-model/inventory/ItemQuality";
import {ItemGroupCharacteristic} from "../../../project/game-model/inventory/ItemgroupCharacteristic"; import {ItemGroupCharacteristic} from "../../../project/game-model/inventory/ItemgroupCharacteristic";
import {Item} from "../../../project/game-model/inventory/Item"; import {Item} from "../../../project/game-model/inventory/Item";

View File

@ -1,9 +1,11 @@
import {ModelComponent} from "../ModelComponent"; import {ModelComponent} from "../ModelComponent";
import {ItemGroup} from "./ItemGroup"; import {ItemGroup} from "./ItemGroup";
import {ItemgroupCharacteristicValue} from "./ItemgroupCharacteristicValue";
export class Item extends ModelComponent { export class Item extends ModelComponent {
inheritedGroups: ItemGroup[] = [] inheritedGroups: ItemGroup[] = []
itemCharacteristics: ItemgroupCharacteristicValue[] = []
addInheritedGroup(itemgroup: ItemGroup) { addInheritedGroup(itemgroup: ItemGroup) {
if(this.findItemgroupByName(itemgroup.componentName) == undefined) { if(this.findItemgroupByName(itemgroup.componentName) == undefined) {

View File

@ -1,5 +1,4 @@
import {ModelComponent} from "../ModelComponent"; import {ModelComponent} from "../ModelComponent";
import {ItemQuality} from "./ItemQuality";
import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic"; import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic";
export abstract class ItemGroup extends ModelComponent { export abstract class ItemGroup extends ModelComponent {

View File

@ -1,10 +0,0 @@
export class ItemQuality {
key: string
value: number
constructor(key: string, value: number) {
this.key = key;
this.value = value;
}
}

View File

@ -0,0 +1,14 @@
import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic";
export class ItemgroupCharacteristicValue {
key: ItemGroupCharacteristic
value: number
constructor(key: ItemGroupCharacteristic, value: number) {
this.key = key;
this.value = value;
}
}