Gamemodes removed
This commit is contained in:
@@ -12,13 +12,14 @@ import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.util.Align;
|
||||
import io.anuke.arc.util.Scaling;
|
||||
import io.anuke.mindustry.game.Difficulty;
|
||||
import io.anuke.mindustry.game.GameMode;
|
||||
import io.anuke.mindustry.game.RulePreset;
|
||||
import io.anuke.mindustry.maps.Map;
|
||||
import io.anuke.mindustry.ui.BorderImage;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class CustomGameDialog extends FloatingDialog{
|
||||
Difficulty difficulty = Difficulty.normal;
|
||||
|
||||
public CustomGameDialog(){
|
||||
super("$customgame");
|
||||
@@ -46,11 +47,11 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
Table modes = new Table();
|
||||
modes.marginBottom(5);
|
||||
|
||||
for(GameMode mode : GameMode.values()){
|
||||
if(mode.hidden) continue;
|
||||
for(RulePreset mode : RulePreset.values()){
|
||||
|
||||
modes.addButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode)
|
||||
.update(b -> b.setChecked(state.mode == mode)).group(group).size(140f, 54f);
|
||||
//todo fix presets
|
||||
modes.addButton(mode.toString(), "toggle", () -> state.rules = mode.get())/*
|
||||
.update(b -> b.setChecked(state.rules == mode))*/.group(group).size(140f, 54f);
|
||||
if(i++ % 2 == 1) modes.row();
|
||||
}
|
||||
selmode.add(modes);
|
||||
@@ -66,20 +67,21 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
Table sdif = new Table();
|
||||
|
||||
sdif.add("$setting.difficulty.name").padRight(15f);
|
||||
|
||||
sdif.defaults().height(s + 4);
|
||||
sdif.addImageButton("icon-arrow-left", 10 * 3, () -> {
|
||||
state.difficulty = (ds[Mathf.mod(state.difficulty.ordinal() - 1, ds.length)]);
|
||||
difficulty = (ds[Mathf.mod(difficulty.ordinal() - 1, ds.length)]);
|
||||
state.wavetime = difficulty.waveTime;
|
||||
}).width(s);
|
||||
|
||||
sdif.addButton("", () -> {})
|
||||
.update(t -> {
|
||||
t.setText(state.difficulty.toString());
|
||||
t.setText(difficulty.toString());
|
||||
t.touchable(Touchable.disabled);
|
||||
}).width(180f);
|
||||
|
||||
sdif.addImageButton("icon-arrow-right", 10 * 3, () -> {
|
||||
state.difficulty = (ds[Mathf.mod(state.difficulty.ordinal() + 1, ds.length)]);
|
||||
difficulty = (ds[Mathf.mod(difficulty.ordinal() + 1, ds.length)]);
|
||||
state.wavetime = difficulty.waveTime;
|
||||
}).width(s);
|
||||
|
||||
cont.add(sdif);
|
||||
@@ -141,8 +143,7 @@ public class CustomGameDialog extends FloatingDialog{
|
||||
ScrollPane pane = new ScrollPane(table);
|
||||
pane.setFadeScrollBars(false);
|
||||
table.row();
|
||||
for(GameMode mode : GameMode.values()){
|
||||
if(mode.hidden) continue;
|
||||
for(RulePreset mode : RulePreset.values()){
|
||||
table.labelWrap("[accent]" + mode.toString() + ":[] [lightgray]" + mode.description()).width(400f);
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -112,9 +112,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
button.defaults().padBottom(3);
|
||||
button.row();
|
||||
button.add(Core.bundle.format("save.map", color + (slot.getMap() == null ? "Unknown" : slot.getMap().meta.name())));
|
||||
button.row();
|
||||
button.add(Core.bundle.get("level.mode") + " " + color + slot.getMode());
|
||||
button.add(Core.bundle.format("save.map", color + (slot.getMap() == null ? Core.bundle.get("unknown") : slot.getMap().meta.name())));
|
||||
button.row();
|
||||
button.add(Core.bundle.format("save.wave", color + slot.getWave()));
|
||||
button.row();
|
||||
|
||||
@@ -26,7 +26,7 @@ public class RestartDialog extends FloatingDialog{
|
||||
|
||||
buttons.margin(10);
|
||||
|
||||
if(state.mode.isPvp){
|
||||
if(state.rules.pvp){
|
||||
cont.add(Core.bundle.format("gameover.pvp",winner.localized())).pad(6);
|
||||
buttons.addButton("$menu", () -> {
|
||||
hide();
|
||||
|
||||
@@ -369,18 +369,18 @@ public class HudFragment extends Fragment{
|
||||
table.touchable(Touchable.enabled);
|
||||
|
||||
table.labelWrap(() ->
|
||||
(state.enemies() > 0 && state.mode.disableWaveTimer ?
|
||||
(state.enemies() > 0 && !state.rules.waveTimer ?
|
||||
wavef.get(state.wave) + "\n" + (state.enemies() == 1 ?
|
||||
enemyf.get(state.enemies()) :
|
||||
enemiesf.get(state.enemies())) :
|
||||
wavef.get(state.wave) + "\n" +
|
||||
(!state.mode.disableWaveTimer ?
|
||||
(state.rules.waveTimer ?
|
||||
Core.bundle.format("wave.waiting", (int)(state.wavetime/60)) :
|
||||
Core.bundle.get("waiting")))
|
||||
).growX().pad(8f);
|
||||
|
||||
table.setDisabled(true);
|
||||
table.visible(() -> !(state.mode.disableWaves || !state.mode.showMission));
|
||||
table.visible(() -> state.rules.waves);
|
||||
}
|
||||
|
||||
private void addPlayButton(Table table){
|
||||
@@ -391,11 +391,11 @@ public class HudFragment extends Fragment{
|
||||
state.wavetime = 0f;
|
||||
}
|
||||
}).growY().fillX().right().width(40f).update(l -> {
|
||||
boolean vis = state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active());
|
||||
boolean vis = !state.rules.waveTimer && ((Net.server() || players[0].isAdmin) || !Net.active());
|
||||
boolean paused = state.is(State.paused) || !vis;
|
||||
|
||||
l.getStyle().imageUp = Core.scene.skin.getDrawable(vis ? "icon-play" : "clear");
|
||||
l.touchable(!paused ? Touchable.enabled : Touchable.disabled);
|
||||
}).visible(() -> state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active()) && unitGroups[Team.red.ordinal()].size() == 0);
|
||||
}).visible(() -> !state.rules.waveTimer && ((Net.server() || players[0].isAdmin) || !Net.active()) && unitGroups[Team.red.ordinal()].size() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class PlacementFragment extends Fragment{
|
||||
button.update(() -> { //color unplacable things gray
|
||||
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;
|
||||
Color color = core != null && (core.items.has(recipe.requirements) || state.rules.infiniteResources) ? Color.WHITE : ulock ? Color.GRAY : Color.WHITE;
|
||||
button.forEach(elem -> elem.setColor(color));
|
||||
button.setChecked(input.recipe == recipe);
|
||||
|
||||
@@ -196,7 +196,7 @@ public class PlacementFragment extends Fragment{
|
||||
line.add(stack.item.localizedName()).color(Color.LIGHT_GRAY).padLeft(2).left();
|
||||
line.labelWrap(() -> {
|
||||
TileEntity core = players[0].getClosestCore();
|
||||
if(core == null || state.mode.infiniteResources) return "*/*";
|
||||
if(core == null || state.rules.infiniteResources) return "*/*";
|
||||
|
||||
int amount = core.items.get(stack.item);
|
||||
String color = (amount < stack.amount / 2f ? "[red]" : amount < stack.amount ? "[accent]" : "[white]");
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.util.Interval;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.Lines;
|
||||
import io.anuke.arc.scene.Group;
|
||||
@@ -15,7 +8,13 @@ import io.anuke.arc.scene.event.Touchable;
|
||||
import io.anuke.arc.scene.ui.Image;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
import io.anuke.arc.scene.ui.layout.Unit;
|
||||
import io.anuke.arc.util.Timer;
|
||||
import io.anuke.arc.util.Interval;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetConnection;
|
||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -137,7 +136,7 @@ public class PlayerListFragment extends Fragment{
|
||||
|
||||
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
|
||||
content.row();
|
||||
content.addImage("blank").height(3f).color(state.mode.isPvp ? player.getTeam().color : Palette.accent).growX();
|
||||
content.addImage("blank").height(3f).color(state.rules.pvp ? player.getTeam().color : Palette.accent).growX();
|
||||
content.row();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user