Beginning of Editor for Characterspecific Gamesystems
This commit is contained in:
parent
244222bc5b
commit
4d8fc93ef8
@ -29,7 +29,7 @@ import {ModelComponentEditorComponent} from "./editor/model-component-editor/mod
|
|||||||
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
import {DeleteConfirmationDialogComponent} from "./delete-confirmation-dialog/delete-confirmation-dialog.component";
|
||||||
import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog";
|
import {MatDialogActions, MatDialogContent, MatDialogTitle} from "@angular/material/dialog";
|
||||||
import {GamescriptOverviewComponent} from "./side-overviews/gamescript-overview/gamescript-overview.component";
|
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 {GamesystemEditorComponent} from "./editor/gamesystem-editor/gamesystem-editor.component";
|
||||||
import {
|
import {
|
||||||
SimpleGamesystemEditorComponent
|
SimpleGamesystemEditorComponent
|
||||||
@ -61,7 +61,7 @@ import {
|
|||||||
ProductStateEditorComponent
|
ProductStateEditorComponent
|
||||||
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
|
} from "./editor/gamesystem-editor/state-editor/product-state-editor/product-state-editor.component";
|
||||||
import {MatTooltip} from "@angular/material/tooltip";
|
import {MatTooltip} from "@angular/material/tooltip";
|
||||||
import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card";
|
import {MatCard, MatCardContent, MatCardHeader} from "@angular/material/card";
|
||||||
import {
|
import {
|
||||||
ScriptaccountActionEditorComponent
|
ScriptaccountActionEditorComponent
|
||||||
} from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
|
} 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";
|
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
|
||||||
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
import {CharacterOverviewComponent} from "./side-overviews/character-overview/character-overview.component";
|
||||||
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
|
import {CharacterEditorComponent} from "./editor/character-editor/character-editor.component";
|
||||||
import {
|
import {MatAccordion, MatExpansionPanel} from "@angular/material/expansion";
|
||||||
MatAccordion,
|
|
||||||
MatExpansionPanel,
|
|
||||||
MatExpansionPanelHeader,
|
|
||||||
MatExpansionPanelTitle
|
|
||||||
} from "@angular/material/expansion";
|
|
||||||
import {
|
|
||||||
TemplateSystemEditorComponent
|
|
||||||
} from "./editor/gamesystem-editor/template-system-editor/template-system-editor.component";
|
|
||||||
|
|
||||||
// AoT requires an exported function for factories
|
// AoT requires an exported function for factories
|
||||||
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||||
@ -102,8 +94,7 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
|
|||||||
ScriptaccountActionEditorComponent,
|
ScriptaccountActionEditorComponent,
|
||||||
ScriptaccountConditionEditorComponent,
|
ScriptaccountConditionEditorComponent,
|
||||||
CharacterOverviewComponent,
|
CharacterOverviewComponent,
|
||||||
CharacterEditorComponent,
|
CharacterEditorComponent
|
||||||
TemplateSystemEditorComponent
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -162,11 +153,8 @@ const httpLoaderFactory = (http: HttpClient): TranslateHttpLoader => new Transl
|
|||||||
MatCard,
|
MatCard,
|
||||||
MatCardContent,
|
MatCardContent,
|
||||||
MatCardHeader,
|
MatCardHeader,
|
||||||
MatCardTitle,
|
|
||||||
MatAccordion,
|
MatAccordion,
|
||||||
MatExpansionPanel,
|
MatExpansionPanel
|
||||||
MatExpansionPanelTitle,
|
|
||||||
MatExpansionPanelHeader
|
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title>Charactersystems</mat-card-title>
|
<mat-card-title>Characterspecific Gamesystems</mat-card-title>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-accordion>
|
<mat-accordion>
|
||||||
<mat-expansion-panel *ngFor="let characterSystem of character!.characterSpecificGamesystems">
|
<mat-expansion-panel *ngFor="let gamesystem of character!.characterSpecificGamesystems">
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>{{gamesystem.componentName}}</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>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
<button style="width: 100%; margin-top: 10px" mat-stroked-button (click)="openTemplateEditor()">Add Charactersystem</button>
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {Character} from '../../project/game-model/characters/Character';
|
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 {GameModel} from "../../project/game-model/GameModel";
|
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({
|
@Component({
|
||||||
selector: 'app-character-editor',
|
selector: 'app-character-editor',
|
||||||
@ -19,25 +11,4 @@ export class CharacterEditorComponent {
|
|||||||
|
|
||||||
@Input() character: Character | undefined
|
@Input() character: Character | undefined
|
||||||
@Input() gameModel: GameModel | 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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,7 @@
|
|||||||
(onOpenGamesystemEditor)="openGameModelComponent($event)"
|
(onOpenGamesystemEditor)="openGameModelComponent($event)"
|
||||||
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
|
[scriptAccounts]="gameModel!.scriptAccounts"></app-gamesystem-editor>
|
||||||
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
|
<app-character-editor *ngIf="modelComponent.type === ModelComponentType.CHARACTER"
|
||||||
[character]="convertModelComponentToCharacter(modelComponent)"
|
[gameModel]="gameModel!" [character]="convertModelComponentToCharacter(modelComponent)">
|
||||||
[gameModel]="gameModel!">
|
|
||||||
|
|
||||||
</app-character-editor>
|
</app-character-editor>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
@ -54,7 +54,7 @@ export class EditorComponent {
|
|||||||
|
|
||||||
convertModelComponentToCharacter(modelComponent: ModelComponent) {
|
convertModelComponentToCharacter(modelComponent: ModelComponent) {
|
||||||
if(modelComponent instanceof Character) {
|
if(modelComponent instanceof Character) {
|
||||||
return modelComponent as Character
|
return modelComponent as Character;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import {SimpleTemplateGamesystem} from "../gamesystems/SimpleTemplateGamesystem"
|
|||||||
|
|
||||||
export class Character extends ModelComponent{
|
export class Character extends ModelComponent{
|
||||||
|
|
||||||
private characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
|
characterSpecificGamesystems: SimpleTemplateGamesystem<Character>[] = []
|
||||||
|
|
||||||
constructor(componentName: string, componentDescription: string) {
|
constructor(componentName: string, componentDescription: string) {
|
||||||
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
super(componentName, componentDescription, ModelComponentType.CHARACTER);
|
||||||
|
Loading…
Reference in New Issue
Block a user