Netvoork
This commit is contained in:
parent
d7328fe437
commit
213d22d925
BIN
assets/tilesets/tileset_ground-atlas.png
Normal file
BIN
assets/tilesets/tileset_ground-atlas.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
assets/tilesets/tileset_ground-atlas_n.png
Normal file
BIN
assets/tilesets/tileset_ground-atlas_n.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -98,10 +98,7 @@ public partial class start_game_menu : Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta){}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startSingleGame() {
|
private void startSingleGame() {
|
||||||
|
|
||||||
@ -110,10 +107,38 @@ public partial class start_game_menu : Control
|
|||||||
|
|
||||||
}
|
}
|
||||||
private void startLANMultiGame(bool isHost = true) {
|
private void startLANMultiGame(bool isHost = true) {
|
||||||
|
const string ERR = "Invalid IP address.";
|
||||||
}
|
if (isHost) {
|
||||||
|
ENetMultiplayerPeer peer = new ENetMultiplayerPeer ();
|
||||||
private void selectLANMultiGame() {
|
peer.CreateServer(666, 2);
|
||||||
Error = "lanmulti";
|
Multiplayer.MultiplayerPeer = peer;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
string ip = _ip.Get("text").ToString();
|
||||||
|
|
||||||
|
if (!ip.Contains('.')) {
|
||||||
|
Error = ERR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] ips = ip.Split('.');
|
||||||
|
|
||||||
|
if (ips.Length != 4) {
|
||||||
|
Error = ERR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int x =0; x < 4; ++x) {
|
||||||
|
int val = 0;
|
||||||
|
if (!int.TryParse(ips[0], out val) || val < 0 || val > 255) {
|
||||||
|
Error = ERR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ENetMultiplayerPeer peer = new ENetMultiplayerPeer ();
|
||||||
|
peer.CreateClient(ip, 666);
|
||||||
|
Multiplayer.MultiplayerPeer = peer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user