hestia-rsps / hestia

An open-source Kotlin game server.
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

TaskPriority auto screen close suspension #61

Closed GregHib closed 4 years ago

GregHib commented 4 years ago

55

A suspension much like waiting for an open widget to close #56 but instead only if there is a screen open:

Ideally, this will be injected into the beginning of the Queue on the initiation of QueueTask depending on the (immutable) QueuePriority.

POC

fun hack(queue: Queue) = queue

data class QueueTask private constructor(val priority: QueuePriority, val queue: Queue) {
    constructor(queue: Queue, priority: QueuePriority) : this(priority, if (priority == QueuePriority.Normal) hack {
        waitForScreen()//TODO
        queue()
    } else queue)
}