Global inventory / 'Deploying' / Removed command center
This commit is contained in:
35
core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java
Normal file
35
core/src/io/anuke/mindustry/ui/dialogs/DeployDialog.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.collection.ObjectIntMap;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
|
||||
public class DeployDialog extends FloatingDialog{
|
||||
|
||||
public DeployDialog(){
|
||||
super("$text.play");
|
||||
|
||||
shown(this::setup);
|
||||
}
|
||||
|
||||
void setup(){
|
||||
content().clear();
|
||||
|
||||
content().stack(new Table(){{
|
||||
top().left().margin(10);
|
||||
|
||||
ObjectIntMap<Item> items = Vars.data.items();
|
||||
for(Item item : Vars.content.items()){
|
||||
if(Vars.data.isUnlocked(item)){
|
||||
add(items.get(item, 0) + "");
|
||||
addImage(item.region).size(8*3).pad(3);
|
||||
add(item.localizedName());
|
||||
row();
|
||||
}
|
||||
}
|
||||
}}, new Table(){{
|
||||
addButton("$text.play", () -> Vars.world.generator.playRandomMap()).margin(15);
|
||||
}}).grow();
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
dialog.addCloseButton();
|
||||
dialog.content().addButton("$text.settings.clearunlocks", () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.settings.clear.confirm", () -> {
|
||||
control.unlocks.reset();
|
||||
data.reset();
|
||||
dialog.hide();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,8 +13,7 @@ import io.anuke.arc.scene.ui.Tooltip;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.scene.utils.UIUtils;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.control;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class UnlocksDialog extends FloatingDialog{
|
||||
|
||||
@@ -59,11 +58,11 @@ public class UnlocksDialog extends FloatingDialog{
|
||||
|
||||
if(unlock.isHidden()) continue;
|
||||
|
||||
Image image = control.unlocks.isUnlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked");
|
||||
Image image = data.isUnlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-locked");
|
||||
image.addListener(new HandCursorListener());
|
||||
list.add(image).size(size).pad(3);
|
||||
|
||||
if(control.unlocks.isUnlocked(unlock)){
|
||||
if(data.isUnlocked(unlock)){
|
||||
image.clicked(() -> Vars.ui.content.show(unlock));
|
||||
image.addListener(new Tooltip<>(new Table("button"){{
|
||||
add(unlock.localizedName());
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.scene.Group;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.util.Strings;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.game.EventType.ResizeEvent;
|
||||
import io.anuke.mindustry.game.Version;
|
||||
import io.anuke.mindustry.ui.MenuButton;
|
||||
import io.anuke.mindustry.ui.MobileButton;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.scene.Group;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.util.Strings;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -139,6 +138,9 @@ public class MenuFragment extends Fragment{
|
||||
}
|
||||
|
||||
private void showPlaySelect(){
|
||||
ui.deploy.show();
|
||||
|
||||
/*
|
||||
float w = 220f;
|
||||
float bw = w * 2f + 10f;
|
||||
|
||||
@@ -169,6 +171,6 @@ public class MenuFragment extends Fragment{
|
||||
dialog.hide();
|
||||
})).width(bw).colspan(2);
|
||||
|
||||
dialog.show();
|
||||
dialog.show();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class PlacementFragment extends Fragment{
|
||||
if(tile != null){
|
||||
tile = tile.target();
|
||||
Recipe tryRecipe = Recipe.getByResult(tile.block());
|
||||
if(tryRecipe != null && control.unlocks.isUnlocked(tryRecipe)){
|
||||
if(tryRecipe != null && data.isUnlocked(tryRecipe)){
|
||||
input.recipe = tryRecipe;
|
||||
currentCategory = input.recipe.category;
|
||||
return true;
|
||||
@@ -91,7 +91,7 @@ public class PlacementFragment extends Fragment{
|
||||
Array<Recipe> recipes = Recipe.getByCategory(currentCategory);
|
||||
for(KeyCode key : inputGrid){
|
||||
if(Core.input.keyDown(key))
|
||||
input.recipe = (i < recipes.size && control.unlocks.isUnlocked(recipes.get(i))) ? recipes.get(i) : null;
|
||||
input.recipe = (i < recipes.size && data.isUnlocked(recipes.get(i))) ? recipes.get(i) : null;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -126,13 +126,13 @@ public class PlacementFragment extends Fragment{
|
||||
boolean[] unlocked = {false};
|
||||
|
||||
ImageButton button = blockTable.addImageButton("icon-locked", "select", 8 * 4, () -> {
|
||||
if(control.unlocks.isUnlocked(recipe)){
|
||||
if(data.isUnlocked(recipe)){
|
||||
input.recipe = input.recipe == recipe ? null : recipe;
|
||||
}
|
||||
}).size(46f).group(group).get();
|
||||
|
||||
button.update(() -> { //color unplacable things gray
|
||||
boolean ulock = control.unlocks.isUnlocked(recipe);
|
||||
boolean ulock = data.isUnlocked(recipe);
|
||||
TileEntity core = players[0].getClosestCore();
|
||||
Color color = core != null && (core.items.has(recipe.requirements) || state.mode.infiniteResources) ? Color.WHITE : ulock ? Color.GRAY : Color.WHITE;
|
||||
button.forEach(elem -> elem.setColor(color));
|
||||
@@ -176,10 +176,10 @@ public class PlacementFragment extends Fragment{
|
||||
header.left();
|
||||
header.add(new ImageStack(lastDisplay.getCompactIcon())).size(8 * 4);
|
||||
header.labelWrap(() ->
|
||||
!control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay)) ? Core.bundle.get("text.blocks.unknown") : lastDisplay.formalName)
|
||||
!data.isUnlocked(Recipe.getByResult(lastDisplay)) ? Core.bundle.get("text.blocks.unknown") : lastDisplay.formalName)
|
||||
.left().width(190f).padLeft(5);
|
||||
header.add().growX();
|
||||
if(control.unlocks.isUnlocked(Recipe.getByResult(lastDisplay))){
|
||||
if(data.isUnlocked(Recipe.getByResult(lastDisplay))){
|
||||
header.addButton("?", "clear-partial", () -> ui.content.show(Recipe.getByResult(lastDisplay)))
|
||||
.size(8 * 5).padTop(-5).padRight(-5).right().grow();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user