From 9499b9dfaf2eacd2120955957d89258542adf383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=82=A4=EC=97=90=EB=A5=B4?= <44261958+Kieaer@users.noreply.github.com> Date: Mon, 27 Jan 2020 07:56:11 +0900 Subject: [PATCH] Add custom text on screen (#1448) --- core/src/mindustry/core/NetClient.java | 5 +++++ core/src/mindustry/core/UI.java | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index b961b62385..0823bf4a7b 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 onInfoPopup(String message, float duration, int align, int top, int left, int bottom, int right){ + ui.showInfoPopup(message, duration, align, top, left, bottom, right); + } + @Remote(variants = Variant.both) public static void onInfoToast(String message, float duration){ ui.showInfoToast(message, duration); diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index ab7587e9d5..ab99bf8ae9 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -302,6 +302,15 @@ public class UI implements ApplicationListener, Loadable{ Core.scene.add(table); } + public void showInfoPopup(String info, float duration, int align, int top, int left, int bottom, int right){ + Table table = new Table(); + table.setFillParent(true); + table.update(() -> { if(state.is(State.menu)) table.remove(); }); + table.actions(Actions.delay(duration), Actions.remove()); + table.align(align).table(Styles.black3, t -> t.margin(4).add(info).style(Styles.outlineLabel)).pad(top,left,bottom,right); + Core.scene.add(table); + } + public void showInfo(String info){ new Dialog(""){{ getCell(cont).growX();