New sector dialog done
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 167 B |
BIN
core/assets-raw/sprites/ui/sector-select.png
Normal file
After Width: | Height: | Size: 250 B |
@ -54,7 +54,7 @@ text.mission.complete.body = Sector {0},{1} has been conquered.
|
||||
text.mission.wave = Survive[accent] {0}/{1} []waves\nWave in {2}
|
||||
text.mission.wave.enemies = Survive[accent] {0}/{1} []waves\n{2} Enemies
|
||||
text.mission.wave.enemy = Survive[accent] {0}/{1} []waves\n{2} Enemy
|
||||
text.mission.wave.menu = Survive[accent] {0} []waves
|
||||
text.mission.wave.menu = Survive[accent] {0}[] waves
|
||||
text.mission.battle = Destroy the enemy core
|
||||
text.mission.resource.menu = Obtain {0} x{1}
|
||||
text.mission.resource = Obtain {0}\:\n[accent]{1}/{2}[]
|
||||
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 104 KiB |
@ -5,7 +5,7 @@ page id=1 file="square2.png"
|
||||
page id=2 file="square3.png"
|
||||
chars count=11450
|
||||
char id=10 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=0 page=0 chnl=0
|
||||
char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=0
|
||||
char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=0 xadvance=10 page=0 chnl=0
|
||||
char id=33 x=2039 y=147 width=7 height=23 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0
|
||||
char id=34 x=147 y=2032 width=15 height=11 xoffset=-1 yoffset=4 xadvance=16 page=0 chnl=0
|
||||
char id=36 x=7 y=0 width=23 height=31 xoffset=-1 yoffset=0 xadvance=24 page=0 chnl=0
|
||||
|
@ -441,14 +441,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
mid.table("button", t -> {
|
||||
Slider slider = new Slider(0, MapEditor.brushSizes.length - 1, 1, false);
|
||||
slider.moved(f -> editor.setBrushSize(MapEditor.brushSizes[(int) (float) f]));
|
||||
slider.update(() -> {
|
||||
for(int j = 0; j < MapEditor.brushSizes.length; j++){
|
||||
if(editor.getBrushSize() == j){
|
||||
slider.setValue(j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
t.top();
|
||||
t.add("$text.editor.brush");
|
||||
|
@ -1,49 +1,119 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.maps.Sector;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.scene.Element;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.scene.event.InputEvent;
|
||||
import io.anuke.ucore.scene.event.InputListener;
|
||||
import io.anuke.ucore.scene.event.Touchable;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
import io.anuke.ucore.scene.utils.Cursors;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Log;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class SectorsDialog extends FloatingDialog{
|
||||
private static final float sectorSize = Unit.dp.scl(32*5);
|
||||
private Sector selected;
|
||||
private Table table;
|
||||
private SectorView view;
|
||||
|
||||
public SectorsDialog(){
|
||||
super("");
|
||||
|
||||
table = new Table(){
|
||||
@Override
|
||||
public float getPrefWidth(){
|
||||
return sectorSize*2f;
|
||||
}
|
||||
};
|
||||
table.visible(() -> selected != null);
|
||||
table.update(() -> {
|
||||
if(selected != null){
|
||||
|
||||
int offsetX = (int)(view.panX / sectorSize);
|
||||
int offsetY = (int)(view.panY / sectorSize);
|
||||
float drawX = x + width/2f+ selected.x * (sectorSize-2) - offsetX * sectorSize - view.panX % sectorSize + sectorSize/2f;
|
||||
float drawY = y + height/2f + selected.y * (sectorSize-2) - offsetY * sectorSize - view.panY % sectorSize + sectorSize/2f;
|
||||
|
||||
table.setPosition(drawX, drawY - sectorSize/2f + 1, Align.top);
|
||||
}
|
||||
});
|
||||
|
||||
Group container = new Group();
|
||||
container.setTouchable(Touchable.childrenOnly);
|
||||
container.addChild(table);
|
||||
|
||||
margin(0);
|
||||
getTitleTable().clear();
|
||||
clear();
|
||||
stack(content(), buttons()).grow();
|
||||
stack(content(), buttons(), container).grow();
|
||||
|
||||
shown(this::setup);
|
||||
}
|
||||
|
||||
void setup(){
|
||||
selected = null;
|
||||
|
||||
table.clear();
|
||||
content().clear();
|
||||
buttons().clear();
|
||||
buttons().bottom().margin(15);
|
||||
|
||||
addCloseButton();
|
||||
content().add(new SectorView()).grow();
|
||||
content().add(view = new SectorView()).grow();
|
||||
}
|
||||
|
||||
void selectSector(Sector sector){
|
||||
Log.info((int)' ');
|
||||
selected = sector;
|
||||
|
||||
table.clear();
|
||||
table.background("button").margin(5);
|
||||
|
||||
table.defaults().pad(3);
|
||||
table.add(Bundles.format("text.sector", sector.x + ", " + sector.y));
|
||||
table.row();
|
||||
|
||||
if(selected.completedMissions < selected.missions.size && !selected.complete){
|
||||
table.labelWrap(Bundles.format("text.mission", selected.getDominantMission().menuDisplayString())).growX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
if(selected.hasSave()){
|
||||
table.labelWrap(Bundles.format("text.sector.time", selected.getSave().getPlayTime())).growX();
|
||||
table.row();
|
||||
}
|
||||
|
||||
table.table(t -> {
|
||||
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();
|
||||
|
||||
if(selected.hasSave()){
|
||||
t.addImageTextButton("$text.sector.abandon", "icon-cancel", 16 * 2, () ->
|
||||
Vars.ui.showConfirm("$text.confirm", "$text.sector.abandon.confirm", () -> world.sectors.abandonSector(selected))
|
||||
).width(sectorSize).height(60f);
|
||||
}
|
||||
}).pad(-5).growX().padTop(0);
|
||||
|
||||
table.pack();
|
||||
table.act(Gdx.graphics.getDeltaTime());
|
||||
}
|
||||
|
||||
public Sector getSelected(){
|
||||
@ -52,7 +122,6 @@ public class SectorsDialog extends FloatingDialog{
|
||||
|
||||
class SectorView extends Element{
|
||||
float lastX, lastY;
|
||||
float sectorSize = Unit.dp.scl(32*5);
|
||||
boolean clicked = false;
|
||||
float panX = 0, panY = -sectorSize/2f;
|
||||
|
||||
@ -61,7 +130,7 @@ public class SectorsDialog extends FloatingDialog{
|
||||
@Override
|
||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
|
||||
if(pointer != 0) return false;
|
||||
Cursors.setHand();
|
||||
//Cursors.setHand();
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
return true;
|
||||
@ -91,13 +160,11 @@ public class SectorsDialog extends FloatingDialog{
|
||||
public void draw(){
|
||||
Draw.alpha(alpha);
|
||||
|
||||
float padSectorSize = sectorSize;
|
||||
int shownSectorsX = (int)(width/sectorSize);
|
||||
int shownSectorsY = (int)(height/sectorSize);
|
||||
|
||||
int shownSectorsX = (int)(width/padSectorSize);
|
||||
int shownSectorsY = (int)(height/padSectorSize);
|
||||
|
||||
int offsetX = (int)(panX / padSectorSize);
|
||||
int offsetY = (int)(panY / padSectorSize);
|
||||
int offsetX = (int)(panX / sectorSize);
|
||||
int offsetY = (int)(panY / sectorSize);
|
||||
|
||||
Vector2 mouse = Graphics.mouse();
|
||||
|
||||
@ -106,20 +173,20 @@ public class SectorsDialog extends FloatingDialog{
|
||||
int sectorX = offsetX + x;
|
||||
int sectorY = offsetY + y;
|
||||
|
||||
float drawX = x + width/2f+ sectorX * (padSectorSize-2) - offsetX * padSectorSize - panX % padSectorSize + padSectorSize/2f;
|
||||
float drawY = y + height/2f + sectorY * (padSectorSize-2) - offsetY * padSectorSize - panY % padSectorSize + padSectorSize/2f;
|
||||
float drawX = x + width/2f+ sectorX * (sectorSize-2) - offsetX * sectorSize - panX % sectorSize + sectorSize/2f;
|
||||
float drawY = y + height/2f + sectorY * (sectorSize-2) - offsetY * sectorSize - panY % sectorSize + sectorSize/2f;
|
||||
|
||||
Sector sector = world.sectors.get(sectorX, sectorY);
|
||||
|
||||
if(sector == null || sector.texture == null){
|
||||
|
||||
Draw.reset();
|
||||
Draw.rect("empty-sector", drawX, drawY, sectorSize, sectorSize);
|
||||
|
||||
int i = 0;
|
||||
for(GridPoint2 point : Geometry.d4){
|
||||
Sector other = world.sectors.get(sectorX + point.x, sectorY + point.y);
|
||||
if(other != null){
|
||||
Draw.rect("sector-edge", drawX, drawY, padSectorSize, padSectorSize, i*90);
|
||||
Draw.rect("sector-edge", drawX, drawY, sectorSize, sectorSize, i*90);
|
||||
}
|
||||
|
||||
i ++;
|
||||
@ -138,25 +205,31 @@ public class SectorsDialog extends FloatingDialog{
|
||||
region = "icon-mission-done";
|
||||
}
|
||||
|
||||
Color iconColor;
|
||||
Color missionColor = Color.BLACK;
|
||||
Color iconColor = Color.WHITE;
|
||||
Color backColor = Color.BLACK;
|
||||
Color selectColor = Color.CLEAR;
|
||||
|
||||
if(sector == selected){
|
||||
iconColor = Palette.accent;
|
||||
}else if(Mathf.inRect(mouse.x, mouse.y, drawX - padSectorSize / 2f, drawY - padSectorSize / 2f,
|
||||
drawX + padSectorSize / 2f, drawY + padSectorSize / 2f)){
|
||||
selectColor = Palette.accent;
|
||||
}else if(Mathf.inRect(mouse.x, mouse.y, drawX - sectorSize / 2f, drawY - sectorSize / 2f,
|
||||
drawX + sectorSize / 2f, drawY + sectorSize / 2f)){
|
||||
if(clicked){
|
||||
selectSector(sector);
|
||||
}
|
||||
iconColor = Color.WHITE;
|
||||
}else if(sector.complete){
|
||||
iconColor = missionColor = Color.CLEAR;
|
||||
selectColor = Color.WHITE;
|
||||
}else{
|
||||
iconColor = Color.GRAY;
|
||||
}
|
||||
|
||||
Draw.color(missionColor);
|
||||
Draw.alpha(0.75f * missionColor.a);
|
||||
if(sector.complete){
|
||||
iconColor = backColor = Color.CLEAR;
|
||||
}
|
||||
|
||||
Draw.color(selectColor);
|
||||
Draw.rect("sector-select", drawX, drawY, sectorSize, sectorSize);
|
||||
|
||||
Draw.color(backColor);
|
||||
Draw.alpha(0.75f * backColor.a);
|
||||
Draw.rect("icon-mission-background", drawX, drawY, Unit.dp.scl(18f * 5), Unit.dp.scl(18f * 5));
|
||||
|
||||
float size = Unit.dp.scl(10f * 5);
|
||||
|
@ -15,7 +15,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Junction extends Block{
|
||||
protected float speed = 26; //frames taken to go through this junction
|
||||
protected int capacity = 32;
|
||||
protected int capacity = 6;
|
||||
|
||||
public Junction(String name){
|
||||
super(name);
|
||||
|
@ -17,7 +17,7 @@ public class NumberValue implements StatValue{
|
||||
this.unit = unit;
|
||||
this.value = value;
|
||||
|
||||
if(unit.localized().contains("???")){
|
||||
if(unit != StatUnit.none && unit.localized().contains("???")){
|
||||
throw new RuntimeException("No bundle definition found for unit: '" + unit + "'");
|
||||
}
|
||||
}
|
||||
|
@ -306,6 +306,7 @@ public class ServerControl extends Module{
|
||||
}
|
||||
|
||||
info(" &ly{0} FPS.", (int) (60f / Timers.delta()));
|
||||
info(" &ly{0} MB used.", Gdx.app.getJavaHeap() / 1024 / 1024);
|
||||
|
||||
if(playerGroup.size() > 0){
|
||||
info(" &lyPlayers: {0}", playerGroup.size());
|
||||
|