Added weapon factory block, refactored recipes
This commit is contained in:
@@ -1,24 +1,6 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Weapon;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.function.Listenable;
|
||||
import io.anuke.ucore.scene.ui.Image;
|
||||
import io.anuke.ucore.scene.ui.TextButton;
|
||||
import io.anuke.ucore.scene.ui.Tooltip;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
|
||||
public class UpgradeDialog extends FloatingDialog{
|
||||
boolean wasPaused = false;
|
||||
|
||||
@@ -28,6 +10,7 @@ public class UpgradeDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
void setup(){
|
||||
/*
|
||||
addCloseButton();
|
||||
|
||||
hidden(()->{
|
||||
@@ -43,10 +26,14 @@ public class UpgradeDialog extends FloatingDialog{
|
||||
weptab.margin(20);
|
||||
|
||||
int i = 0;
|
||||
for(Weapon weapon : Weapon.values()){
|
||||
TextButton button = new TextButton("$weapon."+weapon.name()+".name");
|
||||
for(Upgrade upgrade : Upgrade.getAllUpgrades()){
|
||||
if(!(upgrade instanceof Weapon)) continue;
|
||||
|
||||
Weapon weapon = (Weapon)upgrade;
|
||||
|
||||
TextButton button = new TextButton(weapon.localized());
|
||||
|
||||
Image img = new Image(Draw.region(weapon.name()));
|
||||
Image img = new Image(Draw.region(weapon.name));
|
||||
button.add(img).size(8*5);
|
||||
button.getCells().reverse();
|
||||
button.row();
|
||||
@@ -139,6 +126,7 @@ public class UpgradeDialog extends FloatingDialog{
|
||||
content().row();
|
||||
content().add(weptab);
|
||||
content().row();
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockConfigFragment implements Fragment {
|
||||
|
||||
table.update(()->{
|
||||
table.setOrigin(Align.center);
|
||||
Vector2 pos = Graphics.screen(tile.worldx(), tile.worldy());
|
||||
Vector2 pos = Graphics.screen(tile.worldx() + tile.block().getPlaceOffset().x, tile.worldy() + tile.block().getPlaceOffset().y);
|
||||
table.setPosition(pos.x, pos.y, Align.center);
|
||||
if(configTile == null || configTile.block() == Blocks.air){
|
||||
hideConfig();
|
||||
|
||||
@@ -9,10 +9,7 @@ import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Recipe;
|
||||
import io.anuke.mindustry.resource.Section;
|
||||
import io.anuke.mindustry.resource.*;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.graphics.Hue;
|
||||
@@ -72,17 +69,17 @@ public class BlocksFragment implements Fragment{
|
||||
|
||||
Stack stack = new Stack();
|
||||
ButtonGroup<ImageButton> group = new ButtonGroup<>();
|
||||
Array<Recipe> recipes = new Array<Recipe>();
|
||||
Array<Recipe> recipes = new Array<>();
|
||||
|
||||
for (Section sec : Section.values()) {
|
||||
recipes.clear();
|
||||
Recipe.getBy(sec, recipes);
|
||||
Recipes.getBy(sec, recipes);
|
||||
maxcol = Math.max((int) ((float) recipes.size / rows + 1), maxcol);
|
||||
}
|
||||
|
||||
for (Section sec : Section.values()) {
|
||||
recipes.clear();
|
||||
Recipe.getBy(sec, recipes);
|
||||
Recipes.getBy(sec, recipes);
|
||||
|
||||
Table table = new Table();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class WeaponFragment implements Fragment{
|
||||
weapontable.defaults().size(58, 62);
|
||||
|
||||
for(Weapon weapon : control.getWeapons()){
|
||||
ImageButton button = new ImageButton(Draw.region(weapon.name()), "toggle");
|
||||
ImageButton button = new ImageButton(Draw.region(weapon.name), "toggle");
|
||||
button.getImageCell().size(8*5);
|
||||
|
||||
group.add(button);
|
||||
@@ -52,7 +52,7 @@ public class WeaponFragment implements Fragment{
|
||||
String description = weapon.description;
|
||||
|
||||
tiptable.background("button");
|
||||
tiptable.add("$weapon."+weapon.name()+".name", 0.5f).left().padBottom(3f);
|
||||
tiptable.add("$weapon."+weapon.name+".name", 0.5f).left().padBottom(3f);
|
||||
|
||||
tiptable.row();
|
||||
tiptable.row();
|
||||
@@ -65,7 +65,5 @@ public class WeaponFragment implements Fragment{
|
||||
|
||||
button.addListener(tip);
|
||||
}
|
||||
|
||||
weapontable.addImageButton("icon-menu", 8*4, ui.upgrades::show);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user