Delete Childsystems (and correct loading childgamesystems (relation was not loaded bidirectional))
All checks were successful
E2E Testing / test (push) Successful in 1m31s
All checks were successful
E2E Testing / test (push) Successful in 1m31s
This commit is contained in:
parent
e8687ae95e
commit
b68d2a812c
@ -14,13 +14,10 @@ import {MatDialog} from "@angular/material/dialog";
|
|||||||
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
||||||
import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount";
|
import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount";
|
||||||
import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
|
import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
|
||||||
import {SimpleGamesystem} from "./game-model/gamesystems/SimpleGamesystem";
|
|
||||||
import {ProductGamesystem} from "./game-model/gamesystems/ProductGamesystem";
|
|
||||||
import {ProductState} from "./game-model/gamesystems/states/ProductState";
|
|
||||||
import {LoadModel} from "../../app/LoadModel";
|
|
||||||
import {LoadedProject} from "../../app/LoadedProject";
|
import {LoadedProject} from "../../app/LoadedProject";
|
||||||
import {ProcessLoadedProject} from "./game-model/fs/ProcessLoadedProject";
|
import {ProcessLoadedProject} from "./game-model/fs/ProcessLoadedProject";
|
||||||
import {StoreProject} from "./game-model/fs/store/StoreProject";
|
import {StoreProject} from "./game-model/fs/store/StoreProject";
|
||||||
|
import {Gamesystem} from "./game-model/gamesystems/Gamesystem";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -111,12 +108,16 @@ export class AppComponent implements OnInit{
|
|||||||
|
|
||||||
private onDeleteModelComponent() {
|
private onDeleteModelComponent() {
|
||||||
const affectedModelComponent = this.getSelectedModelComponent();
|
const affectedModelComponent = this.getSelectedModelComponent();
|
||||||
|
console.log("Affected ModelComponent: ", affectedModelComponent)
|
||||||
const dialogRef = this.dialog.open(DeleteConfirmationDialogComponent, {data: affectedModelComponent, minWidth: "400px"});
|
const dialogRef = this.dialog.open(DeleteConfirmationDialogComponent, {data: affectedModelComponent, minWidth: "400px"});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(res => {
|
dialogRef.afterClosed().subscribe(res => {
|
||||||
if(res != undefined && res) {
|
if(res != undefined && res) {
|
||||||
if(affectedModelComponent instanceof ScriptAccount) {
|
if(affectedModelComponent instanceof ScriptAccount) {
|
||||||
this.gameModel!.removeScriptAccount(affectedModelComponent);
|
this.gameModel!.removeScriptAccount(affectedModelComponent);
|
||||||
|
} else if(affectedModelComponent instanceof Gamesystem) {
|
||||||
|
this.gameModel!.removeGamesystem(affectedModelComponent);
|
||||||
|
this.gamesystemOverview!.refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -159,6 +160,12 @@ export class AppComponent implements OnInit{
|
|||||||
} else {
|
} else {
|
||||||
console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
|
console.log("[WARN] [App.component] ScriptAccountOverview is undefined")
|
||||||
}
|
}
|
||||||
|
} else if(this.openContent == ModelComponentType.GAMESYTEM){
|
||||||
|
if(this.gamesystemOverview != undefined) {
|
||||||
|
return this.gamesystemOverview!.getSelectedGamesystem()
|
||||||
|
} else {
|
||||||
|
console.log("[WARN] [App.component] GamesystemOverview is undefined")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,12 @@ export class GameModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeGamesystem(gamesystem : Gamesystem<any, any>) {
|
removeGamesystem(gamesystem : Gamesystem<any, any>) {
|
||||||
|
if(gamesystem.parentGamesystem == undefined) {
|
||||||
this._gamesystems = this._gamesystems.filter(g => g !== gamesystem);
|
this._gamesystems = this._gamesystems.filter(g => g !== gamesystem);
|
||||||
|
} else {
|
||||||
|
(gamesystem.parentGamesystem as ProductGamesystem).removeChildGamesystem(gamesystem);
|
||||||
|
console.log(gamesystem.parentGamesystem)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createScriptAccount(scriptAccountName: string) {
|
createScriptAccount(scriptAccountName: string) {
|
||||||
|
@ -50,12 +50,14 @@ export class ProcessLoadedProject {
|
|||||||
const simpleGamesystem: SimpleGamesystem = SimpleGamesystemParser.parseSimpleGamesystem(parsedJsonString, gameModel.scriptAccounts);
|
const simpleGamesystem: SimpleGamesystem = SimpleGamesystemParser.parseSimpleGamesystem(parsedJsonString, gameModel.scriptAccounts);
|
||||||
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem
|
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem
|
||||||
parentModel.addChildGamesystem(simpleGamesystem);
|
parentModel.addChildGamesystem(simpleGamesystem);
|
||||||
|
simpleGamesystem.parentGamesystem = parentModel
|
||||||
} else {
|
} else {
|
||||||
console.log("Gamesystems: ", )
|
console.log("Gamesystems: ", )
|
||||||
//ProductGamesystem
|
//ProductGamesystem
|
||||||
const productGamesystem: ProductGamesystem = ProductGamesystemParser.parseProductGamesystem(parsedJsonString);
|
const productGamesystem: ProductGamesystem = ProductGamesystemParser.parseProductGamesystem(parsedJsonString);
|
||||||
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem;
|
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem;
|
||||||
parentModel.addChildGamesystem(productGamesystem);
|
parentModel.addChildGamesystem(productGamesystem);
|
||||||
|
productGamesystem.parentGamesystem = parentModel
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Top Gamesystem
|
//Top Gamesystem
|
||||||
|
@ -7,6 +7,7 @@ export abstract class Gamesystem<S, T> extends ModelComponent{
|
|||||||
|
|
||||||
states: S[] = [];
|
states: S[] = [];
|
||||||
transitions: T[] = [];
|
transitions: T[] = [];
|
||||||
|
parentGamesystem: ProductGamesystem | undefined
|
||||||
constructor(gamesystemName: string, gamesystemDescription: string) {
|
constructor(gamesystemName: string, gamesystemDescription: string) {
|
||||||
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
|
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import {ProductStateTrainer} from "../../../../e2e/game-model/gamesystems/produc
|
|||||||
export class ProductGamesystem extends Gamesystem<ProductState, ProductTransition> {
|
export class ProductGamesystem extends Gamesystem<ProductState, ProductTransition> {
|
||||||
|
|
||||||
innerGamesystems: Gamesystem<State<any>, Transition<any>>[] = [];
|
innerGamesystems: Gamesystem<State<any>, Transition<any>>[] = [];
|
||||||
parentGamesystem: ProductGamesystem | undefined
|
|
||||||
|
|
||||||
static constructFromSimpleGamesystem(simpleGamesystem: SimpleGamesystem, gameModel: GameModel) {
|
static constructFromSimpleGamesystem(simpleGamesystem: SimpleGamesystem, gameModel: GameModel) {
|
||||||
const productGamesystem = new ProductGamesystem(simpleGamesystem.componentName, simpleGamesystem.componentDescription);
|
const productGamesystem = new ProductGamesystem(simpleGamesystem.componentName, simpleGamesystem.componentDescription);
|
||||||
@ -154,8 +153,8 @@ export class ProductGamesystem extends Gamesystem<ProductState, ProductTransitio
|
|||||||
this.innerGamesystems.push(gamesystem);
|
this.innerGamesystems.push(gamesystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private removeChildGamesystem(gamesystem: Gamesystem<State<any>, Transition<any>>) {
|
removeChildGamesystem(gamesystem: Gamesystem<State<any>, Transition<any>>) {
|
||||||
this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem != gamesystem);
|
this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem.componentName !== gamesystem.componentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
findProductStateByInnerStates(innerStates: State<any>[]) {
|
findProductStateByInnerStates(innerStates: State<any>[]) {
|
||||||
|
@ -8,8 +8,6 @@ import {ProductTransition} from "./transitions/ProductTransition";
|
|||||||
import {ProductGamesystem} from "./ProductGamesystem";
|
import {ProductGamesystem} from "./ProductGamesystem";
|
||||||
export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> {
|
export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> {
|
||||||
|
|
||||||
parentGamesystem: ProductGamesystem | undefined
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createState(label: string, description: string): SimpleState | undefined {
|
createState(label: string, description: string): SimpleState | undefined {
|
||||||
|
@ -4,15 +4,7 @@ import {State} from "../../game-model/gamesystems/states/State";
|
|||||||
import {Transition} from "../../game-model/gamesystems/transitions/Transition";
|
import {Transition} from "../../game-model/gamesystems/transitions/Transition";
|
||||||
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
import {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
||||||
import {FlatTreeControl} from "@angular/cdk/tree";
|
import {FlatTreeControl} from "@angular/cdk/tree";
|
||||||
import {
|
import {MatTreeFlatDataSource, MatTreeFlattener} from "@angular/material/tree";
|
||||||
MatTree,
|
|
||||||
MatTreeFlatDataSource,
|
|
||||||
MatTreeFlattener,
|
|
||||||
MatTreeNode, MatTreeNodeDef,
|
|
||||||
MatTreeNodePadding, MatTreeNodeToggle
|
|
||||||
} from "@angular/material/tree";
|
|
||||||
import {MatIcon} from "@angular/material/icon";
|
|
||||||
import {MatIconButton} from "@angular/material/button";
|
|
||||||
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
||||||
import {GameModel} from "../../game-model/GameModel";
|
import {GameModel} from "../../game-model/GameModel";
|
||||||
import {ElectronService} from "../../core/services";
|
import {ElectronService} from "../../core/services";
|
||||||
@ -100,6 +92,14 @@ export class GamescriptOverviewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSelectedGamesystem() {
|
||||||
|
if(this.selectedGamesystem != undefined) {
|
||||||
|
return this.gameModel!.findGamesystem(this.selectedGamesystem!.name);
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.dataSource.data = this.gameModel!.gamesystems;
|
this.dataSource.data = this.gameModel!.gamesystems;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user