Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/world/blocks/environment/Floor.java
	core/src/mindustry/world/blocks/payloads/Payload.java
	gradle.properties
This commit is contained in:
Anuken
2021-07-15 09:13:35 -04:00
61 changed files with 571 additions and 262 deletions

View File

@@ -203,7 +203,7 @@ public class Fonts{
/** Merges the UI and font atlas together for better performance. */
public static void mergeFontAtlas(TextureAtlas atlas){
//grab all textures from the ui page, remove all the regions assigned to it, then copy them over to Fonts.packer and replace the texture in this atlas.
//grab all textures from the ui page, remove all the regions assigned to it, then copy them over to UI.packer and replace the texture in this atlas.
//grab old UI texture and regions...
Texture texture = atlas.find("logo").texture;
@@ -236,8 +236,12 @@ public class Fonts{
}
public static TextureRegionDrawable getGlyph(Font font, char glyph){
Glyph g = font.getData().getGlyph(glyph);
if(g == null) throw new IllegalArgumentException("No glyph: " + glyph + " (" + (int)glyph + ")");
Glyph found = font.getData().getGlyph(glyph);
if(found == null){
Log.warn("No icon found for glyph: @ (@)", glyph, (int)glyph);
found = font.getData().getGlyph('F');
}
Glyph g = found;
float size = Math.max(g.width, g.height);
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().texture, g.u, g.v2, g.u2, g.v)){

View File

@@ -31,7 +31,7 @@ public class Styles{
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane, nonePane;
public static KeybindDialog.KeybindDialogStyle defaultKeybindDialog;
public static SliderStyle defaultSlider, vSlider;
public static SliderStyle defaultSlider;
public static LabelStyle defaultLabel, outlineLabel, techLabel;
public static TextFieldStyle defaultField, nodeField, areaField, nodeArea;
public static CheckBoxStyle defaultCheck;
@@ -320,13 +320,7 @@ public class Styles{
}};
defaultSlider = new SliderStyle(){{
background = slider;
knob = sliderKnob;
knobOver = sliderKnobOver;
knobDown = sliderKnobDown;
}};
vSlider = new SliderStyle(){{
background = sliderVertical;
background = sliderBack;
knob = sliderKnob;
knobOver = sliderKnobOver;
knobDown = sliderKnobDown;

View File

@@ -2,6 +2,7 @@ package mindustry.ui;
import arc.graphics.g2d.*;
import arc.scene.*;
import arc.scene.ui.layout.*;
import mindustry.graphics.*;
public class WarningBar extends Element{
@@ -27,7 +28,7 @@ public class WarningBar extends Element{
rx + barWidth, y
);
}
Lines.stroke(3f);
Lines.stroke(Scl.scl(3f));
Lines.line(x, y, x + width, y);
Lines.line(x, y + height, x + width, y + height);

View File

@@ -80,9 +80,7 @@ public class ModsDialog extends BaseDialog{
}
shown(this::setup);
if(mobile){
onResize(this::setup);
}
onResize(this::setup);
Events.on(ResizeEvent.class, event -> {
if(currentContent != null){
@@ -144,10 +142,10 @@ public class ModsDialog extends BaseDialog{
void setup(){
float h = 110f;
float w = Math.min(Core.graphics.getWidth() / 1.1f, 520f);
float w = Math.min(Core.graphics.getWidth() / Scl.scl(1.05f), 520f);
cont.clear();
cont.defaults().width(Math.min(Core.graphics.getWidth() / 1.2f, 556f)).pad(4);
cont.defaults().width(Math.min(Core.graphics.getWidth() / Scl.scl(1.05f), 556f)).pad(4);
cont.add("@mod.reloadrequired").visible(mods::requiresReload).center().get().setAlignment(Align.center);
cont.row();

View File

@@ -6,6 +6,7 @@ import arc.func.*;
import arc.graphics.*;
import arc.graphics.Texture.*;
import arc.input.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
@@ -286,7 +287,8 @@ public class SettingsMenuDialog extends Dialog{
sound.sliderPref("sfxvol", bundle.get("setting.sfxvol.name", "SFX Volume"), 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("ambientvol", bundle.get("setting.ambientvol.name", "Ambient Volume"), 100, 0, 100, 1, i -> i + "%");
game.screenshakePref();
game.sliderPref("saveinterval", 60, 10, 5 * 120, 10, i -> Core.bundle.format("setting.seconds", i));
if(mobile){
game.checkPref("autotarget", true);
game.checkPref("keyboard", false, val -> {
@@ -307,7 +309,6 @@ public class SettingsMenuDialog extends Dialog{
control.setInput(new MobileInput());
}
}*/
game.sliderPref("saveinterval", 60, 10, 5 * 120, 10, i -> Core.bundle.format("setting.seconds", i));
if(!mobile){
game.checkPref("crashreport", true);
@@ -350,6 +351,8 @@ public class SettingsMenuDialog extends Dialog{
Core.settings.put("uiscalechanged", s != lastUiScale[0]);
return s + "%";
});
graphics.sliderPref("screenshake", 4, 0, 8, i -> (i / 4f) + "x");
graphics.sliderPref("fpscap", 240, 15, 245, 5, s -> (s > 240 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
graphics.sliderPref("lasersopacity", 100, 0, 100, 5, s -> {
@@ -559,10 +562,6 @@ public class SettingsMenuDialog extends Dialog{
rebuild();
}
public void screenshakePref(){
sliderPref("screenshake", bundle.get("setting.screenshake.name", "Screen Shake"), 4, 0, 8, i -> (i / 4f) + "x");
}
public SliderSetting sliderPref(String name, String title, int def, int min, int max, StringProcessor s){
return sliderPref(name, title, def, min, max, 1, s);
}
@@ -686,23 +685,21 @@ public class SettingsMenuDialog extends Dialog{
slider.setValue(settings.getInt(name));
Label label = new Label(title);
Label value = new Label("");
value.setStyle(Styles.outlineLabel);
value.touchable = Touchable.disabled;
slider.changed(() -> {
settings.put(name, (int)slider.getValue());
label.setText(title + ": " + sp.get((int)slider.getValue()));
value.setText(title + ": " + sp.get((int)slider.getValue()));
});
value.setAlignment(Align.center);
value.setWrap(true);
slider.change();
table.table(t -> {
t.left().defaults().left();
t.add(label).minWidth(label.getPrefWidth() / Scl.scl(1f) + 50);
if(Core.graphics.isPortrait()){
t.row();
}
t.add(slider).width(180);
}).left().padTop(3);
table.stack(slider, value).width(Math.min(Core.graphics.getWidth() / 1.2f, 460f)).left().padTop(4);
table.row();
}
}

View File

@@ -14,6 +14,7 @@ import arc.scene.ui.layout.Stack;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import mindustry.core.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.type.*;
@@ -200,9 +201,9 @@ public class BlockInventoryFragment extends Fragment{
private String round(float f){
f = (int)f;
if(f >= 1000000){
return (int)(f / 1000000f) + "[gray]" + Core.bundle.getOrNull("unit.millions") + "[]";
return (int)(f / 1000000f) + "[gray]" + UI.millions;
}else if(f >= 1000){
return (int)(f / 1000) + Core.bundle.getOrNull("unit.thousands");
return (int)(f / 1000) + UI.thousands;
}else{
return (int)f + "";
}

View File

@@ -83,13 +83,15 @@ public class PlayerListFragment extends Fragment{
Groups.player.copy(players);
players.sort(Structs.comps(Structs.comparing(Player::team), Structs.comparingBool(p -> !p.admin)));
if(sField.getText().length() > 0){
players.filter(p -> Strings.stripColors(p.name().toLowerCase()).contains(sField.getText().toLowerCase()));
}
for(var user : players){
found = true;
NetConnection connection = user.con;
if(connection == null && net.server() && !user.isLocal()) return;
if(sField.getText().length() > 0 && !user.name().toLowerCase().contains(sField.getText().toLowerCase()) && !Strings.stripColors(user.name().toLowerCase()).contains(sField.getText().toLowerCase())) return;
Table button = new Table();
button.left();