Launch button

This commit is contained in:
Anuken
2019-01-17 23:17:17 -05:00
parent 22a6c4e8af
commit 48facc0978
18 changed files with 369 additions and 476 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 267 B

+2
View File
@@ -235,6 +235,8 @@ editor = Editor
mapeditor = Map Editor mapeditor = Map Editor
donate = Donate donate = Donate
resume = Resume Zone:\n[LIGHT_GRAY]{0} resume = Resume Zone:\n[LIGHT_GRAY]{0}
launch = Launch
launch.title = Launch Successful
connectfail = [crimson]Failed to connect to server:\n\n[accent]{0} connectfail = [crimson]Failed to connect to server:\n\n[accent]{0}
error.unreachable = Server unreachable.\nIs the address spelled correctly? error.unreachable = Server unreachable.\nIs the address spelled correctly?
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 KiB

After

Width:  |  Height:  |  Size: 608 KiB

+11 -3
View File
@@ -24,14 +24,15 @@ public class Fx implements ContentList{
vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock, reactorsmoke, nuclearsmoke, nuclearcloud, vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock, reactorsmoke, nuclearsmoke, nuclearcloud,
redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, redgeneratespark, generatespark, fuelburn, plasticburn, pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium,
producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, doorclose, dooropen, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, producesmoke, smeltsmoke, formsmoke, blastsmoke, lava, doorclose, dooropen, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate,
mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble, commandSend, mine, mineBig, mineHuge, smelt, teleportActivate, teleport, teleportOut, ripple, bubble, launch,
healBlock, healBlockFull, healWaveMend, overdriveWave, overdriveBlockFull, shieldBreak, hitBulletSmall, hitFuse, healBlock, healBlockFull, healWaveMend, overdriveWave, overdriveBlockFull, shieldBreak, hitBulletSmall, hitFuse,
hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion,
plasticExplosion, artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak, burning, fire, plasticExplosion, artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak, burning, fire,
fireSmoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem, shockwave, fireSmoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem, shockwave,
bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke, shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke,
shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium,
shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot; shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot,
launchFull;
@Override @Override
public void load(){ public void load(){
@@ -1060,7 +1061,7 @@ public class Fx implements ContentList{
Draw.reset(); Draw.reset();
}); });
commandSend = new Effect(28, e -> { launch = new Effect(28, e -> {
Draw.color(Palette.command); Draw.color(Palette.command);
Lines.stroke(e.fout() * 2f); Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f); Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f);
@@ -1108,5 +1109,12 @@ public class Fx implements ContentList{
Lines.poly(e.x, e.y, 6, e.rotation + e.fin(), 90); Lines.poly(e.x, e.y, 6, e.rotation + e.fin(), 90);
Draw.reset(); Draw.reset();
}); });
launchFull = new Effect(60, 9999999999f, e -> {
Draw.color();
Draw.alpha(e.fslope());
Fill.rect(Core.camera.position.x, Core.camera.position.y, Core.camera.width + 10, Core.camera.height + 10);
Draw.reset();
});
} }
} }
@@ -16,7 +16,7 @@ public class Liquids implements ContentList{
effect = StatusEffects.wet; effect = StatusEffects.wet;
}}; }};
slag = new Liquid("slag", Color.valueOf("e37341")){{ slag = new Liquid("slag", Color.valueOf("ffcd66")){{
temperature = 1f; temperature = 1f;
viscosity = 0.8f; viscosity = 0.8f;
tier = 2; tier = 2;
@@ -20,7 +20,7 @@ public class Weapons implements ContentList{
blasterSmall = new Weapon("blaster"){{ blasterSmall = new Weapon("blaster"){{
length = 1.5f; length = 1.5f;
reload = 15f; reload = 20f;
roundrobin = true; roundrobin = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardCopper; ammo = Bullets.standardCopper;
@@ -28,7 +28,7 @@ public class Weapons implements ContentList{
glaiveBlaster = new Weapon("bomber"){{ glaiveBlaster = new Weapon("bomber"){{
length = 1.5f; length = 1.5f;
reload = 10f; reload = 13f;
roundrobin = true; roundrobin = true;
ejectEffect = Fx.shellEjectSmall; ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardGlaive; ammo = Bullets.standardGlaive;
@@ -54,7 +54,7 @@ public class Weapons implements ContentList{
missiles = new Weapon("missiles"){{ missiles = new Weapon("missiles"){{
length = 1.5f; length = 1.5f;
reload = 60f; reload = 70f;
shots = 4; shots = 4;
inaccuracy = 2f; inaccuracy = 2f;
roundrobin = true; roundrobin = true;
@@ -18,6 +18,7 @@ public class Zones implements ContentList{
deployCost = ItemStack.with(Items.copper, 100); deployCost = ItemStack.with(Items.copper, 100);
startingItems = ItemStack.with(Items.copper, 50); startingItems = ItemStack.with(Items.copper, 50);
alwaysUnlocked = true; alwaysUnlocked = true;
conditionWave = 10;
rules = () -> new Rules(){{ rules = () -> new Rules(){{
waves = true; waves = true;
waveTimer = true; waveTimer = true;
@@ -165,7 +165,7 @@ public class ContentLoader{
} }
if(id >= contentMap[type.ordinal()].size || id < 0){ if(id >= contentMap[type.ordinal()].size || id < 0){
throw new RuntimeException("No " + type.name() + " with ID '" + id + "' found!"); return null;
} }
return (T)contentMap[type.ordinal()].get(id); return (T)contentMap[type.ordinal()].get(id);
} }
@@ -16,7 +16,7 @@ public class GameState{
/**Wave countdown in ticks.*/ /**Wave countdown in ticks.*/
public float wavetime; public float wavetime;
/**Whether the game is in game over state.*/ /**Whether the game is in game over state.*/
public boolean gameOver = false; public boolean gameOver = false, launched = false;
/**The current game rules.*/ /**The current game rules.*/
public Rules rules = new Rules(); public Rules rules = new Rules();
/**Statistics for this save/game. Displayed after game over.*/ /**Statistics for this save/game. Displayed after game over.*/
@@ -38,7 +38,7 @@ public class GameState{
} }
public boolean isPaused(){ public boolean isPaused(){
return is(State.paused) && !Net.active(); return (is(State.paused) || gameOver) && !Net.active();
} }
public boolean is(State astate){ public boolean is(State astate){
+1 -1
View File
@@ -62,7 +62,7 @@ public class Logic implements ApplicationListener{
public void reset(){ public void reset(){
state.wave = 1; state.wave = 1;
state.wavetime = state.rules.waveSpacing; state.wavetime = state.rules.waveSpacing;
state.gameOver = false; state.gameOver = state.launched = false;
state.teams = new Teams(); state.teams = new Teams();
state.rules = new Rules(); state.rules = new Rules();
state.stats = new Stats(); state.stats = new Stats();
@@ -5,17 +5,21 @@ import io.anuke.arc.Core;
import io.anuke.arc.Events; import io.anuke.arc.Events;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.IntArray; 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.entities.EntityQuery;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry; import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2; import io.anuke.arc.math.geom.Point2;
import io.anuke.arc.util.Log; import io.anuke.arc.util.Log;
import io.anuke.arc.util.Structs; import io.anuke.arc.util.Structs;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp; import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.ai.BlockIndexer; import io.anuke.mindustry.ai.BlockIndexer;
import io.anuke.mindustry.ai.Pathfinder; import io.anuke.mindustry.ai.Pathfinder;
import io.anuke.mindustry.ai.WaveSpawner; import io.anuke.mindustry.ai.WaveSpawner;
import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.EventType.TileChangeEvent; import io.anuke.mindustry.game.EventType.TileChangeEvent;
import io.anuke.mindustry.game.EventType.WorldLoadEvent; import io.anuke.mindustry.game.EventType.WorldLoadEvent;
@@ -27,6 +31,7 @@ import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
import io.anuke.mindustry.maps.Maps; import io.anuke.mindustry.maps.Maps;
import io.anuke.mindustry.maps.generators.Generator; import io.anuke.mindustry.maps.generators.Generator;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Zone; import io.anuke.mindustry.type.Zone;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
@@ -195,6 +200,24 @@ public class World implements ApplicationListener{
return generating; 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(){ public boolean isZone(){
return getZone() != null; return getZone() != null;
} }
+1 -1
View File
@@ -26,7 +26,7 @@ public class Zone extends UnlockableContent{
/**Whether this zone has met its condition; if true, the player can leave.*/ /**Whether this zone has met its condition; if true, the player can leave.*/
public boolean metCondition(){ public boolean metCondition(){
return state.wave > conditionWave; return state.wave >= conditionWave;
} }
@Override @Override
@@ -22,6 +22,7 @@ public class GameOverDialog extends FloatingDialog{
} }
void rebuild(){ void rebuild(){
title.setText(state.launched ? "$launch.title" : "$gameover");
buttons.clear(); buttons.clear();
cont.clear(); cont.clear();
@@ -56,7 +57,7 @@ public class GameOverDialog extends FloatingDialog{
cont.add("$stat.delivered"); cont.add("$stat.delivered");
cont.row(); cont.row();
for(Item item : content.items()){ for(Item item : content.items()){
if(state.stats.itemsDelivered.containsKey(item)){ if(state.stats.itemsDelivered.get(item, 0) > 0){
cont.table(items -> { cont.table(items -> {
items.add(" [LIGHT_GRAY]" + state.stats.itemsDelivered.get(item, 0)); items.add(" [LIGHT_GRAY]" + state.stats.itemsDelivered.get(item, 0));
items.addImage(item.region).size(8 *3).pad(4); items.addImage(item.region).size(8 *3).pad(4);
@@ -1,131 +0,0 @@
package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core;
import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.Element;
import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Align;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.consumers.Consume;
import static io.anuke.mindustry.Vars.*;
public class BlockConsumeFragment extends Fragment{
private Table table;
private Tile lastTile;
private boolean visible;
@Override
public void build(Group parent){
table = new Table();
table.visible(() -> !state.is(State.menu) && visible);
table.setTransform(true);
parent.addChild(new Element(){{update(() -> {
if(!Core.scene.hasMouse()){
Tile tile = world.tileWorld(Core.input.mouseWorld().x, Core.input.mouseWorld().y);
if(tile == null) return;
tile = tile.target();
if(tile != lastTile){
if(tile.getTeam() == players[0].getTeam() && tile.block().consumes.hasAny()){
show(tile);
}else if(visible){
hide();
}
lastTile = tile;
}
}
});}});
parent.setTransform(true);
parent.addChild(table);
}
public void show(Tile tile){
ObjectSet<Consume> consumers = new ObjectSet<>();
TileEntity entity = tile.entity;
Block block = tile.block();
table.clearChildren();
rebuild(block, entity);
visible = true;
table.update(() -> {
if(tile.entity == null || state.is(State.menu)){
hide();
return;
}
boolean rebuild = false;
for(Consume c : block.consumes.array()){
boolean valid = c.isOptional() || c.valid(block, entity);
if(consumers.contains(c) == valid){
if(valid){
consumers.remove(c);
}else{
consumers.add(c);
}
rebuild = true;
}
}
if(rebuild){
rebuild(block, entity);
}
Vector2 v = Core.input.mouseScreen(tile.drawx() - tile.block().size * tilesize / 2f + 0.25f, tile.drawy() + tile.block().size * tilesize / 2f);
table.pack();
table.setPosition(v.x, v.y, Align.topRight);
});
table.act(Core.graphics.getDeltaTime());
}
public void hide(){
table.clear();
table.update(() -> {});
visible = false;
}
private void rebuild(Block block, TileEntity entity){
table.clearChildren();
table.left();
int scale = mobile ? 4 : 3;
for(Consume c : block.consumes.array()){
if(!c.isOptional() && !c.valid(block, entity)){
boolean[] hovered = {false};
table.table("inventory", c::buildTooltip).visible(() -> hovered[0]).height(scale * 10 + 6).padBottom(-4).right().update(t -> {
if(t.getChildren().size == 0) t.remove();
}).get().act(0);
Table result = table.table(out -> {
out.addImage(c.getIcon()).size(10 * scale).color(Color.DARK_GRAY).padRight(-10 * scale).padBottom(-scale * 2);
out.addImage(c.getIcon()).size(10 * scale).color(Palette.accent);
out.addImage("icon-missing").size(10 * scale).color(Palette.remove).padLeft(-10 * scale);
}).size(10 * scale).get();
result.hovered(() -> hovered[0] = true);
if(!mobile){
result.exited(() -> hovered[0] = false);
}
table.row();
}
}
}
}
@@ -196,6 +196,9 @@ public class HudFragment extends Fragment{
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))); .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()));
//'saving' indicator //'saving' indicator
parent.fill(t -> { parent.fill(t -> {
t.bottom().visible(() -> !state.is(State.menu) && control.saves.isSaving()); t.bottom().visible(() -> !state.is(State.menu) && control.saves.isSaving());
@@ -3,20 +3,16 @@ package io.anuke.mindustry.ui.fragments;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.arc.scene.Group; import io.anuke.arc.scene.Group;
/** /**Fragment for displaying overlays such as block inventories. One is created for each input handler.*/
* Fragment for displaying overlays such as block inventories. One is created for each input handler.
*/
public class OverlayFragment extends Fragment{ public class OverlayFragment extends Fragment{
public final BlockInventoryFragment inv; public final BlockInventoryFragment inv;
public final BlockConfigFragment config; public final BlockConfigFragment config;
public final BlockConsumeFragment consume;
private Group group = new Group(); private Group group = new Group();
public OverlayFragment(InputHandler input){ public OverlayFragment(InputHandler input){
inv = new BlockInventoryFragment(input); inv = new BlockInventoryFragment(input);
config = new BlockConfigFragment(input); config = new BlockConfigFragment(input);
consume = new BlockConsumeFragment();
} }
@Override @Override
@@ -26,9 +22,6 @@ public class OverlayFragment extends Fragment{
inv.build(group); inv.build(group);
config.build(group); config.build(group);
consume.build(group);
//input.buildUI(group);
} }
public void remove(){ public void remove(){