diff --git a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.html b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.html index 6c8ab4c..e984077 100644 --- a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.html @@ -1,9 +1,90 @@
- + + + + Filter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Starting State + {{transition.startingState.stateLabel}} + Ending State + {{transition.endingState.stateLabel}} + +
+
+
+ +
+
+ +
+
+ + +
+
+ + + + + + + +
+ +
+
+
- +
-
diff --git a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.scss b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.scss index 2709357..60f9291 100644 --- a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.scss +++ b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.scss @@ -5,3 +5,81 @@ .reference-editor, .template-editor{ flex: 1; } + +table { + width: 100%; + margin-top: 20px; +} +.mat-column-edit, .mat-column-delete, .mat-column-expand { + width: 32px; +} + +tr.example-detail-row { + height: 0; +} + +tr.example-element-row:not(.example-expanded-row):hover { + background: #545456; +} + +tr.example-element-row:not(.example-expanded-row):active { + background: #545456; +} + +.example-element-row td { + border-bottom-width: 0; +} + +.example-element-detail { + overflow: hidden; + display: flex; +} + +.example-element-diagram { + min-width: 80px; + border: 2px solid black; + padding: 8px; + font-weight: lighter; + margin: 8px 0; + height: 104px; +} + +.example-element-symbol { + font-weight: bold; + font-size: 40px; + line-height: normal; +} + +.example-element-description { + padding: 16px; +} + +.example-element-description-attribution { + opacity: 0.5; +} + +.long-form { + width: 100%; +} + +.warning-icon { + margin-right: 5px; +} + +.mat-error { + color: red; +} + +.condition-action-container { + display: flex; + flex-wrap: wrap; + width: 100% +} + +.condition-container { + flex: 1; +} + +.action-container { + flex: 1; +} diff --git a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.ts b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.ts index 2220553..7655553 100644 --- a/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.ts +++ b/src/app/editor/gamesystem-editor/template-gamesystem-editor/template-transition-editor/template-transition-editor.component.ts @@ -1,13 +1,70 @@ -import {Component, Input} from '@angular/core'; +import {Component, EventEmitter, Input, Output} from '@angular/core'; import {TemplateGamesystem} from "../../../../project/game-model/gamesystems/TemplateGamesystem"; import {AppModule} from "../../../../app.module"; +import {animate, state, style, transition, trigger} from "@angular/animations"; +import {MatTableDataSource} from "@angular/material/table"; +import {SimpleTransition} from "../../../../project/game-model/gamesystems/transitions/SimpleTransition"; +import {SimpleState} from "../../../../project/game-model/gamesystems/states/SimpleState"; +import {ScriptAccount} from "../../../../project/game-model/scriptAccounts/ScriptAccount"; +import {ScriptAccountCondition} from "../../../../project/game-model/gamesystems/conditions/ScriptAccountCondition"; @Component({ selector: 'app-template-transition-editor', templateUrl: './template-transition-editor.component.html', - styleUrl: './template-transition-editor.component.scss' + styleUrl: './template-transition-editor.component.scss', + animations: [ + trigger('detailExpand', [ + state('collapsed,void', style({height: '0px', minHeight: '0'})), + state('expanded', style({height: '*'})), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')), + ]), + ], }) export class TemplateTransitionEditorComponent { @Input() templateGamesystem: TemplateGamesystem | undefined + @Input() scriptAccounts: ScriptAccount[] = [] + displayedColumns: string[] = ["starting-state", "ending-state", "edit", "delete"]; + dataSource = new MatTableDataSource(); + columnsToDisplayWithExpand = [...this.displayedColumns, 'expand']; + expandedElement: SimpleTransition | null = null; + editedTransition: SimpleTransition | undefined + editedTransitionIndex = -1; + + defaultStartingState: SimpleState = new SimpleState("None", ""); + defaultEndingState: SimpleState = new SimpleState("None", ""); + + transitionError: boolean = false; + transitionStartingStateError = true; + transitionEndingStateError = true; + + applyFilter(event: KeyboardEvent) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + } + + onCreateCondition(transition: SimpleTransition, condition: ScriptAccountCondition) { + + } + + deleteCondition(transition: SimpleTransition, condition: ScriptAccountCondition) { + + } + + deleteTransition(transition: SimpleTransition) { + + } + + onEditTransition(transition: SimpleTransition) { + if(this.editedTransition == undefined) { + this.editedTransition = transition + } else { + this.editedTransition = undefined + } + } + + extractReferencedTransition(transition: SimpleTransition) { + this.templateGamesystem!.addReferenceTransition(transition) + this.dataSource.data = this.templateGamesystem!.templateTransitions + } } diff --git a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html index 91f3790..18c7981 100644 --- a/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html +++ b/src/app/editor/gamesystem-editor/transition-editor/simple-transition-editor/simple-transition-editor.component.html @@ -58,7 +58,8 @@ - + @@ -74,7 +75,7 @@ - +