Improved sector dialog look / Made mobile versions show play select
This commit is contained in:
@@ -68,6 +68,7 @@ public class SectorsDialog extends FloatingDialog{
|
|||||||
float panX, panY;
|
float panX, panY;
|
||||||
float lastX, lastY;
|
float lastX, lastY;
|
||||||
float sectorSize = 100f;
|
float sectorSize = 100f;
|
||||||
|
float sectorPadding = 14f;
|
||||||
boolean clicked = false;
|
boolean clicked = false;
|
||||||
|
|
||||||
SectorView(){
|
SectorView(){
|
||||||
@@ -107,14 +108,16 @@ public class SectorsDialog extends FloatingDialog{
|
|||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.alpha(alpha);
|
Draw.alpha(alpha);
|
||||||
|
|
||||||
|
float padSectorSize = sectorSize + sectorPadding;
|
||||||
|
|
||||||
float clipSize = Math.min(width, height);
|
float clipSize = Math.min(width, height);
|
||||||
int shownSectors = (int)(clipSize/sectorSize);
|
int shownSectors = (int)(clipSize/padSectorSize);
|
||||||
clip.setSize(clipSize).setCenter(x + width/2f, y + height/2f);
|
clip.setSize(clipSize).setCenter(x + width/2f, y + height/2f);
|
||||||
Graphics.flush();
|
Graphics.flush();
|
||||||
boolean clipped = ScissorStack.pushScissors(clip);
|
boolean clipped = ScissorStack.pushScissors(clip);
|
||||||
|
|
||||||
int offsetX = (int)(panX / sectorSize);
|
int offsetX = (int)(panX / padSectorSize);
|
||||||
int offsetY = (int)(panY / sectorSize);
|
int offsetY = (int)(panY / padSectorSize);
|
||||||
|
|
||||||
Vector2 mouse = Graphics.mouse();
|
Vector2 mouse = Graphics.mouse();
|
||||||
|
|
||||||
@@ -123,8 +126,8 @@ public class SectorsDialog extends FloatingDialog{
|
|||||||
int sectorX = offsetX + x;
|
int sectorX = offsetX + x;
|
||||||
int sectorY = offsetY + y;
|
int sectorY = offsetY + y;
|
||||||
|
|
||||||
float drawX = x + width/2f+ sectorX * sectorSize - offsetX * sectorSize - panX % sectorSize;
|
float drawX = x + width/2f+ sectorX * padSectorSize - offsetX * padSectorSize - panX % padSectorSize;
|
||||||
float drawY = y + height/2f + sectorY * sectorSize - offsetY * sectorSize - panY % sectorSize;
|
float drawY = y + height/2f + sectorY * padSectorSize - offsetY * padSectorSize - panY % padSectorSize;
|
||||||
|
|
||||||
Sector sector = world.sectors().get(sectorX, sectorY);
|
Sector sector = world.sectors().get(sectorX, sectorY);
|
||||||
|
|
||||||
@@ -133,11 +136,14 @@ public class SectorsDialog extends FloatingDialog{
|
|||||||
Draw.rect(sector.texture, drawX, drawY, sectorSize, sectorSize);
|
Draw.rect(sector.texture, drawX, drawY, sectorSize, sectorSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float stroke = 4f;
|
||||||
|
|
||||||
if(sector == null){
|
if(sector == null){
|
||||||
Draw.color(Color.DARK_GRAY);
|
Draw.color(Color.DARK_GRAY);
|
||||||
}else if(sector == selected){
|
}else if(sector == selected){
|
||||||
Draw.color(Palette.place);
|
Draw.color(Palette.place);
|
||||||
}else if(Mathf.inRect(mouse.x, mouse.y, drawX - sectorSize/2f, drawY - sectorSize/2f, drawX + sectorSize/2f, drawY + sectorSize/2f)){
|
stroke = 6f;
|
||||||
|
}else if(Mathf.inRect(mouse.x, mouse.y, drawX - padSectorSize/2f, drawY - padSectorSize/2f, drawX + padSectorSize/2f, drawY + padSectorSize/2f)){
|
||||||
if(clicked){
|
if(clicked){
|
||||||
selectSector(sector);
|
selectSector(sector);
|
||||||
}
|
}
|
||||||
@@ -148,8 +154,8 @@ public class SectorsDialog extends FloatingDialog{
|
|||||||
Draw.color(Color.LIGHT_GRAY);
|
Draw.color(Color.LIGHT_GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines.stroke(sector != null && selected == sector ? 5f : 3f);
|
Lines.stroke(stroke);
|
||||||
Lines.crect(drawX, drawY, sectorSize, sectorSize);
|
Lines.crect(drawX, drawY, sectorSize, sectorSize, (int)stroke);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MenuFragment extends Fragment{
|
|||||||
container.defaults().size(size).pad(5).padTop(4f);
|
container.defaults().size(size).pad(5).padTop(4f);
|
||||||
|
|
||||||
MobileButton
|
MobileButton
|
||||||
play = new MobileButton("icon-play-2", isize, "$text.play", ui.levels::show),
|
play = new MobileButton("icon-play-2", isize, "$text.play", this::showPlaySelect),
|
||||||
maps = new MobileButton("icon-map", isize, "$text.maps", ui.maps::show),
|
maps = new MobileButton("icon-map", isize, "$text.maps", ui.maps::show),
|
||||||
load = new MobileButton("icon-load", isize, "$text.load", ui.load::show),
|
load = new MobileButton("icon-load", isize, "$text.load", ui.load::show),
|
||||||
join = new MobileButton("icon-add", isize, "$text.joingame", ui.join::show),
|
join = new MobileButton("icon-add", isize, "$text.joingame", ui.join::show),
|
||||||
|
|||||||
Reference in New Issue
Block a user