Skip to content

Commit

Permalink
implement new flow control
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoButtermilch committed Mar 17, 2024
1 parent f87fb47 commit cd286bc
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 130 deletions.
7 changes: 4 additions & 3 deletions src/app/dialogue/comment/comment.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div *ngIf="comment"
class="comment p-1 "
@if (comment) {
<div class="comment p-1 "
[style.background-color]="comment.color">
<div class="head text-white d-flex align-items-center justify-content-between mb-1">
<div class="d-flex">
Expand All @@ -25,4 +25,5 @@
[value]="comment.content"
(input)="updateContent($event)">{{comment.content}}</textarea>
</div>
</div>
</div>
}
29 changes: 20 additions & 9 deletions src/app/dialogue/condition/condition.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div *ngIf="conditionNode && formGroup"
[formGroup]="formGroup"
@if (conditionNode && formGroup) {

<div [formGroup]="formGroup"
class="condition-node {{errorMessage !== '' ? 'warning': ''}}">

<div class="warn-message bg-danger text-white text-center">{{errorMessage}}</div>
Expand All @@ -21,22 +22,33 @@ <h3>Condition</h3>
id="var"
name="var"
formControlName="{{guidFieldName}}">
<option *ngFor="let variable of variables$ | async; let i = index;"
value="{{variable.guid}}"

@for (variable of variables$ | async; track variable.guid; let i = $index) {

<option value="{{variable.guid}}"
[selected]="false">
{{variable.name}}
</option>

}

</select>

<select class="m-1 bg-dark text-white p-0"
id="type"
name="type"
formControlName="{{conditionFieldName}}">
<option *ngFor="let enum of conditionTypes | keyvalue"
[selected]="enum.key == conditionNode.type"

@for (enum of conditionTypes | keyvalue; track $index) {


<option [selected]="enum.key == conditionNode.type"
value="{{enum.key}}">
{{getConditionTypeLabel(enum.value)}}
</option>

}

</select>

<input type="text"
Expand All @@ -52,6 +64,5 @@ <h3>Condition</h3>
(onUpdate)="updateOutPortFails($event)"></app-port>
</div>
</div>


</div>
</div>
}
9 changes: 5 additions & 4 deletions src/app/dialogue/event/event.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div *ngIf="eventNode"
class="event-node ">
@if (eventNode) {
<div class="event-node ">


<div class="d-flex justify-content-between p-1">
Expand All @@ -21,7 +21,8 @@ <h3>Event</h3>
</div>

<app-port [port]="eventNode.outPort"
(onUpdate)="updateOutPort($event)"></app-port>
(onUpdate)="updateOutPort($event)"></app-port>

</div>
</div>
</div>
}
34 changes: 22 additions & 12 deletions src/app/dialogue/node/node.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div *ngIf="dialogueNode"
class="node bg-dark">
@if (dialogueNode) {

<div class="node bg-dark">


<div class="character-indicator w-100 d-flex justify-content-end align-items-center"
Expand All @@ -9,14 +10,15 @@
</div>

<div class="d-flex justify-content-between p-1">
<app-port *ngIf="!dialogueNode.isRoot"
[port]="dialogueNode.inPort"></app-port>
@if (!dialogueNode.isRoot) {

<button *ngIf="!dialogueNode.isRoot"
(click)="onDelete.emit(dialogueNode)"
<app-port [port]="dialogueNode.inPort"></app-port>
<button (click)="onDelete.emit(dialogueNode)"
class="btn btn-danger p-0 me-1">
<svg-icon name="icon_delete"></svg-icon>
</button>
}

</div>

<div class="content bg-gray d-flex justify-content-between align-items-center p-1">
Expand All @@ -34,11 +36,14 @@ <h3 class="text-white">Character</h3>
<select class="bg-dark text-white p-0"
(input)="onCharacterChange($event)">

<option *ngFor="let char of characterOptions$ | async; let i = index"
value="{{char.guid}}"
[selected]="i === selectedCharacterIndex">
@for (char of characterOptions$ | async; track char.guid; ) {

<option value="{{char.guid}}"
[selected]="$index === selectedCharacterIndex">
{{char.name}}
</option>

}
</select>

</div>
Expand All @@ -60,15 +65,20 @@ <h3>Content</h3>
(cdkDropListDropped)="cdkChoiceDropped($event)"
class="col-4 ms-1 d-flex flex-column">
<h3>Choices</h3>
<app-choice *ngFor="let choice of dialogueNode.choices"
cdkDrag
@for (choice of dialogueNode.choices; track choice.guid) {

<app-choice cdkDrag
cdkDragData="{{choice.outPort.guid}}"
(cdkDragStarted)="cdkChoiceDragStarted($event, choice)"
(cdkDragEnded)="cdkChoiceDragEnded($event, choice)"
(onDeleteClicked)="deleteChoice(choice)"
(onUpdate)="updateChoice($event)"
[choice]="choice"></app-choice>

}
</div>

</div>
</div>
</div>

}
7 changes: 4 additions & 3 deletions src/app/dialogue/port/port.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div *ngIf="port"
(click)="onClicked()"
@if (port) {
<div (click)="onClicked()"
class="{{port.direction === 'out' ? 'reverse' :''}}
{{canBeClicked ? 'clickable' : 'unclickable'}}
{{isCurrentlySelected ? 'selected' : ''}}
Expand All @@ -9,4 +9,5 @@
<svg-icon name="icon_port"></svg-icon>
</button>
<p class="ms-1 text-light p-1">{{label}}</p>
</div>
</div>
}
17 changes: 10 additions & 7 deletions src/app/dialogue/random/random.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div *ngIf="randomNode"
class="random-node ">
@if (randomNode) {
<div class="random-node ">


<div class="d-flex justify-content-between p-1">
Expand All @@ -25,21 +25,24 @@ <h3 class="text-white m-0">{{randomNode.possibilites.length}}</h3>
</div>

<div class="possibilites">
@for (possibility of randomNode.possibilites; track possibility.guid) {

<div class="d-flex justify-content-end align-items-center"
*ngFor="let possibility of randomNode.possibilites">
<div class="d-flex justify-content-end align-items-center">

<button class="btn btn-danger p-0 me-1"
(click)="deletePossibility(possibility)">
<svg-icon name="icon_delete"></svg-icon>
</button>
<app-port [port]="possibility.outPort"
(onUpdate)="updateOutPort($event, possibility)"></app-port>
(onUpdate)="updateOutPort($event, possibility)"></app-port>

</div>


}
</div>


</div>
</div>
</div>

}
8 changes: 5 additions & 3 deletions src/app/dialogue/repeat/repeat.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div *ngIf="repeatNode"
class="repeat-node "
@if (repeatNode) {

<div class="repeat-node "
[formGroup]="formGroup">


Expand Down Expand Up @@ -29,4 +30,5 @@ <h3>Repeat </h3>
(onUpdate)="updateOutPort($event)"></app-port>

</div>
</div>
</div>
}
48 changes: 24 additions & 24 deletions src/app/editor/character-panel/character-panel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@ <h3 class="text-light">Characters</h3>
cdkDropList
(cdkDropListDropped)="cdkCharacterDropped($event)">

<div *ngFor="let char of characters$|async"
cdkDrag
class="">
<div class="group d-flex align-items-center">
@for (char of characters$ | async; track char.guid) {
<div cdkDrag
class="">
<div class="group d-flex align-items-center">

<input class="bg-dark text-white p-0"
type="text"
name="name"
value="{{char.name}}"
(input)="updateCharacterName($event, char)">
<input class="bg-dark text-white p-0"
type="color"
name="color"
value="{{char.color}}"
(input)="updateCharacterColor($event, char)">
<input class="bg-dark text-white p-0"
type="text"
name="name"
value="{{char.name}}"
(input)="updateCharacterName($event, char)">
<input class="bg-dark text-white p-0"
type="color"
name="color"
value="{{char.color}}"
(input)="updateCharacterColor($event, char)">

<div *ngIf="char.isDefault"
class="placeholder"></div>

<button *ngIf="!char.isDefault"
class="btn btn-danger m-1 p-0"
(click)="removeCharacter(char)">
<svg-icon name="icon_delete"></svg-icon>
</button>
@if (char.isDefault) {
<div class="placeholder"></div>
} @else {
<button class="btn btn-danger m-1 p-0"
(click)="removeCharacter(char)">
<svg-icon name="icon_delete"></svg-icon>
</button>
}
</div>
</div>
</div>

}
</div>
</div>
</app-resizable>
8 changes: 5 additions & 3 deletions src/app/editor/context-menu/context-menu.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@if (visible) {

<div class="menu text-white p-1"
[style.left]="left"
[style.top]="top"
*ngIf="visible">
[style.top]="top">

<div class="select bg-dark border-bottom">
<div class="title p-1">New <span class="icon"><svg-icon name="icon_chevron_right"></svg-icon></span></div>
Expand Down Expand Up @@ -39,4 +40,5 @@
</div>
</div>

</div>
</div>
}
Loading

0 comments on commit cd286bc

Please sign in to comment.