alt-templatesystem-impl #29

Closed
sebastian wants to merge 23 commits from alt-templatesystem-impl into character-specific-gamesystems
6 changed files with 12 additions and 58 deletions
Showing only changes of commit 4d8fc93ef8 - Show all commits

View File

@ -29,7 +29,7 @@ import {ModelComponentEditorComponent} from "./editor/model-component-editor/mod
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog";
import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
import { MatTreeModule} from "@angular/material/tree";
import {MatTree, MatTreeModule} from "@angular/material/tree";
import {GamesystemEditorComponent} from "./editor/gamesystem-editor/gamesystem-editor.component";
import {
SimpleGamesystemEditorComponent
@ -61,7 +61,7 @@ import {
ProductStateEditorComponent
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
import {MatTooltip} from "@angular/material/tooltip";
import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card";
import {MatCard, MatCardContent, MatCardHeader} from "@angular/material/card";
import {
ScriptaccountActionEditorComponent
} from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
@ -70,15 +70,7 @@ import {
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
import {
MatAccordion,
MatExpansionPanel,
MatExpansionPanelHeader,
MatExpansionPanelTitle
} from "@angular/material/expansion";
import {
TemplateSystemEditorComponent
} from "./editor/gamesystem-editor/template-system-editor/template-system-editor.component";
import {MatAccordion, MatExpansionPanel} from "@angular/material/expansion";
// AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -102,8 +94,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
ScriptaccountActionEditorComponent,
ScriptaccountConditionEditorComponent,
CharacterOverviewComponent,
CharacterEditorComponent,
TemplateSystemEditorComponent
CharacterEditorComponent
],
imports: [
BrowserModule,
@ -162,11 +153,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
MatCard,
MatCardContent,
MatCardHeader,
MatCardTitle,
MatAccordion,
MatExpansionPanel,
MatExpansionPanelTitle,
MatExpansionPanelHeader
MatExpansionPanel
],
providers: [],
bootstrap: [AppComponent]

View File

@ -1,16 +1,12 @@
<mat-card>
<mat-card-header>
<mat-card-title>Charactersystems</mat-card-title>
<mat-card-title>Characterspecific Gamesystems</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-accordion>
<mat-expansion-panel *ngFor="let characterSystem of character!.characterSpecificGamesystems">
<mat-expansion-panel-header>
<mat-panel-title>{{characterSystem.componentName}}</mat-panel-title>
</mat-expansion-panel-header>
<app-gamesystem-editor [gamesystem]="characterSystem" [scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
<mat-expansion-panel *ngFor="let gamesystem of character!.characterSpecificGamesystems">
<mat-expansion-panel-header>{{gamesystem.componentName}}</mat-expansion-panel-header>
</mat-expansion-panel>
</mat-accordion>
<button style="width: 100%; margin-top: 10px" mat-stroked-button (click)="openTemplateEditor()">Add Charactersystem</button>
</mat-card-content>
</mat-card>

View File

@ -1,14 +1,6 @@
import {Component, Input} from '@angular/core';
import {Character} from '../../project/game-model/characters/Character';
import {MatDialog} from "@angular/material/dialog";
import {
TemplateSystemEditorComponent
} from "../gamesystem-editor/template-system-editor/template-system-editor.component";
import {Character} from "../../project/game-model/characters/Character";
import {GameModel} from "../../project/game-model/GameModel";
import {TemplateType} from "../../project/game-model/gamesystems/TemplateType";
import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem";
import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem";
import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem";
@Component({
selector: 'app-character-editor',
@ -19,25 +11,4 @@ export class CharacterEditorComponent {
@Input() character: Character | undefined
@Input() gameModel: GameModel | undefined
constructor(private dialog: MatDialog) {
}
openTemplateEditor() {
const dialogRef = this.dialog.open(TemplateSystemEditorComponent, {
minWidth: "400px",
data: this.gameModel!.getTemplateGamesystems(TemplateType.CHARACTER)
})
dialogRef.afterClosed().subscribe(res => {
if(res != undefined) {
const referenceSystem: Gamesystem<any, any> = res
if(referenceSystem instanceof SimpleGamesystem) {
this.character!.addCharacterSpecificSimpleGamesystem(referenceSystem)
} else if(referenceSystem instanceof ProductGamesystem) {
this.character!.addCharacterSpecificProductTemplateGamesystem(referenceSystem)
}
}
})
}
}

View File

@ -15,8 +15,7 @@
(onOpenGamesystemEditor)="openGameModelComponent($event)"
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
[character]="convertModelComponentToCharacter(modelComponent)"
[gameModel]="gameModel!">
[gameModel]="gameModel!" [character]="convertModelComponentToCharacter(modelComponent)">
</app-character-editor>
</mat-tab>

View File

@ -54,7 +54,7 @@ export class EditorComponent {
convertModelComponentToCharacter(modelComponent: ModelComponent) {
if(modelComponent instanceof Character) {
return modelComponent as Character
return modelComponent as Character;
}
}
}

View File

@ -4,7 +4,7 @@ import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"
export class Character extends ModelComponent{
private characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
constructor(componentName: string, componentDescription: string) {
super(componentName, componentDescription, ModelComponentType.CHARACTER);