Lobby prefs

This commit is contained in:
Anuken
2019-08-30 19:49:36 -04:00
parent 7e80a60e65
commit 7f2c7685b4
5 changed files with 22 additions and 1 deletions

View File

@@ -534,6 +534,7 @@ setting.sfxvol.name = SFX Volume
setting.mutesound.name = Mute Sound setting.mutesound.name = Mute Sound
setting.crashreport.name = Send Anonymous Crash Reports setting.crashreport.name = Send Anonymous Crash Reports
setting.savecreate.name = Auto-Create Saves setting.savecreate.name = Auto-Create Saves
setting.publichost.name = Public Game Visibility
setting.chatopacity.name = Chat Opacity setting.chatopacity.name = Chat Opacity
setting.playerchat.name = Display In-Game Chat setting.playerchat.name = Display In-Game Chat
uiscale.reset = UI scale has been changed.\nPress "OK" to confirm this scale.\n[scarlet]Reverting and exiting in[accent] {0}[] seconds... uiscale.reset = UI scale has been changed.\nPress "OK" to confirm this scale.\n[scarlet]Reverting and exiting in[accent] {0}[] seconds...

View File

@@ -13,6 +13,11 @@ import static io.anuke.mindustry.Vars.mobile;
public interface Platform{ public interface Platform{
/**Steam: Update lobby visibility.*/
default void updateLobby(){
}
/** Add a text input dialog that should show up after the field is tapped. */ /** Add a text input dialog that should show up after the field is tapped. */
default void addDialog(TextField field){ default void addDialog(TextField field){
addDialog(field, 16); addDialog(field, 16);

View File

@@ -223,6 +223,10 @@ public class SettingsMenuDialog extends SettingsDialog{
game.checkPref("savecreate", true); game.checkPref("savecreate", true);
game.checkPref("publichost", false, i -> {
platform.updateLobby();
});
game.pref(new Setting(){ game.pref(new Setting(){
@Override @Override
public void add(SettingsTable table){ public void add(SettingsTable table){

View File

@@ -156,6 +156,11 @@ public class DesktopLauncher extends ClientLauncher{
}); });
} }
@Override
public void updateLobby(){
steamCore.updateLobby();
}
@Override @Override
public void showFileChooser(String text, String content, Consumer<FileHandle> cons, boolean open, Predicate<String> filetype){ public void showFileChooser(String text, String content, Consumer<FileHandle> cons, boolean open, Predicate<String> filetype){
new FileChooser(text, file -> filetype.test(file.extension().toLowerCase()), open, cons).show(); new FileChooser(text, file -> filetype.test(file.extension().toLowerCase()), open, cons).show();

View File

@@ -147,7 +147,13 @@ public class SteamCoreNetImpl implements SteamNetworkingCallback, SteamMatchmaki
@Override @Override
public void host(int port) throws IOException{ public void host(int port) throws IOException{
smat.createLobby(LobbyType.values()[Core.settings.getInt("lobbytype", 2)], 32); smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 32);
}
public void updateLobby(){
if(currentLobby != null && Net.server()){
smat.setLobbyType(currentLobby, Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly);
}
} }
@Override @Override