Automatically initialize CharacteristicValues for manually Inherited groups
All checks were successful
E2E Testing / test (push) Successful in 1m32s
All checks were successful
E2E Testing / test (push) Successful in 1m32s
This commit is contained in:
parent
34c139eecf
commit
aa6c051246
@ -29,7 +29,7 @@ export class GameModel {
|
|||||||
this.gameModelName = gameModelName;
|
this.gameModelName = gameModelName;
|
||||||
|
|
||||||
this.addAbstractItemgroup("Clothing", undefined);
|
this.addAbstractItemgroup("Clothing", undefined);
|
||||||
this.addAbstractItemgroup("Inventory", undefined);
|
this.addConcreteItemgroup("Inventory", undefined);
|
||||||
this.addConcreteItemgroup("Oberteil", GameModel.findItemgroupByName("Clothing", this.itemgroups)! as AbstractItemGroup);
|
this.addConcreteItemgroup("Oberteil", GameModel.findItemgroupByName("Clothing", this.itemgroups)! as AbstractItemGroup);
|
||||||
this.addConcreteItemgroup("Hose", GameModel.findItemgroupByName("Clothing", this.itemgroups)! as AbstractItemGroup);
|
this.addConcreteItemgroup("Hose", GameModel.findItemgroupByName("Clothing", this.itemgroups)! as AbstractItemGroup);
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ export class GameModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addConcreteItemgroup(groupName: string, parentgroup: AbstractItemGroup) {
|
addConcreteItemgroup(groupName: string, parentgroup: AbstractItemGroup | undefined) {
|
||||||
//Ensure that Itemgroup does not exist
|
//Ensure that Itemgroup does not exist
|
||||||
if(parentgroup == undefined) {
|
if(parentgroup == undefined) {
|
||||||
if(GameModel.findItemgroupByName(groupName, this.itemgroups) == undefined) {
|
if(GameModel.findItemgroupByName(groupName, this.itemgroups) == undefined) {
|
||||||
|
@ -11,6 +11,7 @@ export class AbstractItemGroup extends ItemGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected addCharacteristicValue(characteristic: ItemGroupCharacteristic): void {
|
protected addCharacteristicValue(characteristic: ItemGroupCharacteristic): void {
|
||||||
|
console.log("Abstract Characteristic Value: Do nothing (" , characteristic.characteristicName , ")")
|
||||||
//Do Nothing
|
//Do Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ export class Item extends ModelComponent {
|
|||||||
addInheritedGroup(itemgroup: ItemGroup) {
|
addInheritedGroup(itemgroup: ItemGroup) {
|
||||||
if(this.findItemgroupByName(itemgroup.componentName) == undefined) {
|
if(this.findItemgroupByName(itemgroup.componentName) == undefined) {
|
||||||
this.manuallyInheritedGroups.push(itemgroup);
|
this.manuallyInheritedGroups.push(itemgroup);
|
||||||
|
itemgroup.manuallyInheritedItems.push(this);
|
||||||
this.initializeItemCharacteristicsOfItemgroup(itemgroup);
|
this.initializeItemCharacteristicsOfItemgroup(itemgroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,6 +41,7 @@ export class Item extends ModelComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addCharacteristic(characteristic: ItemGroupCharacteristic) {
|
addCharacteristic(characteristic: ItemGroupCharacteristic) {
|
||||||
|
console.log("Add Characteristic: " , characteristic)
|
||||||
const characteristicValue = new ItemgroupCharacteristicValue(characteristic, 0);
|
const characteristicValue = new ItemgroupCharacteristicValue(characteristic, 0);
|
||||||
if(!this.isValueInitialized(characteristic)) {
|
if(!this.isValueInitialized(characteristic)) {
|
||||||
this.itemCharacteristicValues.push(characteristicValue);
|
this.itemCharacteristicValues.push(characteristicValue);
|
||||||
|
@ -12,6 +12,7 @@ export abstract class ItemGroup extends ModelComponent {
|
|||||||
addItemgroupCharacteristic(itemgroupCharacteristic: ItemGroupCharacteristic) {
|
addItemgroupCharacteristic(itemgroupCharacteristic: ItemGroupCharacteristic) {
|
||||||
this.itemGroupCharacteristics.push(itemgroupCharacteristic);
|
this.itemGroupCharacteristics.push(itemgroupCharacteristic);
|
||||||
this.addCharacteristicValueForManuallyItems(itemgroupCharacteristic);
|
this.addCharacteristicValueForManuallyItems(itemgroupCharacteristic);
|
||||||
|
console.log("[Itemgroup] Add ItemgroupCharacteristic ", itemgroupCharacteristic);
|
||||||
this.addCharacteristicValue(itemgroupCharacteristic);
|
this.addCharacteristicValue(itemgroupCharacteristic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user