Tech tree usability improvements / Bugfixes
BIN
core/assets-raw/sprites/ui/content-background-noitems.9.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 511 KiB After Width: | Height: | Size: 523 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 33 KiB |
@@ -46,9 +46,14 @@ public class EditorTile extends Tile{
|
|||||||
@Override
|
@Override
|
||||||
public void setBlock(Block type){
|
public void setBlock(Block type){
|
||||||
Block previous = block;
|
Block previous = block;
|
||||||
|
byte pteam = getTeamID();
|
||||||
if(previous == type) return;
|
if(previous == type) return;
|
||||||
super.setBlock(type);
|
super.setBlock(type);
|
||||||
|
if(pteam != getTeamID()){
|
||||||
|
op(TileOp.get(x, y, (byte)OpType.team.ordinal(), pteam, getTeamID()));
|
||||||
|
}
|
||||||
op(TileOp.get(x, y, (byte)OpType.block.ordinal(), previous.id, type.id));
|
op(TileOp.get(x, y, (byte)OpType.block.ordinal(), previous.id, type.id));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import io.anuke.arc.graphics.Color;
|
|||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.Lines;
|
import io.anuke.arc.graphics.g2d.Lines;
|
||||||
import io.anuke.arc.math.Interpolation;
|
import io.anuke.arc.math.Interpolation;
|
||||||
|
import io.anuke.arc.scene.Element;
|
||||||
import io.anuke.arc.scene.Group;
|
import io.anuke.arc.scene.Group;
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
import io.anuke.arc.scene.actions.Actions;
|
||||||
|
import io.anuke.arc.scene.actions.RelativeTemporalAction;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
||||||
import io.anuke.arc.scene.ui.ImageButton;
|
import io.anuke.arc.scene.ui.ImageButton;
|
||||||
@@ -150,6 +152,21 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
if(mobile){
|
if(mobile){
|
||||||
hoverNode = button;
|
hoverNode = button;
|
||||||
rebuild();
|
rebuild();
|
||||||
|
float right = infoTable.getRight();
|
||||||
|
if(right > Core.graphics.getWidth()){
|
||||||
|
float moveBy = right - Core.graphics.getWidth();
|
||||||
|
addAction(new RelativeTemporalAction(){
|
||||||
|
{
|
||||||
|
setDuration(0.1f);
|
||||||
|
setInterpolation(Interpolation.fade);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateRelative(float percentDelta){
|
||||||
|
panX -= moveBy * percentDelta;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}else if(data.hasItems(node.node.requirements) && locked(node.node)){
|
}else if(data.hasItems(node.node.requirements) && locked(node.node)){
|
||||||
unlock(node.node);
|
unlock(node.node);
|
||||||
}
|
}
|
||||||
@@ -173,7 +190,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
button.update(() -> {
|
button.update(() -> {
|
||||||
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
float offset = (Core.graphics.getHeight() % 2) / 2f;
|
||||||
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
button.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f + offset, Align.center);
|
||||||
button.getStyle().up = Core.scene.skin.getDrawable(!locked(node.node) ? "content-background" : "content-background-locked");
|
button.getStyle().up = Core.scene.skin.getDrawable(!locked(node.node) ? "content-background" : !data.hasItems(node.node.requirements) ? "content-background-noitems" : "content-background-locked");
|
||||||
((TextureRegionDrawable)button.getStyle().imageUp)
|
((TextureRegionDrawable)button.getStyle().imageUp)
|
||||||
.setRegion(node.visible ? node.node.block.icon(Icon.medium) : Core.atlas.find("icon-tree-locked"));
|
.setRegion(node.visible ? node.node.block.icon(Icon.medium) : Core.atlas.find("icon-tree-locked"));
|
||||||
button.getImage().setColor(!locked(node.node) ? Color.WHITE : Color.GRAY);
|
button.getImage().setColor(!locked(node.node) ? Color.WHITE : Color.GRAY);
|
||||||
@@ -181,6 +198,16 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
addChild(button);
|
addChild(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mobile){
|
||||||
|
tapped(() -> {
|
||||||
|
Element e = hit(Core.input.mouseX(), Core.input.mouseY(), true);
|
||||||
|
if(e == this){
|
||||||
|
hoverNode = null;
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dragged((x, y) -> {
|
dragged((x, y) -> {
|
||||||
moved = true;
|
moved = true;
|
||||||
panX += x;
|
panX += x;
|
||||||
@@ -257,6 +284,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
|
|
||||||
addChild(infoTable);
|
addChild(infoTable);
|
||||||
infoTable.pack();
|
infoTable.pack();
|
||||||
|
infoTable.act(Core.graphics.getDeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||