blob: 362c27074c11e670e66ff44c65b2fdb393958e89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import o1game.Client.newClient
import o1game.Server.Server
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.io.StdIn.readLine
// TODO: add proper logic for starting the game
@main def main(): Unit =
print("How do you want to play?\n1) Host and join local game\n2) Join local game\n> ")
readLine().toIntOption match
case Some(1) =>
Future(Server(2267, 5, 30, true).startServer())
println("Server started in background.")
print("Choose a name:\n> ")
val name = readLine()
newClient(name, "127.0.0.1", 2267).map(_.startClient())
case Some(2) =>
print("Choose a name:\n> ")
val name = readLine()
newClient(name, "127.0.0.1", 2267).map(_.startClient())
case _ => println("Invalid input")
|