mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-14 02:41:41 -07:00
ClientServerConnectEvent (#8309)
This commit is contained in:
parent
b65c3cd931
commit
29f36c1927
2 changed files with 12 additions and 0 deletions
|
|
@ -162,6 +162,16 @@ public class EventType{
|
|||
}
|
||||
}
|
||||
|
||||
public static class ClientServerConnectEvent{
|
||||
public final String ip;
|
||||
public final int port;
|
||||
|
||||
public ClientServerConnectEvent(String ip, int port){
|
||||
this.ip = ip;
|
||||
this.port = port;
|
||||
}
|
||||
}
|
||||
|
||||
/** Consider using Menus.registerMenu instead. */
|
||||
public static class MenuOptionChooseEvent{
|
||||
public final Player player;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import arc.func.*;
|
|||
import arc.net.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import mindustry.net.Streamable.*;
|
||||
|
|
@ -154,6 +155,7 @@ public class Net{
|
|||
public void connect(String ip, int port, Runnable success){
|
||||
try{
|
||||
if(!active){
|
||||
Events.fire(new ClientServerConnectEvent(ip, port));
|
||||
provider.connectClient(ip, port, success);
|
||||
active = true;
|
||||
server = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue