Bundle update / Custom game button / Join button

This commit is contained in:
Anuken
2019-01-26 10:37:04 -05:00
parent a9f11256cd
commit 0f26d62a0a
28 changed files with 1014 additions and 962 deletions

View File

@@ -20,6 +20,7 @@ import static io.anuke.mindustry.Vars.*;
public class CustomGameDialog extends FloatingDialog{
Difficulty difficulty = Difficulty.normal;
RulePreset lastPreset = RulePreset.survival;
public CustomGameDialog(){
super("$customgame");
@@ -30,6 +31,7 @@ public class CustomGameDialog extends FloatingDialog{
}
void setup(){
state.rules = lastPreset.get();
cont.clear();
Table maps = new Table();
@@ -48,10 +50,10 @@ public class CustomGameDialog extends FloatingDialog{
modes.marginBottom(5);
for(RulePreset mode : RulePreset.values()){
//todo fix presets
modes.addButton(mode.toString(), "toggle", () -> state.rules = mode.get())/*
.update(b -> b.setChecked(state.rules == mode))*/.group(group).size(140f, 54f);
modes.addButton(mode.toString(), "toggle", () -> {
state.rules = mode.get();
lastPreset = mode;
}).update(b -> b.setChecked(lastPreset == mode)).group(group).size(140f, 54f);
if(i++ % 2 == 1) modes.row();
}
selmode.add(modes);

View File

@@ -196,8 +196,8 @@ public class HudFragment extends Fragment{
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f))));
});
parent.fill(t -> t.top().right().addRowImageTextButton("$launch", "icon-arrow-up", 8*3, () -> world.launchZone())
.size(94f, 70f).visible(() -> world.isZone() && world.getZone().metCondition()));
parent.fill(t -> t.top().right().addRowImageTextButton("$launch", "icon-arrow-up", 8*3, Call::launchZone)
.size(94f, 70f).visible(() -> world.isZone() && world.getZone().metCondition() && !Net.client()));
//'saving' indicator
parent.fill(t -> {

View File

@@ -111,7 +111,13 @@ public class MenuFragment extends Fragment{
out.margin(16);
out.defaults().size(w, 66f).padTop(5).padRight(5);
out.add(new MenuButton("icon-play-2", "$play", MenuFragment.this::showPlaySelect)).width(bw).colspan(2);
out.add(new MenuButton("icon-play-2", "$play", ui.deploy::show)).width(bw).colspan(2);
out.row();
out.add(new MenuButton("icon-add", "$joingame", ui.join::show));
out.add(new MenuButton("icon-play-custom", "$customgame", ui.custom::show));
out.row();
@@ -130,41 +136,4 @@ public class MenuFragment extends Fragment{
out.add(new MenuButton("icon-exit", "$quit", Core.app::exit)).width(bw).colspan(2);
});
}
private void showPlaySelect(){
ui.deploy.show();
/*
float w = 220f;
float bw = w * 2f + 10f;
FloatingDialog dialog = new FloatingDialog("$play");
dialog.addCloseButton();
dialog.cont.defaults().height(66f).width(w).padRight(5f);
dialog.cont.add(new MenuButton("icon-play-2", "$map.random", () -> {
dialog.hide();
world.generator.playRandomMap();
})).width(bw).colspan(2);
dialog.cont.row();
dialog.cont.add(new MenuButton("icon-add", "$joingame", () -> {
ui.join.show();
dialog.hide();
}));
dialog.cont.add(new MenuButton("icon-editor", "$customgame", () -> {
dialog.hide();
ui.levels.show();
}));
dialog.cont.row();
dialog.cont.add(new MenuButton("icon-load", "$loadgame", () -> {
ui.load.show();
dialog.hide();
})).width(bw).colspan(2);
dialog.show();*/
}
}