Create New Items
All checks were successful
E2E Testing / test (push) Successful in 1m36s

This commit is contained in:
Sebastian Böckelmann 2024-04-20 17:06:26 +02:00
parent a3d5846ec1
commit 3b00a46c25
4 changed files with 16 additions and 7 deletions

View File

@ -97,6 +97,12 @@ function createWindow(): BrowserWindow {
click: () => { click: () => {
win!.webContents.send('context-menu', "new-character"); win!.webContents.send('context-menu', "new-character");
} }
},
{
label: 'Item',
click: () => {
win!.webContents.send('context-menu', "new-item");
}
} }
] ]

View File

@ -138,6 +138,7 @@ export class AppComponent implements OnInit{
case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break
case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(templateType); break case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(templateType); break
case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
case ModelComponentType.ITEM: this.onCreateNewItem(); break
} }
} }
@ -181,6 +182,13 @@ export class AppComponent implements OnInit{
} }
} }
private onCreateNewItem() {
const createdItem = this.gameModel!.createInventoryItem("New Item");
if(createdItem != undefined) {
this.editor?.openGameModelComponent(createdItem);
}
}
private getSelectedModelComponent(): ModelComponent | undefined { private getSelectedModelComponent(): ModelComponent | undefined {
if(this.openContent == ModelComponentType.SCRIPTACCOUNT) { if(this.openContent == ModelComponentType.SCRIPTACCOUNT) {
if(this.scriptAccountOverview != undefined) { if(this.scriptAccountOverview != undefined) {

View File

@ -107,7 +107,9 @@ export class GameModel {
if(itemName != undefined) { if(itemName != undefined) {
const item = new Item(itemName, "", ModelComponentType.ITEM); const item = new Item(itemName, "", ModelComponentType.ITEM);
this.inventoryItems.push(item); this.inventoryItems.push(item);
return item;
} }
return undefined;
} }
createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined, templateType: TemplateType | undefined) { createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined, templateType: TemplateType | undefined) {

View File

@ -13,13 +13,6 @@ export class Item extends ModelComponent {
constructor(componentName: string, componentDescription: string, type: ModelComponentType) { constructor(componentName: string, componentDescription: string, type: ModelComponentType) {
super(componentName, componentDescription, type); super(componentName, componentDescription, type);
this.itemProperties.push(new ItemProperty("Weight", "Some Weights", 10))
this.possible_qualities.push(new ItemQuality(0.25))
this.possible_qualities.push(new ItemQuality(0.50))
this.possible_qualities.push(new ItemQuality(0.75))
this.possible_qualities.push(new ItemQuality(1.00))
this.addPerQualityProperty(new ItemPropertyDescription("Price", "Price to buy item"))
} }
removePerQualityProperty(qualityProperty: ItemPropertyDescription) { removePerQualityProperty(qualityProperty: ItemPropertyDescription) {