issue-15 #21
@ -14,13 +14,10 @@ import {MatDialog} from "@angular/material/dialog";
|
||||
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
||||
import {ScriptAccount} from "./game-model/scriptAccounts/ScriptAccount";
|
||||
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 {ProcessLoadedProject} from "./game-model/fs/ProcessLoadedProject";
|
||||
import {StoreProject} from "./game-model/fs/store/StoreProject";
|
||||
import {Gamesystem} from "./game-model/gamesystems/Gamesystem";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -111,12 +108,16 @@ export class AppComponent implements OnInit{
|
||||
|
||||
private onDeleteModelComponent() {
|
||||
const affectedModelComponent = this.getSelectedModelComponent();
|
||||
console.log("Affected ModelComponent: ", affectedModelComponent)
|
||||
const dialogRef = this.dialog.open(DeleteConfirmationDialogComponent, {data: affectedModelComponent, minWidth: "400px"});
|
||||
|
||||
dialogRef.afterClosed().subscribe(res => {
|
||||
if(res != undefined && res) {
|
||||
if(affectedModelComponent instanceof ScriptAccount) {
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
|
@ -33,7 +33,12 @@ export class GameModel {
|
||||
}
|
||||
|
||||
removeGamesystem(gamesystem : Gamesystem<any, any>) {
|
||||
if(gamesystem.parentGamesystem == undefined) {
|
||||
this._gamesystems = this._gamesystems.filter(g => g !== gamesystem);
|
||||
} else {
|
||||
(gamesystem.parentGamesystem as ProductGamesystem).removeChildGamesystem(gamesystem);
|
||||
console.log(gamesystem.parentGamesystem)
|
||||
}
|
||||
}
|
||||
|
||||
createScriptAccount(scriptAccountName: string) {
|
||||
|
@ -50,12 +50,14 @@ export class ProcessLoadedProject {
|
||||
const simpleGamesystem: SimpleGamesystem = SimpleGamesystemParser.parseSimpleGamesystem(parsedJsonString, gameModel.scriptAccounts);
|
||||
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem
|
||||
parentModel.addChildGamesystem(simpleGamesystem);
|
||||
simpleGamesystem.parentGamesystem = parentModel
|
||||
} else {
|
||||
console.log("Gamesystems: ", )
|
||||
//ProductGamesystem
|
||||
const productGamesystem: ProductGamesystem = ProductGamesystemParser.parseProductGamesystem(parsedJsonString);
|
||||
const parentModel: ProductGamesystem = gameModel.findGamesystem(recursiveLoadModel.parentLoadModelname) as ProductGamesystem;
|
||||
parentModel.addChildGamesystem(productGamesystem);
|
||||
productGamesystem.parentGamesystem = parentModel
|
||||
}
|
||||
} else {
|
||||
//Top Gamesystem
|
||||
|
@ -7,6 +7,7 @@ export abstract class Gamesystem<S, T> extends ModelComponent{
|
||||
|
||||
states: S[] = [];
|
||||
transitions: T[] = [];
|
||||
parentGamesystem: ProductGamesystem | undefined
|
||||
constructor(gamesystemName: string, gamesystemDescription: string) {
|
||||
super(gamesystemName, gamesystemDescription, ModelComponentType.GAMESYTEM);
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import {ProductStateTrainer} from "../../../../e2e/game-model/gamesystems/produc
|
||||
export class ProductGamesystem extends Gamesystem<ProductState, ProductTransition> {
|
||||
|
||||
innerGamesystems: Gamesystem<State<any>, Transition<any>>[] = [];
|
||||
parentGamesystem: ProductGamesystem | undefined
|
||||
|
||||
static constructFromSimpleGamesystem(simpleGamesystem: SimpleGamesystem, gameModel: GameModel) {
|
||||
const productGamesystem = new ProductGamesystem(simpleGamesystem.componentName, simpleGamesystem.componentDescription);
|
||||
@ -154,8 +153,8 @@ export class ProductGamesystem extends Gamesystem<ProductState, ProductTransitio
|
||||
this.innerGamesystems.push(gamesystem);
|
||||
}
|
||||
|
||||
private removeChildGamesystem(gamesystem: Gamesystem<State<any>, Transition<any>>) {
|
||||
this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem != gamesystem);
|
||||
removeChildGamesystem(gamesystem: Gamesystem<State<any>, Transition<any>>) {
|
||||
this.innerGamesystems = this.innerGamesystems.filter(childSystem => childSystem.componentName !== gamesystem.componentName);
|
||||
}
|
||||
|
||||
findProductStateByInnerStates(innerStates: State<any>[]) {
|
||||
|
@ -8,8 +8,6 @@ import {ProductTransition} from "./transitions/ProductTransition";
|
||||
import {ProductGamesystem} from "./ProductGamesystem";
|
||||
export class SimpleGamesystem extends Gamesystem<SimpleState, SimpleTransition> {
|
||||
|
||||
parentGamesystem: ProductGamesystem | 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 {ProductGamesystem} from "../../game-model/gamesystems/ProductGamesystem";
|
||||
import {FlatTreeControl} from "@angular/cdk/tree";
|
||||
import {
|
||||
MatTree,
|
||||
MatTreeFlatDataSource,
|
||||
MatTreeFlattener,
|
||||
MatTreeNode, MatTreeNodeDef,
|
||||
MatTreeNodePadding, MatTreeNodeToggle
|
||||
} from "@angular/material/tree";
|
||||
import {MatIcon} from "@angular/material/icon";
|
||||
import {MatIconButton} from "@angular/material/button";
|
||||
import {MatTreeFlatDataSource, MatTreeFlattener} from "@angular/material/tree";
|
||||
import {SimpleGamesystem} from "../../game-model/gamesystems/SimpleGamesystem";
|
||||
import {GameModel} from "../../game-model/GameModel";
|
||||
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() {
|
||||
this.dataSource.data = this.gameModel!.gamesystems;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user