Minor UI tweaks

This commit is contained in:
Anuken
2020-06-17 15:07:20 -04:00
parent bce8a61390
commit e88ff1a358
8 changed files with 52 additions and 15 deletions

View File

@ -224,7 +224,6 @@ save.new = New Save
save.overwrite = Are you sure you want to overwrite\nthis save slot?
overwrite = Overwrite
save.none = No saves found!
saveload = Saving...
savefail = Failed to save game!
save.delete.confirm = Are you sure you want to delete this save?
save.delete = Delete

View File

@ -22,7 +22,7 @@ public class Scripts implements Disposable{
".awt", "socket", "classloader", "oracle", "invoke", "arc.events", "java.util.function", "java.util.stream");
private final Seq<String> whitelist = Seq.with("mindustry.net", "netserver", "netclient", "com.sun.proxy.$proxy", "mindustry.gen.");
private final Context context;
private Scriptable scope;
private final Scriptable scope;
private boolean errored;
private LoadedMod currentMod = null;
private Seq<EventHandle> events = new Seq<>();

View File

@ -30,7 +30,7 @@ public class Styles{
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane;
public static KeybindDialogStyle defaultKeybindDialog;
public static SliderStyle defaultSlider, vSlider;
public static LabelStyle defaultLabel, outlineLabel;
public static LabelStyle defaultLabel, outlineLabel, techLabel;
public static TextFieldStyle defaultField, areaField;
public static CheckBoxStyle defaultCheck;
public static DialogStyle defaultDialog, fullDialog;
@ -268,6 +268,10 @@ public class Styles{
font = Fonts.outline;
fontColor = Color.white;
}};
techLabel = new LabelStyle(){{
font = Fonts.tech;
fontColor = Color.white;
}};
defaultField = new TextFieldStyle(){{
font = Fonts.chat;

View File

@ -0,0 +1,33 @@
package mindustry.ui;
import arc.graphics.g2d.*;
import arc.scene.*;
import mindustry.graphics.*;
public class WarningBar extends Element{
public float barWidth = 40f, spacing = barWidth*2, skew = barWidth;
{
setColor(Pal.accent);
}
@Override
public void draw(){
Draw.color(color);
Draw.alpha(parentAlpha);
int amount = (int)(width / spacing) + 2;
for(int i = 0; i < amount; i++){
float rx = x + (i - 1)*spacing;
Fill.quad(
rx, y,
rx + skew, y + height,
rx + skew + barWidth, y + height,
rx + barWidth, y
);
}
Draw.color();
}
}

View File

@ -120,7 +120,7 @@ public class PausedDialog extends BaseDialog{
return;
}
ui.loadAnd("$saveload", () -> {
ui.loadAnd("$saving", () -> {
try{
control.saves.getCurrent().save();
}catch(Throwable e){

View File

@ -44,7 +44,7 @@ public class SaveDialog extends LoadDialog{
void save(SaveSlot slot){
ui.loadfrag.show("$saveload");
ui.loadfrag.show("$saving");
Time.runTask(5f, () -> {
hide();

View File

@ -308,7 +308,7 @@ public class HudFragment extends Fragment{
//'saving' indicator
parent.fill(t -> {
t.bottom().visible(() -> control.saves.isSaving());
t.add("$saveload").style(Styles.outlineLabel);
t.add("$saving").style(Styles.outlineLabel);
});
parent.fill(p -> {

View File

@ -2,13 +2,12 @@ package mindustry.ui.fragments;
import arc.func.*;
import arc.graphics.*;
import arc.scene.Group;
import arc.scene.*;
import arc.scene.actions.*;
import arc.scene.event.Touchable;
import arc.scene.ui.Label;
import arc.scene.ui.TextButton;
import arc.scene.ui.layout.Table;
import mindustry.graphics.Pal;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import mindustry.graphics.*;
import mindustry.ui.*;
public class LoadingFragment extends Fragment{
@ -22,11 +21,13 @@ public class LoadingFragment extends Fragment{
t.visible(false);
t.touchable(Touchable.enabled);
t.add().height(133f).row();
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
//t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.add(new WarningBar()).growX().height(30f);
t.row();
t.add("$loading").name("namelabel").pad(10f);
t.add("$loading").name("namelabel").pad(10f).style(Styles.techLabel);
t.row();
t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.add(new WarningBar()).growX().height(30f);
//t.image().growX().height(3f).pad(4f).growX().get().setColor(Pal.accent);
t.row();
bar = t.add(new Bar()).pad(3).size(500f, 40f).visible(false).get();