Misc bugfixes

This commit is contained in:
Anuken
2018-11-19 17:56:26 -05:00
parent f31f09d77a
commit 3c37047afb
2 changed files with 17 additions and 11 deletions
+1 -2
View File
@@ -60,7 +60,7 @@ public class Recipe extends UnlockableContent{
public static Array<Recipe> getByCategory(Category category){ public static Array<Recipe> getByCategory(Category category){
returnArray.clear(); returnArray.clear();
for(Recipe recipe : content.recipes()){ for(Recipe recipe : content.recipes()){
if(recipe.category == category && !recipe.isHidden()){ if(recipe.category == category && recipe.visibility.shown() && (recipe.mode == state.mode || recipe.mode == null)){
returnArray.add(recipe); returnArray.add(recipe);
} }
} }
@@ -91,7 +91,6 @@ public class Recipe extends UnlockableContent{
return this; return this;
} }
@Override @Override
public boolean alwaysUnlocked(){ public boolean alwaysUnlocked(){
return alwaysUnlocked; return alwaysUnlocked;
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.math.Interpolation;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.EventType.WorldLoadGraphicsEvent;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.type.Category; import io.anuke.mindustry.type.Category;
@@ -13,6 +14,7 @@ import io.anuke.mindustry.ui.ImageStack;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.OreBlock; import io.anuke.mindustry.world.blocks.OreBlock;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.scene.Group; import io.anuke.ucore.scene.Group;
import io.anuke.ucore.scene.actions.Actions; import io.anuke.ucore.scene.actions.Actions;
@@ -34,6 +36,14 @@ public class PlacementFragment extends Fragment{
Table blockTable, toggler; Table blockTable, toggler;
boolean shown = true; boolean shown = true;
public PlacementFragment(){
Events.on(WorldLoadGraphicsEvent.class, event -> {
Group group = toggler.getParent();
toggler.remove();
build(group);
});
}
@Override @Override
public void build(Group parent){ public void build(Group parent){
parent.fill(full -> { parent.fill(full -> {
@@ -84,16 +94,13 @@ public class PlacementFragment extends Fragment{
} }
}); });
if(!mobile){ button.hovered(() -> hovered = recipe.result);
button.hovered(() -> hovered = recipe.result); button.exited(() -> {
button.exited(() -> { if(hovered == recipe.result){
if(hovered == recipe.result){ hovered = null;
hovered = null; }
} });
});
}
} }
blockTable.act(0f); blockTable.act(0f);
}; };