David Edwards
06/30/2021, 8:13 PM@Composable
fun BotScreen(host: BotHost) {
Column {
val characterList = host.playerStateMap()
HorizontalRule()
ListCharacters(list = characterList)
HorizontalRule()
ListLogs(state = LogController.state)
HorizontalRule()
}
}
David Edwards
06/30/2021, 8:13 PMColton Idle
06/30/2021, 8:56 PMTash
06/30/2021, 10:33 PMefemoney
06/30/2021, 11:26 PMDavid Edwards
07/01/2021, 6:40 AMcom.
(in code it was org.
).
Then I had issues with it not updating. It turns out that when the runMosaic
scope body is at the end, the whole Mosaic system stops. Which makes sense. You just need to keep it running. Which can probably be done by waiting for user input. My bot doesn't accept command line input yet, so it uses a naughty function to keep it going:
suspend fun MosaicScope.neverStop() = let { while (true) yield() }
fun main() = runMosaic {
val host = BotHost(this)
setContent {
BotScreen(host = host)
}
neverStop()
}
David Edwards
07/01/2021, 6:41 AM@Composable
fun PaddedText(text: String, maxLength: Int) {
Text(text.take(maxLength - 1).padEnd(maxLength))
}
efemoney
07/01/2021, 10:05 AMawaitCancellation
instead of the loop (neverStop
)David Edwards
07/01/2021, 11:48 AM