Mobile chat fix / Turret balance / UI disable variable
This commit is contained in:
@@ -73,6 +73,7 @@ public class Vars{
|
|||||||
};
|
};
|
||||||
//server port
|
//server port
|
||||||
public static final int port = 6567;
|
public static final int port = 6567;
|
||||||
|
public static boolean disableUI;
|
||||||
public static boolean testMobile;
|
public static boolean testMobile;
|
||||||
//shorthand for whether or not this is running on android or ios
|
//shorthand for whether or not this is running on android or ios
|
||||||
public static boolean mobile;
|
public static boolean mobile;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
|||||||
shootShake = 1f;
|
shootShake = 1f;
|
||||||
shootCone = 40f;
|
shootCone = 40f;
|
||||||
rotatespeed = 8f;
|
rotatespeed = 8f;
|
||||||
powerUsed = 9f;
|
powerUsed = 10f;
|
||||||
powerCapacity = 30f;
|
powerCapacity = 30f;
|
||||||
range = 150f;
|
range = 150f;
|
||||||
shootEffect = ShootFx.lightningShoot;
|
shootEffect = ShootFx.lightningShoot;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import io.anuke.ucore.core.Timers;
|
|||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
import io.anuke.ucore.util.Log;
|
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -29,7 +28,6 @@ public abstract class Platform {
|
|||||||
if(!mobile) return; //this is mobile only, desktop doesn't need dialogs
|
if(!mobile) return; //this is mobile only, desktop doesn't need dialogs
|
||||||
|
|
||||||
field.tapped(() -> {
|
field.tapped(() -> {
|
||||||
Log.info("yappd");
|
|
||||||
Dialog dialog = new Dialog("", "dialog");
|
Dialog dialog = new Dialog("", "dialog");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.content().top();
|
dialog.content().top();
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
if(disableUI) return;
|
||||||
|
|
||||||
if(Graphics.drawing()) Graphics.end();
|
if(Graphics.drawing()) Graphics.end();
|
||||||
|
|
||||||
act();
|
act();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package io.anuke.mindustry.ui.fragments;
|
package io.anuke.mindustry.ui.fragments;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Input.Keys;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
@@ -8,13 +10,13 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.core.Platform;
|
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Inputs;
|
import io.anuke.ucore.core.Inputs;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.scene.Group;
|
import io.anuke.ucore.scene.Group;
|
||||||
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
import io.anuke.ucore.scene.ui.Label;
|
import io.anuke.ucore.scene.ui.Label;
|
||||||
import io.anuke.ucore.scene.ui.Label.LabelStyle;
|
import io.anuke.ucore.scene.ui.Label.LabelStyle;
|
||||||
import io.anuke.ucore.scene.ui.TextField;
|
import io.anuke.ucore.scene.ui.TextField;
|
||||||
@@ -22,8 +24,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
|||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.players;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static io.anuke.mindustry.Vars.state;
|
|
||||||
import static io.anuke.ucore.core.Core.scene;
|
import static io.anuke.ucore.core.Core.scene;
|
||||||
import static io.anuke.ucore.core.Core.skin;
|
import static io.anuke.ucore.core.Core.skin;
|
||||||
|
|
||||||
@@ -113,9 +114,35 @@ public class ChatFragment extends Table{
|
|||||||
chatfield.getStyle().font = skin.getFont("default-font-chat");
|
chatfield.getStyle().font = skin.getFont("default-font-chat");
|
||||||
chatfield.getStyle().fontColor = Color.WHITE;
|
chatfield.getStyle().fontColor = Color.WHITE;
|
||||||
chatfield.setStyle(chatfield.getStyle());
|
chatfield.setStyle(chatfield.getStyle());
|
||||||
Platform.instance.addDialog(chatfield, Vars.maxTextLength);
|
|
||||||
|
|
||||||
bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(4f);
|
if(mobile){
|
||||||
|
chatfield.tapped(() -> {
|
||||||
|
Dialog dialog = new Dialog("", "dialog");
|
||||||
|
dialog.setFillParent(true);
|
||||||
|
dialog.content().top();
|
||||||
|
dialog.content().defaults().height(65f);
|
||||||
|
TextField to = dialog.content().addField("", t-> {}).pad(15).width(250f).get();
|
||||||
|
to.setMaxLength(maxTextLength);
|
||||||
|
to.keyDown(Keys.ENTER, () -> dialog.content().find("okb").fireClick());
|
||||||
|
dialog.content().addButton("$text.ok", () -> {
|
||||||
|
chatfield.clearText();
|
||||||
|
chatfield.appendText(to.getText());
|
||||||
|
chatfield.change();
|
||||||
|
dialog.hide();
|
||||||
|
Gdx.input.setOnscreenKeyboardVisible(false);
|
||||||
|
toggle();
|
||||||
|
}).width(90f).name("okb");
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
Timers.runTask(1f, () -> {
|
||||||
|
to.setCursorPosition(to.getText().length());
|
||||||
|
Core.scene.setKeyboardFocus(to);
|
||||||
|
Gdx.input.setOnscreenKeyboardVisible(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f);
|
||||||
|
|
||||||
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
|
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
|
||||||
|
|
||||||
@@ -123,10 +150,6 @@ public class ChatFragment extends Table{
|
|||||||
marginBottom(105f);
|
marginBottom(105f);
|
||||||
marginRight(240f);
|
marginRight(240f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Vars.mobile){
|
|
||||||
addImageButton("icon-arrow-right", 14 * 2, this::toggle).size(46f, 51f).visible(() -> chatOpen).pad(2f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user