Sound things
This commit is contained in:
@@ -317,6 +317,10 @@ public class UI implements ApplicationListener{
|
||||
}
|
||||
|
||||
public void showConfirm(String title, String text, Runnable confirmed){
|
||||
showConfirm(title, text, null, confirmed);
|
||||
}
|
||||
|
||||
public void showConfirm(String title, String text, BooleanProvider hide, Runnable confirmed){
|
||||
FloatingDialog dialog = new FloatingDialog(title);
|
||||
dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||
@@ -326,6 +330,13 @@ public class UI implements ApplicationListener{
|
||||
dialog.hide();
|
||||
confirmed.run();
|
||||
});
|
||||
if(hide != null){
|
||||
dialog.update(() -> {
|
||||
if(hide.get()){
|
||||
dialog.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||
dialog.show();
|
||||
|
||||
@@ -59,13 +59,6 @@ public class DeployDialog extends FloatingDialog{
|
||||
titleTable.remove();
|
||||
margin(0f).marginBottom(8);
|
||||
|
||||
if(!Core.settings.getBool("zone-info", false)){
|
||||
Core.app.post(() -> ui.showInfoText("TEMPORARY GUIDE ON HOW TO PLAY ZONES", "- deploy to zones by selecting them here\n- most zones require items to deploy\n- once you survive a set amount of waves, you can launch all the resources in your core\n- use these items to research in the tech tree or uncover new zones"));
|
||||
|
||||
Core.settings.put("zone-info", true);
|
||||
Core.settings.save();
|
||||
}
|
||||
|
||||
Stack stack = new Stack();
|
||||
|
||||
stack.add(new Image(new Texture("sprites/backgrounds/stars.png"){{
|
||||
|
||||
@@ -637,14 +637,18 @@ public class HudFragment extends Fragment{
|
||||
});
|
||||
}
|
||||
|
||||
private boolean canSkipWave(){
|
||||
return state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0 && !world.spawner.isSpawning();
|
||||
}
|
||||
|
||||
private void addPlayButton(Table table){
|
||||
table.right().addImageButton("icon-play", "right", 30f, () -> {
|
||||
if(Net.client() && player.isAdmin){
|
||||
Call.onAdminRequest(player, AdminAction.wave);
|
||||
}else{
|
||||
state.wavetime = 0f;
|
||||
ui.showConfirm("$confirm", "$launch.skip.confirm", () -> !canSkipWave(), () -> state.wavetime = 0f);
|
||||
}
|
||||
}).growY().fillX().right().width(40f)
|
||||
.visible(() -> state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0 && !world.spawner.isSpawning() && !inLaunchWave());
|
||||
.visible(this::canSkipWave);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.audio.*;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.collection.EnumSet;
|
||||
import io.anuke.arc.function.BiConsumer;
|
||||
@@ -18,6 +19,7 @@ import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
import io.anuke.mindustry.gen.*;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -34,6 +36,7 @@ public abstract class Turret extends Block{
|
||||
protected Effect shootEffect = Fx.none;
|
||||
protected Effect smokeEffect = Fx.none;
|
||||
protected Effect ammoUseEffect = Fx.none;
|
||||
protected Sound shootSound = Sounds.shoot;
|
||||
|
||||
protected int ammoPerShot = 1;
|
||||
protected float ammoEjectBack = 1f;
|
||||
@@ -276,6 +279,7 @@ public abstract class Turret extends Block{
|
||||
|
||||
Effects.effect(shootEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
Effects.effect(smokeEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
shootSound.at(tile);
|
||||
|
||||
if(shootShake > 0){
|
||||
Effects.shake(shootShake, shootShake, tile.entity);
|
||||
|
||||
Reference in New Issue
Block a user