Load Character Specific States of Character Specific Gamesystems
All checks were successful
E2E Testing / test (push) Successful in 1m31s

This commit is contained in:
Sebastian Böckelmann 2024-03-22 18:07:11 +01:00
parent 5cb535a264
commit 413d16392b
3 changed files with 17 additions and 4 deletions

View File

@ -23,13 +23,22 @@ export class CharacterEditorComponent implements OnInit{
ngOnInit() {
this.referenceGamesystems.forEach(referenceGamesystem => {
if(referenceGamesystem instanceof SimpleGamesystem) {
const characterSpecificGamesystem = this.findReferencedGamesystemInCharacter(referenceGamesystem.componentName)
if(characterSpecificGamesystem != undefined) {
this.templateSimpleGamesystems.push(characterSpecificGamesystem)
} else {
this.templateSimpleGamesystems.push(new TemplateGamesystem(referenceGamesystem))
}
} else {
this.templateProductGamesystems.push(referenceGamesystem as ProductGamesystem)
}
})
}
private findReferencedGamesystemInCharacter(referenceGamesystemName: string) {
return this.character!.characterSpecificGamesystems.find(system => system.referenceGamesystem.componentName === referenceGamesystemName)
}
onRemoveLastTemplateState(templateGamesystem: TemplateGamesystem) {
this.character!.removeCharacterSpecificGamesystem(templateGamesystem)
}

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Component, EventEmitter, Input, OnChanges, Output} from '@angular/core';
import {SimpleGamesystem} from "../../../project/game-model/gamesystems/SimpleGamesystem";
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
import {Gamesystem} from "../../../project/game-model/gamesystems/Gamesystem";

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild} from '@angular/core';
import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState";
import {TemplateGamesystem} from "../../../../project/game-model/gamesystems/TemplateGamesystem";
import {SimpleStateEditorComponent} from "../../state-editor/simple-state-editor/simple-state-editor.component";
@ -19,7 +19,7 @@ import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems
]),
],
})
export class TemplateStateEditorComponent {
export class TemplateStateEditorComponent implements OnChanges {
@Input() templateGamesystem: TemplateGamesystem | undefined
@Input() scriptAccounts: ScriptAccount[] = []
@ -34,6 +34,10 @@ export class TemplateStateEditorComponent {
editedStateLabelError: boolean = false;
ngOnChanges() {
this.dataSource.data = this.templateGamesystem!.templateStates
}
onExtractReferenceState(state: SimpleState) {
if(this.templateGamesystem!.templateStates.length == 0) {
this.onAddFirstTemplateState.emit(state)