Input fixes
This commit is contained in:
@@ -10,7 +10,6 @@ buildscript{
|
|||||||
dependencies{
|
dependencies{
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
|
||||||
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
|
||||||
classpath files('tools/filters.jar')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +36,7 @@ allprojects{
|
|||||||
if(arcHash == null){
|
if(arcHash == null){
|
||||||
try{
|
try{
|
||||||
arcHash = 'git ls-remote https://github.com/Anuken/Arc.git'.execute().text.split("\t")[0]//new JsonSlurper().parse(new URL("https://api.github.com/repos/Anuken/Arc/commits/master"))["sha"]
|
arcHash = 'git ls-remote https://github.com/Anuken/Arc.git'.execute().text.split("\t")[0]//new JsonSlurper().parse(new URL("https://api.github.com/repos/Anuken/Arc/commits/master"))["sha"]
|
||||||
}catch(e){ //github can get angry sometimes
|
}catch(e){
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
arcHash = "-SNAPSHOT";
|
arcHash = "-SNAPSHOT";
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 323 KiB After Width: | Height: | Size: 327 KiB |
@@ -66,7 +66,8 @@ public class Control implements ApplicationListener{
|
|||||||
content.initialize(Content::load);
|
content.initialize(Content::load);
|
||||||
|
|
||||||
if(Core.atlas.getTextures().size != 1){
|
if(Core.atlas.getTextures().size != 1){
|
||||||
throw new IllegalStateException("Atlas must be exactly one texture.");
|
throw new IllegalStateException("Atlas must be exactly one texture. " +
|
||||||
|
"If more textures are used, the map editor will not display them correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
unlocks.load();
|
unlocks.load();
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package io.anuke.mindustry.core;
|
package io.anuke.mindustry.core;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.Input.TextInput;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.Consumer;
|
||||||
import io.anuke.arc.input.KeyCode;
|
|
||||||
import io.anuke.arc.scene.ui.Dialog;
|
|
||||||
import io.anuke.arc.scene.ui.TextField;
|
import io.anuke.arc.scene.ui.TextField;
|
||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.arc.util.serialization.Base64Coder;
|
import io.anuke.arc.util.serialization.Base64Coder;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -26,6 +24,17 @@ 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(() -> {
|
||||||
|
TextInput input = new TextInput();
|
||||||
|
input.text = field.getText();
|
||||||
|
input.maxLength = maxLength;
|
||||||
|
input.accepted = text -> {
|
||||||
|
field.clearText();
|
||||||
|
field.appendText(text);
|
||||||
|
field.change();
|
||||||
|
Core.input.setOnscreenKeyboardVisible(false);
|
||||||
|
};
|
||||||
|
Core.input.getTextInput(input);
|
||||||
|
/*
|
||||||
Dialog dialog = new Dialog("", "dialog");
|
Dialog dialog = new Dialog("", "dialog");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.content().top();
|
dialog.content().top();
|
||||||
@@ -59,7 +68,7 @@ public abstract class Platform {
|
|||||||
to.setCursorPosition(to.getText().length());
|
to.setCursorPosition(to.getText().length());
|
||||||
Core.scene.setKeyboardFocus(to);
|
Core.scene.setKeyboardFocus(to);
|
||||||
Core.input.setOnscreenKeyboardVisible(true);
|
Core.input.setOnscreenKeyboardVisible(true);
|
||||||
});
|
});*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**Update discord RPC.*/
|
/**Update discord RPC.*/
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
package io.anuke.mindustry.entities.units.types;
|
|
||||||
|
|
||||||
import io.anuke.annotations.Annotations.Loc;
|
|
||||||
import io.anuke.annotations.Annotations.Remote;
|
|
||||||
import io.anuke.arc.Core;
|
|
||||||
import io.anuke.arc.entities.Effects;
|
|
||||||
import io.anuke.arc.math.Angles;
|
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
|
||||||
import io.anuke.mindustry.Vars;
|
|
||||||
import io.anuke.mindustry.content.fx.UnitFx;
|
|
||||||
import io.anuke.mindustry.entities.Player;
|
|
||||||
import io.anuke.mindustry.entities.Predict;
|
|
||||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
|
||||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
|
||||||
import io.anuke.mindustry.entities.units.UnitCommand;
|
|
||||||
import io.anuke.mindustry.entities.units.UnitState;
|
|
||||||
import io.anuke.mindustry.gen.Call;
|
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
import io.anuke.mindustry.type.AmmoType;
|
|
||||||
|
|
||||||
import java.io.DataInput;
|
|
||||||
import java.io.DataOutput;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.headless;
|
|
||||||
import static io.anuke.mindustry.Vars.players;
|
|
||||||
|
|
||||||
public class AlphaDrone extends FlyingUnit {
|
|
||||||
static final float followDistance = 80f;
|
|
||||||
|
|
||||||
public Player leader;
|
|
||||||
|
|
||||||
public final UnitState attack = new UnitState() {
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
if(leader == null || leader.isDead() || !leader.isAdded()){
|
|
||||||
damage(99999f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TargetTrait last = target;
|
|
||||||
target = leader;
|
|
||||||
|
|
||||||
if(last == null){
|
|
||||||
circle(leader.isShooting ? 60f : 0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
target = last;
|
|
||||||
if(dst(leader) < followDistance){
|
|
||||||
targetClosest();
|
|
||||||
}else{
|
|
||||||
target = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(target != null){
|
|
||||||
attack(50f);
|
|
||||||
|
|
||||||
if((Angles.near(angleTo(target), rotation, 15f) && dst(target) < getWeapon().getAmmo().getRange())){
|
|
||||||
AmmoType ammo = getWeapon().getAmmo();
|
|
||||||
|
|
||||||
Vector2 to = Predict.intercept(AlphaDrone.this, target, ammo.bullet.speed);
|
|
||||||
getWeapon().update(AlphaDrone.this, to.x, to.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!leader.isShooting && dst(leader) < 7f){
|
|
||||||
Call.onAlphaDroneFade(AlphaDrone.this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Remote(called = Loc.server)
|
|
||||||
public static void onAlphaDroneFade(BaseUnit drone){
|
|
||||||
if(drone == null) return;
|
|
||||||
Effects.effect(UnitFx.pickup, drone);
|
|
||||||
//must run afterwards so the unit's group is not null when sending the removal packet
|
|
||||||
Core.app.post(drone::remove);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCommand(UnitCommand command){
|
|
||||||
//nuh
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void behavior(){
|
|
||||||
//nope
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UnitState getStartState() {
|
|
||||||
return attack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(DataOutput stream) throws IOException {
|
|
||||||
super.write(stream);
|
|
||||||
stream.writeInt(leader == null ? -1 : leader.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(DataInput stream) throws IOException {
|
|
||||||
super.read(stream);
|
|
||||||
leader = Vars.playerGroup.getByID(stream.readInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSave(DataInput stream) throws IOException{
|
|
||||||
super.readSave(stream);
|
|
||||||
|
|
||||||
if(!Net.active() && !headless){
|
|
||||||
leader = players[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ public class BackgroundFragment extends Fragment{
|
|||||||
Draw.shader();
|
Draw.shader();
|
||||||
|
|
||||||
boolean portrait = Core.graphics.getWidth() < Core.graphics.getHeight();
|
boolean portrait = Core.graphics.getWidth() < Core.graphics.getHeight();
|
||||||
float logoscl = (int) Unit.dp.scl(1) * (portrait ? 5f / 7f : 1f);
|
float logoscl = (int) Unit.dp.scl(1) * (portrait ? 0.5f : 0.75f);
|
||||||
TextureRegion logo = Core.atlas.find("logotext");
|
TextureRegion logo = Core.atlas.find("logotext");
|
||||||
float logow = logo.getWidth() * logoscl;
|
float logow = logo.getWidth() * logoscl;
|
||||||
float logoh = logo.getHeight() * logoscl;
|
float logoh = logo.getHeight() * logoscl;
|
||||||
|
|||||||
Reference in New Issue
Block a user