Initial UI cleanup commit
This commit is contained in:
@@ -3,65 +3,40 @@ package io.anuke.mindustry.core;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Mindustry;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.mapeditor.MapEditor;
|
||||
import io.anuke.mindustry.mapeditor.MapEditorDialog;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
import io.anuke.mindustry.ui.dialogs.*;
|
||||
import io.anuke.mindustry.ui.fragments.*;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.Configurable;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.modules.SceneModule;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.Skin;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.builders.build;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.ui.*;
|
||||
import io.anuke.ucore.scene.ui.Dialog;
|
||||
import io.anuke.ucore.scene.ui.TextField;
|
||||
import io.anuke.ucore.scene.ui.TextField.TextFieldFilter;
|
||||
import io.anuke.ucore.scene.ui.TextField.TextFieldFilter.DigitsOnlyFilter;
|
||||
import io.anuke.ucore.scene.ui.Window.WindowStyle;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.scene.ui.TooltipManager;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
import static io.anuke.ucore.scene.actions.Actions.*;
|
||||
|
||||
public class UI extends SceneModule{
|
||||
Table loadingtable, configtable;
|
||||
MindustrySettingsDialog prefs;
|
||||
MindustryKeybindDialog keys;
|
||||
MapEditorDialog editorDialog;
|
||||
Dialog about, restart, levels, upgrades, load, settingserror, gameerror, discord, join;
|
||||
MenuDialog menu;
|
||||
Tooltip tooltip;
|
||||
Tile configTile;
|
||||
MapEditor editor;
|
||||
boolean wasPaused = false;
|
||||
|
||||
private Fragment menufrag = new MenuFragment(),
|
||||
toolfrag = new ToolFragment(),
|
||||
hudfrag = new HudFragment(),
|
||||
placefrag = new PlacementFragment(),
|
||||
weaponfrag = new WeaponFragment(),
|
||||
chatfrag = new ChatFragment(),
|
||||
listfrag = new PlayerListFragment();
|
||||
public Dialog about, restart, levels, upgrades, load, discord, join, menu, prefs, keys, editor;
|
||||
|
||||
public final MenuFragment menufrag = new MenuFragment();
|
||||
public final ToolFragment toolfrag = new ToolFragment();
|
||||
public final HudFragment hudfrag = new HudFragment();
|
||||
public final PlacementFragment placefrag = new PlacementFragment();
|
||||
public final WeaponFragment weaponfrag = new WeaponFragment();
|
||||
public final ChatFragment chatfrag = new ChatFragment();
|
||||
public final PlayerListFragment listfrag = new PlayerListFragment();
|
||||
public final BackgroundFragment backfrag = new BackgroundFragment();
|
||||
public final LoadingFragment loadfrag = new LoadingFragment();
|
||||
|
||||
public UI() {
|
||||
Dialog.setShowAction(()-> sequence(
|
||||
@@ -89,7 +64,7 @@ public class UI extends SceneModule{
|
||||
|
||||
TooltipManager.getInstance().animations = false;
|
||||
|
||||
Settings.setErrorHandler(()-> Timers.run(1f, ()-> settingserror.show()));
|
||||
Settings.setErrorHandler(()-> Timers.run(1f, ()-> showError("[crimson]Failed to access local storage.\nSettings will not be saved.")));
|
||||
|
||||
Settings.defaults("pixelate", true);
|
||||
|
||||
@@ -114,261 +89,66 @@ public class UI extends SceneModule{
|
||||
Colors.put("breakStart", Color.YELLOW);
|
||||
Colors.put("breakInvalid", Color.RED);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void loadSkin(){
|
||||
skin = new Skin(Gdx.files.internal("ui/uiskin.json"), Core.atlas);
|
||||
}
|
||||
|
||||
void drawBackground(){
|
||||
int w = (int)screen.x;
|
||||
int h = (int)screen.y;
|
||||
|
||||
Draw.color();
|
||||
|
||||
TextureRegion back = Draw.region("background");
|
||||
float backscl = Unit.dp.scl(5f);
|
||||
|
||||
Draw.alpha(0.7f);
|
||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
||||
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
||||
|
||||
float logoscl = (int)Unit.dp.scl(7);
|
||||
TextureRegion logo = skin.getRegion("logotext");
|
||||
float logow = logo.getRegionWidth()*logoscl;
|
||||
float logoh = logo.getRegionHeight()*logoscl;
|
||||
|
||||
|
||||
Draw.color();
|
||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15, logow, logoh);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(Vars.debug && !Vars.showUI) return;
|
||||
|
||||
if(GameState.is(State.menu)){
|
||||
scene.getBatch().getProjectionMatrix().setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
scene.getBatch().begin();
|
||||
|
||||
drawBackground();
|
||||
|
||||
scene.getBatch().end();
|
||||
}
|
||||
|
||||
scene.act();
|
||||
scene.draw();
|
||||
|
||||
if(control.showCursor()) {
|
||||
Draw.color();
|
||||
|
||||
float scl = Unit.dp.scl(3f);
|
||||
scene.getBatch().begin();
|
||||
Draw.rect("controller-cursor", Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), 16*scl, 16*scl);
|
||||
scene.getBatch().end();
|
||||
|
||||
Graphics.begin();
|
||||
Draw.rect("controller-cursor", Graphics.mouse().x, Graphics.mouse().y, 16*scl, 16*scl);
|
||||
Graphics.end();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
|
||||
configtable = new Table();
|
||||
scene.add(configtable);
|
||||
|
||||
if(!Vars.gwt){
|
||||
editor = new MapEditor();
|
||||
editorDialog = new MapEditorDialog(editor);
|
||||
editor = new MapEditorDialog();
|
||||
}
|
||||
|
||||
settingserror = new Dialog("Warning", "dialog");
|
||||
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
|
||||
settingserror.content().margin(10f);
|
||||
settingserror.getButtonTable().addButton("OK", settingserror::hide).size(80f, 55f).pad(4);
|
||||
|
||||
gameerror = new Dialog("$text.error.crashtitle", "dialog");
|
||||
gameerror.content().labelWrap("$text.error.crashmessage").width(600f).pad(10f);
|
||||
gameerror.buttons().addButton("#text.ok", gameerror::hide).size(200f, 50);
|
||||
|
||||
restart = new RestartDialog();
|
||||
join = new JoinDialog();
|
||||
|
||||
discord = new Dialog("Discord", "dialog");
|
||||
discord.content().margin(12f);
|
||||
discord.content().add("$text.discord");
|
||||
discord.content().row();
|
||||
discord.content().add("[orange]"+Vars.discordURL);
|
||||
discord.buttons().defaults().size(200f, 50);
|
||||
discord.buttons().addButton("$text.openlink", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
||||
discord.buttons().addButton("$text.back", discord::hide);
|
||||
|
||||
discord = new DiscordDialog();
|
||||
load = new LoadDialog();
|
||||
|
||||
upgrades = new UpgradeDialog();
|
||||
|
||||
levels = new LevelDialog();
|
||||
|
||||
prefs = new MindustrySettingsDialog();
|
||||
prefs.setStyle(Core.skin.get("dialog", WindowStyle.class));
|
||||
|
||||
menu = new MenuDialog();
|
||||
|
||||
prefs.sound.volumePrefs();
|
||||
|
||||
prefs.game.sliderPref("difficulty", 1, 0, 2, i -> Bundles.get("setting.difficulty." + (i == 0 ? "easy" : i == 1 ? "normal" : "hard")));
|
||||
prefs.game.screenshakePref();
|
||||
prefs.game.checkPref("smoothcam", true);
|
||||
prefs.game.checkPref("indicators", true);
|
||||
prefs.game.checkPref("effects", true);
|
||||
prefs.game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
|
||||
prefs.game.sliderPref("saveinterval", 90, 15, 5*120, i -> Bundles.format("setting.seconds", i));
|
||||
|
||||
prefs.graphics.checkPref("fps", false);
|
||||
prefs.graphics.checkPref("vsync", true, b -> Gdx.graphics.setVSync(b));
|
||||
prefs.graphics.checkPref("lasers", true);
|
||||
prefs.graphics.checkPref("healthbars", true);
|
||||
prefs.graphics.checkPref("pixelate", true, b->{
|
||||
if(b){
|
||||
Vars.renderer.pixelSurface.setScale(Core.cameraScale);
|
||||
Vars.renderer.shadowSurface.setScale(Core.cameraScale);
|
||||
Vars.renderer.shieldSurface.setScale(Core.cameraScale);
|
||||
}else{
|
||||
Vars.renderer.shadowSurface.setScale(1);
|
||||
Vars.renderer.shieldSurface.setScale(1);
|
||||
}
|
||||
renderer.setPixelate(b);
|
||||
});
|
||||
|
||||
Gdx.graphics.setVSync(Settings.getBool("vsync"));
|
||||
|
||||
prefs.hidden(()->{
|
||||
if(!GameState.is(State.menu)){
|
||||
if(!wasPaused || Net.active())
|
||||
GameState.set(State.playing);
|
||||
}
|
||||
});
|
||||
|
||||
prefs.shown(()->{
|
||||
if(!GameState.is(State.menu)){
|
||||
wasPaused = GameState.is(State.paused);
|
||||
if(menu.getScene() != null){
|
||||
wasPaused = menu.wasPaused;
|
||||
}
|
||||
if(!Net.active()) GameState.set(State.paused);
|
||||
menu.hide();
|
||||
}
|
||||
});
|
||||
|
||||
keys = new MindustryKeybindDialog();
|
||||
|
||||
about = new FloatingDialog("About");
|
||||
about.addCloseButton();
|
||||
for(String text : aboutText){
|
||||
about.content().add(text).left();
|
||||
about.content().row();
|
||||
}
|
||||
|
||||
restart = new Dialog("$text.gameover", "dialog");
|
||||
|
||||
restart.shown(()->{
|
||||
restart.content().clearChildren();
|
||||
if(control.isHighScore()){
|
||||
restart.content().add("$text.highscore").pad(6);
|
||||
restart.content().row();
|
||||
}
|
||||
restart.content().add("$text.lasted").pad(12).get();
|
||||
restart.content().add("[GREEN]" + control.getWave());
|
||||
restart.pack();
|
||||
});
|
||||
|
||||
restart.getButtonTable().addButton("$text.menu", ()->{
|
||||
restart.hide();
|
||||
GameState.set(State.menu);
|
||||
control.reset();
|
||||
}).size(200, 50).pad(3);
|
||||
about = new AboutDialog();
|
||||
|
||||
build.begin(scene);
|
||||
|
||||
|
||||
backfrag.build();
|
||||
weaponfrag.build();
|
||||
|
||||
hudfrag.build();
|
||||
|
||||
menufrag.build();
|
||||
|
||||
placefrag.build();
|
||||
|
||||
loadingtable = new table("loadDim"){{
|
||||
touchable(Touchable.enabled);
|
||||
get().addImage("white").growX()
|
||||
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||
row();
|
||||
new label("$text.loading"){{
|
||||
get().setName("namelabel");
|
||||
}}.pad(10);
|
||||
row();
|
||||
get().addImage("white").growX()
|
||||
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||
}}.end().get();
|
||||
|
||||
loadingtable.setVisible(false);
|
||||
|
||||
toolfrag.build();
|
||||
|
||||
chatfrag.build();
|
||||
|
||||
listfrag.build();
|
||||
|
||||
updateItems();
|
||||
loadfrag.build();
|
||||
|
||||
build.end();
|
||||
}
|
||||
|
||||
public void addChatMessage(String sender, String message){
|
||||
((ChatFragment)chatfrag).addMessage(message, sender);
|
||||
}
|
||||
|
||||
public void showGameError(){
|
||||
gameerror.show();
|
||||
}
|
||||
|
||||
public void updateWeapons(){
|
||||
((WeaponFragment)weaponfrag).updateWeapons();
|
||||
}
|
||||
|
||||
public void fadeRespawn(boolean in){
|
||||
((HudFragment)hudfrag).fadeRespawn(in);
|
||||
}
|
||||
|
||||
public void showConfig(Tile tile){
|
||||
configTile = tile;
|
||||
|
||||
configtable.clear();
|
||||
((Configurable)tile.block()).buildTable(tile, configtable);
|
||||
configtable.pack();
|
||||
configtable.setTransform(true);
|
||||
configtable.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
|
||||
Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));
|
||||
|
||||
configtable.update(()->{
|
||||
configtable.setOrigin(Align.center);
|
||||
Vector2 pos = Graphics.screen(tile.worldx(), tile.worldy());
|
||||
configtable.setPosition(pos.x, pos.y, Align.center);
|
||||
if(configTile == null || configTile.block() == Blocks.air){
|
||||
hideConfig();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean hasConfigMouse(){
|
||||
Element e = scene.hit(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), true);
|
||||
return e != null && (e == configtable || e.isDescendantOf(configtable));
|
||||
}
|
||||
|
||||
public void hideConfig(){
|
||||
configtable.actions(Actions.scaleTo(0f, 1f, 0.06f, Interpolation.pow3Out), Actions.visible(false));
|
||||
}
|
||||
|
||||
public void showTextInput(String title, String text, String def, TextFieldFilter filter, Consumer<String> confirmed){
|
||||
new Dialog(title, "dialog"){{
|
||||
content().margin(30);
|
||||
content().add(text).padRight(6f);
|
||||
content().margin(30).add(text).padRight(6f);
|
||||
TextField field = content().addField(def, t->{}).size(170f, 50f).get();
|
||||
field.setTextFieldFilter((f, c) -> field.getText().length() < 12 && filter.acceptChar(f, c));
|
||||
Mindustry.platforms.addDialog(field);
|
||||
@@ -387,150 +167,11 @@ public class UI extends SceneModule{
|
||||
|
||||
public void showError(String text){
|
||||
new Dialog("$text.error.title", "dialog"){{
|
||||
content().margin(15);
|
||||
content().add(text);
|
||||
content().margin(15).add(text);
|
||||
buttons().addButton("$text.ok", this::hide).size(90, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
public void showErrorClose(String text){
|
||||
new Dialog("$text.error.title", "dialog"){{
|
||||
content().margin(15);
|
||||
content().add(text);
|
||||
buttons().addButton("$text.quit", Gdx.app::exit).size(90, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
public void showLoading(){
|
||||
showLoading("$text.loading");
|
||||
}
|
||||
|
||||
public void showLoading(String text){
|
||||
loadingtable.<Label>find("namelabel").setText(text);
|
||||
loadingtable.setVisible(true);
|
||||
loadingtable.toFront();
|
||||
}
|
||||
|
||||
public void hideLoading(){
|
||||
loadingtable.setVisible(false);
|
||||
}
|
||||
|
||||
public void showPrefs(){
|
||||
prefs.show();
|
||||
}
|
||||
|
||||
public void showControls(){
|
||||
keys.show();
|
||||
}
|
||||
|
||||
public void showLevels(){
|
||||
levels.show();
|
||||
}
|
||||
|
||||
public void showLoadGame(){
|
||||
load.show();
|
||||
}
|
||||
|
||||
public void showJoinGame(){
|
||||
join.show();
|
||||
}
|
||||
|
||||
public void hideJoinGame(){
|
||||
join.hide();
|
||||
}
|
||||
|
||||
public void showMenu(){
|
||||
menu.show();
|
||||
}
|
||||
|
||||
public void hideMenu(){
|
||||
menu.hide();
|
||||
|
||||
if(scene.getKeyboardFocus() != null && scene.getKeyboardFocus() instanceof Dialog){
|
||||
((Dialog)scene.getKeyboardFocus()).hide();
|
||||
}
|
||||
}
|
||||
|
||||
public void showRestart(){
|
||||
restart.show();
|
||||
}
|
||||
|
||||
public void hideTooltip(){
|
||||
if(tooltip != null)
|
||||
tooltip.hide();
|
||||
}
|
||||
|
||||
public void showInfo(String info){
|
||||
scene.table().add(info).get().getParent().actions(Actions.fadeOut(4f), Actions.removeActor());
|
||||
}
|
||||
|
||||
public void showHostServer(){
|
||||
showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
|
||||
int result = Strings.parseInt(text);
|
||||
if(result == Integer.MIN_VALUE || result >= 65535){
|
||||
Vars.ui.showError("$text.server.invalidport");
|
||||
}else{
|
||||
try{
|
||||
Net.host(result);
|
||||
}catch (IOException e){
|
||||
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showAbout(){
|
||||
about.show();
|
||||
}
|
||||
|
||||
public boolean onDialog(){
|
||||
return scene.getKeyboardFocus() instanceof Dialog;
|
||||
}
|
||||
|
||||
public boolean isGameOver(){
|
||||
return restart.getScene() != null;
|
||||
}
|
||||
|
||||
public void showUpgrades(){
|
||||
upgrades.show();
|
||||
}
|
||||
|
||||
public void showDiscord(){
|
||||
discord.show();
|
||||
}
|
||||
|
||||
public void showEditor(){
|
||||
editorDialog.show();
|
||||
}
|
||||
|
||||
public MapEditorDialog getEditorDialog(){
|
||||
return editorDialog;
|
||||
}
|
||||
|
||||
public ToolFragment getTools(){
|
||||
return (ToolFragment)toolfrag;
|
||||
}
|
||||
|
||||
public MapEditor getEditor(){
|
||||
return editor;
|
||||
}
|
||||
|
||||
public void reloadLevels(){
|
||||
((LevelDialog)levels).reload();
|
||||
}
|
||||
|
||||
public boolean isEditing(){
|
||||
return editorDialog.getScene() != null;
|
||||
}
|
||||
|
||||
public void updateItems(){
|
||||
((HudFragment)hudfrag).updateItems();
|
||||
}
|
||||
|
||||
public MindustrySettingsDialog getPrefs() {
|
||||
return prefs;
|
||||
}
|
||||
|
||||
public void showConfirm(String title, String text, Listenable confirmed){
|
||||
FloatingDialog dialog = new FloatingDialog(title);
|
||||
dialog.content().add(text).pad(4f);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ui.FileChooser;
|
||||
import io.anuke.mindustry.ui.dialogs.FileChooser;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.ColorMapper;
|
||||
import io.anuke.mindustry.world.ColorMapper.BlockPair;
|
||||
@@ -37,9 +37,8 @@ public class MapEditorDialog extends Dialog{
|
||||
|
||||
private ButtonGroup<ImageButton> blockgroup;
|
||||
|
||||
public MapEditorDialog(MapEditor editor){
|
||||
public MapEditorDialog(){
|
||||
super("$text.mapeditor", "dialog");
|
||||
this.editor = editor;
|
||||
dialog = new MapGenerateDialog(editor);
|
||||
view = new MapView(editor);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.badlogic.gdx.utils.Scaling;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.mapeditor.MapFilter.GenPref;
|
||||
import io.anuke.mindustry.ui.BorderImage;
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Pixmaps;
|
||||
import io.anuke.ucore.scene.style.TextureRegionDrawable;
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.mapeditor;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ui.BorderImage;
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.mindustry.world.Map;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.mapeditor;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.function.BiConsumer;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.mapeditor;
|
||||
|
||||
import io.anuke.mindustry.Mindustry;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.mindustry.world.Map;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.ui.*;
|
||||
import io.anuke.ucore.scene.ui.layout.Stack;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class MindustrySettingsDialog extends SettingsDialog{
|
||||
public SettingsTable graphics;
|
||||
public SettingsTable game;
|
||||
public SettingsTable sound;
|
||||
|
||||
private Table prefs;
|
||||
private Table menu;
|
||||
private boolean built = false;
|
||||
|
||||
public MindustrySettingsDialog(){
|
||||
setFillParent(true);
|
||||
title().setAlignment(Align.center);
|
||||
getTitleTable().row();
|
||||
getTitleTable().add(new Image("white"))
|
||||
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
||||
|
||||
content().clearChildren();
|
||||
content().remove();
|
||||
buttons().remove();
|
||||
|
||||
menu = new Table();
|
||||
|
||||
Consumer<SettingsTable> s = table -> {
|
||||
table.row();
|
||||
table.addImageTextButton("$text.back", "icon-arrow-left", 10*3, this::back).size(240f, 60f).colspan(2).padTop(15f);
|
||||
};
|
||||
|
||||
game = new SettingsTable(s);
|
||||
graphics = new SettingsTable(s);
|
||||
sound = new SettingsTable(s);
|
||||
|
||||
prefs = new Table();
|
||||
prefs.top();
|
||||
prefs.margin(14f);
|
||||
|
||||
menu.defaults().size(300f, 60f).pad(3f);
|
||||
menu.addButton("$text.settings.game", () -> visible(0));
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.graphics", () -> visible(1));
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.sound", () -> visible(2));
|
||||
|
||||
if(!Vars.android) {
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.controls", () -> Vars.ui.showControls());
|
||||
}
|
||||
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
|
||||
ScrollPane pane = new ScrollPane(prefs, "clear");
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
row();
|
||||
add(pane).grow().top();
|
||||
row();
|
||||
add(buttons()).fillX();
|
||||
|
||||
hidden(this::back);
|
||||
}
|
||||
|
||||
private void back(){
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
}
|
||||
|
||||
private void visible(int index){
|
||||
prefs.clearChildren();
|
||||
Table table = Mathf.select(index, game, graphics, sound);
|
||||
prefs.add(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons().addImageTextButton("$text.menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||
|
||||
keyDown(key->{
|
||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||
hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
17
core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java
Normal file
17
core/src/io/anuke/mindustry/ui/dialogs/AboutDialog.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import static io.anuke.mindustry.Vars.aboutText;
|
||||
|
||||
public class AboutDialog extends FloatingDialog {
|
||||
|
||||
public AboutDialog(){
|
||||
super("$text.about");
|
||||
|
||||
addCloseButton();
|
||||
|
||||
for(String text : aboutText){
|
||||
content().add(text).left();
|
||||
content().row();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
core/src/io/anuke/mindustry/ui/dialogs/DiscordDialog.java
Normal file
19
core/src/io/anuke/mindustry/ui/dialogs/DiscordDialog.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.mindustry.Mindustry;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.ucore.scene.ui.Dialog;
|
||||
|
||||
public class DiscordDialog extends Dialog {
|
||||
|
||||
public DiscordDialog(){
|
||||
super("Discord", "dialog");
|
||||
content().margin(12f);
|
||||
content().add("$text.discord");
|
||||
content().row();
|
||||
content().add("[orange]"+ Vars.discordURL);
|
||||
buttons().defaults().size(200f, 50);
|
||||
buttons().addButton("$text.openlink", () -> Mindustry.platforms.openLink(Vars.discordURL));
|
||||
buttons().addButton("$text.back", this::hide);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
@@ -17,7 +17,7 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class FileChooser extends FloatingDialog{
|
||||
public class FileChooser extends FloatingDialog {
|
||||
private Table files;
|
||||
private FileHandle homeDirectory = Gdx.files.absolute(Gdx.files.getExternalStoragePath());
|
||||
private FileHandle directory = homeDirectory;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
18
core/src/io/anuke/mindustry/ui/dialogs/HostDialog.java
Normal file
18
core/src/io/anuke/mindustry/ui/dialogs/HostDialog.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
public class HostDialog {
|
||||
/*
|
||||
showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
|
||||
int result = Strings.parseInt(text);
|
||||
if(result == Integer.MIN_VALUE || result >= 65535){
|
||||
Vars.ui.showError("$text.server.invalidport");
|
||||
}else{
|
||||
try{
|
||||
Net.host(result);
|
||||
}catch (IOException e){
|
||||
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Mindustry;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
@@ -1,10 +1,11 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.ui.PressGroup;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.builders.build;
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
@@ -0,0 +1,158 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.SettingsDialog;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.renderer;
|
||||
|
||||
public class MindustrySettingsDialog extends SettingsDialog{
|
||||
public SettingsTable graphics;
|
||||
public SettingsTable game;
|
||||
public SettingsTable sound;
|
||||
|
||||
private Table prefs;
|
||||
private Table menu;
|
||||
private boolean built = false;
|
||||
private boolean wasPaused;
|
||||
|
||||
public MindustrySettingsDialog(){
|
||||
setStyle(Core.skin.get("dialog", WindowStyle.class));
|
||||
|
||||
hidden(()->{
|
||||
if(!GameState.is(State.menu)){
|
||||
if(!wasPaused || Net.active())
|
||||
GameState.set(State.playing);
|
||||
}
|
||||
});
|
||||
|
||||
shown(()->{
|
||||
if(!GameState.is(State.menu)){
|
||||
wasPaused = GameState.is(State.paused);
|
||||
if(menu.getScene() != null){
|
||||
wasPaused = ((io.anuke.mindustry.ui.dialogs.MenuDialog)menu).wasPaused;
|
||||
}
|
||||
if(!Net.active()) GameState.set(State.paused);
|
||||
//TODO hide menu
|
||||
Vars.ui.menu.hide();
|
||||
}
|
||||
});
|
||||
|
||||
setFillParent(true);
|
||||
title().setAlignment(Align.center);
|
||||
getTitleTable().row();
|
||||
getTitleTable().add(new Image("white"))
|
||||
.growX().height(3f).pad(4f).get().setColor(Colors.get("accent"));
|
||||
|
||||
content().clearChildren();
|
||||
content().remove();
|
||||
buttons().remove();
|
||||
|
||||
menu = new Table();
|
||||
|
||||
Consumer<SettingsTable> s = table -> {
|
||||
table.row();
|
||||
table.addImageTextButton("$text.back", "icon-arrow-left", 10*3, this::back).size(240f, 60f).colspan(2).padTop(15f);
|
||||
};
|
||||
|
||||
game = new SettingsTable(s);
|
||||
graphics = new SettingsTable(s);
|
||||
sound = new SettingsTable(s);
|
||||
|
||||
prefs = new Table();
|
||||
prefs.top();
|
||||
prefs.margin(14f);
|
||||
|
||||
menu.defaults().size(300f, 60f).pad(3f);
|
||||
menu.addButton("$text.settings.game", () -> visible(0));
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.graphics", () -> visible(1));
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.sound", () -> visible(2));
|
||||
|
||||
if(!Vars.android) {
|
||||
menu.row();
|
||||
menu.addButton("$text.settings.controls", Vars.ui.keys::show);
|
||||
}
|
||||
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
|
||||
ScrollPane pane = new ScrollPane(prefs, "clear");
|
||||
pane.setFadeScrollBars(false);
|
||||
|
||||
row();
|
||||
add(pane).grow().top();
|
||||
row();
|
||||
add(buttons()).fillX();
|
||||
|
||||
hidden(this::back);
|
||||
|
||||
addSettings();
|
||||
}
|
||||
|
||||
void addSettings(){
|
||||
sound.volumePrefs();
|
||||
|
||||
game.sliderPref("difficulty", 1, 0, 2, i -> Bundles.get("setting.difficulty." + (i == 0 ? "easy" : i == 1 ? "normal" : "hard")));
|
||||
game.screenshakePref();
|
||||
game.checkPref("smoothcam", true);
|
||||
game.checkPref("indicators", true);
|
||||
game.checkPref("effects", true);
|
||||
game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
|
||||
game.sliderPref("saveinterval", 90, 15, 5*120, i -> Bundles.format("setting.seconds", i));
|
||||
|
||||
graphics.checkPref("fps", false);
|
||||
graphics.checkPref("vsync", true, b -> Gdx.graphics.setVSync(b));
|
||||
graphics.checkPref("lasers", true);
|
||||
graphics.checkPref("healthbars", true);
|
||||
graphics.checkPref("pixelate", true, b->{
|
||||
if(b){
|
||||
Vars.renderer.pixelSurface.setScale(Core.cameraScale);
|
||||
Vars.renderer.shadowSurface.setScale(Core.cameraScale);
|
||||
Vars.renderer.shieldSurface.setScale(Core.cameraScale);
|
||||
}else{
|
||||
Vars.renderer.shadowSurface.setScale(1);
|
||||
Vars.renderer.shieldSurface.setScale(1);
|
||||
}
|
||||
renderer.setPixelate(b);
|
||||
});
|
||||
|
||||
Gdx.graphics.setVSync(Settings.getBool("vsync"));
|
||||
}
|
||||
|
||||
private void back(){
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
}
|
||||
|
||||
private void visible(int index){
|
||||
prefs.clearChildren();
|
||||
Table table = Mathf.select(index, game, graphics, sound);
|
||||
prefs.add(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons().addImageTextButton("$text.menu", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||
|
||||
keyDown(key->{
|
||||
if(key == Keys.ESCAPE || key == Keys.BACK)
|
||||
hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
31
core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java
Normal file
31
core/src/io/anuke/mindustry/ui/dialogs/RestartDialog.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.ucore.scene.ui.Dialog;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
|
||||
public class RestartDialog extends Dialog {
|
||||
|
||||
public RestartDialog(){
|
||||
super("$text.gameover", "dialog");
|
||||
|
||||
shown(()->{
|
||||
content().clearChildren();
|
||||
if(control.isHighScore()){
|
||||
content().add("$text.highscore").pad(6);
|
||||
content().row();
|
||||
}
|
||||
content().add("$text.lasted").pad(12).get();
|
||||
content().add("[GREEN]" + control.getWave());
|
||||
pack();
|
||||
});
|
||||
|
||||
getButtonTable().addButton("$text.menu", ()-> {
|
||||
hide();
|
||||
GameState.set(State.menu);
|
||||
control.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.io.SaveIO;
|
||||
import io.anuke.mindustry.io.Saves;
|
||||
import io.anuke.mindustry.io.Saves.SaveSlot;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.builders.button;
|
||||
import io.anuke.ucore.scene.ui.ConfirmDialog;
|
||||
import io.anuke.ucore.scene.ui.Dialog;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
import io.anuke.ucore.scene.ui.layout.Cell;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public class SaveDialog extends LoadDialog{
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.ui;
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
public class BackgroundFragment implements Fragment {
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
|
||||
Core.scene.table().addRect((a, b, w, h) -> {
|
||||
Draw.color();
|
||||
|
||||
TextureRegion back = Draw.region("background");
|
||||
float backscl = Unit.dp.scl(5f);
|
||||
|
||||
Draw.alpha(0.7f);
|
||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
||||
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
||||
|
||||
float logoscl = (int)Unit.dp.scl(7);
|
||||
TextureRegion logo = Core.skin.getRegion("logotext");
|
||||
float logow = logo.getRegionWidth()*logoscl;
|
||||
float logoh = logo.getRegionHeight()*logoscl;
|
||||
|
||||
Draw.color();
|
||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15, logow, logoh);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.mindustry.world.blocks.types.Configurable;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class BlockConfigFragment implements Fragment {
|
||||
private Table table;
|
||||
private Tile configTile;
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
table = new Table();
|
||||
Core.scene.add(table);
|
||||
}
|
||||
|
||||
public void showConfig(Tile tile){
|
||||
configTile = tile;
|
||||
|
||||
table.clear();
|
||||
((Configurable)tile.block()).buildTable(tile, table);
|
||||
table.pack();
|
||||
table.setTransform(true);
|
||||
table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
|
||||
Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));
|
||||
|
||||
table.update(()->{
|
||||
table.setOrigin(Align.center);
|
||||
Vector2 pos = Graphics.screen(tile.worldx(), tile.worldy());
|
||||
table.setPosition(pos.x, pos.y, Align.center);
|
||||
if(configTile == null || configTile.block() == Blocks.air){
|
||||
hideConfig();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean hasConfigMouse(){
|
||||
Element e = Core.scene.hit(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY(), true);
|
||||
return e != null && (e == table || e.isDescendantOf(table));
|
||||
}
|
||||
|
||||
public void hideConfig(){
|
||||
table.actions(Actions.scaleTo(0f, 1f, 0.06f, Interpolation.pow3Out), Actions.visible(false));
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Section;
|
||||
import io.anuke.mindustry.ui.FloatingDialog;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.scene.actions.Actions;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.graphics.Colors;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.ui.Label;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
public class LoadingFragment implements Fragment {
|
||||
private Table table;
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
|
||||
table = new table("loadDim"){{
|
||||
touchable(Touchable.enabled);
|
||||
get().addImage("white").growX()
|
||||
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||
row();
|
||||
new label("$text.loading"){{
|
||||
get().setName("namelabel");
|
||||
}}.pad(10);
|
||||
row();
|
||||
get().addImage("white").growX()
|
||||
.height(3f).pad(4f).growX().get().setColor(Colors.get("accent"));
|
||||
}}.end().get();
|
||||
|
||||
table.setVisible(false);
|
||||
}
|
||||
|
||||
public void show(){
|
||||
show("$text.loading");
|
||||
}
|
||||
|
||||
public void show(String text){
|
||||
table.<Label>find("namelabel").setText(text);
|
||||
table.setVisible(true);
|
||||
table.toFront();
|
||||
}
|
||||
|
||||
public void hide(){
|
||||
table.setVisible(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user