godot.signals.SignalProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of godot-library-debug Show documentation
Show all versions of godot-library-debug Show documentation
Contains godot api as kotlin classes and jvm cpp interaction code.
package godot.signals
import godot.Object
import kotlin.reflect.KProperty
/**
* For java convenience usage
*/
object SignalProvider {
@JvmStatic
fun signal(thisRef: Object, name: String): Signal0 = Signal0(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String) = Signal1(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String) = Signal2(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String) = Signal3(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String, p3: String) = Signal4(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String, p3: String, p4: String) = Signal5(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String, p3: String, p4: String, p5: String) = Signal6(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String, p3: String, p4: String, p5: String, p6: String) = Signal7(thisRef, name)
@JvmStatic
@Suppress("UNUSED_PARAMETER")
fun signal(thisRef: Object, name: String, p0: String, p1: String, p2: String, p3: String, p4: String, p5: String, p6: String, p7: String) = Signal8(thisRef, name)
}
class SignalDelegate(val factory: () -> T) {
@PublishedApi
internal var signal: T? = null
@Suppress("NOTHING_TO_INLINE")
inline operator fun getValue(thisRef: Object, property: KProperty<*>): T {
if (signal == null) {
signal = factory()
}
return signal!!
}
}
class SignalDelegateProvider(private val factory: (Object, String) -> T) {
operator fun provideDelegate(thisRef: Object, property: KProperty<*>): SignalDelegate {
return SignalDelegate { factory(thisRef, property.name) }
}
}
fun signal(): SignalDelegateProvider {
return SignalDelegateProvider(::Signal0)
}
@Suppress("UNUSED_PARAMETER")
fun signal(p0: String): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal1)
}
@Suppress("UNUSED_PARAMETER")
fun signal(p0: String, p1: String): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal2)
}
@Suppress("UNUSED_PARAMETER")
fun signal(p0: String, p1: String, p2: String): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal3)
}
@Suppress("UNUSED_PARAMETER")
fun signal(
p0: String,
p1: String,
p2: String,
p3: String
): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal4)
}
@Suppress("UNUSED_PARAMETER")
fun signal(
p0: String,
p1: String,
p2: String,
p3: String,
p4: String
): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal5)
}
@Suppress("UNUSED_PARAMETER")
fun signal(
p0: String,
p1: String,
p2: String,
p3: String,
p4: String,
p5: String
): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal6)
}
@Suppress("UNUSED_PARAMETER")
fun signal(
p0: String,
p1: String,
p2: String,
p3: String,
p4: String,
p5: String,
p6: String
): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal7)
}
@Suppress("UNUSED_PARAMETER")
fun signal(
p0: String,
p1: String,
p2: String,
p3: String,
p4: String,
p5: String,
p6: String,
p7: String
): SignalDelegateProvider> {
return SignalDelegateProvider(::Signal8)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy