Start working on networking
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:fullBackupContent="true"
|
android:fullBackupContent="true"
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.iofferyoutea.WitchQueen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.Net
|
||||||
|
|
||||||
|
class Lobby {
|
||||||
|
//val localServers: MutableSetOf<String> = setOf<String>() <-- HashSet?
|
||||||
|
|
||||||
|
//val localPlayer: Player = <-- Should be local player. Has all their items etc.
|
||||||
|
//val lobby: MutableList<Player> = listOf<Player>(localPlayer) <-- Limit to lobby size (2)?
|
||||||
|
|
||||||
|
val serverSocket = Gdx.net.newServerSocket(
|
||||||
|
Net.Protocol.TCP,
|
||||||
|
"127.0.0.1",
|
||||||
|
2864,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
|
||||||
|
val clientSocket = Gdx.net.newClientSocket(
|
||||||
|
Net.Protocol.TCP,
|
||||||
|
"127.0.0.1", // <- This should be other servers address
|
||||||
|
2864, // <- This should be other servers port
|
||||||
|
null
|
||||||
|
)
|
||||||
|
|
||||||
|
val inputStream = clientSocket.inputStream
|
||||||
|
|
||||||
|
private fun findLocalServer() {
|
||||||
|
Gdx.app.log("Lobby", "Finding local server...")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun replayHasLocalServer(remoteAddress: String, remotePort: Int) {
|
||||||
|
Gdx.app.log("Lobby", "Pinged by another client. Informing that we have an open lobby...")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun connectToServer(ip: String, port: Int) { // String is the ideal type for ip because v6 uses letters too?
|
||||||
|
Gdx.app.log("Lobby", "Connecting to $ip on port $port...")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user