alt-templatesystem-impl #29

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

View File

@ -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} 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,6 +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} from "@angular/material/expansion";
// AoT requires an exported function for factories
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
@ -150,7 +151,10 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
MatHint,
MatTooltip,
MatCard,
MatCardContent
MatCardContent,
MatCardHeader,
MatAccordion,
MatExpansionPanel
],
providers: [],
bootstrap: [AppComponent]

View File

@ -1 +1,12 @@
<p>character-editor works!</p>
<mat-card>
<mat-card-header>
<mat-card-title>Characterspecific Gamesystems</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-accordion>
<mat-expansion-panel *ngFor="let gamesystem of character!.characterSpecificGamesystems">
<mat-expansion-panel-header>{{gamesystem.componentName}}</mat-expansion-panel-header>
</mat-expansion-panel>
</mat-accordion>
</mat-card-content>
</mat-card>

View File

@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import {Component, Input} from '@angular/core';
import {Character} from "../../project/game-model/characters/Character";
import {GameModel} from "../../project/game-model/GameModel";
@Component({
selector: 'app-character-editor',
@ -7,4 +9,6 @@ import { Component } from '@angular/core';
})
export class CharacterEditorComponent {
@Input() character: Character | undefined
@Input() gameModel: GameModel | undefined
}

View File

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

View File

@ -6,6 +6,7 @@ import {Gamesystem} from "../project/game-model/gamesystems/Gamesystem";
import {State} from "../project/game-model/gamesystems/states/State";
import {Transition} from "../project/game-model/gamesystems/transitions/Transition";
import {ModelComponentType} from "../project/game-model/ModelComponentType";
import {Character} from "../project/game-model/characters/Character";
@Component({
@ -50,4 +51,10 @@ export class EditorComponent {
}
protected readonly ModelComponentType = ModelComponentType;
convertModelComponentToCharacter(modelComponent: ModelComponent) {
if(modelComponent instanceof 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);