A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AlmasB/FXGL/commit/444c95108 below:

added audioFileName support to nodes, #651 · AlmasB/FXGL@444c951 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+26

-5

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+26

-5

lines changed Original file line number Diff line number Diff line change

@@ -44,6 +44,11 @@ sealed class DialogueNode(

44 44

val text: String

45 45

get() = textProperty.value

46 46 47 +

val audioFileNameProperty: StringProperty = SimpleStringProperty()

48 + 49 +

val audioFileName: String

50 +

get() = audioFileNameProperty.value

51 + 47 52

override fun toString(): String {

48 53

return javaClass.simpleName

49 54

}

Original file line number Diff line number Diff line change

@@ -22,7 +22,7 @@ import javafx.beans.property.SimpleStringProperty

22 22

* An equivalent of serialVersionUID.

23 23

* Any changes to the serializable graph data structure need to increment this number by 1.

24 24

*/

25 -

private const val GRAPH_VERSION = 1

25 +

private const val GRAPH_VERSION = 2

26 26 27 27

/*

28 28

* We can't use jackson-module-kotlin yet since no module-info.java is provided.

@@ -39,7 +39,10 @@ data class SerializableTextNode

39 39 40 40

@JsonProperty("text")

41 41

val text: String

42 -

)

42 +

) {

43 + 44 +

var audio: String = ""

45 +

}

43 46 44 47

@JsonIgnoreProperties(ignoreUnknown = true)

45 48

data class SerializableChoiceNode

@@ -55,7 +58,10 @@ data class SerializableChoiceNode

55 58 56 59

@JsonProperty("conditions")

57 60

val conditions: Map<Int, String>

58 -

)

61 +

) {

62 + 63 +

var audio: String = ""

64 +

}

59 65 60 66

@JsonIgnoreProperties(ignoreUnknown = true)

61 67

data class SerializableEdge

@@ -126,12 +132,13 @@ object DialogueGraphSerializer {

126 132

fun toSerializable(dialogueGraph: DialogueGraph): SerializableGraph {

127 133

val nodesS = dialogueGraph.nodes

128 134

.filterValues { it.type != CHOICE }

129 -

.mapValues { (_, n) -> SerializableTextNode(n.type, n.text) }

135 +

.mapValues { (_, n) -> SerializableTextNode(n.type, n.text).also { it.audio = n.audioFileName } }

130 136 131 137

val choiceNodesS = dialogueGraph.nodes

132 138

.filterValues { it.type == CHOICE }

133 139

.mapValues { (_, n) ->

134 140

SerializableChoiceNode(n.type, n.text, (n as ChoiceNode).options.mapValues { it.value.value }, n.conditions.mapValues { it.value.value })

141 +

.also { it.audio = n.audioFileName }

135 142

}

136 143 137 144

val edgesS = dialogueGraph.edges

@@ -162,6 +169,8 @@ object DialogueGraphSerializer {

162 169

else -> throw IllegalArgumentException("Unknown node type: ${n.type}")

163 170

}

164 171 172 +

node.audioFileNameProperty.value = n.audio

173 + 165 174

graph.nodes[id] = node

166 175

}

167 176

@@ -176,6 +185,8 @@ object DialogueGraphSerializer {

176 185

node.conditions[option.key] = SimpleStringProperty(option.value)

177 186

}

178 187 188 +

node.audioFileNameProperty.value = n.audio

189 + 179 190

graph.nodes[id] = node

180 191

}

181 192 Original file line number Diff line number Diff line change

@@ -120,6 +120,10 @@ abstract class NodeView(val node: DialogueNode) : Pane() {

120 120

val audioField = AudioField()

121 121

audioField.visibleProperty().bind(getbp(IS_SHOW_AUDIO_LINES))

122 122 123 +

audioField.field.text = node.audioFileNameProperty.value

124 + 125 +

node.audioFileNameProperty.bindBidirectional(audioField.field.textProperty())

126 + 123 127

contentRoot.children.add(0, audioField)

124 128 125 129

prefHeightProperty().bind(textArea.prefHeightProperty().add(85))

@@ -173,12 +177,13 @@ class AudioField() : HBox(5.0) {

173 177

private val audioFileChooser = FileChooser()

174 178

}

175 179 180 +

val field = TextField()

181 + 176 182

init {

177 183

audioFileChooser.initialDirectory = File(System.getProperty("user.dir"))

178 184 179 185

val icon = makeSoundIcon()

180 186 181 -

val field = TextField()

182 187

field.prefWidth = 190.0

183 188 184 189

val button = CustomButton("...", 14.0)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4