spgashfetiti
This commit is contained in:
@@ -58,7 +58,7 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
cont.row();
|
cont.row();
|
||||||
|
|
||||||
cont.addButton("$hostserver", () -> {
|
cont.addButton("$hostserver", () -> {
|
||||||
if(net.active() && steam){
|
if(net.server() && steam){
|
||||||
platform.inviteFriends();
|
platform.inviteFriends();
|
||||||
}else{
|
}else{
|
||||||
if(steam){
|
if(steam){
|
||||||
@@ -67,7 +67,7 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
ui.host.show();
|
ui.host.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).disabled(b -> net.active() && !steam).colspan(2).width(dw * 2 + 20f).update(e -> e.setText(net.active() && steam && net.server() ? "$invitefriends" : "$hostserver"));
|
}).disabled(b -> !((steam && net.server()) || !net.active())).colspan(2).width(dw * 2 + 20f).update(e -> e.setText(net.server() && steam ? "$invitefriends" : "$hostserver"));
|
||||||
}
|
}
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
SVars.user = new SUser();
|
SVars.user = new SUser();
|
||||||
|
|
||||||
Events.on(ClientLoadEvent.class, event -> {
|
Events.on(ClientLoadEvent.class, event -> {
|
||||||
player.name = "ffmpeg";//SVars.net.friends.getPersonaName();
|
player.name = SVars.net.friends.getPersonaName();
|
||||||
Core.settings.defaults("name", SVars.net.friends.getPersonaName());
|
Core.settings.defaults("name", SVars.net.friends.getPersonaName());
|
||||||
Core.settings.put("name", player.name);
|
Core.settings.put("name", player.name);
|
||||||
Core.settings.save();
|
Core.settings.save();
|
||||||
|
|||||||
@@ -61,20 +61,31 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
|
|
||||||
if(net.server()){
|
if(net.server()){
|
||||||
SteamConnection con = steamConnections.get(fromID);
|
SteamConnection con = steamConnections.get(fromID);
|
||||||
//accept users on request
|
try{
|
||||||
if(con == null){
|
//accept users on request
|
||||||
con = new SteamConnection(from);
|
if(con == null){
|
||||||
Connect c = new Connect();
|
con = new SteamConnection(from);
|
||||||
c.addressTCP = "steam:" + from.getAccountID();
|
Connect c = new Connect();
|
||||||
|
c.addressTCP = "steam:" + from.getAccountID();
|
||||||
|
|
||||||
Log.info("&bRecieved connection: {0}", c.addressTCP);
|
Log.info("&bRecieved connection: {0}", c.addressTCP);
|
||||||
|
|
||||||
steamConnections.put(from.getAccountID(), con);
|
steamConnections.put(from.getAccountID(), con);
|
||||||
connections.add(con);
|
connections.add(con);
|
||||||
net.handleServerReceived(con, c);
|
net.handleServerReceived(con, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
net.handleServerReceived(con, output);
|
||||||
|
}catch(RuntimeException e){
|
||||||
|
if(e.getCause() instanceof ValidateException){
|
||||||
|
ValidateException v = (ValidateException)e.getCause();
|
||||||
|
Log.err("Validation failed: {0} ({1})", v.player.name, v.getMessage());
|
||||||
|
}else{
|
||||||
|
Log.err(e);
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
Log.err(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
net.handleServerReceived(con, output);
|
|
||||||
}else if(currentServer != null && fromID == currentServer.getAccountID()){
|
}else if(currentServer != null && fromID == currentServer.getAccountID()){
|
||||||
net.handleClientReceived(output);
|
net.handleClientReceived(output);
|
||||||
}
|
}
|
||||||
@@ -169,6 +180,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
public void hostServer(int port) throws IOException{
|
public void hostServer(int port) throws IOException{
|
||||||
provider.hostServer(port);
|
provider.hostServer(port);
|
||||||
smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 16);
|
smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 16);
|
||||||
|
|
||||||
|
Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: {0}\nClient: {1}\nActive: {2}", net.server(), net.client(), net.active()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLobby(){
|
public void updateLobby(){
|
||||||
@@ -237,6 +250,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
currentLobby = steamIDLobby;
|
currentLobby = steamIDLobby;
|
||||||
currentServer = smat.getLobbyOwner(steamIDLobby);
|
currentServer = smat.getLobbyOwner(steamIDLobby);
|
||||||
|
|
||||||
|
Log.info("Connect to {0}");
|
||||||
|
|
||||||
if(joinCallback != null){
|
if(joinCallback != null){
|
||||||
joinCallback.run();
|
joinCallback.run();
|
||||||
joinCallback = null;
|
joinCallback = null;
|
||||||
@@ -247,6 +262,8 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
|
|
||||||
net.setClientConnected();
|
net.setClientConnected();
|
||||||
net.handleClientReceived(con);
|
net.handleClientReceived(con);
|
||||||
|
|
||||||
|
Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: {0}\nClient: {1}\nActive: {2}", net.server(), net.client(), net.active()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -421,6 +438,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
public SteamConnection(SteamID sid){
|
public SteamConnection(SteamID sid){
|
||||||
super(sid.getAccountID() + "");
|
super(sid.getAccountID() + "");
|
||||||
this.sid = sid;
|
this.sid = sid;
|
||||||
|
Log.info("Create STEAM client {0}", sid.getAccountID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user