Add ItemCharacteristicValue Editor and initialize ItemcharacteristicValues
Some checks failed
E2E Testing / test (push) Failing after 1m34s
Some checks failed
E2E Testing / test (push) Failing after 1m34s
This commit is contained in:
parent
6b93bf1dc5
commit
6e65cc3a6a
@ -88,6 +88,9 @@ import {ItemEditorComponent} from "./editor/items/item-editor/item-editor.compon
|
|||||||
import {
|
import {
|
||||||
ItemgroupInheritorComponent
|
ItemgroupInheritorComponent
|
||||||
} from "./editor/items/item-editor/itemgroup-inheritor/itemgroup-inheritor.component";
|
} from "./editor/items/item-editor/itemgroup-inheritor/itemgroup-inheritor.component";
|
||||||
|
import {
|
||||||
|
InheritedItemCharacteristicEditorComponent
|
||||||
|
} from "./editor/items/item-editor/inherited-item-characteristic-editor/inherited-item-characteristic-editor.component";
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||||
|
|
||||||
@ -116,7 +119,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
|
|||||||
ItemOverviewComponent,
|
ItemOverviewComponent,
|
||||||
ItemGroupEditorComponent,
|
ItemGroupEditorComponent,
|
||||||
ItemEditorComponent,
|
ItemEditorComponent,
|
||||||
ItemgroupInheritorComponent
|
ItemgroupInheritorComponent,
|
||||||
|
InheritedItemCharacteristicEditorComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<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>
|
||||||
|
<app-inherited-item-characteristic-editor [inheritedItemgroup]="itemgroup" [item]="item"></app-inherited-item-characteristic-editor>
|
||||||
<div class="panel-actions">
|
<div class="panel-actions">
|
||||||
<button mat-raised-button color="warn" [disabled]="automaticallyInheritedItemgroups.includes(itemgroup)" (click)="deleteInheritedItemgroup(itemgroup)">Delete</button>
|
<button mat-raised-button color="warn" [disabled]="automaticallyInheritedItemgroups.includes(itemgroup)" (click)="deleteInheritedItemgroup(itemgroup)">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,8 @@ export class ItemEditorComponent {
|
|||||||
@Input() item: Item | undefined
|
@Input() item: Item | undefined
|
||||||
@Input() gameModel: GameModel | undefined;
|
@Input() gameModel: GameModel | undefined;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
constructor(private dialog: MatDialog) {
|
constructor(private dialog: MatDialog) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ export class ItemGroupEditorComponent implements OnInit{
|
|||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.itemgroup!.itemGroupCharacteristics.push(new ItemGroupCharacteristic("Inventory", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."))
|
|
||||||
this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics;
|
this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ export class ItemGroupEditorComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
addItemgroupCharacteristic() {
|
addItemgroupCharacteristic() {
|
||||||
const itemgroupCharacteristic = new ItemGroupCharacteristic("", "");
|
const itemgroupCharacteristic = new ItemGroupCharacteristic("", "", this.itemgroup!);
|
||||||
this.itemgroup!.itemGroupCharacteristics.push(itemgroupCharacteristic);
|
this.itemgroup!.itemGroupCharacteristics.push(itemgroupCharacteristic);
|
||||||
this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics;
|
this.itemQualityDatasource.data = this.itemgroup!.itemGroupCharacteristics;
|
||||||
this.editedCharacteristic = itemgroupCharacteristic;
|
this.editedCharacteristic = itemgroupCharacteristic;
|
||||||
|
@ -6,5 +6,6 @@ export class AbstractItemGroup extends ItemGroup {
|
|||||||
|
|
||||||
addChildItemgroup(itemGroup: ItemGroup) {
|
addChildItemgroup(itemGroup: ItemGroup) {
|
||||||
this.children.push(itemGroup)
|
this.children.push(itemGroup)
|
||||||
|
itemGroup.parentGroup = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,27 @@
|
|||||||
import {ModelComponent} from "../ModelComponent";
|
import {ModelComponent} from "../ModelComponent";
|
||||||
import {ItemGroup} from "./ItemGroup";
|
import {ItemGroup} from "./ItemGroup";
|
||||||
import {ItemgroupCharacteristicValue} from "./ItemgroupCharacteristicValue";
|
import {ItemgroupCharacteristicValue} from "./ItemgroupCharacteristicValue";
|
||||||
|
import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic";
|
||||||
|
|
||||||
export class Item extends ModelComponent {
|
export class Item extends ModelComponent {
|
||||||
|
|
||||||
inheritedGroups: ItemGroup[] = []
|
inheritedGroups: ItemGroup[] = []
|
||||||
itemCharacteristics: ItemgroupCharacteristicValue[] = []
|
itemCharacteristicValues: ItemgroupCharacteristicValue[] = []
|
||||||
|
|
||||||
|
initializeItemCharacteristics() {
|
||||||
|
this.inheritedGroups.forEach(itemGroup => {
|
||||||
|
itemGroup.itemGroupCharacteristics.forEach(characteristic => {
|
||||||
|
const characteristicValue = new ItemgroupCharacteristicValue(characteristic, 0);
|
||||||
|
if(!this.isValueInitialized(characteristic)) {
|
||||||
|
this.itemCharacteristicValues.push(characteristicValue);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValueInitialized(characteristic: ItemGroupCharacteristic) {
|
||||||
|
return this.itemCharacteristicValues.find(value => value.key.characteristicName === characteristic.characteristicName) !== undefined
|
||||||
|
}
|
||||||
|
|
||||||
addInheritedGroup(itemgroup: ItemGroup) {
|
addInheritedGroup(itemgroup: ItemGroup) {
|
||||||
if(this.findItemgroupByName(itemgroup.componentName) == undefined) {
|
if(this.findItemgroupByName(itemgroup.componentName) == undefined) {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import {ModelComponent} from "../ModelComponent";
|
import {ModelComponent} from "../ModelComponent";
|
||||||
import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic";
|
import {ItemGroupCharacteristic} from "./ItemgroupCharacteristic";
|
||||||
|
import {AbstractItemGroup} from "./AbstractItemGroup";
|
||||||
|
|
||||||
export abstract class ItemGroup extends ModelComponent {
|
export abstract class ItemGroup extends ModelComponent {
|
||||||
|
|
||||||
itemGroupCharacteristics: ItemGroupCharacteristic[] = []
|
itemGroupCharacteristics: ItemGroupCharacteristic[] = []
|
||||||
|
parentGroup: AbstractItemGroup | undefined
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
|
import {ItemGroup} from "./ItemGroup";
|
||||||
|
|
||||||
export class ItemGroupCharacteristic {
|
export class ItemGroupCharacteristic {
|
||||||
characteristicName: string;
|
characteristicName: string;
|
||||||
characteristicDescription: string
|
characteristicDescription: string
|
||||||
|
itemgroup: ItemGroup
|
||||||
|
|
||||||
|
|
||||||
constructor(characteristicName: string, characteristicDescription: string) {
|
constructor(characteristicName: string, characteristicDescription: string, itemgroup: ItemGroup) {
|
||||||
this.characteristicName = characteristicName;
|
this.characteristicName = characteristicName;
|
||||||
this.characteristicDescription = characteristicDescription;
|
this.characteristicDescription = characteristicDescription;
|
||||||
|
this.itemgroup = itemgroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user