refactor-scriptaccount-action-editor #52
@ -117,13 +117,16 @@
|
||||
</mat-tab-group>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel *ngIf="!isInteractionSequence(element)">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Actions</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<mat-tab-group>
|
||||
<mat-tab label="ScriptAccount Actions">
|
||||
<app-scriptaccount-action-editor [scriptAccounts]="gameModel!.scriptAccounts"></app-scriptaccount-action-editor>
|
||||
<app-scriptaccount-action-editor [scriptAccounts]="gameModel!.scriptAccounts" [actions]="element.scriptAccountActions"
|
||||
(onAddAction)="onAddAction(element, $event)" (onRemoveAction)="onRemoveAction(element, $event)"
|
||||
[enableEditing]="true"
|
||||
></app-scriptaccount-action-editor>
|
||||
</mat-tab>
|
||||
<mat-tab label="Inventory Actions">
|
||||
<p>Inventory Actions</p>
|
||||
|
@ -9,6 +9,7 @@ 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";
|
||||
import {ScriptAccountAction} from "../../../project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||
|
||||
@Component({
|
||||
selector: 'app-character-interaction-editor',
|
||||
@ -85,4 +86,15 @@ export class CharacterInteractionEditorComponent implements OnInit{
|
||||
onDeleteCondition(interaction: AbstractInteraction, condition: ScriptAccountCondition) {
|
||||
interaction!.removeCondition(condition);
|
||||
}
|
||||
|
||||
onAddAction(interaction: AbstractInteraction, action: ScriptAccountAction) {
|
||||
if(interaction instanceof Interaction) {
|
||||
interaction.addAction(action);
|
||||
}
|
||||
}
|
||||
onRemoveAction(interaction: AbstractInteraction, action: ScriptAccountAction) {
|
||||
if(interaction instanceof Interaction) {
|
||||
interaction.removeAction(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import {Condition} from "./condition/Condition";
|
||||
import {ScriptAccountCondition} from "../gamesystems/conditions/ScriptAccountCondition";
|
||||
import {InventoryCondition} from "./condition/InventoryCondition";
|
||||
import {GamesystemCondition} from "./condition/GamesystemCondition";
|
||||
import {Action} from "./actions/Action";
|
||||
|
||||
export abstract class AbstractInteraction {
|
||||
|
||||
|
@ -35,4 +35,11 @@ export class Interaction extends AbstractInteraction{
|
||||
}
|
||||
|
||||
|
||||
addAction(action: Action) {
|
||||
this.actions.push(action);
|
||||
}
|
||||
|
||||
removeAction(deletedAction: Action) {
|
||||
this.actions = this.actions.filter(action => action !== deletedAction);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user