Make ScriptAccountConditionEditor ready for InteractionConditions
All checks were successful
E2E Testing / test (push) Successful in 1m18s
All checks were successful
E2E Testing / test (push) Successful in 1m18s
This commit is contained in:
parent
d010dfbce6
commit
e6218e107e
@ -101,7 +101,8 @@
|
|||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="ScriptAccount Conditions">
|
<mat-tab label="ScriptAccount Conditions">
|
||||||
<app-scriptaccount-condition-editor [scriptAccounts]="gameModel!.scriptAccounts" [conditions]="element.scriptAccountConditions"></app-scriptaccount-condition-editor>
|
<app-scriptaccount-condition-editor [scriptAccounts]="gameModel!.scriptAccounts" [conditions]="element.scriptAccountConditions" [enableEditiong]="true"
|
||||||
|
(onCreateCondition)="onAddCondition(element, $event)" (onDeleteCondition)="onDeleteCondition(element, $event)"></app-scriptaccount-condition-editor>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Inventory Itemgroup Conditions">
|
<mat-tab label="Inventory Itemgroup Conditions">
|
||||||
<app-item-condition-editor [interaction]="element" [gameModel]="gameModel" [group]="true"></app-item-condition-editor>
|
<app-item-condition-editor [interaction]="element" [gameModel]="gameModel" [group]="true"></app-item-condition-editor>
|
||||||
|
@ -8,6 +8,7 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
|
|||||||
import {Interaction} from "../../../project/game-model/interactions/Interaction";
|
import {Interaction} from "../../../project/game-model/interactions/Interaction";
|
||||||
import {Condition} from "../../../project/game-model/interactions/condition/Condition";
|
import {Condition} from "../../../project/game-model/interactions/condition/Condition";
|
||||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
|
import {ScriptAccountCondition} from "../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-character-interaction-editor',
|
selector: 'app-character-interaction-editor',
|
||||||
@ -75,4 +76,13 @@ export class CharacterInteractionEditorComponent implements OnInit{
|
|||||||
editInteraction(interaction: AbstractInteraction) {
|
editInteraction(interaction: AbstractInteraction) {
|
||||||
this.editedElement = interaction;
|
this.editedElement = interaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAddCondition(interaction: AbstractInteraction, condition: ScriptAccountCondition) {
|
||||||
|
interaction!.addConditon(condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onDeleteCondition(interaction: AbstractInteraction, condition: ScriptAccountCondition) {
|
||||||
|
interaction!.removeCondition(condition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,13 +39,7 @@ export class ScriptaccountConditionEditorComponent implements OnInit{
|
|||||||
|
|
||||||
finishEditing() {
|
finishEditing() {
|
||||||
if(this.addedCondition != undefined) {
|
if(this.addedCondition != undefined) {
|
||||||
const createdCondition = ScriptAccountCondition.constructScriptAccountCondition(this.addedCondition.scriptAccount, this.addedCondition.minValue, this.addedCondition.maxValue);
|
this.onCreateCondition.emit(this.addedCondition);
|
||||||
if(createdCondition != undefined) {
|
|
||||||
console.log(createdCondition)
|
|
||||||
this.onCreateCondition.emit(createdCondition);
|
|
||||||
console.log(this.conditions)
|
|
||||||
this.dataSource.data = this.conditions;
|
|
||||||
}
|
|
||||||
this.addedCondition = undefined;
|
this.addedCondition = undefined;
|
||||||
}
|
}
|
||||||
this.editedCondition = undefined;
|
this.editedCondition = undefined;
|
||||||
@ -55,13 +49,8 @@ export class ScriptaccountConditionEditorComponent implements OnInit{
|
|||||||
this.editedCondition = condition;
|
this.editedCondition = condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCondition(condition: ScriptAccountCondition) {
|
deleteCondition(deletedCondition: ScriptAccountCondition) {
|
||||||
if(this.addedCondition === condition) {
|
this.onDeleteCondition.emit(deletedCondition);
|
||||||
this.addedCondition = undefined;
|
this.dataSource.data = this.dataSource.data.filter(condition => condition !== deletedCondition);
|
||||||
this.dataSource.data = this.conditions.concat();
|
|
||||||
} else {
|
|
||||||
this.onDeleteCondition.emit(condition);
|
|
||||||
this.dataSource.data = this.conditions.concat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user