Implement basic version of characters #32
@ -71,6 +71,12 @@ function createWindow(): BrowserWindow {
|
|||||||
click: () => {
|
click: () => {
|
||||||
win!.webContents.send('context-menu', "new-scriptaccount");
|
win!.webContents.send('context-menu', "new-scriptaccount");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Character",
|
||||||
|
click: () => {
|
||||||
|
win!.webContents.send('context-menu', "new-character");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ export class AppComponent implements OnInit{
|
|||||||
switch (modelComponentType) {
|
switch (modelComponentType) {
|
||||||
case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break
|
case ModelComponentType.SCRIPTACCOUNT: this.onCreateNewScriptAccount(); break
|
||||||
case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(); break
|
case ModelComponentType.GAMESYTEM: this.onCreateNewGamesystem(); break
|
||||||
|
case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +147,15 @@ export class AppComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onCreateNewCharacter() {
|
||||||
|
const createdCharacter = this.gameModel!.createCharacter("New Character")
|
||||||
|
if(createdCharacter != undefined) {
|
||||||
|
this.editor?.openGameModelComponent(createdCharacter);
|
||||||
|
} else {
|
||||||
|
console.log("[DEBUG] [App-Component] ScriptAccount could not be created (Name not unique)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@ -239,4 +249,6 @@ export class AppComponent implements OnInit{
|
|||||||
this.gamesystemOverview.resetSelectedGamesystem()
|
this.gamesystemOverview.resetSelectedGamesystem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ export class GameModel {
|
|||||||
|
|
||||||
constructor(gameModelName: string) {
|
constructor(gameModelName: string) {
|
||||||
this.gameModelName = gameModelName;
|
this.gameModelName = gameModelName;
|
||||||
this.characters.push(new Character("Astrid Hofferson", "", ModelComponentType.CHARACTER))
|
this.characters.push(new Character("Astrid Hofferson", ""))
|
||||||
this.characters.push(new Character("Hicks Haddock", "", ModelComponentType.CHARACTER))
|
this.characters.push(new Character("Hicks Haddock", ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
addGamesystem(gamesystem: Gamesystem<any, any>) {
|
addGamesystem(gamesystem: Gamesystem<any, any>) {
|
||||||
@ -69,6 +69,16 @@ export class GameModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createCharacter(characterName: string) {
|
||||||
|
const searchedCharacter = this.characters.find(character => character.componentName === characterName);
|
||||||
|
if(searchedCharacter == undefined) {
|
||||||
|
const character = new Character(characterName, "");
|
||||||
|
this.characters.push(character)
|
||||||
|
return character
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
removeScriptAccount(scriptAccount: ScriptAccount) {
|
removeScriptAccount(scriptAccount: ScriptAccount) {
|
||||||
if(scriptAccount != undefined) {
|
if(scriptAccount != undefined) {
|
||||||
this.scriptAccounts = this.scriptAccounts.filter(s => s != scriptAccount);
|
this.scriptAccounts = this.scriptAccounts.filter(s => s != scriptAccount);
|
||||||
|
@ -3,7 +3,7 @@ import {ModelComponentType} from "../ModelComponentType";
|
|||||||
|
|
||||||
export class Character extends ModelComponent{
|
export class Character extends ModelComponent{
|
||||||
|
|
||||||
constructor(componentName: string, componentDescription: string, type: ModelComponentType) {
|
constructor(componentName: string, componentDescription: string) {
|
||||||
super(componentName, componentDescription, type);
|
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user