diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 89d2a600f8..b440ef283f 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -266,6 +266,11 @@ public class NetClient implements ApplicationListener{ ui.showText("", message); } + @Remote(variants = Variant.both) + public static void onInfoToast(String message, float duration){ + ui.showInfoFadeBg(message, duration); + } + @Remote(variants = Variant.both) public static void onSetRules(Rules rules){ state.rules = rules; diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 63a09aecc6..3a35f9f4db 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -289,6 +289,14 @@ public class UI implements ApplicationListener, Loadable{ Core.scene.add(table); } + public void showInfoFadeBg(String info, float duration){ + Table table = new Table(); + table.setFillParent(true); + 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); + } + public void showInfo(String info){ new Dialog(""){{ getCell(cont).growX();