Fixed Steam public lobby hosting / Misc Steam bugfixes
This commit is contained in:
@@ -322,6 +322,24 @@ public class UI implements ApplicationListener, Loadable{
|
||||
Core.scene.add(table);
|
||||
}
|
||||
|
||||
public void addDescTooltip(Element elem, String description){
|
||||
if(description == null) return;
|
||||
|
||||
elem.addListener(new Tooltip(t -> t.background(Styles.black8).margin(4f).add(description).color(Color.lightGray)){
|
||||
{
|
||||
allowMobile = true;
|
||||
}
|
||||
@Override
|
||||
protected void setContainerPosition(Element element, float x, float y){
|
||||
this.targetActor = element;
|
||||
Vec2 pos = element.localToStageCoordinates(Tmp.v1.set(0, 0));
|
||||
container.pack();
|
||||
container.setPosition(pos.x, pos.y, Align.topLeft);
|
||||
container.setOrigin(0, element.getHeight());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Shows a fading label at the top of the screen. */
|
||||
public void showInfoToast(String info, float duration){
|
||||
var cinfo = Core.scene.find("coreinfo");
|
||||
|
||||
@@ -38,6 +38,15 @@ public class HostDialog extends BaseDialog{
|
||||
button.update(() -> button.getStyle().imageUpColor = player.color());
|
||||
}).width(w).height(70f).pad(4).colspan(3);
|
||||
|
||||
if(steam){
|
||||
cont.row();
|
||||
|
||||
cont.add().width(65f);
|
||||
|
||||
cont.check("@steam.friendsonly", !Core.settings.getBool("steampublichost"), val -> Core.settings.put("steampublichost", !val)).colspan(2).left()
|
||||
.with(c -> ui.addDescTooltip(c, "@steam.friendsonly.tooltip")).padBottom(15f).row();
|
||||
}
|
||||
|
||||
cont.row();
|
||||
|
||||
cont.add().width(65f);
|
||||
@@ -51,7 +60,11 @@ public class HostDialog extends BaseDialog{
|
||||
runHost();
|
||||
}).width(w).height(70f);
|
||||
|
||||
cont.button("?", () -> ui.showInfo("@host.info")).size(65f, 70f).padLeft(6f);
|
||||
if(!steam){
|
||||
cont.button("?", () -> ui.showInfo("@host.info")).size(65f, 70f).padLeft(6f);
|
||||
}else{
|
||||
cont.add().size(65f, 70f).padLeft(6f);
|
||||
}
|
||||
|
||||
shown(() -> {
|
||||
if(!steam){
|
||||
@@ -68,24 +81,9 @@ public class HostDialog extends BaseDialog{
|
||||
player.admin = true;
|
||||
Events.fire(new HostEvent());
|
||||
|
||||
if(steam){
|
||||
Core.app.post(() -> Core.settings.getBoolOnce("steampublic3", () -> {
|
||||
ui.showCustomConfirm("@setting.publichost.name", "@public.confirm", "@yes", "@no", () -> {
|
||||
ui.showCustomConfirm("@setting.publichost.name", "@public.confirm.really", "@no", "@yes", () -> {
|
||||
Core.settings.put("publichost", true);
|
||||
platform.updateLobby();
|
||||
}, () -> {
|
||||
Core.settings.put("publichost", false);
|
||||
platform.updateLobby();
|
||||
});
|
||||
}, () -> {
|
||||
Core.settings.put("publichost", false);
|
||||
platform.updateLobby();
|
||||
});
|
||||
}));
|
||||
|
||||
if(steam && Core.settings.getBool("steampublichost")){
|
||||
if(Version.modifier.contains("beta") || Version.modifier.contains("alpha")){
|
||||
Core.settings.put("publichost", false);
|
||||
Core.settings.put("steampublichost", false);
|
||||
platform.updateLobby();
|
||||
Core.settings.getBoolOnce("betapublic", () -> ui.showInfo("@public.beta"));
|
||||
}
|
||||
|
||||
@@ -53,11 +53,7 @@ public class PausedDialog extends BaseDialog{
|
||||
if(net.server() && steam){
|
||||
platform.inviteFriends();
|
||||
}else{
|
||||
if(steam){
|
||||
ui.host.runHost();
|
||||
}else{
|
||||
ui.host.show();
|
||||
}
|
||||
ui.host.show();
|
||||
}
|
||||
}).disabled(b -> !((steam && net.server()) || !net.active())).colspan(2).width(dw * 2 + 10f).update(e -> e.setText(net.server() && steam ? "@invitefriends" : "@hostserver"));
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import arc.func.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
import arc.input.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.style.*;
|
||||
@@ -356,7 +355,7 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
});
|
||||
|
||||
if(!Version.modifier.contains("beta")){
|
||||
game.checkPref("publichost", false, i -> {
|
||||
game.checkPref("steampublichost", false, i -> {
|
||||
platform.updateLobby();
|
||||
});
|
||||
}
|
||||
@@ -707,21 +706,7 @@ public class SettingsMenuDialog extends BaseDialog{
|
||||
public abstract void add(SettingsTable table);
|
||||
|
||||
public void addDesc(Element elem){
|
||||
if(description == null) return;
|
||||
|
||||
elem.addListener(new Tooltip(t -> t.background(Styles.black8).margin(4f).add(description).color(Color.lightGray)){
|
||||
{
|
||||
allowMobile = true;
|
||||
}
|
||||
@Override
|
||||
protected void setContainerPosition(Element element, float x, float y){
|
||||
this.targetActor = element;
|
||||
Vec2 pos = element.localToStageCoordinates(Tmp.v1.set(0, 0));
|
||||
container.pack();
|
||||
container.setPosition(pos.x, pos.y, Align.topLeft);
|
||||
container.setOrigin(0, element.getHeight());
|
||||
}
|
||||
});
|
||||
ui.addDescTooltip(elem, description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user