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-tab-group>
|
||||
<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 label="Inventory Itemgroup Conditions">
|
||||
<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 {Condition} from "../../../project/game-model/interactions/condition/Condition";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {ScriptAccountCondition} from "../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||
|
||||
@Component({
|
||||
selector: 'app-character-interaction-editor',
|
||||
@ -75,4 +76,13 @@ export class CharacterInteractionEditorComponent implements OnInit{
|
||||
editInteraction(interaction: AbstractInteraction) {
|
||||
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() {
|
||||
if(this.addedCondition != undefined) {
|
||||
const createdCondition = ScriptAccountCondition.constructScriptAccountCondition(this.addedCondition.scriptAccount, this.addedCondition.minValue, this.addedCondition.maxValue);
|
||||
if(createdCondition != undefined) {
|
||||
console.log(createdCondition)
|
||||
this.onCreateCondition.emit(createdCondition);
|
||||
console.log(this.conditions)
|
||||
this.dataSource.data = this.conditions;
|
||||
}
|
||||
this.onCreateCondition.emit(this.addedCondition);
|
||||
this.addedCondition = undefined;
|
||||
}
|
||||
this.editedCondition = undefined;
|
||||
@ -55,13 +49,8 @@ export class ScriptaccountConditionEditorComponent implements OnInit{
|
||||
this.editedCondition = condition;
|
||||
}
|
||||
|
||||
deleteCondition(condition: ScriptAccountCondition) {
|
||||
if(this.addedCondition === condition) {
|
||||
this.addedCondition = undefined;
|
||||
this.dataSource.data = this.conditions.concat();
|
||||
} else {
|
||||
this.onDeleteCondition.emit(condition);
|
||||
this.dataSource.data = this.conditions.concat();
|
||||
}
|
||||
deleteCondition(deletedCondition: ScriptAccountCondition) {
|
||||
this.onDeleteCondition.emit(deletedCondition);
|
||||
this.dataSource.data = this.dataSource.data.filter(condition => condition !== deletedCondition);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user