Re-added core database in game menus
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.arc.scene.event.HandCursorListener;
|
||||
import io.anuke.arc.scene.ui.Image;
|
||||
import io.anuke.arc.scene.ui.ScrollPane;
|
||||
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.*;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.game.Content;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.graphics.Pal;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
|
||||
public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
@@ -56,11 +54,11 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
for(int i = 0; i < array.size; i++){
|
||||
UnlockableContent unlock = (UnlockableContent) array.get(i);
|
||||
|
||||
Image image = data.isUnlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-tree-locked");
|
||||
Image image = unlocked(unlock) ? new Image(unlock.getContentIcon()) : new Image("icon-tree-locked");
|
||||
image.addListener(new HandCursorListener());
|
||||
list.add(image).size(size).pad(3);
|
||||
|
||||
if(data.isUnlocked(unlock)){
|
||||
if(unlocked(unlock)){
|
||||
image.clicked(() -> Vars.ui.content.show(unlock));
|
||||
image.addListener(new Tooltip<>(new Table("button"){{
|
||||
add(unlock.localizedName());
|
||||
@@ -77,4 +75,8 @@ public class DatabaseDialog extends FloatingDialog{
|
||||
|
||||
cont.add(pane);
|
||||
}
|
||||
|
||||
boolean unlocked(UnlockableContent content){
|
||||
return !Vars.world.isZone() || content.unlocked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class FloatingDialog extends Dialog{
|
||||
|
||||
@Override
|
||||
public void addCloseButton(){
|
||||
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(230f, 64f);
|
||||
buttons.addImageTextButton("$back", "icon-arrow-left", 30f, this::hide).size(210f, 64f);
|
||||
|
||||
keyDown(key -> {
|
||||
if(key == KeyCode.ESCAPE || key == KeyCode.BACK) {
|
||||
|
||||
@@ -40,7 +40,11 @@ public class PausedDialog extends FloatingDialog{
|
||||
cont.addButton("$back", this::hide).colspan(2).width(dw*2 + 20f);
|
||||
|
||||
cont.row();
|
||||
cont.addButton("$techtree", ui.tech::show);
|
||||
if(world.isZone()){
|
||||
cont.addButton("$techtree", ui.tech::show);
|
||||
}else{
|
||||
cont.addButton("$database", ui.database::show);
|
||||
}
|
||||
cont.addButton("$settings", ui.settings::show);
|
||||
|
||||
if(!world.isZone()){
|
||||
|
||||
@@ -47,6 +47,11 @@ public class TechTreeDialog extends FloatingDialog{
|
||||
shown(() -> checkNodes(root));
|
||||
hidden(ui.deploy::setup);
|
||||
addCloseButton();
|
||||
|
||||
buttons.addImageTextButton("$database", "icon-database", 14*2, () -> {
|
||||
hide();
|
||||
ui.database.show();
|
||||
}).size(210f, 64f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,7 +93,7 @@ public class HudFragment extends Fragment{
|
||||
if(Net.active() && mobile){
|
||||
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-chat");
|
||||
}else{
|
||||
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-unlocks");
|
||||
i.getStyle().imageUp = Core.scene.skin.getDrawable("icon-database");
|
||||
}
|
||||
}).get();
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ public class MenuFragment extends Fragment{
|
||||
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
||||
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
||||
unlocks = new MobileButton("icon-unlocks", isize, "$database", ui.database::show),
|
||||
donate = new MobileButton("icon-donate", isize, "$donate", Platform.instance::openDonations);
|
||||
|
||||
if(Core.graphics.getWidth() > Core.graphics.getHeight()){
|
||||
@@ -78,7 +77,6 @@ public class MenuFragment extends Fragment{
|
||||
|
||||
table.add(editor);
|
||||
table.add(tools);
|
||||
table.add(unlocks);
|
||||
|
||||
if(Platform.instance.canDonate()) table.add(donate);
|
||||
}).colspan(4);
|
||||
@@ -96,8 +94,6 @@ public class MenuFragment extends Fragment{
|
||||
container.table(table -> {
|
||||
table.defaults().set(container.defaults());
|
||||
|
||||
table.add(unlocks);
|
||||
|
||||
if(Platform.instance.canDonate()) table.add(donate);
|
||||
}).colspan(2);
|
||||
}
|
||||
|
||||
@@ -552,6 +552,11 @@ public class Block extends BlockStorage{
|
||||
return buildVisibility.get() && !isHidden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden(){
|
||||
return !buildVisibility.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysUnlocked(){
|
||||
return alwaysUnlocked;
|
||||
|
||||
Reference in New Issue
Block a user