This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val param = mapOf( | |
"PS" to mapOf( | |
"ts" to mapOf( | |
"pt" to "Lou", | |
"age" to 28 | |
) | |
), | |
"ENV" to mapOf( | |
"ver" to 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
import kotlin.random.Random | |
enum class GameEvent(val message: String): Event { | |
OnPlayerEnterArea("- 플레이어가 보코블린의 시야에 들어옵니다. -"), | |
OnPlayerLeaveArea("- 플레이어가 보코블린의 시야를 벗어납니다. -"), | |
CloseToAttack("- 보코블린의 타격 범위안에 플레이어가 있습니다. -"), | |
OnPlayerAttack("- 플레이어가 공격합니다 -"), | |
OnHealthZero("- 보코블린의 체력이 0이 되었습니다. -") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DialogHandlerImpl( | |
private val queue: DialogQueue, | |
): DialogHandler { | |
override fun <Req, Res> showDialog( | |
builder: DialogBuilder<Req, Res>, | |
req: Req, | |
priority: DialogQueue.Priority | |
) { | |
show(builder = builder, req = req, priority = priority) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DialogHandler { | |
fun <Req, Res> showDialog( | |
builder: DialogBuilder<Req, Res>, | |
req: Req, | |
priority: DialogQueue.Priority = DialogQueue.Priority.LOW | |
) | |
suspend fun <Res> showDialogForResult( | |
builder: DialogBuilder<Unit, Res>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DialogQueueImpl( | |
private val context: Context, | |
private val lifecycleOwner: LifecycleOwner, | |
private val fragmentManager: FragmentManager, | |
): DialogQueue { | |
private var showingElement: DialogQueueElement? = null | |
companion object { | |
private val queue = PriorityQueue<DialogQueueElement>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DialogQueue { | |
fun add(element: DialogQueueElement) | |
enum class Priority { | |
HIGH, | |
MEDIUM, | |
LOW, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{error::Error, net::UdpSocket, str::from_utf8}; | |
fn main() -> std::io::Result<()> { | |
let socket = UdpSocket::bind("[::]:2000")?; | |
let mut buf = [0; 65507]; | |
loop { | |
let (read, from) = socket.recv_from(&mut buf)?; | |
println!("Received {} bytes from {}", read, from); | |
socket.send_to(&buf[..read], from)?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
io::{stdin, BufRead}, | |
net::UdpSocket, | |
str::from_utf8, | |
}; | |
fn main() -> std::io::Result<()> { | |
let args: Vec<String> = std::env::args().collect(); | |
if args.len() < 2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.pager.HorizontalPager | |
import androidx.compose.foundation.pager.PagerState | |
import androidx.compose.foundation.pager.rememberPagerState | |
import androidx.compose.foundation.shape.RoundedCornerShape | |
import androidx.compose.material3.MaterialTheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.PaddingValues | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.pager.HorizontalPager | |
import androidx.compose.foundation.pager.PageSize | |
import androidx.compose.foundation.pager.PagerState | |
import androidx.compose.foundation.pager.rememberPagerState |
NewerOlder