Bugfixes / Sorter item memory

This commit is contained in:
Anuken
2018-11-26 12:40:24 -05:00
parent a241f63ddc
commit d03ceb2a23
2 changed files with 22 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.fragments;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.EventType.WorldLoadGraphicsEvent;
@@ -33,7 +34,7 @@ public class PlacementFragment extends Fragment{
Category currentCategory = Category.turret;
Block hovered, lastDisplay;
Tile hoverTile;
Table blockTable, toggler;
Table blockTable, toggler, topTable;
boolean shown = true;
public PlacementFragment(){
@@ -106,6 +107,7 @@ public class PlacementFragment extends Fragment{
//top table with hover info
frame.table("clear", top -> {
topTable = top;
top.add(new Table()).growX().update(topTable -> {
if((tileDisplayBlock() == null && lastDisplay == getSelected()) ||
(tileDisplayBlock() != null && lastDisplay == tileDisplayBlock())) return;
@@ -194,8 +196,10 @@ public class PlacementFragment extends Fragment{
Block getSelected(){
Block toDisplay = null;
Vector2 v = topTable.stageToLocalCoordinates(Graphics.mouse());
//setup hovering tile
if(!ui.hasMouse()){
if(!ui.hasMouse() && topTable.hit(v.x, v.y, false) == null){
Tile tile = world.tileWorld(Graphics.mouseWorld().x, Graphics.mouseWorld().y);
if(tile != null){
hoverTile = tile.target();