add names to some major dialog elements

This commit is contained in:
DeltaNedas 2020-10-11 12:57:18 +01:00
parent a60ae3a060
commit 1539d86846
3 changed files with 34 additions and 34 deletions

View File

@ -38,14 +38,15 @@ public class PausedDialog extends BaseDialog{
cont.label(() -> state.getSector() == null ? "" :
("[lightgray]Next turn in [accent]" + state.getSector().displayTimeRemaining() +
(state.rules.winWave > 0 && !state.getSector().isCaptured() ? "\n[lightgray]Reach wave[accent] " + state.rules.winWave + "[] to capture" : "")))
.visible(() -> state.getSector() != null).colspan(2);
.visible(() -> state.getSector() != null).colspan(2)
.name("turn");
cont.row();
float dw = 220f;
cont.defaults().width(dw).height(55).pad(5f);
cont.button("@back", Icon.left, this::hide);
cont.button("@settings", Icon.settings, ui.settings::show);
cont.button("@back", Icon.left, this::hide).name("back");
cont.button("@settings", Icon.settings, ui.settings::show).name("settings");
if(!state.rules.tutorial){
if(!state.isCampaign() && !state.isEditor()){

View File

@ -32,18 +32,18 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//if true, enables launching anywhere for testing
public static boolean debugSelect = false;
final FrameBuffer buffer = new FrameBuffer(2, 2, true);
final PlanetRenderer planets = renderer.planets;
final LaunchLoadoutDialog loadouts = new LaunchLoadoutDialog();
final Table stable = new Table().background(Styles.black3);
public final FrameBuffer buffer = new FrameBuffer(2, 2, true);
public final PlanetRenderer planets = renderer.planets;
public final LaunchLoadoutDialog loadouts = new LaunchLoadoutDialog();
public final Table stable = new Table().background(Styles.black3);
int launchRange;
float zoom = 1f, selectAlpha = 1f;
@Nullable Sector selected, hovered, launchSector;
CoreBuild launcher;
Mode mode = look;
boolean launching;
Cons<Sector> listener = s -> {};
public int launchRange;
public float zoom = 1f, selectAlpha = 1f;
public @Nullable Sector selected, hovered, launchSector;
public CoreBuild launcher;
public Mode mode = look;
public boolean launching;
public Cons<Sector> listener = s -> {};
public PlanetDialog(){
super("", Styles.fullDialog);
@ -237,7 +237,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
cont.clear();
titleTable.remove();
cont.stack(
new Element(){
{
@ -468,7 +467,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
stable.act(0f);
}
enum Mode{
public enum Mode{
/** Look around for existing sectors. Can only deploy. */
look,
/** Launch to a new location. */

View File

@ -31,14 +31,14 @@ import java.util.*;
import static mindustry.Vars.*;
public class ResearchDialog extends BaseDialog{
final float nodeSize = Scl.scl(60f);
ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
TechTreeNode root = new TechTreeNode(TechTree.root, null);
Rect bounds = new Rect();
ItemsDisplay itemDisplay;
View view;
public final float nodeSize = Scl.scl(60f);
public ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
public TechTreeNode root = new TechTreeNode(TechTree.root, null);
public Rect bounds = new Rect();
public ItemsDisplay itemDisplay;
public View view;
ItemSeq items;
public ItemSeq items;
public ResearchDialog(){
super("");
@ -114,7 +114,7 @@ public class ResearchDialog extends BaseDialog{
buttons.button("@database", Icon.book, () -> {
hide();
ui.database.show();
}).size(210f, 64f);
}).size(210f, 64f).name("database");
//scaling/drag input
addListener(new InputListener(){
@ -250,7 +250,7 @@ public class ResearchDialog extends BaseDialog{
return node.content.unlocked() || !node.objectives.contains(i -> !i.complete());
}
void showToast(String info){
public void showToast(String info){
Table table = new Table();
table.actions(Actions.fadeOut(0.5f, Interp.fade), Actions.remove());
table.top().add(info);
@ -279,11 +279,11 @@ public class ResearchDialog extends BaseDialog{
}
}
class TechTreeNode extends TreeNode<TechTreeNode>{
final TechNode node;
boolean visible = true, selectable = true;
public class TechTreeNode extends TreeNode<TechTreeNode>{
public final TechNode node;
public boolean visible = true, selectable = true;
TechTreeNode(TechNode node, TechTreeNode parent){
public TechTreeNode(TechNode node, TechTreeNode parent){
this.node = node;
this.parent = parent;
this.width = this.height = nodeSize;
@ -297,11 +297,11 @@ public class ResearchDialog extends BaseDialog{
}
}
class View extends Group{
float panX = 0, panY = -200, lastZoom = -1;
boolean moved = false;
ImageButton hoverNode;
Table infoTable = new Table();
public class View extends Group{
public float panX = 0, panY = -200, lastZoom = -1;
public boolean moved = false;
public ImageButton hoverNode;
public Table infoTable = new Table();
{
infoTable.touchable = Touchable.enabled;