Bundle update / Custom game button / Join button
This commit is contained in:
@@ -4,15 +4,19 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.ApplicationListener;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
|
||||
import io.anuke.arc.entities.Effects;
|
||||
import io.anuke.arc.entities.Entities;
|
||||
import io.anuke.arc.entities.EntityGroup;
|
||||
import io.anuke.arc.entities.EntityQuery;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.*;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -111,6 +115,25 @@ public class Logic implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(called = Loc.both)
|
||||
public static void launchZone(){
|
||||
Effects.effect(Fx.launchFull, 0, 0);
|
||||
|
||||
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
||||
Effects.effect(Fx.launch, tile);
|
||||
}
|
||||
|
||||
Time.runTask(30f, () -> {
|
||||
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
||||
for(Item item : content.items()){
|
||||
data.addItem(item, tile.entity.items.get(item) / playerGroup.size());
|
||||
}
|
||||
world.removeBlock(tile);
|
||||
}
|
||||
state.launched = true;
|
||||
});
|
||||
}
|
||||
|
||||
@Remote(called = Loc.both)
|
||||
public static void onGameOver(Team winner){
|
||||
ui.restart.show(winner);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class UI implements ApplicationListener{
|
||||
|
||||
public AboutDialog about;
|
||||
public GameOverDialog restart;
|
||||
public CustomGameDialog levels;
|
||||
public CustomGameDialog custom;
|
||||
public MapsDialog maps;
|
||||
public LoadDialog load;
|
||||
public DiscordDialog discord;
|
||||
@@ -163,7 +163,7 @@ public class UI implements ApplicationListener{
|
||||
join = new JoinDialog();
|
||||
discord = new DiscordDialog();
|
||||
load = new LoadDialog();
|
||||
levels = new CustomGameDialog();
|
||||
custom = new CustomGameDialog();
|
||||
language = new LanguageDialog();
|
||||
database = new DatabaseDialog();
|
||||
settings = new SettingsMenuDialog();
|
||||
|
||||
@@ -5,21 +5,17 @@ import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.IntArray;
|
||||
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
|
||||
import io.anuke.arc.entities.Effects;
|
||||
import io.anuke.arc.entities.EntityQuery;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.geom.Geometry;
|
||||
import io.anuke.arc.math.geom.Point2;
|
||||
import io.anuke.arc.util.Log;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.arc.util.Time;
|
||||
import io.anuke.arc.util.Tmp;
|
||||
import io.anuke.mindustry.ai.BlockIndexer;
|
||||
import io.anuke.mindustry.ai.Pathfinder;
|
||||
import io.anuke.mindustry.ai.WaveSpawner;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||
@@ -31,7 +27,6 @@ import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.maps.Maps;
|
||||
import io.anuke.mindustry.maps.generators.Generator;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@@ -200,24 +195,6 @@ public class World implements ApplicationListener{
|
||||
return generating;
|
||||
}
|
||||
|
||||
public void launchZone(){
|
||||
Effects.effect(Fx.launchFull, 0, 0);
|
||||
|
||||
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
||||
Effects.effect(Fx.launch, tile);
|
||||
}
|
||||
|
||||
Time.runTask(30f, () -> {
|
||||
for(Tile tile : new ObjectSetIterator<>(state.teams.get(defaultTeam).cores)){
|
||||
for(Item item : content.items()){
|
||||
data.addItem(item, tile.entity.items.get(item));
|
||||
}
|
||||
world.removeBlock(tile);
|
||||
}
|
||||
state.launched = true;
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isZone(){
|
||||
return getZone() != null;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 -> {
|
||||
|
||||
@@ -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();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,8 @@ public class CoreBlock extends LaunchPad{
|
||||
if(entity.items.get(item) >= launchThreshold + launchChunkSize && entity.timer.get(timerLaunch, launchTime)){
|
||||
//TODO play animation of some sort
|
||||
Effects.effect(Fx.dooropenlarge, tile);
|
||||
data.addItem(item, launchChunkSize);
|
||||
//items sent are split evenly across every player in the game
|
||||
data.addItem(item, launchChunkSize / playerGroup.size());
|
||||
entity.items.remove(item, launchChunkSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user