Create Characterspecific Systems and open their editor correctly
All checks were successful
E2E Testing / test (push) Successful in 1m50s
All checks were successful
E2E Testing / test (push) Successful in 1m50s
This commit is contained in:
parent
010adc9136
commit
312a684a17
17
app/main.ts
17
app/main.ts
@ -64,9 +64,20 @@ function createWindow(): BrowserWindow {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "Gamesystem",
|
label: "Gamesystem",
|
||||||
click: () => {
|
submenu: [
|
||||||
win!.webContents.send('context-menu', "new-gamesystem");
|
{
|
||||||
}
|
label: "Normal",
|
||||||
|
click: () => {
|
||||||
|
win!.webContents.send('context-menu', "new-gamesystem-normal");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Characterspecific",
|
||||||
|
click: () => {
|
||||||
|
win!.webContents.send('context-menu', "new-gamesystem-character");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "ScriptAccount",
|
label: "ScriptAccount",
|
||||||
|
@ -24,6 +24,8 @@ import {Character} from "./project/game-model/characters/Character";
|
|||||||
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
||||||
import {CharacterSerializer} from "./project/serializer/CharacterSerializer";
|
import {CharacterSerializer} from "./project/serializer/CharacterSerializer";
|
||||||
import {CharacterParser} from "./project/parser/characterParser/CharacterParser";
|
import {CharacterParser} from "./project/parser/characterParser/CharacterParser";
|
||||||
|
import {TemplateType} from "./project/game-model/TemplateType";
|
||||||
|
import {TemplateTypeUtilities} from "./project/game-model/TemplateTypeUtilities";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -76,8 +78,13 @@ export class AppComponent implements OnInit{
|
|||||||
} else if(message.startsWith("new")) {
|
} else if(message.startsWith("new")) {
|
||||||
const splittedMessage = message.split("-");
|
const splittedMessage = message.split("-");
|
||||||
const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]);
|
const modelComponentType = ModelComponentTypeUtillities.fromString(splittedMessage[1]);
|
||||||
|
let templateType: TemplateType = TemplateType.NORMAL
|
||||||
|
if(splittedMessage.length > 2) {
|
||||||
|
templateType = TemplateTypeUtilities.fromString(splittedMessage[2]);
|
||||||
|
}
|
||||||
|
|
||||||
if(modelComponentType != undefined) {
|
if(modelComponentType != undefined) {
|
||||||
this.onCreateModelComponent(modelComponentType);
|
this.onCreateModelComponent(modelComponentType, templateType);
|
||||||
} else {
|
} else {
|
||||||
console.log("[ERROR] [App-Component] Unknown Context-Menu Command!")
|
console.log("[ERROR] [App-Component] Unknown Context-Menu Command!")
|
||||||
}
|
}
|
||||||
@ -127,10 +134,10 @@ export class AppComponent implements OnInit{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private onCreateModelComponent(modelComponentType: ModelComponentType) {
|
private onCreateModelComponent(modelComponentType: ModelComponentType, templateType: TemplateType) {
|
||||||
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(templateType); break
|
||||||
case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
|
case ModelComponentType.CHARACTER: this.onCreateNewCharacter(); break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,7 +151,7 @@ export class AppComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onCreateNewGamesystem() {
|
private onCreateNewGamesystem(templateType: TemplateType) {
|
||||||
let parentGamesystemName = undefined
|
let parentGamesystemName = undefined
|
||||||
if(this.openContent != ModelComponentType.GAMESYTEM) {
|
if(this.openContent != ModelComponentType.GAMESYTEM) {
|
||||||
this.openGamesystemsOverview();
|
this.openGamesystemsOverview();
|
||||||
@ -153,7 +160,7 @@ export class AppComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const createdGamesystem = this.gameModel!.createGamesystem("New Gamesystem", parentGamesystemName);
|
const createdGamesystem = this.gameModel!.createGamesystem("New Gamesystem "+ templateType, parentGamesystemName, templateType);
|
||||||
if(createdGamesystem != undefined) {
|
if(createdGamesystem != undefined) {
|
||||||
this.gamesystemOverview!.refresh();
|
this.gamesystemOverview!.refresh();
|
||||||
this.editor?.openGameModelComponent(createdGamesystem);
|
this.editor?.openGameModelComponent(createdGamesystem);
|
||||||
|
@ -5,6 +5,7 @@ import { Transition } from '../../project/game-model/gamesystems/transitions/Tra
|
|||||||
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
|
||||||
|
import {SimpleTemplateGamesystem} from "../../project/game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gamesystem-editor',
|
selector: 'app-gamesystem-editor',
|
||||||
@ -22,11 +23,11 @@ export class GamesystemEditorComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
isSimpleGamesystem() {
|
isSimpleGamesystem() {
|
||||||
return this.gamesystem instanceof SimpleGamesystem;
|
return this.gamesystem instanceof SimpleGamesystem || this.gamesystem instanceof SimpleTemplateGamesystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertGamesystemToSimpleGamesystem() {
|
convertGamesystemToSimpleGamesystem() {
|
||||||
if(this.gamesystem instanceof SimpleGamesystem) {
|
if(!(this.gamesystem instanceof ProductGamesystem)) {
|
||||||
return this.gamesystem as SimpleGamesystem;
|
return this.gamesystem as SimpleGamesystem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {MatTableDataSource} from "@angular/material/table";
|
import {MatTableDataSource} from "@angular/material/table";
|
||||||
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
|
||||||
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||||
|
import {SimpleTemplateGamesystem} from "../../../project/game-model/gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-simple-gamesystem-editor',
|
selector: 'app-simple-gamesystem-editor',
|
||||||
templateUrl: './simple-gamesystem-editor.component.html',
|
templateUrl: './simple-gamesystem-editor.component.html',
|
||||||
styleUrl: './simple-gamesystem-editor.component.scss'
|
styleUrl: './simple-gamesystem-editor.component.scss'
|
||||||
})
|
})
|
||||||
export class SimpleGamesystemEditorComponent {
|
export class SimpleGamesystemEditorComponent implements OnInit{
|
||||||
|
|
||||||
@Input() simpleGamesystem: SimpleGamesystem | undefined
|
@Input() simpleGamesystem: SimpleGamesystem | SimpleTemplateGamesystem<any> | undefined
|
||||||
@Input() scriptAccunts: ScriptAccount[] = []
|
@Input() scriptAccunts: ScriptAccount[] = []
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log("SimpleGamesystem: ", this.simpleGamesystem)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ import {State} from "./gamesystems/states/State";
|
|||||||
import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "./gamesystems/ProductGamesystem";
|
||||||
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "./gamesystems/SimpleGamesystem";
|
||||||
import {Character} from "./characters/Character";
|
import {Character} from "./characters/Character";
|
||||||
import {ModelComponentType} from "./ModelComponentType";
|
import {TemplateType} from "./TemplateType";
|
||||||
|
import {SimpleTemplateGamesystem} from "./gamesystems/SimpleTemplateGamesystem";
|
||||||
|
|
||||||
export class GameModel {
|
export class GameModel {
|
||||||
gameModelName: string
|
gameModelName: string
|
||||||
@ -45,9 +46,14 @@ export class GameModel {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined) {
|
createGamesystem(gamesystemName: string, parentGamesystemName: string | undefined, templateType: TemplateType) {
|
||||||
if(gamesystemName != undefined && this.findGamesystem(gamesystemName) == undefined) {
|
if(gamesystemName != undefined && this.findGamesystem(gamesystemName) == undefined) {
|
||||||
const simpleGamesystem = new SimpleGamesystem(gamesystemName, "");
|
let simpleGamesystem = new SimpleGamesystem(gamesystemName, "");
|
||||||
|
if(templateType == TemplateType.CHARACTER) {
|
||||||
|
simpleGamesystem = new SimpleTemplateGamesystem<Character>(gamesystemName, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(parentGamesystemName != undefined) {
|
if(parentGamesystemName != undefined) {
|
||||||
const parentGamesystem = this.findGamesystem(parentGamesystemName);
|
const parentGamesystem = this.findGamesystem(parentGamesystemName);
|
||||||
if(parentGamesystem instanceof SimpleGamesystem) {
|
if(parentGamesystem instanceof SimpleGamesystem) {
|
||||||
|
3
src/app/project/game-model/TemplateType.ts
Normal file
3
src/app/project/game-model/TemplateType.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export enum TemplateType {
|
||||||
|
NORMAL, CHARACTER
|
||||||
|
}
|
11
src/app/project/game-model/TemplateTypeUtilities.ts
Normal file
11
src/app/project/game-model/TemplateTypeUtilities.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import {TemplateType} from "./TemplateType";
|
||||||
|
|
||||||
|
export class TemplateTypeUtilities {
|
||||||
|
static fromString(value: string) {
|
||||||
|
if(value === 'character') {
|
||||||
|
return TemplateType.CHARACTER
|
||||||
|
} else {
|
||||||
|
return TemplateType.NORMAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import {Gamesystem} from "./Gamesystem";
|
|||||||
import {SimpleTransition} from "./transitions/SimpleTransition";
|
import {SimpleTransition} from "./transitions/SimpleTransition";
|
||||||
import {SimpleState} from "./states/SimpleState";
|
import {SimpleState} from "./states/SimpleState";
|
||||||
import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition";
|
import {SimpleTemplateTransition} from "./transitions/SimpleTemplateTransition";
|
||||||
|
import {TemplateType} from "../TemplateType";
|
||||||
|
|
||||||
export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> {
|
export class SimpleTemplateGamesystem<ReferenceType> extends Gamesystem<SimpleTemplateState<ReferenceType>, SimpleTemplateTransition<ReferenceType>> {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user