Various fixes
This commit is contained in:
@@ -61,6 +61,8 @@ public class Vars{
|
||||
public static final int iconsize = 48;
|
||||
/** size of UI icons (small)*/
|
||||
public static final int iconsizesmall = 32;
|
||||
/** size of UI icons (medium)*/
|
||||
public static final int iconsizemed = 42;
|
||||
/** units outside of this bound will simply die instantly */
|
||||
public static final float finalWorldBounds = worldBounds + 500;
|
||||
/** ticks spent out of bound until self destruct. */
|
||||
|
||||
@@ -112,7 +112,7 @@ public class Renderer implements ApplicationListener{
|
||||
}else{
|
||||
camera.position.lerpDelta(position, 0.08f);
|
||||
}
|
||||
}else if(!mobile){
|
||||
}else if(!mobile || settings.getBool("keyboard")){
|
||||
camera.position.lerpDelta(position, 0.08f);
|
||||
}
|
||||
|
||||
|
||||
@@ -564,10 +564,10 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
data.unlockContent(mech);
|
||||
}
|
||||
|
||||
if(mobile){
|
||||
updateFlying();
|
||||
if(mobile && !Core.settings.getBool("keyboard")){
|
||||
updateTouch();
|
||||
}else{
|
||||
updateMech();
|
||||
updateKeyboard();
|
||||
}
|
||||
|
||||
isTyping = ui.chatfrag.chatOpen();
|
||||
@@ -579,7 +579,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateMech(){
|
||||
protected void updateKeyboard(){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
isBoosting = Core.input.keyDown(Binding.dash) && !mech.flying;
|
||||
@@ -646,7 +646,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateFlying(){
|
||||
protected void updateTouch(){
|
||||
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){
|
||||
target = null;
|
||||
}
|
||||
@@ -657,6 +657,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
|
||||
float targetX = Core.camera.position.x, targetY = Core.camera.position.y;
|
||||
float attractDst = 15f;
|
||||
float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed;
|
||||
|
||||
if(moveTarget != null && !moveTarget.isDead()){
|
||||
targetX = moveTarget.getX();
|
||||
@@ -680,7 +681,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
||||
moveTarget = null;
|
||||
}
|
||||
|
||||
movement.set((targetX - x) / Time.delta(), (targetY - y) / Time.delta()).limit(isBoosting && !mech.flying ? mech.boostSpeed : mech.speed);
|
||||
movement.set((targetX - x) / Time.delta(), (targetY - y) / Time.delta()).limit(speed);
|
||||
movement.setAngle(Mathf.slerp(movement.angle(), velocity.angle(), 0.05f));
|
||||
|
||||
if(dst(targetX, targetY) < attractDst){
|
||||
|
||||
@@ -141,7 +141,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(state.is(State.menu) || Core.scene.hasDialog()) return;
|
||||
|
||||
//zoom and rotate things
|
||||
//zoom things
|
||||
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
table.row();
|
||||
table.left().margin(0f).defaults().size(48f);
|
||||
|
||||
table.addImageButton("icon-break", "clear-toggle-partial", iconsize, () -> {
|
||||
table.addImageButton("icon-break-small", "clear-toggle-partial", iconsizesmall, () -> {
|
||||
mode = mode == breaking ? block == null ? none : placing : breaking;
|
||||
lastBlock = block;
|
||||
if(mode == breaking){
|
||||
@@ -274,17 +274,17 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}).update(l -> l.setChecked(mode == breaking));
|
||||
|
||||
//diagonal swap button
|
||||
table.addImageButton("icon-diagonal", "clear-toggle-partial", iconsize, () -> {
|
||||
table.addImageButton("icon-diagonal-small", "clear-toggle-partial", iconsizesmall, () -> {
|
||||
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
|
||||
Core.settings.save();
|
||||
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
|
||||
|
||||
//rotate button
|
||||
table.addImageButton("icon-arrow", "clear-partial", iconsize, () -> rotation = Mathf.mod(rotation + 1, 4))
|
||||
table.addImageButton("icon-arrow-small", "clear-partial", iconsizesmall, () -> rotation = Mathf.mod(rotation + 1, 4))
|
||||
.update(i -> i.getImage().setRotationOrigin(rotation * 90, Align.center)).visible(() -> block != null && block.rotate);
|
||||
|
||||
//confirm button
|
||||
table.addImageButton("icon-check", "clear-partial", iconsize, () -> {
|
||||
table.addImageButton("icon-check-small", "clear-partial", iconsizesmall, () -> {
|
||||
for(PlaceRequest request : selection){
|
||||
Tile tile = request.tile();
|
||||
|
||||
@@ -475,7 +475,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
//call tap events
|
||||
if(pointer == 0 && !selecting && mode == none){
|
||||
tryTapPlayer(worldx, worldy);
|
||||
if(!tryTapPlayer(worldx, worldy) && Core.settings.getBool("keyboard")){
|
||||
//shoot on touch down when in keyboard mode
|
||||
player.isShooting = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -598,6 +601,27 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
mode = none;
|
||||
}
|
||||
|
||||
//zoom things
|
||||
if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && (Core.input.keyDown(Binding.zoom_hold))){
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
if(!Core.settings.getBool("keyboard")){
|
||||
//move camera around
|
||||
float camSpeed = 6f;
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta() * camSpeed));
|
||||
}
|
||||
|
||||
if(Core.settings.getBool("keyboard")){
|
||||
if(Core.input.keyRelease(Binding.select)){
|
||||
player.isShooting = false;
|
||||
}
|
||||
|
||||
if(player.isShooting && !canShoot()){
|
||||
player.isShooting = false;
|
||||
}
|
||||
}
|
||||
|
||||
//reset state when not placing
|
||||
if(mode == none){
|
||||
selecting = false;
|
||||
@@ -678,7 +702,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean pan(float x, float y, float deltaX, float deltaY){
|
||||
if(Core.scene.hasDialog()) return false;
|
||||
if(Core.scene.hasDialog() || Core.settings.getBool("keyboard")) return false;
|
||||
|
||||
float scale = Core.camera.width / Core.graphics.getWidth();
|
||||
deltaX *= scale;
|
||||
@@ -723,6 +747,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public boolean zoom(float initialDistance, float distance){
|
||||
if(Core.settings.getBool("keyboard")) return false;
|
||||
if(lastDistance == -1) lastDistance = initialDistance;
|
||||
|
||||
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();
|
||||
|
||||
@@ -64,7 +64,7 @@ public class MapPlayDialog extends FloatingDialog{
|
||||
buttons.clearChildren();
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$play", "icon-play", 8*3, () -> {
|
||||
buttons.addImageTextButton("$play", "icon-play", iconsize, () -> {
|
||||
control.playMap(map, rules);
|
||||
hide();
|
||||
ui.custom.hide();
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
|
||||
}else{
|
||||
cont.defaults().size(120f).pad(5);
|
||||
float isize = 14f * 4;
|
||||
float isize = iconsize;
|
||||
|
||||
cont.addRowImageTextButton("$back", "icon-play-2", isize, this::hide);
|
||||
cont.addRowImageTextButton("$settings", "icon-tools", isize, ui.settings::show);
|
||||
|
||||
@@ -12,7 +12,6 @@ import io.anuke.arc.scene.ui.*;
|
||||
import io.anuke.arc.scene.ui.SettingsDialog.SettingsTable.Setting;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.util.Align;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
@@ -76,12 +75,10 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
menu.addButton("$settings.graphics", () -> visible(1));
|
||||
menu.row();
|
||||
menu.addButton("$settings.sound", () -> visible(2));
|
||||
if(!Vars.mobile){
|
||||
menu.row();
|
||||
menu.addButton("$settings.controls", ui.controls::show);
|
||||
}
|
||||
menu.row();
|
||||
menu.addButton("$settings.language", ui.language::show);
|
||||
menu.row();
|
||||
menu.addButton("$settings.controls", ui.controls::show).visible(() -> !mobile || Core.settings.getBool("keyboard"));
|
||||
|
||||
prefs.clearChildren();
|
||||
prefs.add(menu);
|
||||
@@ -125,6 +122,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.screenshakePref();
|
||||
if(mobile){
|
||||
game.checkPref("autotarget", true);
|
||||
game.checkPref("keyboard", false);
|
||||
}
|
||||
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Core.bundle.format("setting.seconds", i));
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ public class PlacementFragment extends Fragment{
|
||||
continue;
|
||||
}
|
||||
|
||||
categories.addImageButton("icon-" + cat.name(), "clear-toggle", iconsize, () -> {
|
||||
categories.addImageButton("icon-" + cat.name() + "-med", "clear-toggle", iconsizemed, () -> {
|
||||
currentCategory = cat;
|
||||
rebuildCategory.run();
|
||||
}).group(group).update(i -> i.setChecked(currentCategory == cat));
|
||||
|
||||
@@ -105,14 +105,14 @@ public class PlayerListFragment extends Fragment{
|
||||
button.table(t -> {
|
||||
t.defaults().size(bs);
|
||||
|
||||
t.addImageButton("icon-ban", "clear-partial", iconsize,
|
||||
t.addImageButton("icon-ban-small", "clear-partial", iconsizesmall,
|
||||
() -> ui.showConfirm("$confirm", "$confirmban", () -> Call.onAdminRequest(user, AdminAction.ban)));
|
||||
t.addImageButton("icon-cancel", "clear-partial", iconsize,
|
||||
t.addImageButton("icon-cancel-small", "clear-partial", iconsizesmall,
|
||||
() -> ui.showConfirm("$confirm", "$confirmkick", () -> Call.onAdminRequest(user, AdminAction.kick)));
|
||||
|
||||
t.row();
|
||||
|
||||
t.addImageButton("icon-admin", "clear-toggle-partial", iconsize, () -> {
|
||||
t.addImageButton("icon-admin-small", "clear-toggle-partial", iconsizesmall, () -> {
|
||||
if(Net.client()) return;
|
||||
|
||||
String id = user.uuid;
|
||||
@@ -128,7 +128,7 @@ public class PlayerListFragment extends Fragment{
|
||||
.touchable(() -> Net.client() ? Touchable.disabled : Touchable.enabled)
|
||||
.checked(user.isAdmin);
|
||||
|
||||
t.addImageButton("icon-zoom", "clear-partial", iconsize, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
t.addImageButton("icon-zoom-small", "clear-partial", iconsizesmall, () -> Call.onAdminRequest(user, AdminAction.trace));
|
||||
|
||||
}).padRight(12).size(bs + 10f, bs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user