Add enable building hint, combine building and respawn hints (#4678)
This commit is contained in:
@@ -8,7 +8,6 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.event.*;
|
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -42,38 +41,32 @@ public class DesktopInput extends InputHandler{
|
|||||||
/** Selected build request for movement. */
|
/** Selected build request for movement. */
|
||||||
public @Nullable BuildPlan sreq;
|
public @Nullable BuildPlan sreq;
|
||||||
/** Whether player is currently deleting removal requests. */
|
/** Whether player is currently deleting removal requests. */
|
||||||
public boolean deleting = false, wasBuilding = true, shouldShoot = false, panning = false;
|
public boolean deleting = false, shouldShoot = false, panning = false;
|
||||||
/** Mouse pan speed. */
|
/** Mouse pan speed. */
|
||||||
public float panScale = 0.005f, panSpeed = 4.5f, panBoostSpeed = 11f;
|
public float panScale = 0.005f, panSpeed = 4.5f, panBoostSpeed = 11f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildUI(Group group){
|
public void buildUI(Group group){
|
||||||
//respawn hints
|
//building and respawn hints
|
||||||
group.fill(t -> {
|
group.fill(t -> {
|
||||||
t.visible(() -> Core.settings.getBool("hints") && ui.hudfrag.shown && !player.dead() && !player.unit().spawnedByCore() && !(Core.settings.getBool("hints") && lastSchematic != null && !selectRequests.isEmpty()));
|
t.visible(() -> ui.hudfrag.shown && Core.settings.getBool("hints") && selectRequests.isEmpty() && (!isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() || !player.dead() && !player.unit().spawnedByCore()));
|
||||||
t.bottom();
|
t.bottom();
|
||||||
t.table(Styles.black6, b -> {
|
t.table(Styles.black6, b -> {
|
||||||
b.defaults().left();
|
b.defaults().left();
|
||||||
b.label(() -> Core.bundle.format("respawn", Core.keybinds.get(Binding.respawn).key.toString())).style(Styles.outlineLabel);
|
b.label(() -> {
|
||||||
}).margin(6f);
|
String str = "";
|
||||||
});
|
if(!isBuilding && !Core.settings.getBool("buildautopause") && !player.unit().isBuilding()){
|
||||||
|
str += Core.bundle.format("enablebuilding", Core.keybinds.get(Binding.pause_building).key.toString());
|
||||||
//building hints
|
}else if(player.unit().isBuilding()){
|
||||||
group.fill(t -> {
|
str += Core.bundle.format(isBuilding ? "pausebuilding" : "resumebuilding", Core.keybinds.get(Binding.pause_building).key.toString()) +
|
||||||
t.bottom();
|
"\n" + Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString()) +
|
||||||
t.visible(() -> {
|
"\n" + Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString());
|
||||||
t.color.a = Mathf.lerpDelta(t.color.a, player.unit().isBuilding() ? 1f : 0f, 0.15f);
|
}
|
||||||
|
if(!player.dead() && !player.unit().spawnedByCore()){
|
||||||
return ui.hudfrag.shown && Core.settings.getBool("hints") && selectRequests.isEmpty() && t.color.a > 0.01f;
|
str += (!str.isEmpty() ? "\n" : "") + Core.bundle.format("respawn", Core.keybinds.get(Binding.respawn).key.toString());
|
||||||
});
|
}
|
||||||
t.touchable(() -> t.color.a < 0.1f ? Touchable.disabled : Touchable.childrenOnly);
|
return str;
|
||||||
t.table(Styles.black6, b -> {
|
}).style(Styles.outlineLabel);
|
||||||
b.defaults().left();
|
|
||||||
b.label(() -> Core.bundle.format(!isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.toString())).style(Styles.outlineLabel);
|
|
||||||
b.row();
|
|
||||||
b.label(() -> Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString())).style(Styles.outlineLabel);
|
|
||||||
b.row();
|
|
||||||
b.label(() -> Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString())).style(Styles.outlineLabel);
|
|
||||||
}).margin(10f);
|
}).margin(10f);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -454,7 +447,6 @@ public class DesktopInput extends InputHandler{
|
|||||||
buildWasAutoPaused = false;
|
buildWasAutoPaused = false;
|
||||||
|
|
||||||
if(isBuilding){
|
if(isBuilding){
|
||||||
wasBuilding = player.unit().isBuilding();
|
|
||||||
player.shooting = false;
|
player.shooting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,7 +554,6 @@ public class DesktopInput extends InputHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
mode = none;
|
mode = none;
|
||||||
wasBuilding = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Core.input.keyTap(Binding.toggle_block_status)){
|
if(Core.input.keyTap(Binding.toggle_block_status)){
|
||||||
|
|||||||
Reference in New Issue
Block a user