diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index b440ef283f..9508ad94e3 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -268,7 +268,7 @@ public class NetClient implements ApplicationListener{ @Remote(variants = Variant.both) public static void onInfoToast(String message, float duration){ - ui.showInfoFadeBg(message, duration); + ui.showInfoToast(message, duration); } @Remote(variants = Variant.both) diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 3a35f9f4db..70606c55d5 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -289,9 +289,14 @@ public class UI implements ApplicationListener, Loadable{ Core.scene.add(table); } - public void showInfoFadeBg(String info, float duration){ + public void showInfoToast(String info, float duration){ Table table = new Table(); table.setFillParent(true); + table.update(() -> { + if(state.is(State.menu)){ + table.remove(); + } + }); table.actions(Actions.delay(duration * 0.9f), Actions.fadeOut(duration * 0.1f, Interpolation.fade), Actions.remove()); table.top().table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).padTop(10); Core.scene.add(table);