UI stuff
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 3.3 KiB |
BIN
core/assets-raw/sprites/ui/button-red.9.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 202 B |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 73 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 712 B |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 788 KiB |
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 233 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 52 KiB |
@@ -36,17 +36,17 @@
|
|||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { r: 0, g: 0, b: 0, a: 0 }
|
color: { r: 0, g: 0, b: 0, a: 0 }
|
||||||
},
|
},
|
||||||
flat: {
|
flat-trans: {
|
||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { r: 0.0, g: 0.0, b: 0.0, a: 0.6 }
|
color: { r: 0.0, g: 0.0, b: 0.0, a: 0.6 }
|
||||||
},
|
},
|
||||||
|
flat: {
|
||||||
|
name: whiteui,
|
||||||
|
color: { r: 0.0, g: 0.0, b: 0.0, a: 1 }
|
||||||
|
},
|
||||||
flat-over: {
|
flat-over: {
|
||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { hex: "#ffffff82" }
|
color: { hex: "#454545ff" }
|
||||||
},
|
|
||||||
flat-down: {
|
|
||||||
name: whiteui,
|
|
||||||
color: { hex: "#ffd37fff" }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ButtonStyle: {
|
ButtonStyle: {
|
||||||
@@ -71,12 +71,12 @@
|
|||||||
up: button
|
up: button
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
disabled: content-background-locked,
|
disabled: button,
|
||||||
font: default-font,
|
font: default-font,
|
||||||
fontColor: white,
|
fontColor: white,
|
||||||
disabledFontColor: gray,
|
disabledFontColor: gray,
|
||||||
up: content-background,
|
up: button-over,
|
||||||
over: content-background-over
|
over: button-down
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
over: button-right-over,
|
over: button-right-over,
|
||||||
@@ -169,8 +169,8 @@
|
|||||||
imageUpColor: white
|
imageUpColor: white
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
up: content-background,
|
up: button-over,
|
||||||
over: content-background-over
|
over: button-down
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
over: button-right-over,
|
over: button-right-over,
|
||||||
@@ -224,6 +224,12 @@
|
|||||||
up: flat,
|
up: flat,
|
||||||
over: flat-over
|
over: flat-over
|
||||||
},
|
},
|
||||||
|
clear-toggle-trans: {
|
||||||
|
down: flat-down,
|
||||||
|
checked: flat-down,
|
||||||
|
up: flat-trans,
|
||||||
|
over: flat-over
|
||||||
|
},
|
||||||
clear-toggle-partial: {
|
clear-toggle-partial: {
|
||||||
down: flat-down,
|
down: flat-down,
|
||||||
checked: flat-down,
|
checked: flat-down,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import io.anuke.arc.math.Interpolation;
|
|||||||
import io.anuke.arc.scene.*;
|
import io.anuke.arc.scene.*;
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
import io.anuke.arc.scene.actions.Actions;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
|
import io.anuke.arc.scene.style.NinePatchDrawable;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.TextField.TextFieldFilter;
|
import io.anuke.arc.scene.ui.TextField.TextFieldFilter;
|
||||||
import io.anuke.arc.scene.ui.Tooltip.Tooltips;
|
import io.anuke.arc.scene.ui.Tooltip.Tooltips;
|
||||||
@@ -26,7 +27,7 @@ import io.anuke.mindustry.graphics.Pal;
|
|||||||
import io.anuke.mindustry.ui.dialogs.*;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
import io.anuke.mindustry.ui.fragments.*;
|
import io.anuke.mindustry.ui.fragments.*;
|
||||||
|
|
||||||
import static io.anuke.arc.scene.actions.Actions.*;
|
import static io.anuke.arc.scene.actions.Actions.sequence;
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class UI implements ApplicationListener{
|
public class UI implements ApplicationListener{
|
||||||
@@ -70,6 +71,14 @@ public class UI implements ApplicationListener{
|
|||||||
Skin skin = new Skin(Core.atlas);
|
Skin skin = new Skin(Core.atlas);
|
||||||
generateFonts(skin);
|
generateFonts(skin);
|
||||||
skin.load(Core.files.internal("sprites/uiskin.json"));
|
skin.load(Core.files.internal("sprites/uiskin.json"));
|
||||||
|
NinePatchDrawable draw = (NinePatchDrawable)skin.getDrawable("flat-down");
|
||||||
|
draw.setMinWidth(0);
|
||||||
|
draw.setMinHeight(0);
|
||||||
|
draw.setTopHeight(0);
|
||||||
|
draw.setRightWidth(0);
|
||||||
|
draw.setBottomHeight(0);
|
||||||
|
draw.setLeftWidth(0);
|
||||||
|
//TODO fix
|
||||||
|
|
||||||
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
||||||
font.setUseIntegerPositions(true);
|
font.setUseIntegerPositions(true);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class MenuRenderer implements Disposable{
|
public class MenuRenderer implements Disposable{
|
||||||
private static final float darkness = 0.3f;
|
private static final float darkness = 0.3f;
|
||||||
private final int width = !mobile ? 90 : 60, height = !mobile ? 40 : 50;
|
private final int width = !mobile ? 100 : 60, height = !mobile ? 50 : 40;
|
||||||
|
|
||||||
private int cacheFloor, cacheWall;
|
private int cacheFloor, cacheWall;
|
||||||
private Camera camera = new Camera();
|
private Camera camera = new Camera();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Pal{
|
|||||||
bar = Color.SLATE,
|
bar = Color.SLATE,
|
||||||
accent = Color.valueOf("ffd37f"),
|
accent = Color.valueOf("ffd37f"),
|
||||||
stat = Color.valueOf("ffd37f"),
|
stat = Color.valueOf("ffd37f"),
|
||||||
locked = Color.valueOf("989aa4"),
|
locked = Color.valueOf("454545"),
|
||||||
accentBack = Color.valueOf("d4816b"),
|
accentBack = Color.valueOf("d4816b"),
|
||||||
place = Color.valueOf("6335f8"),
|
place = Color.valueOf("6335f8"),
|
||||||
remove = Color.valueOf("e55454"),
|
remove = Color.valueOf("e55454"),
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class LanguageDialog extends FloatingDialog{
|
|||||||
ButtonGroup<TextButton> group = new ButtonGroup<>();
|
ButtonGroup<TextButton> group = new ButtonGroup<>();
|
||||||
|
|
||||||
for(Locale loc : locales){
|
for(Locale loc : locales){
|
||||||
TextButton button = new TextButton(Strings.capitalize(loc.getDisplayName(loc)), "toggle");
|
TextButton button = new TextButton(Strings.capitalize(loc.getDisplayName(loc)), "clear-toggle");
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
if(getLocale().equals(loc)) return;
|
if(getLocale().equals(loc)) return;
|
||||||
Core.settings.put("locale", loc.toString());
|
Core.settings.put("locale", loc.toString());
|
||||||
@@ -37,7 +37,7 @@ public class LanguageDialog extends FloatingDialog{
|
|||||||
Log.info("Setting locale: {0}", loc.toString());
|
Log.info("Setting locale: {0}", loc.toString());
|
||||||
ui.showInfo("$language.restart");
|
ui.showInfo("$language.restart");
|
||||||
});
|
});
|
||||||
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).pad(2).row();
|
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
cont.add(pane);
|
cont.add(pane);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
button.update(() -> {
|
button.update(() -> {
|
||||||
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
||||||
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
||||||
button.getStyle().up = Core.scene.skin.getDrawable(!locked(node.node) ? "content-background" : !data.hasItems(node.node.requirements) ? "content-background-noitems" : "content-background-locked");
|
button.getStyle().up = Core.scene.skin.getDrawable(!locked(node.node) ? "button-over" : !data.hasItems(node.node.requirements) ? "button-red" : "button");
|
||||||
((TextureRegionDrawable)button.getStyle().imageUp)
|
((TextureRegionDrawable)button.getStyle().imageUp)
|
||||||
.setRegion(node.visible ? node.node.block.icon(Icon.medium) : Core.atlas.find("icon-locked"));
|
.setRegion(node.visible ? node.node.block.icon(Icon.medium) : Core.atlas.find("icon-locked"));
|
||||||
button.getImage().setColor(!locked(node.node) ? Color.WHITE : Color.GRAY);
|
button.getImage().setColor(!locked(node.node) ? Color.WHITE : Color.GRAY);
|
||||||
@@ -249,11 +249,12 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
infoTable.update(() -> infoTable.setPosition(button.getX() + button.getWidth(), button.getY() + button.getHeight(), Align.topLeft));
|
infoTable.update(() -> infoTable.setPosition(button.getX() + button.getWidth(), button.getY() + button.getHeight(), Align.topLeft));
|
||||||
|
|
||||||
infoTable.left();
|
infoTable.left();
|
||||||
|
infoTable.background("button").margin(8f);
|
||||||
|
|
||||||
infoTable.table("content-background", b -> {
|
infoTable.table(b -> {
|
||||||
b.margin(0).left().defaults().left();
|
b.margin(0).left().defaults().left();
|
||||||
|
|
||||||
b.addImageButton("icon-info", "node", iconsize, () -> ui.content.show(node.block)).growY().width(50f);
|
b.addImageButton("icon-info-small", "clear", iconsizesmall, () -> ui.content.show(node.block)).growY().width(50f);
|
||||||
b.add().grow();
|
b.add().grow();
|
||||||
b.table(desc -> {
|
b.table(desc -> {
|
||||||
desc.left().defaults().left();
|
desc.left().defaults().left();
|
||||||
@@ -287,7 +288,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
|
|
||||||
infoTable.row();
|
infoTable.row();
|
||||||
if(node.block.description != null){
|
if(node.block.description != null){
|
||||||
infoTable.table("dialogDim", t -> t.margin(3f).left().labelWrap(node.block.description).color(Color.LIGHT_GRAY).growX()).fillX();
|
infoTable.table(t -> t.margin(3f).left().labelWrap(node.block.description).color(Color.LIGHT_GRAY).growX()).fillX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +306,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
for(TechTreeNode child : node.children){
|
for(TechTreeNode child : node.children){
|
||||||
if(!child.visible) continue;
|
if(!child.visible) continue;
|
||||||
|
|
||||||
Lines.stroke(Unit.dp.scl(3f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
|
Lines.stroke(Unit.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
|
||||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import io.anuke.arc.Core;
|
|||||||
import io.anuke.arc.Events;
|
import io.anuke.arc.Events;
|
||||||
import io.anuke.arc.graphics.Texture;
|
import io.anuke.arc.graphics.Texture;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
|
import io.anuke.arc.math.Interpolation;
|
||||||
import io.anuke.arc.scene.Group;
|
import io.anuke.arc.scene.Group;
|
||||||
|
import io.anuke.arc.scene.actions.Actions;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.ui.Button;
|
import io.anuke.arc.scene.ui.Button;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
@@ -154,6 +156,7 @@ public class MenuFragment extends Fragment{
|
|||||||
|
|
||||||
container.table(background, t -> {
|
container.table(background, t -> {
|
||||||
submenu = t;
|
submenu = t;
|
||||||
|
t.getColor().a = 0f;
|
||||||
t.top();
|
t.top();
|
||||||
t.defaults().width(width).height(70f);
|
t.defaults().width(width).height(70f);
|
||||||
t.visible(() -> !t.getChildren().isEmpty());
|
t.visible(() -> !t.getChildren().isEmpty());
|
||||||
@@ -161,6 +164,21 @@ public class MenuFragment extends Fragment{
|
|||||||
}).width(width).growY();
|
}).width(width).growY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fadeInMenu(){
|
||||||
|
submenu.clearActions();
|
||||||
|
submenu.actions(Actions.alpha(1f, 0.15f, Interpolation.fade));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeOutMenu(){
|
||||||
|
//nothing to fade out
|
||||||
|
if(submenu.getChildren().isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
submenu.clearActions();
|
||||||
|
submenu.actions(Actions.alpha(1f), Actions.alpha(0f, 0.2f, Interpolation.fade), Actions.run(() -> submenu.clearChildren()));
|
||||||
|
}
|
||||||
|
|
||||||
private void buttons(Table t, Buttoni... buttons){
|
private void buttons(Table t, Buttoni... buttons){
|
||||||
for(Buttoni b : buttons){
|
for(Buttoni b : buttons){
|
||||||
Button[] out = {null};
|
Button[] out = {null};
|
||||||
@@ -168,18 +186,19 @@ public class MenuFragment extends Fragment{
|
|||||||
iconsizesmall, () -> {
|
iconsizesmall, () -> {
|
||||||
if(currentMenu == out[0]){
|
if(currentMenu == out[0]){
|
||||||
currentMenu = null;
|
currentMenu = null;
|
||||||
submenu.clearChildren();
|
fadeOutMenu();
|
||||||
}else{
|
}else{
|
||||||
if(b.submenu != null){
|
if(b.submenu != null){
|
||||||
currentMenu = out[0];
|
currentMenu = out[0];
|
||||||
submenu.clearChildren();
|
submenu.clearChildren();
|
||||||
|
fadeInMenu();
|
||||||
//correctly offset the button
|
//correctly offset the button
|
||||||
submenu.add().height(Core.graphics.getHeight() - out[0].getY(Align.topLeft));
|
submenu.add().height(Core.graphics.getHeight() - out[0].getY(Align.topLeft));
|
||||||
submenu.row();
|
submenu.row();
|
||||||
buttons(submenu, b.submenu);
|
buttons(submenu, b.submenu);
|
||||||
}else{
|
}else{
|
||||||
currentMenu = null;
|
currentMenu = null;
|
||||||
submenu.clearChildren();
|
fadeOutMenu();
|
||||||
b.runnable.run();
|
b.runnable.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public class PlacementFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
||||||
frame.row();
|
frame.row();
|
||||||
frame.addImage("blank").color(Pal.accent).colspan(3).height(3).growX();
|
frame.addImage("blank").color(Pal.locked).colspan(3).height(4).growX();
|
||||||
frame.row();
|
frame.row();
|
||||||
frame.table("pane-2", blocksSelect -> {
|
frame.table("pane-2", blocksSelect -> {
|
||||||
blocksSelect.margin(4).marginTop(0);
|
blocksSelect.margin(4).marginTop(0);
|
||||||
@@ -269,11 +269,11 @@ public class PlacementFragment extends Fragment{
|
|||||||
if(f++ % 2 == 0) categories.row();
|
if(f++ % 2 == 0) categories.row();
|
||||||
|
|
||||||
if(categoryEmpty[cat.ordinal()]){
|
if(categoryEmpty[cat.ordinal()]){
|
||||||
categories.addImage("flat");
|
categories.addImage("flat-trans");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
categories.addImageButton("icon-" + cat.name() + "-med", "clear-toggle", iconsizemed, () -> {
|
categories.addImageButton("icon-" + cat.name() + "-med", "clear-toggle-trans", iconsizemed, () -> {
|
||||||
currentCategory = cat;
|
currentCategory = cat;
|
||||||
rebuildCategory.run();
|
rebuildCategory.run();
|
||||||
}).group(group).update(i -> i.setChecked(currentCategory == cat));
|
}).group(group).update(i -> i.setChecked(currentCategory == cat));
|
||||||
|
|||||||