Added rotation to Android placement
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
@@ -19,12 +19,24 @@ public class ContentLoader {
|
|||||||
public static void load(){
|
public static void load(){
|
||||||
|
|
||||||
ContentList[] content = {
|
ContentList[] content = {
|
||||||
|
//effects
|
||||||
|
new BlockFx(),
|
||||||
|
new BulletFx(),
|
||||||
|
new EnvironmentFx(),
|
||||||
|
new ExplosionFx(),
|
||||||
|
new Fx(),
|
||||||
|
new ShootFx(),
|
||||||
|
new UnitFx(),
|
||||||
|
|
||||||
//items
|
//items
|
||||||
new Items(),
|
new Items(),
|
||||||
|
|
||||||
//liquids
|
//liquids
|
||||||
new Liquids(),
|
new Liquids(),
|
||||||
|
|
||||||
|
//status effects
|
||||||
|
new StatusEffects(),
|
||||||
|
|
||||||
//bullets
|
//bullets
|
||||||
new ArtilleryBullets(),
|
new ArtilleryBullets(),
|
||||||
new FlakBullets(),
|
new FlakBullets(),
|
||||||
@@ -39,24 +51,9 @@ public class ContentLoader {
|
|||||||
//mechs
|
//mechs
|
||||||
new Mechs(),
|
new Mechs(),
|
||||||
|
|
||||||
//units
|
|
||||||
new UnitTypes(),
|
|
||||||
|
|
||||||
//weapons
|
//weapons
|
||||||
new Weapons(),
|
new Weapons(),
|
||||||
|
|
||||||
//status effects
|
|
||||||
new StatusEffects(),
|
|
||||||
|
|
||||||
//effects
|
|
||||||
new BlockFx(),
|
|
||||||
new BulletFx(),
|
|
||||||
new EnvironmentFx(),
|
|
||||||
new ExplosionFx(),
|
|
||||||
new Fx(),
|
|
||||||
new ShootFx(),
|
|
||||||
new UnitFx(),
|
|
||||||
|
|
||||||
//blocks
|
//blocks
|
||||||
new Blocks(),
|
new Blocks(),
|
||||||
new DefenseBlocks(),
|
new DefenseBlocks(),
|
||||||
@@ -72,6 +69,9 @@ public class ContentLoader {
|
|||||||
|
|
||||||
//recipes
|
//recipes
|
||||||
new Recipes(),
|
new Recipes(),
|
||||||
|
|
||||||
|
//units
|
||||||
|
new UnitTypes(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (ContentList list : content){
|
for (ContentList list : content){
|
||||||
|
|||||||
@@ -134,6 +134,8 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
act();
|
act();
|
||||||
|
|
||||||
|
Graphics.begin();
|
||||||
|
|
||||||
for(int i = 0; i < players.length; i ++){
|
for(int i = 0; i < players.length; i ++){
|
||||||
InputHandler input = control.input(i);
|
InputHandler input = control.input(i);
|
||||||
|
|
||||||
@@ -142,11 +144,12 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
float scl = Unit.dp.scl(3f);
|
float scl = Unit.dp.scl(3f);
|
||||||
|
|
||||||
Graphics.begin();
|
|
||||||
Draw.rect("controller-cursor", input.getMouseX(), Gdx.graphics.getHeight() - input.getMouseY(), 16*scl, 16*scl);
|
Draw.rect("controller-cursor", input.getMouseX(), Gdx.graphics.getHeight() - input.getMouseY(), 16*scl, 16*scl);
|
||||||
Graphics.end();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Graphics.end();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -181,7 +184,7 @@ public class UI extends SceneModule{
|
|||||||
placefrag.build(group);
|
placefrag.build(group);
|
||||||
chatfrag.build(group);
|
chatfrag.build(group);
|
||||||
listfrag.build(group);
|
listfrag.build(group);
|
||||||
debugfrag.build(group);
|
//debugfrag.build(group);
|
||||||
playermenufrag.build(group);
|
playermenufrag.build(group);
|
||||||
loadfrag.build(group);
|
loadfrag.build(group);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import static io.anuke.mindustry.Vars.world;
|
|||||||
public interface BlockBuilder {
|
public interface BlockBuilder {
|
||||||
//temporary static final values
|
//temporary static final values
|
||||||
Translator[] tmptr = {new Translator(), new Translator(), new Translator(), new Translator()};
|
Translator[] tmptr = {new Translator(), new Translator(), new Translator(), new Translator()};
|
||||||
float placeDistance = 80f;
|
float placeDistance = 200f;
|
||||||
|
|
||||||
/**Returns the queue for storing build requests.*/
|
/**Returns the queue for storing build requests.*/
|
||||||
Queue<BuildRequest> getPlaceQueue();
|
Queue<BuildRequest> getPlaceQueue();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.input.GestureDetector;
|
|||||||
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
import com.badlogic.gdx.input.GestureDetector.GestureListener;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
@@ -147,27 +148,38 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
|||||||
//Create confirm/cancel table
|
//Create confirm/cancel table
|
||||||
new table(){{
|
new table(){{
|
||||||
abottom().aleft();
|
abottom().aleft();
|
||||||
defaults().size(60f);
|
|
||||||
|
|
||||||
//Add a cancel button, which clears the selection.
|
new table("pane"){{
|
||||||
new imagebutton("icon-cancel", 14*2f, () -> recipe = null);
|
margin(5);
|
||||||
|
defaults().size(60f);
|
||||||
|
|
||||||
//Add an accept button, which places everything.
|
//Add a cancel button, which clears the selection.
|
||||||
new imagebutton("icon-check", 14*2f, () -> {
|
new imagebutton("icon-cancel", 16 * 2f, () -> recipe = null);
|
||||||
for(PlaceRequest request : placement){
|
|
||||||
Tile tile = request.tile();
|
|
||||||
|
|
||||||
if(tile != null){
|
//Add an accept button, which places everything.
|
||||||
rotation = request.rotation;
|
new imagebutton("icon-check", 16 * 2f, () -> {
|
||||||
recipe = request.recipe;
|
for (PlaceRequest request : placement) {
|
||||||
tryPlaceBlock(tile.x, tile.y);
|
Tile tile = request.tile();
|
||||||
|
|
||||||
|
if (tile != null) {
|
||||||
|
rotation = request.rotation;
|
||||||
|
recipe = request.recipe;
|
||||||
|
tryPlaceBlock(tile.x, tile.y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
removals.addAll(placement);
|
removals.addAll(placement);
|
||||||
placement.clear();
|
placement.clear();
|
||||||
selecting = false;
|
selecting = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Add a rotate button
|
||||||
|
new imagebutton("icon-arrow", 16 * 2f, () -> rotation = Mathf.mod(rotation + 1, 4))
|
||||||
|
.update(i -> {
|
||||||
|
i.getImage().setRotation(rotation * 90);
|
||||||
|
i.getImage().setOrigin(Align.center);
|
||||||
|
}).cell.disabled(i -> recipe == null || !recipe.result.rotate);
|
||||||
|
}}.end();
|
||||||
}}.visible(() -> isPlacing() && placement.size > 0).end();
|
}}.visible(() -> isPlacing() && placement.size > 0).end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +245,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
for(TextureRegion region : regions){
|
for(TextureRegion region : regions){
|
||||||
Draw.rect(region, x *tilesize + recipe.result.offset(), y * tilesize + recipe.result.offset(),
|
Draw.rect(region, x *tilesize + recipe.result.offset(), y * tilesize + recipe.result.offset(),
|
||||||
region.getRegionWidth() * lineScale, region.getRegionHeight() * lineScale, recipe.result.rotate ? rotation * 90 : 0);
|
region.getRegionWidth() * lineScale, region.getRegionHeight() * lineScale, recipe.result.rotate ? result.rotation * 90 : 0);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
Draw.color(Palette.breakInvalid);
|
Draw.color(Palette.breakInvalid);
|
||||||
@@ -315,7 +327,7 @@ public class AndroidInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(float x, float y) {
|
public boolean longPress(float x, float y) {
|
||||||
if(state.is(State.menu)) return false;
|
if(state.is(State.menu) || !isPlacing()) return false;
|
||||||
|
|
||||||
//get tile on cursor
|
//get tile on cursor
|
||||||
Tile cursor = tileAt(x, y);
|
Tile cursor = tileAt(x, y);
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ import io.anuke.ucore.util.Translator;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public abstract class InputHandler extends InputAdapter{
|
public abstract class InputHandler extends InputAdapter{
|
||||||
float playerSelectRange = Unit.dp.scl(80f);
|
/**Used for dropping items.*/
|
||||||
|
float playerSelectRange = Unit.dp.scl(40f);
|
||||||
Translator stackTrns = new Translator();
|
Translator stackTrns = new Translator();
|
||||||
|
|
||||||
public final Player player;
|
public final Player player;
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class DebugFragment implements Fragment {
|
|||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
|
|
||||||
Player player = players[0];
|
Player player = players[0];
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
visible(() -> debug);
|
visible(() -> debug);
|
||||||
|
|
||||||
|
|||||||