mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-03 16:39:37 +07:00
Made inventory hide on second tap / Mobile rotation arrow
This commit is contained in:
@ -19,6 +19,7 @@ import io.anuke.arc.math.geom.Vector2;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.util.Align;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.Tmp;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
@ -218,6 +219,23 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
void drawPlaceArrow(Block block, int x, int y, int rotation){
|
||||
if(!block.rotate) return;
|
||||
Draw.color(!validPlace(x, y, block, rotation) ? Pal.removeBack : Pal.accentBack);
|
||||
Draw.rect(Core.atlas.find("place-arrow"),
|
||||
x * tilesize + block.offset(),
|
||||
y * tilesize + block.offset() - 1,
|
||||
Core.atlas.find("place-arrow").getWidth() * Draw.scl,
|
||||
Core.atlas.find("place-arrow").getHeight() * Draw.scl, rotation * 90 - 90);
|
||||
|
||||
Draw.color(!validPlace(x, y, block, rotation) ? Pal.remove : Pal.accent);
|
||||
Draw.rect(Core.atlas.find("place-arrow"),
|
||||
x * tilesize + block.offset(),
|
||||
y * tilesize + block.offset(),
|
||||
Core.atlas.find("place-arrow").getWidth() * Draw.scl,
|
||||
Core.atlas.find("place-arrow").getHeight() * Draw.scl, rotation * 90 - 90);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
//region UI and drawing
|
||||
@ -311,10 +329,18 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
request.scale = Mathf.lerpDelta(request.scale, 1f, 0.2f);
|
||||
request.redness = Mathf.lerpDelta(request.redness, 0f, 0.2f);
|
||||
}else{
|
||||
request.scale = Mathf.lerpDelta(request.scale, 0.5f, 0.1f);
|
||||
request.redness = Mathf.lerpDelta(request.redness, 1f, 0.2f);
|
||||
request.scale = Mathf.lerpDelta(request.scale, 0.6f, 0.1f);
|
||||
request.redness = Mathf.lerpDelta(request.redness, 0.9f, 0.2f);
|
||||
}
|
||||
|
||||
Tmp.c1.set(Draw.getMixColor());
|
||||
|
||||
if(!request.remove && request == lastPlaced && request.block != null){
|
||||
Draw.mixcol();
|
||||
drawPlaceArrow(request.block, tile.x, tile.y, request.rotation);
|
||||
}
|
||||
|
||||
Draw.mixcol(Tmp.c1, 1f);
|
||||
drawRequest(request);
|
||||
|
||||
//draw last placed request
|
||||
@ -334,12 +360,19 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
//draw placing
|
||||
if(mode == placing && block != null){
|
||||
|
||||
NormalizeDrawResult dresult = PlaceUtils.normalizeDrawArea(block, lineStartX, lineStartY, tileX, tileY, true, maxLength, lineScale);
|
||||
|
||||
Lines.rect(dresult.x, dresult.y, dresult.x2 - dresult.x, dresult.y2 - dresult.y);
|
||||
|
||||
NormalizeResult result = PlaceUtils.normalizeArea(lineStartX, lineStartY, tileX, tileY, rotation, true, maxLength);
|
||||
|
||||
{
|
||||
int x = lineStartX + result.getLength() * Mathf.sign(tileX - lineStartX) * Mathf.num(result.isX());
|
||||
int y = lineStartY + result.getLength() * Mathf.sign(tileY - lineStartY) * Mathf.num(!result.isX());
|
||||
drawPlaceArrow(block, x, y, result.rotation);
|
||||
}
|
||||
|
||||
//go through each cell and draw the block to place if valid
|
||||
for(int i = 0; i <= result.getLength(); i += block.size){
|
||||
int x = lineStartX + i * Mathf.sign(tileX - lineStartX) * Mathf.num(result.isX());
|
||||
|
@ -7,7 +7,6 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.ui.ContentDisplay;
|
||||
|
||||
public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
@ -24,8 +23,6 @@ public class Item extends UnlockableContent implements Comparable<Item>{
|
||||
public float radioactivity;
|
||||
/**drill hardness of the item*/
|
||||
public int hardness = 0;
|
||||
/**the burning color of this item. TODO unused; implement*/
|
||||
public Color flameColor = Pal.darkFlame.cpy();
|
||||
/**
|
||||
* base material cost of this item, used for calculating place times
|
||||
* 1 cost = 1 tick added to build time
|
||||
|
@ -66,6 +66,10 @@ public class BlockInventoryFragment extends Fragment{
|
||||
}
|
||||
|
||||
public void showFor(Tile t){
|
||||
if(this.tile == t.target()){
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
this.tile = t.target();
|
||||
if(tile == null || tile.entity == null || !tile.block().isAccessible() || tile.entity.items.total() == 0)
|
||||
return;
|
||||
|
@ -69,12 +69,6 @@ task dist(type: Jar){
|
||||
}
|
||||
}
|
||||
|
||||
task clearOut(type: Delete){
|
||||
doLast{
|
||||
delete "packr-out/"
|
||||
}
|
||||
}
|
||||
|
||||
//note: call desktop:dist beforehand
|
||||
task packrCmd(){
|
||||
|
||||
@ -102,35 +96,41 @@ task packrCmd(){
|
||||
}
|
||||
}
|
||||
|
||||
task fixMac(type: Copy){
|
||||
dependsOn "packrCmd"
|
||||
|
||||
into "packr-out/" + appName + ".app/Contents/"
|
||||
from "packr-out/Contents/"
|
||||
|
||||
doLast{
|
||||
delete{
|
||||
delete "packr-out/Contents/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task fixWindows32(type: Copy){
|
||||
dependsOn "packrCmd"
|
||||
|
||||
into "packr-out/jre/bin/"
|
||||
from JDK_DIR + "zip.dll"
|
||||
rename("zip.dll", "ojdkbuild_zlib.dll")
|
||||
|
||||
doLast{
|
||||
copy{
|
||||
into "packr-out/jre/bin/"
|
||||
from JDK_DIR + "zip.dll"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task packrZip(){
|
||||
task clearOut(type: Delete){
|
||||
doLast{
|
||||
delete "packr-out/"
|
||||
}
|
||||
}
|
||||
|
||||
task fixMac(type: Copy){
|
||||
dependsOn "packrCmd"
|
||||
|
||||
into "packr-out/" + appName + ".app/Contents/"
|
||||
from "packr-out/Contents/"
|
||||
|
||||
doLast{
|
||||
delete{
|
||||
delete "packr-out/Contents/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task fixWindows32(type: Copy){
|
||||
dependsOn "packrCmd"
|
||||
|
||||
into "packr-out/jre/bin/"
|
||||
from JDK_DIR + "zip.dll"
|
||||
rename("zip.dll", "ojdkbuild_zlib.dll")
|
||||
|
||||
doLast{
|
||||
copy{
|
||||
into "packr-out/jre/bin/"
|
||||
from JDK_DIR + "zip.dll"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependsOn "packrCmd"
|
||||
finalizedBy "clearOut"
|
||||
|
||||
@ -144,12 +144,12 @@ task packrZip(){
|
||||
dependsOn "fixWindows32"
|
||||
}
|
||||
|
||||
task zip(type: Zip){
|
||||
task rzip(type: Zip){
|
||||
from "packr-out/"
|
||||
archiveName "$appName-${getPlatform()}-${getVersionString()}.zip"
|
||||
destinationDir(file("packr-export"))
|
||||
}
|
||||
|
||||
finalizedBy 'zip'
|
||||
finalizedBy 'rzip'
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user