Enable double-click to play sector
This commit is contained in:
@@ -412,6 +412,10 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
public void tap(InputEvent event, float x, float y, int count, KeyCode button){
|
||||
if(showing()) return;
|
||||
|
||||
if(selected == hovered){
|
||||
playSelected();
|
||||
}
|
||||
|
||||
if(hovered != null && (canSelect(hovered) || debugSelect)){
|
||||
selected = hovered;
|
||||
}
|
||||
@@ -761,7 +765,36 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
sector.isBeingPlayed() ? "@sectors.resume" :
|
||||
sector.hasBase() ? "@sectors.go" :
|
||||
locked ? "@locked" : "@sectors.launch",
|
||||
locked ? Icon.lock :Icon.play, () -> {
|
||||
locked ? Icon.lock : Icon.play, () -> {
|
||||
playSelected();
|
||||
}).growX().height(54f).minWidth(170f).padTop(4).disabled(locked);
|
||||
}
|
||||
|
||||
stable.pack();
|
||||
stable.setPosition(x, y, Align.center);
|
||||
|
||||
stable.update(() -> {
|
||||
if(selected != null){
|
||||
if(launching){
|
||||
stable.color.sub(0, 0, 0, 0.05f * Time.delta);
|
||||
}else{
|
||||
//fade out UI when not facing selected sector
|
||||
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
||||
float dot = planets.cam.direction.dot(Tmp.v31);
|
||||
stable.color.a = Math.max(dot, 0f)*2f;
|
||||
if(dot*2f <= -0.1f){
|
||||
selected = null;
|
||||
updateSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
stable.act(0f);
|
||||
}
|
||||
|
||||
void playSelected(){
|
||||
Sector sector = selected;
|
||||
|
||||
if(sector.isBeingPlayed()){
|
||||
//already at this sector
|
||||
@@ -814,30 +847,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
||||
}
|
||||
|
||||
if(shouldHide) hide();
|
||||
}).growX().height(54f).minWidth(170f).padTop(4).disabled(locked);
|
||||
}
|
||||
|
||||
stable.pack();
|
||||
stable.setPosition(x, y, Align.center);
|
||||
|
||||
stable.update(() -> {
|
||||
if(selected != null){
|
||||
if(launching){
|
||||
stable.color.sub(0, 0, 0, 0.05f * Time.delta);
|
||||
}else{
|
||||
//fade out UI when not facing selected sector
|
||||
Tmp.v31.set(selected.tile.v).rotate(Vec3.Y, -planets.planet.getRotation()).scl(-1f).nor();
|
||||
float dot = planets.cam.direction.dot(Tmp.v31);
|
||||
stable.color.a = Math.max(dot, 0f)*2f;
|
||||
if(dot*2f <= -0.1f){
|
||||
selected = null;
|
||||
updateSelected();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
stable.act(0f);
|
||||
}
|
||||
|
||||
public enum Mode{
|
||||
|
||||
Reference in New Issue
Block a user