Add custom text on screen (#1448)

This commit is contained in:
키에르 2020-01-27 07:56:11 +09:00 committed by Anuken
parent 9baaacc8ac
commit 9499b9dfaf
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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();