Misc. cleanup of UI / Removed 'font scale' var / Removed [orange]

This commit is contained in:
Anuken
2018-11-06 23:47:23 -05:00
parent 837f621633
commit d4f5e854c5
37 changed files with 1186 additions and 1203 deletions

View File

@@ -1,22 +1,16 @@
package io.anuke.mindustry.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.function.Supplier;
import io.anuke.ucore.scene.ui.Image;
import io.anuke.ucore.scene.ui.layout.Stack;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.ui.layout.Unit;
public class ItemImage extends Stack{
public ItemImage(TextureRegion region, Supplier<CharSequence> text){
Table t = new Table().left().bottom();
t.label(text).color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
t.row();
t.label(text);
add(new Image(region));
@@ -25,9 +19,6 @@ public class ItemImage extends Stack{
public ItemImage(ItemStack stack){
Table t = new Table().left().bottom();
t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-Core.skin.font().getData().capHeight * 2 / Unit.dp.scl(1f));
t.row();
t.add(stack.amount + "");
add(new Image(stack.item.region));

View File

@@ -38,7 +38,7 @@ public class LanguageDialog extends FloatingDialog{
Log.info("Setting locale: {0}", loc.toString());
ui.showInfo("$text.language.restart");
});
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 60f).row();
langs.add(button).group(group).update(t -> t.setChecked(loc.equals(getLocale()))).size(400f, 50f).row();
}
content().add(pane);

View File

@@ -116,7 +116,7 @@ public class PausedDialog extends FloatingDialog{
control.saves.getCurrent().save();
}catch(Throwable e){
e.printStackTrace();
threads.runGraphics(() -> ui.showError("[orange]" + Bundles.get("text.savefail")));
threads.runGraphics(() -> ui.showError("[accent]" + Bundles.get("text.savefail")));
}
state.set(State.menu);
});

View File

@@ -53,7 +53,7 @@ public class SaveDialog extends LoadDialog{
}catch(Throwable e){
e.printStackTrace();
ui.showError("[orange]" + Bundles.get("text.savefail"));
ui.showError("[accent]" + Bundles.get("text.savefail"));
}
});
}

View File

@@ -37,7 +37,7 @@ public class SectorsDialog extends FloatingDialog{
table = new Table(){
@Override
public float getPrefWidth(){
return Unit.dp.scl(sectorSize*2f);
return sectorSize*2f;
}
};
table.visible(() -> selected != null);
@@ -101,7 +101,7 @@ public class SectorsDialog extends FloatingDialog{
Cell<?> cell = t.addImageTextButton(sector.hasSave() ? "$text.sector.resume" : "$text.sector.deploy", "icon-play", 10*3, () -> {
hide();
Vars.ui.loadLogic(() -> world.sectors.playSector(selected));
}).height(60f).growX();
}).height(60f);
if(selected.hasSave()){
t.addImageTextButton("$text.sector.abandon", "icon-cancel", 16 * 2, () ->
@@ -109,9 +109,11 @@ public class SectorsDialog extends FloatingDialog{
world.sectors.abandonSector(selected);
// Simulate a sector selection so the buttons get updated.
selectSector(selected);
})
).width(sectorSize).height(60f);
cell.width(sectorSize);
})
).width(sectorSize / Unit.dp.scl(1f)).height(60f);
cell.width(sectorSize / Unit.dp.scl(1f));
}else{
cell.width(sectorSize*2f / Unit.dp.scl(1f));
}
}).pad(-5).growX().padTop(0);

View File

@@ -323,7 +323,7 @@ public class BlocksFragment extends Fragment{
if(core == null || state.mode.infiniteResources) return "*/*";
int amount = core.items.get(stack.item);
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[orange]" : "[white]");
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[accent]" : "[white]");
return color + format(amount) + "[white]/" + stack.amount;
});

View File

@@ -142,7 +142,7 @@ public class HudFragment extends Fragment{
//paused table
parent.fill(t -> {
t.top().visible(() -> state.is(State.paused) && !Net.active());
t.table("clear", top -> top.add("$text.paused").pad(6).get().setFontScale(fontScale * 1.5f));
t.table("clear", top -> top.add("$text.paused").pad(6).get().setFontScale(1.5f));
});
parent.fill(t -> {

View File

@@ -32,12 +32,12 @@ public class MenuFragment extends Fragment{
});
//discord icon in top right
parent.fill(c -> c.top().right().addButton("", "discord", ui.discord::show).size(81, 42)
parent.fill(c -> c.top().right().addButton("", "discord", ui.discord::show).size(84, 45)
.visible(() -> state.is(State.menu)));
//info icon
if(mobile){
parent.fill(c -> c.top().left().addButton("", "info", ui.about::show).size(81, 42)
parent.fill(c -> c.top().left().addButton("", "info", ui.about::show).size(84, 45)
.visible(() -> state.is(State.menu)));
}