BasicNetworkedElement.bumpVersion call from outside now properly notifies listeners
This commit is contained in:
parent
06a202bf17
commit
6729f2decc
@ -42,11 +42,16 @@ open class BasicNetworkedElement<TYPE, LEGACY>(private var value: TYPE, protecte
|
|||||||
val old = value
|
val old = value
|
||||||
value = t
|
value = t
|
||||||
queue.clear()
|
queue.clear()
|
||||||
bumpVersion()
|
super.bumpVersion()
|
||||||
valueListeners.forEach { it.callable.invoke(t, old) }
|
valueListeners.forEach { it.callable.invoke(t, old) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun bumpVersion() {
|
||||||
|
super.bumpVersion()
|
||||||
|
valueListeners.forEach { it.callable.invoke(value, value) }
|
||||||
|
}
|
||||||
|
|
||||||
override fun addListener(listener: Consumer<TYPE>): Listenable.L {
|
override fun addListener(listener: Consumer<TYPE>): Listenable.L {
|
||||||
return Listener(listener)
|
return Listener(listener)
|
||||||
}
|
}
|
||||||
@ -68,7 +73,7 @@ open class BasicNetworkedElement<TYPE, LEGACY>(private var value: TYPE, protecte
|
|||||||
val old = value
|
val old = value
|
||||||
value = if (isLegacy) fromLegacy(legacyCodec.read(data)) else codec.read(data)
|
value = if (isLegacy) fromLegacy(legacyCodec.read(data)) else codec.read(data)
|
||||||
queue.clear()
|
queue.clear()
|
||||||
bumpVersion()
|
super.bumpVersion()
|
||||||
|
|
||||||
if (value != old) {
|
if (value != old) {
|
||||||
valueListeners.forEach { it.callable.invoke(value, old) }
|
valueListeners.forEach { it.callable.invoke(value, old) }
|
||||||
@ -85,7 +90,7 @@ open class BasicNetworkedElement<TYPE, LEGACY>(private var value: TYPE, protecte
|
|||||||
|
|
||||||
override fun readDelta(data: DataInputStream, interpolationDelay: Double, isLegacy: Boolean) {
|
override fun readDelta(data: DataInputStream, interpolationDelay: Double, isLegacy: Boolean) {
|
||||||
val read = if (isLegacy) fromLegacy(legacyCodec.read(data)) else codec.read(data)
|
val read = if (isLegacy) fromLegacy(legacyCodec.read(data)) else codec.read(data)
|
||||||
bumpVersion()
|
super.bumpVersion()
|
||||||
|
|
||||||
if (isInterpolating) {
|
if (isInterpolating) {
|
||||||
queue.push(read, interpolationDelay)
|
queue.push(read, interpolationDelay)
|
||||||
|
Loading…
Reference in New Issue
Block a user