Shooting -> Function category / Dialog cleanup

This commit is contained in:
Anuken
2020-10-23 10:39:01 -04:00
parent d66cf13ac6
commit bf1268bb6e
16 changed files with 44 additions and 66 deletions

View File

@@ -1,7 +1,6 @@
package mindustry.editor;
import arc.*;
import arc.input.*;
import arc.math.*;
import arc.scene.event.*;
import arc.scene.ui.*;
@@ -39,11 +38,7 @@ public class WaveInfoDialog extends BaseDialog{
state.rules.spawns = groups;
});
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
addCloseListener();
onResize(this::setup);
addCloseButton();

View File

@@ -53,15 +53,19 @@ public class BaseDialog extends Dialog{
});
}
@Override
public void addCloseButton(){
buttons.defaults().size(210f, 64f);
buttons.button("@back", Icon.left, this::hide).size(210f, 64f);
public void addCloseListener(){
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
}
@Override
public void addCloseButton(){
buttons.defaults().size(210f, 64f);
buttons.button("@back", Icon.left, this::hide).size(210f, 64f);
addCloseListener();
}
}

View File

@@ -51,11 +51,7 @@ public class FileChooser extends BaseDialog{
ok.fireClick();
});
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
addCloseListener();
}
private void setupWidgets(){

View File

@@ -2,7 +2,6 @@ package mindustry.ui.dialogs;
import arc.*;
import arc.func.*;
import arc.input.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
@@ -37,11 +36,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
buttons.defaults().size(160f, 64f);
buttons.button("@back", Icon.left, this::hide);
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
addCloseListener();
ItemSeq sitems = sector.getItems();

View File

@@ -2,7 +2,6 @@ package mindustry.ui.dialogs;
import arc.*;
import arc.graphics.*;
import arc.input.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.util.*;
@@ -24,11 +23,7 @@ public class MapsDialog extends BaseDialog{
buttons.remove();
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
addCloseListener();
shown(this::setup);
onResize(() -> {

View File

@@ -38,8 +38,7 @@ public class PaletteDialog extends Dialog{
}
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back)
hide();
if(key == KeyCode.escape || key == KeyCode.back) hide();
});
}

View File

@@ -1,7 +1,6 @@
package mindustry.ui.dialogs;
import arc.*;
import arc.input.*;
import mindustry.gen.*;
import static mindustry.Vars.*;
@@ -17,11 +16,7 @@ public class PausedDialog extends BaseDialog{
shown(this::rebuild);
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
hide();
}
});
addCloseListener();
}
void rebuild(){

View File

@@ -49,14 +49,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
shouldPause = true;
getCell(buttons).padBottom(-4);
buttons.background(Styles.black).defaults().growX().height(64f).pad(0);
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back){
Core.app.post(this::hide);
}
});
buttons.defaults().size(200f, 56f).pad(2);
buttons.button("@back", Icon.left, this::hide);
buttons.button("@techtree", Icon.tree, () -> ui.research.show());
buttons.bottom().margin(0).marginBottom(-8);
dragged((cx, cy) -> {
Vec3 pos = planets.camPos;
@@ -263,11 +259,14 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
Core.scene.setScrollFocus(PlanetDialog.this);
}
},
//info text
new Table(t -> {
t.touchable = Touchable.disabled;
t.top();
t.label(() -> mode == select ? "@sectors.select" : "").style(Styles.outlineLabel).color(Pal.accent);
}),
buttons,
//planet selection
new Table(t -> {
t.right();
if(content.planets().count(p -> p.accessible) > 1) {

View File

@@ -53,20 +53,20 @@ public enum Stat{
linkRange(StatCat.crafting),
instructions(StatCat.crafting),
speedIncrease(StatCat.shooting),
repairTime(StatCat.shooting),
range(StatCat.shooting),
shootRange(StatCat.shooting),
inaccuracy(StatCat.shooting),
shots(StatCat.shooting),
reload(StatCat.shooting),
powerShot(StatCat.shooting),
targetsAir(StatCat.shooting),
targetsGround(StatCat.shooting),
damage(StatCat.shooting),
ammo(StatCat.shooting),
shieldHealth(StatCat.shooting),
cooldownTime(StatCat.shooting),
speedIncrease(StatCat.function),
repairTime(StatCat.function),
range(StatCat.function),
shootRange(StatCat.function),
inaccuracy(StatCat.function),
shots(StatCat.function),
reload(StatCat.function),
powerShot(StatCat.function),
targetsAir(StatCat.function),
targetsGround(StatCat.function),
damage(StatCat.function),
ammo(StatCat.function),
shieldHealth(StatCat.function),
cooldownTime(StatCat.function),
booster(StatCat.optional),
boostEffect(StatCat.optional),

View File

@@ -9,7 +9,7 @@ public enum StatCat{
liquids,
items,
crafting,
shooting,
function,
optional;
public String localized(){