From 10c3a01f9f0fadd644fd9d692fd8e76851c2050f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Fri, 22 Mar 2024 17:11:47 +0100 Subject: [PATCH] Add and Remove Conditions from TemplateState --- .../character-editor/character-editor.component.html | 2 +- .../character-editor/character-editor.component.ts | 2 ++ src/app/editor/editor.component.html | 3 ++- .../template-gamesystem-editor.component.html | 2 +- .../template-state-editor.component.ts | 11 ++++++----- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/editor/character-editor/character-editor.component.html b/src/app/editor/character-editor/character-editor.component.html index 4844143..c9e990a 100644 --- a/src/app/editor/character-editor/character-editor.component.html +++ b/src/app/editor/character-editor/character-editor.component.html @@ -3,6 +3,6 @@ {{templateGamesystem.referenceGamesystem.componentName}} - + diff --git a/src/app/editor/character-editor/character-editor.component.ts b/src/app/editor/character-editor/character-editor.component.ts index 8d0a829..4d5e3a0 100644 --- a/src/app/editor/character-editor/character-editor.component.ts +++ b/src/app/editor/character-editor/character-editor.component.ts @@ -4,6 +4,7 @@ import {Gamesystem} from "../../project/game-model/gamesystems/Gamesystem"; import {TemplateGamesystem} from "../../project/game-model/gamesystems/TemplateGamesystem"; import {ProductGamesystem} from "../../project/game-model/gamesystems/ProductGamesystem"; import {SimpleGamesystem} from "../../project/game-model/gamesystems/SimpleGamesystem"; +import {ScriptAccount} from "../../project/game-model/scriptAccounts/ScriptAccount"; @Component({ selector: 'app-character-editor', @@ -14,6 +15,7 @@ export class CharacterEditorComponent implements OnInit{ @Input() character: Character | undefined @Input() referenceGamesystems: Gamesystem[] = [] + @Input() scriptAccounts: ScriptAccount[] = [] templateSimpleGamesystems: TemplateGamesystem[] = [] templateProductGamesystems: ProductGamesystem[] = [] diff --git a/src/app/editor/editor.component.html b/src/app/editor/editor.component.html index 3009a7f..c8ad774 100644 --- a/src/app/editor/editor.component.html +++ b/src/app/editor/editor.component.html @@ -16,7 +16,8 @@ [scriptAccounts]="gameModel!.scriptAccounts"> + [character]="convertModelComponentToCharacter(modelComponent)" + [scriptAccounts]="gameModel!.scriptAccounts"> diff --git a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-gamesystem-editor.component.html b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-gamesystem-editor.component.html index 4471bdf..d201e9c 100644 --- a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-gamesystem-editor.component.html +++ b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-gamesystem-editor.component.html @@ -1 +1 @@ - + diff --git a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-state-editor/template-state-editor.component.ts b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-state-editor/template-state-editor.component.ts index dfab3fc..e0cb89c 100644 --- a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-state-editor/template-state-editor.component.ts +++ b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-state-editor/template-state-editor.component.ts @@ -42,10 +42,6 @@ export class TemplateStateEditorComponent { this.dataSource.filter = filterValue.trim().toLowerCase(); } - onCreateCondition(state: SimpleState, $event: ScriptAccountCondition) { - - } - onEditState(state: SimpleState) { if(this.editedElement == null) { this.editedElement = state @@ -59,7 +55,12 @@ export class TemplateStateEditorComponent { this.dataSource.data = this.templateGamesystem!.templateStates } - deleteCondition(state: SimpleState, $event: ScriptAccountCondition) { + onCreateCondition(state: SimpleState, condition: ScriptAccountCondition) { + state.addScriptAccountCondition(condition); + } + + deleteCondition(state: SimpleState, condition: ScriptAccountCondition) { + state.removeScriptAccountCondition(condition.scriptAccount); } }