Merge branches 'master' and 'mech-rework' of https://github.com/Anuken/Mindustry into mech-rework
# Conflicts: # android/src/mindustry/android/AndroidLauncher.java # annotations/src/main/java/mindustry/annotations/SerializeAnnotationProcessor.java # annotations/src/main/java/mindustry/annotations/impl/AssetsAnnotationProcessor.java # build.gradle # core/assets-raw/fontgen/config.json # core/assets/bundles/bundle_cs.properties # core/assets/bundles/bundle_it.properties # core/assets/fonts/font.ttf # core/assets/fonts/icon.ttf # core/assets/icons/icons.properties # core/assets/sprites/block_colors.png # core/assets/sprites/sprites.atlas # core/assets/sprites/sprites.png # core/assets/sprites/sprites3.png # core/assets/sprites/sprites5.png # core/src/mindustry/content/UnitTypes.java # core/src/mindustry/core/NetClient.java # core/src/mindustry/core/NetServer.java # core/src/mindustry/entities/bullet/BulletType.java # core/src/mindustry/entities/type/TileEntity.java # core/src/mindustry/maps/filters/FilterOption.java # core/src/mindustry/mod/Scripts.java # core/src/mindustry/ui/Fonts.java # core/src/mindustry/ui/dialogs/DeployDialog.java # core/src/mindustry/ui/fragments/HudFragment.java # core/src/mindustry/ui/fragments/MenuFragment.java # core/src/mindustry/world/blocks/production/Cultivator.java # core/src/mindustry/world/blocks/units/CommandCenter.java # gradle.properties # tools/src/mindustry/tools/FontGenerator.java
This commit is contained in:
@@ -3,6 +3,7 @@ package mindustry.ui.dialogs;
|
||||
import arc.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.*;
|
||||
@@ -59,8 +60,9 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
image.table(t -> {
|
||||
t.left();
|
||||
for(Gamemode mode : Gamemode.all){
|
||||
if(mode.valid(map) && Core.atlas.has("icon-mode-" + mode.name())){
|
||||
t.addImage(Core.atlas.drawable("icon-mode-" + mode.name())).size(16f).pad(4f);
|
||||
TextureRegionDrawable icon = Vars.ui.getIcon("mode" + Strings.capitalize(mode.name()) + "Small");
|
||||
if(mode.valid(map) && Core.atlas.isFound(icon.getRegion())){
|
||||
t.addImage(icon).size(16f).pad(4f);
|
||||
}
|
||||
}
|
||||
}).left();
|
||||
|
||||
@@ -122,7 +122,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
setFilter(TextureFilter.Linear);
|
||||
}}){{
|
||||
float[] time = {0};
|
||||
setColor(Color.gray(0.3f));
|
||||
setColor(Color.grays(0.3f));
|
||||
setScale(1.5f);
|
||||
update(() -> {
|
||||
setOrigin(Align.center);
|
||||
@@ -140,7 +140,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
Stack sub = new Stack();
|
||||
|
||||
if(slot.getZone() != null){
|
||||
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.gray(0.1f)).grow()));
|
||||
sub.add(new Table(f -> f.margin(4f).add(new Image()).color(Color.grays(0.1f)).grow()));
|
||||
|
||||
sub.add(new Table(f -> f.margin(4f).add(new Image(slot.getZone().preview).setScaling(Scaling.fit)).update(img -> {
|
||||
TextureRegionDrawable draw = (TextureRegionDrawable)img.getDrawable();
|
||||
@@ -254,7 +254,7 @@ public class DeployDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
||||
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.gray(0.2f)).grow()));
|
||||
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.darkGray : Color.grays(0.2f)).grow()));
|
||||
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
||||
|
||||
Button button = new Button(Styles.squaret);
|
||||
|
||||
@@ -95,11 +95,16 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
});
|
||||
|
||||
onResize(this::setup);
|
||||
onResize(() -> {
|
||||
setup();
|
||||
refreshLocal();
|
||||
refreshRemote();
|
||||
});
|
||||
}
|
||||
|
||||
void setupRemote(){
|
||||
remote.clear();
|
||||
|
||||
for(Server server : servers){
|
||||
//why are java lambdas this bad
|
||||
TextButton[] buttons = {null};
|
||||
@@ -266,7 +271,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
cont.addCenteredImageTextButton("$server.add", Icon.add, () -> {
|
||||
renaming = null;
|
||||
add.show();
|
||||
}).marginLeft(6).width(w).height(80f).update(button -> {
|
||||
}).marginLeft(10).width(w).height(80f).update(button -> {
|
||||
float pw = w;
|
||||
float pad = 0f;
|
||||
if(pane.getChildren().first().getPrefHeight() > pane.getHeight()){
|
||||
@@ -363,7 +368,7 @@ public class JoinDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
float targetWidth(){
|
||||
return Core.graphics.isPortrait() ? 350f : 500f;
|
||||
return Math.min(Core.graphics.getWidth() / Scl.scl() * 0.9f, 500f);//Core.graphics.isPortrait() ? 350f : 500f;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import arc.struct.*;
|
||||
import arc.files.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.Texture.*;
|
||||
@@ -12,6 +11,7 @@ import arc.scene.ui.*;
|
||||
import arc.scene.ui.SettingsDialog.SettingsTable.*;
|
||||
import arc.scene.ui.TextButton.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.core.GameState.*;
|
||||
import mindustry.core.*;
|
||||
@@ -240,10 +240,17 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.checkPref("buildautopause", false);
|
||||
}
|
||||
|
||||
if(steam && !Version.modifier.contains("beta")){
|
||||
game.checkPref("publichost", false, i -> {
|
||||
if(steam){
|
||||
game.sliderPref("playerlimit", 16, 2, 32, i -> {
|
||||
platform.updateLobby();
|
||||
return i + "";
|
||||
});
|
||||
|
||||
if(!Version.modifier.contains("beta")){
|
||||
game.checkPref("publichost", false, i -> {
|
||||
platform.updateLobby();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
game.pref(new Setting(){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.ui.dialogs;
|
||||
|
||||
import arc.*;
|
||||
import arc.scene.ui.layout.Stack;
|
||||
import arc.struct.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
@@ -25,6 +26,8 @@ import mindustry.ui.Cicon;
|
||||
import mindustry.ui.layout.*;
|
||||
import mindustry.ui.layout.TreeLayout.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class TechTreeDialog extends FloatingDialog{
|
||||
@@ -110,9 +113,25 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
void treeLayout(){
|
||||
RadialTreeLayout layout = new RadialTreeLayout();
|
||||
float spacing = 20f;
|
||||
LayoutNode node = new LayoutNode(root, null);
|
||||
layout.layout(node);
|
||||
LayoutNode[] children = node.children;
|
||||
LayoutNode[] leftHalf = Arrays.copyOfRange(node.children, 0, Mathf.ceil(node.children.length/2f));
|
||||
LayoutNode[] rightHalf = Arrays.copyOfRange(node.children, Mathf.ceil(node.children.length/2f), node.children.length);
|
||||
node.children = leftHalf;
|
||||
new BranchTreeLayout(){{
|
||||
gapBetweenLevels = gapBetweenNodes = spacing;
|
||||
rootLocation = TreeLocation.top;
|
||||
}}.layout(node);
|
||||
node.children = rightHalf;
|
||||
|
||||
new BranchTreeLayout(){{
|
||||
gapBetweenLevels = gapBetweenNodes = spacing;
|
||||
rootLocation = TreeLocation.bottom;
|
||||
}}.layout(node);
|
||||
|
||||
node.children = children;
|
||||
|
||||
float minx = 0f, miny = 0f, maxx = 0f, maxy = 0f;
|
||||
copyInfo(node);
|
||||
|
||||
@@ -252,7 +271,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
||||
button.getStyle().up = !locked(node.node) ? Tex.buttonOver : !data.hasItems(node.node.requirements) ? Tex.buttonRed : Tex.button;
|
||||
((TextureRegionDrawable)button.getStyle().imageUp)
|
||||
.setRegion(node.visible ? node.node.block.icon(Cicon.medium) : Core.atlas.find("icon-locked"));
|
||||
.setRegion(node.visible ? node.node.block.icon(Cicon.medium) : Icon.lock.getRegion());
|
||||
button.getImage().setColor(!locked(node.node) ? Color.white : Color.gray);
|
||||
});
|
||||
addChild(button);
|
||||
@@ -358,7 +377,7 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
infoTable.row();
|
||||
if(node.block.description != null){
|
||||
infoTable.table(t -> t.margin(3f).left().labelWrap(node.block.description).color(Color.lightGray).growX()).fillX();
|
||||
infoTable.table(t -> t.margin(3f).left().labelWrap(node.block.displayDescription()).color(Color.lightGray).growX()).fillX();
|
||||
}
|
||||
|
||||
addChild(infoTable);
|
||||
@@ -378,7 +397,12 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
|
||||
Lines.stroke(Scl.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
|
||||
Draw.alpha(parentAlpha);
|
||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||
if(Mathf.equal(Math.abs(node.y - child.y), Math.abs(node.x - child.x), 1f) && Mathf.dstm(node.x, node.y, child.x, child.y) <= node.width*3){
|
||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||
}else{
|
||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, node.y + offsetY);
|
||||
Lines.line(child.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user