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){
|
public void tap(InputEvent event, float x, float y, int count, KeyCode button){
|
||||||
if(showing()) return;
|
if(showing()) return;
|
||||||
|
|
||||||
|
if(selected == hovered){
|
||||||
|
playSelected();
|
||||||
|
}
|
||||||
|
|
||||||
if(hovered != null && (canSelect(hovered) || debugSelect)){
|
if(hovered != null && (canSelect(hovered) || debugSelect)){
|
||||||
selected = hovered;
|
selected = hovered;
|
||||||
}
|
}
|
||||||
@@ -762,6 +766,35 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
sector.hasBase() ? "@sectors.go" :
|
sector.hasBase() ? "@sectors.go" :
|
||||||
locked ? "@locked" : "@sectors.launch",
|
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()){
|
if(sector.isBeingPlayed()){
|
||||||
//already at this sector
|
//already at this sector
|
||||||
@@ -814,30 +847,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(shouldHide) hide();
|
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{
|
public enum Mode{
|
||||||
|
|||||||
Reference in New Issue
Block a user