Compare commits
No commits in common. "fe63b301155c9aca21a0680976f954be77e85d60" and "e6218e107e22bdcab7dfdb8fa504cb1e259f22a0" have entirely different histories.
fe63b30115
...
e6218e107e
@ -64,7 +64,7 @@ import {MatTooltip} from "@angular/material/tooltip";
|
||||
import {MatCard, MatCardContent, MatCardHeader, MatCardTitle} from "@angular/material/card";
|
||||
import {
|
||||
ScriptaccountActionEditorComponent
|
||||
} from "./editor/gamesystem-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
|
||||
} from "./editor/gamesystem-editor/transition-editor/scriptaccount-action-editor/scriptaccount-action-editor.component";
|
||||
import {
|
||||
ScriptaccountConditionEditorComponent
|
||||
} from "./editor/gamesystem-editor/scriptaccount-condition-editor/scriptaccount-condition-editor.component";
|
||||
|
@ -117,16 +117,13 @@
|
||||
</mat-tab-group>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<mat-expansion-panel *ngIf="!isInteractionSequence(element)">
|
||||
<mat-expansion-panel>
|
||||
<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" [actions]="element.scriptAccountActions"
|
||||
(onAddAction)="onAddAction(element, $event)" (onRemoveAction)="onRemoveAction(element, $event)"
|
||||
[enableEditing]="true"
|
||||
></app-scriptaccount-action-editor>
|
||||
<app-scriptaccount-action-editor [scriptAccounts]="gameModel!.scriptAccounts"></app-scriptaccount-action-editor>
|
||||
</mat-tab>
|
||||
<mat-tab label="Inventory Actions">
|
||||
<p>Inventory Actions</p>
|
||||
|
@ -9,7 +9,6 @@ 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',
|
||||
@ -86,15 +85,4 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,64 +0,0 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {ScriptAccount} from "../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||
import {Transition} from "../../../project/game-model/gamesystems/transitions/Transition";
|
||||
import {ScriptAccountAction} from "../../../project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||
import {TemplateElement} from "../../../project/game-model/templates/TemplateElement";
|
||||
import {
|
||||
SimpleTemplateTransition
|
||||
} from "../../../project/game-model/templates/simpleGamesystem/SimpleTemplateTransition";
|
||||
import {ScriptAccountCondition} from "../../../project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
||||
|
||||
@Component({
|
||||
selector: 'app-scriptaccount-action-editor',
|
||||
templateUrl: './scriptaccount-action-editor.component.html',
|
||||
styleUrl: './scriptaccount-action-editor.component.scss'
|
||||
})
|
||||
export class ScriptaccountActionEditorComponent implements OnInit{
|
||||
@Input() scriptAccounts: ScriptAccount[] = []
|
||||
@Input() enableEditing: boolean = false;
|
||||
@Input() actions: ScriptAccountAction[] = []
|
||||
@Output() onAddAction: EventEmitter<ScriptAccountAction> = new EventEmitter<ScriptAccountAction>();
|
||||
@Output() onRemoveAction: EventEmitter<ScriptAccountAction> = new EventEmitter<ScriptAccountAction>();
|
||||
|
||||
dataSource: MatTableDataSource<ScriptAccountAction> = new MatTableDataSource();
|
||||
displayedColumns: string[] = ['scriptAccount', "valueChange", 'edit', 'delete'];
|
||||
|
||||
editedAction: ScriptAccountAction | undefined
|
||||
addedAction: ScriptAccountAction | undefined
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource.data = this.actions
|
||||
|
||||
|
||||
|
||||
if(!this.enableEditing) {
|
||||
this.displayedColumns = this.displayedColumns.slice(0, -2);
|
||||
}
|
||||
}
|
||||
|
||||
editAction(scriptAccountAction: ScriptAccountAction) {
|
||||
this.editedAction = scriptAccountAction;
|
||||
}
|
||||
|
||||
createNewAction() {
|
||||
this.addedAction = new ScriptAccountAction(new ScriptAccount("", ""), 0);
|
||||
this.editedAction = this.addedAction;
|
||||
|
||||
this.dataSource.data = this.dataSource.data.concat(this.addedAction);
|
||||
}
|
||||
|
||||
finishEditing() {
|
||||
if(this.addedAction != undefined && this.addedAction.scriptAccount.componentName !== '') {
|
||||
this.onAddAction.emit(this.addedAction);
|
||||
this.addedAction = undefined;
|
||||
}
|
||||
this.editedAction = undefined;
|
||||
}
|
||||
|
||||
|
||||
deleteAction(deletedAction: ScriptAccountAction) {
|
||||
this.dataSource.data = this.dataSource.data.filter(action => action !== deletedAction);
|
||||
this.onRemoveAction.emit(deletedAction);
|
||||
}
|
||||
}
|
@ -62,8 +62,7 @@
|
||||
<td mat-cell *matCellDef="let element" [attr.colspan]="columnsToDisplayWithExpand.length">
|
||||
<div class="example-element-detail"
|
||||
[@detailExpand]="element == expandedElement ? 'expanded' : 'collapsed'">
|
||||
<app-scriptaccount-condition-editor [enableEditiong]="false" [conditions]="element.scriptAccountConditions" ></app-scriptaccount-condition-editor>
|
||||
<app-scriptaccount-action-editor [enableEditing]="false" [actions]="element.scriptAccountActions"></app-scriptaccount-action-editor>
|
||||
<app-scriptaccount-condition-editor [enableEditiong]="false" [conditions]="element.scriptAccountConditions" ></app-scriptaccount-condition-editor>
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
@ -0,0 +1,89 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount";
|
||||
import {Transition} from "../../../../project/game-model/gamesystems/transitions/Transition";
|
||||
import {ScriptAccountAction} from "../../../../project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||
import {TemplateElement} from "../../../../project/game-model/templates/TemplateElement";
|
||||
import {
|
||||
SimpleTemplateTransition
|
||||
} from "../../../../project/game-model/templates/simpleGamesystem/SimpleTemplateTransition";
|
||||
|
||||
@Component({
|
||||
selector: 'app-scriptaccount-action-editor',
|
||||
templateUrl: './scriptaccount-action-editor.component.html',
|
||||
styleUrl: './scriptaccount-action-editor.component.scss'
|
||||
})
|
||||
export class ScriptaccountActionEditorComponent implements OnInit{
|
||||
@Input() transition: Transition<any> | undefined
|
||||
@Input() scriptAccounts: ScriptAccount[] = []
|
||||
@Input() enableEditing: boolean = false;
|
||||
@Input() templateElement: TemplateElement | undefined
|
||||
|
||||
dataSource: MatTableDataSource<ScriptAccountAction> = new MatTableDataSource();
|
||||
displayedColumns: string[] = ['scriptAccount', "valueChange", 'edit', 'delete'];
|
||||
|
||||
editedAction: ScriptAccountAction | undefined
|
||||
addedAction: ScriptAccountAction | undefined
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource.data = this.getDisplayedActions()
|
||||
|
||||
|
||||
|
||||
if(!this.enableEditing) {
|
||||
this.displayedColumns = this.displayedColumns.slice(0, -2);
|
||||
}
|
||||
}
|
||||
|
||||
editAction(scriptAccountAction: ScriptAccountAction) {
|
||||
this.editedAction = scriptAccountAction;
|
||||
}
|
||||
|
||||
createNewAction() {
|
||||
this.addedAction = new ScriptAccountAction(new ScriptAccount("", ""), 0);
|
||||
this.editedAction = this.addedAction;
|
||||
|
||||
this.dataSource.data = this.dataSource.data.concat(this.addedAction);
|
||||
}
|
||||
|
||||
finishEditing() {
|
||||
if(this.addedAction != undefined && this.addedAction.scriptAccount.componentName !== '') {
|
||||
if(this.templateElement != undefined && this.transition instanceof SimpleTemplateTransition) {
|
||||
if(this.transition.actionMap.has(this.templateElement!)) {
|
||||
this.transition.actionMap.get(this.templateElement!)!.push(this.addedAction)
|
||||
} else {
|
||||
this.transition.actionMap.set(this.templateElement!, [this.addedAction])
|
||||
}
|
||||
} else {
|
||||
this.transition?.addScriptAccountAction(this.addedAction)
|
||||
}
|
||||
|
||||
|
||||
this.dataSource.data = this.getDisplayedActions();
|
||||
this.addedAction = undefined;
|
||||
}
|
||||
this.editedAction = undefined;
|
||||
}
|
||||
|
||||
getDisplayedActions(): ScriptAccountAction[] {
|
||||
if(this.templateElement == undefined) {
|
||||
return this.transition!.scriptAccountActions.map(action => action);
|
||||
} else if(this.transition instanceof SimpleTemplateTransition) {
|
||||
return this.transition!.actionMap.get(this.templateElement)!
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
deleteAction(action: ScriptAccountAction) {
|
||||
if(this.templateElement != undefined && this.transition instanceof SimpleTemplateTransition && this.transition.actionMap.has(this.templateElement!)) {
|
||||
const updatedAction = this.transition.actionMap.get(this.templateElement)!.filter(currentAction =>
|
||||
currentAction.scriptAccount !== action.scriptAccount)
|
||||
this.transition.actionMap.set(this.templateElement!, updatedAction)
|
||||
} else {
|
||||
this.transition!.removeScriptAccountAction(action.scriptAccount)
|
||||
}
|
||||
|
||||
this.dataSource.data = this.getDisplayedActions()
|
||||
}
|
||||
}
|
@ -42,8 +42,7 @@
|
||||
[@detailExpand]="element == expandedElement ? 'expanded' : 'collapsed'">
|
||||
<div class="condition-action-container">
|
||||
<div class="action-container">
|
||||
<app-scriptaccount-action-editor [actions]="getDisplayedActions(element)" [scriptAccounts]="scriptAccounts" [enableEditing]="true"
|
||||
(onAddAction)="onAddAction(element, $event)" (onRemoveAction)="onDeleteAction(element, $event)"></app-scriptaccount-action-editor>
|
||||
<app-scriptaccount-action-editor [templateElement]="templateElement" [transition]="element" [scriptAccounts]="scriptAccounts" [enableEditing]="true"></app-scriptaccount-action-editor>
|
||||
</div>
|
||||
<div class="condition-container">
|
||||
<app-scriptaccount-condition-editor [conditions]="getDisplayedConditions(element)" [scriptAccounts]="scriptAccounts" [enableEditiong]="true"
|
||||
|
@ -12,7 +12,6 @@ import {TemplateElement} from "../../../../project/game-model/templates/Template
|
||||
import {
|
||||
SimpleTemplateTransition
|
||||
} from "../../../../project/game-model/templates/simpleGamesystem/SimpleTemplateTransition";
|
||||
import {ScriptAccountAction} from "../../../../project/game-model/gamesystems/actions/ScriptAccountAction";
|
||||
@Component({
|
||||
selector: 'app-simple-transition-editor',
|
||||
templateUrl: './simple-transition-editor.component.html',
|
||||
@ -103,6 +102,7 @@ export class SimpleTransitionEditorComponent implements OnInit {
|
||||
} else {
|
||||
transition.addScriptAccountCondition(condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
deleteCondition(trasition: SimpleTransition, condition: ScriptAccountCondition) {
|
||||
@ -126,32 +126,4 @@ export class SimpleTransitionEditorComponent implements OnInit {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
onAddAction(transition: SimpleTransition, action: ScriptAccountAction) {
|
||||
if(this.templateElement != undefined && transition instanceof SimpleTemplateTransition) {
|
||||
transition.actionMap.get(this.templateElement)!.push(action)
|
||||
} else {
|
||||
transition.addScriptAccountAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
onDeleteAction(transition: SimpleTransition, action: ScriptAccountAction) {
|
||||
if(this.templateElement != undefined && transition instanceof SimpleTemplateTransition) {
|
||||
let updatedActions = transition.actionMap.get(this.templateElement)!
|
||||
updatedActions = updatedActions.filter(currentAction => action.scriptAccount !== currentAction.scriptAccount);
|
||||
transition.actionMap.set(this.templateElement, updatedActions);
|
||||
} else {
|
||||
transition.removeScriptAccountAction(action.scriptAccount);
|
||||
}
|
||||
}
|
||||
|
||||
getDisplayedActions(transition: SimpleTransition) {
|
||||
if(this.templateElement == undefined) {
|
||||
return transition.scriptAccountActions
|
||||
} else if(transition instanceof SimpleTemplateTransition) {
|
||||
return transition.actionMap.get(this.templateElement)!
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ 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,11 +35,4 @@ export class Interaction extends AbstractInteraction{
|
||||
}
|
||||
|
||||
|
||||
addAction(action: Action) {
|
||||
this.actions.push(action);
|
||||
}
|
||||
|
||||
removeAction(deletedAction: Action) {
|
||||
this.actions = this.actions.filter(action => action !== deletedAction);
|
||||
}
|
||||
}
|
||||
|
@ -7,27 +7,8 @@
|
||||
"conditions": [],
|
||||
"stateLabel": "A",
|
||||
"stateDescription": ""
|
||||
},
|
||||
{
|
||||
"initial": false,
|
||||
"conditions": [],
|
||||
"stateLabel": "B",
|
||||
"stateDescription": ""
|
||||
}
|
||||
],
|
||||
"transitions": [
|
||||
{
|
||||
"scriptAccountActions": [
|
||||
{
|
||||
"characterDependency": 2,
|
||||
"changingValue": 6,
|
||||
"scriptAccount": "Test"
|
||||
}
|
||||
],
|
||||
"scriptAccountConditions": [],
|
||||
"startingState": "A",
|
||||
"endingState": "B"
|
||||
}
|
||||
],
|
||||
"transitions": [],
|
||||
"generateIsolatedStates": false
|
||||
}
|
@ -7,27 +7,8 @@
|
||||
"conditions": [],
|
||||
"stateLabel": "1",
|
||||
"stateDescription": ""
|
||||
},
|
||||
{
|
||||
"initial": false,
|
||||
"conditions": [],
|
||||
"stateLabel": "2",
|
||||
"stateDescription": ""
|
||||
}
|
||||
],
|
||||
"transitions": [
|
||||
{
|
||||
"scriptAccountActions": [
|
||||
{
|
||||
"characterDependency": 2,
|
||||
"changingValue": 5,
|
||||
"scriptAccount": "Test"
|
||||
}
|
||||
],
|
||||
"scriptAccountConditions": [],
|
||||
"startingState": "1",
|
||||
"endingState": "2"
|
||||
}
|
||||
],
|
||||
"transitions": [],
|
||||
"generateIsolatedStates": false
|
||||
}
|
Loading…
Reference in New Issue
Block a user