Merge branch 'master' of https://github.com/Anuken/Mindustry into tutorial
@@ -16,7 +16,7 @@ import io.anuke.arc.backends.android.surfaceview.AndroidApplicationConfiguration
|
|||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.Consumer;
|
||||||
import io.anuke.arc.function.Predicate;
|
import io.anuke.arc.function.Predicate;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.Strings;
|
import io.anuke.arc.util.Strings;
|
||||||
import io.anuke.arc.util.serialization.Base64Coder;
|
import io.anuke.arc.util.serialization.Base64Coder;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.Platform;
|
||||||
@@ -106,7 +106,7 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
};
|
};
|
||||||
|
|
||||||
if(doubleScaleTablets && isTablet(this.getContext())){
|
if(doubleScaleTablets && isTablet(this.getContext())){
|
||||||
Unit.dp.addition = 0.5f;
|
UnitScl.dp.addition = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.hideStatusBar = true;
|
config.hideStatusBar = true;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
|
|||||||
try{
|
try{
|
||||||
|
|
||||||
String path = Paths.get(Utils.filer.createResource(StandardLocation.CLASS_OUTPUT, "no", "no")
|
String path = Paths.get(Utils.filer.createResource(StandardLocation.CLASS_OUTPUT, "no", "no")
|
||||||
.toUri().toURL().toString().substring("file:".length()))
|
.toUri().toURL().toString().substring(System.getProperty("os.name").contains("Windows") ? 6 : "file:".length()))
|
||||||
.getParent().getParent().getParent().getParent().getParent().getParent().toString();
|
.getParent().getParent().getParent().getParent().getParent().getParent().toString();
|
||||||
|
|
||||||
process("Sounds", path + "/assets/sounds", "io.anuke.arc.audio.Sound", "newSound");
|
process("Sounds", path + "/assets/sounds", "io.anuke.arc.audio.Sound", "newSound");
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.1 KiB |
BIN
core/assets-raw/sprites/ui/button-edge-over-4.9.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@@ -323,7 +323,7 @@ bestwave = [lightgray]Best Wave: {0}
|
|||||||
launch = < LAUNCH >
|
launch = < LAUNCH >
|
||||||
launch.title = Launch Successful
|
launch.title = Launch Successful
|
||||||
launch.next = [lightgray]next opportunity at wave {0}
|
launch.next = [lightgray]next opportunity at wave {0}
|
||||||
launch.unable = [scarlet]Unable to LAUNCH.[] {0} Enemies.
|
launch.unable2 = [scarlet]Unable to LAUNCH.[]
|
||||||
launch.confirm = This will launch all resources in your core.\nYou will not be able to return to this base.
|
launch.confirm = This will launch all resources in your core.\nYou will not be able to return to this base.
|
||||||
uncover = Uncover
|
uncover = Uncover
|
||||||
configure = Configure Loadout
|
configure = Configure Loadout
|
||||||
@@ -984,7 +984,7 @@ block.liquid-tank.description = Stores a large amount of liquids. Use for creati
|
|||||||
block.liquid-junction.description = Acts as a bridge for two crossing conduits. Useful in situations with two different conduits carrying different liquids to different locations.
|
block.liquid-junction.description = Acts as a bridge for two crossing conduits. Useful in situations with two different conduits carrying different liquids to different locations.
|
||||||
block.bridge-conduit.description = Advanced liquid transport block. Allows transporting liquids over up to 3 tiles of any terrain or building.
|
block.bridge-conduit.description = Advanced liquid transport block. Allows transporting liquids over up to 3 tiles of any terrain or building.
|
||||||
block.phase-conduit.description = Advanced liquid transport block. Uses power to teleport liquids to a connected phase conduit over several tiles.
|
block.phase-conduit.description = Advanced liquid transport block. Uses power to teleport liquids to a connected phase conduit over several tiles.
|
||||||
block.power-node.description = Transmits power to connected nodes. Up to four power sources, sinks or nodes can be connected. The node will receive power from or supply power to any adjacent blocks.
|
block.power-node.description = Transmits power to connected nodes. The node will receive power from or supply power to any adjacent blocks.
|
||||||
block.power-node-large.description = An advanced power node with greater range and more connections.
|
block.power-node-large.description = An advanced power node with greater range and more connections.
|
||||||
block.surge-tower.description = An extremely long-range power node with fewer available connections.
|
block.surge-tower.description = An extremely long-range power node with fewer available connections.
|
||||||
block.battery.description = Stores power as a buffer in times of surplus energy. Outputs power in times of deficit.
|
block.battery.description = Stores power as a buffer in times of surplus energy. Outputs power in times of deficit.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 336 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 375 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 350 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 368 B |
BIN
core/assets/music/game1.mp3
Normal file
BIN
core/assets/music/game2.mp3
Normal file
BIN
core/assets/music/game3.mp3
Normal file
BIN
core/assets/music/game4.mp3
Normal file
BIN
core/assets/music/launch.mp3
Normal file
BIN
core/assets/sounds/place.ogg
Normal file
|
Before Width: | Height: | Size: 715 B After Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 676 KiB After Width: | Height: | Size: 676 KiB |
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 464 KiB After Width: | Height: | Size: 461 KiB |
@@ -64,7 +64,12 @@
|
|||||||
checked: button-down,
|
checked: button-down,
|
||||||
down: button-down,
|
down: button-down,
|
||||||
up: button
|
up: button
|
||||||
}
|
},
|
||||||
|
wave: {
|
||||||
|
up: button-edge-4,
|
||||||
|
over: button-edge-over-4,
|
||||||
|
disabled: button-edge-4
|
||||||
|
},
|
||||||
},
|
},
|
||||||
TextButtonStyle: {
|
TextButtonStyle: {
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 29 KiB |
BIN
core/assets/zones/nomap.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
@@ -12,6 +12,7 @@ import io.anuke.mindustry.game.*;
|
|||||||
import io.anuke.mindustry.game.Teams.*;
|
import io.anuke.mindustry.game.Teams.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.meta.*;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -118,7 +119,7 @@ public class BlockIndexer{
|
|||||||
|
|
||||||
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
ObjectSet<Tile> set = damagedTiles[team.ordinal()];
|
||||||
for(Tile tile : set){
|
for(Tile tile : set){
|
||||||
if(tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()){
|
if((tile.entity == null || tile.entity.getTeam() != team || !tile.entity.damaged()) && !(tile.block() instanceof BuildBlock)){
|
||||||
returnArray.add(tile);
|
returnArray.add(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1613,13 +1613,13 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
spiritFactory = new UnitFactory("spirit-factory"){{
|
spiritFactory = new UnitFactory("spirit-factory"){{
|
||||||
requirements(Category.units, ItemStack.with(Items.metaglass, 35, Items.lead, 55, Items.silicon, 45));
|
requirements(Category.units, ItemStack.with(Items.metaglass, 45, Items.lead, 55, Items.silicon, 45));
|
||||||
type = UnitTypes.spirit;
|
type = UnitTypes.spirit;
|
||||||
produceTime = 2850;
|
produceTime = 3500;
|
||||||
size = 2;
|
size = 2;
|
||||||
maxSpawn = 2;
|
maxSpawn = 2;
|
||||||
consumes.power(0.80f);
|
consumes.power(0.80f);
|
||||||
consumes.items(new ItemStack(Items.silicon, 10), new ItemStack(Items.lead, 15));
|
consumes.items(new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 15));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
phantomFactory = new UnitFactory("phantom-factory"){{
|
phantomFactory = new UnitFactory("phantom-factory"){{
|
||||||
@@ -1673,9 +1673,9 @@ public class Blocks implements ContentList{
|
|||||||
type = UnitTypes.crawler;
|
type = UnitTypes.crawler;
|
||||||
produceTime = 250;
|
produceTime = 250;
|
||||||
size = 2;
|
size = 2;
|
||||||
maxSpawn = 6;
|
maxSpawn = 8;
|
||||||
consumes.power(0.4f);
|
consumes.power(0.4f);
|
||||||
consumes.items(new ItemStack(Items.coal, 6));
|
consumes.items(new ItemStack(Items.coal, 5));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titanFactory = new UnitFactory("titan-factory"){{
|
titanFactory = new UnitFactory("titan-factory"){{
|
||||||
@@ -1699,7 +1699,8 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
repairPoint = new RepairPoint("repair-point"){{
|
repairPoint = new RepairPoint("repair-point"){{
|
||||||
requirements(Category.units, ItemStack.with(Items.lead, 15, Items.copper, 15, Items.silicon, 15));
|
requirements(Category.units, ItemStack.with(Items.lead, 15, Items.copper, 15, Items.silicon, 15));
|
||||||
repairSpeed = 0.3f;
|
repairSpeed = 0.5f;
|
||||||
|
repairRadius = 65f;
|
||||||
powerUse = 1f;
|
powerUse = 1f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Tmp;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.Damage;
|
|
||||||
import io.anuke.mindustry.entities.Effects;
|
|
||||||
import io.anuke.mindustry.entities.bullet.*;
|
import io.anuke.mindustry.entities.bullet.*;
|
||||||
import io.anuke.mindustry.entities.effect.*;
|
import io.anuke.mindustry.entities.effect.*;
|
||||||
import io.anuke.mindustry.entities.type.Unit;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.blocks.BuildBlock;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
@@ -43,7 +40,7 @@ public class Bullets implements ContentList{
|
|||||||
fireball, basicFlame, pyraFlame, driverBolt, healBullet, frag, eruptorShot,
|
fireball, basicFlame, pyraFlame, driverBolt, healBullet, frag, eruptorShot,
|
||||||
|
|
||||||
//bombs
|
//bombs
|
||||||
bombExplosive, bombIncendiary, bombOil, explode;
|
bombExplosive, bombIncendiary, bombOil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
@@ -470,6 +467,11 @@ public class Bullets implements ContentList{
|
|||||||
status = StatusEffects.burning;
|
status = StatusEffects.burning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float range(){
|
||||||
|
return 50f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Bullet b){
|
public void draw(Bullet b){
|
||||||
}
|
}
|
||||||
@@ -698,23 +700,5 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
explode = new BombBulletType(2f, 3f, "clear"){
|
|
||||||
{
|
|
||||||
hitEffect = Fx.pulverize;
|
|
||||||
lifetime = 30f;
|
|
||||||
speed = 1f;
|
|
||||||
splashDamageRadius = 50f;
|
|
||||||
splashDamage = 28f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(Bullet b){
|
|
||||||
if(b.getOwner() instanceof Unit){
|
|
||||||
((Unit)b.getOwner()).kill();
|
|
||||||
}
|
|
||||||
b.time(b.lifetime());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,14 +160,14 @@ public class Fx implements ContentList{
|
|||||||
healWave = new Effect(22, e -> {
|
healWave = new Effect(22, e -> {
|
||||||
Draw.color(Pal.heal);
|
Draw.color(Pal.heal);
|
||||||
Lines.stroke(e.fout() * 2f);
|
Lines.stroke(e.fout() * 2f);
|
||||||
Lines.poly(e.x, e.y, 30, 4f + e.finpow() * 60f);
|
Lines.circle(e.x, e.y, 4f + e.finpow() * 60f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
});
|
});
|
||||||
|
|
||||||
heal = new Effect(11, e -> {
|
heal = new Effect(11, e -> {
|
||||||
Draw.color(Pal.heal);
|
Draw.color(Pal.heal);
|
||||||
Lines.stroke(e.fout() * 2f);
|
Lines.stroke(e.fout() * 2f);
|
||||||
Lines.poly(e.x, e.y, 24, 2f + e.finpow() * 7f);
|
Lines.circle(e.x, e.y, 2f + e.finpow() * 7f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -568,21 +568,21 @@ public class Fx implements ContentList{
|
|||||||
nuclearShockwave = new Effect(10f, 200f, e -> {
|
nuclearShockwave = new Effect(10f, 200f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fout() * 3f + 0.2f);
|
Lines.stroke(e.fout() * 3f + 0.2f);
|
||||||
Lines.poly(e.x, e.y, 40, e.fin() * 140f);
|
Lines.circle(e.x, e.y, e.fin() * 140f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
impactShockwave = new Effect(13f, 300f, e -> {
|
impactShockwave = new Effect(13f, 300f, e -> {
|
||||||
Draw.color(Pal.lighterOrange, Color.LIGHT_GRAY, e.fin());
|
Draw.color(Pal.lighterOrange, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fout() * 4f + 0.2f);
|
Lines.stroke(e.fout() * 4f + 0.2f);
|
||||||
Lines.poly(e.x, e.y, 60, e.fin() * 200f);
|
Lines.circle(e.x, e.y, e.fin() * 200f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
spawnShockwave = new Effect(20f, 400f, e -> {
|
spawnShockwave = new Effect(20f, 400f, e -> {
|
||||||
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
|
||||||
Lines.stroke(e.fout() * 3f + 0.5f);
|
Lines.stroke(e.fout() * 3f + 0.5f);
|
||||||
Lines.poly(e.x, e.y, 40, e.fin() * (e.rotation + 50f));
|
Lines.circle(e.x, e.y, e.fin() * (e.rotation + 50f));
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ public class Fx implements ContentList{
|
|||||||
|
|
||||||
e.scaled(5 + intensity * 2, i -> {
|
e.scaled(5 + intensity * 2, i -> {
|
||||||
Lines.stroke(3.1f * i.fout());
|
Lines.stroke(3.1f * i.fout());
|
||||||
Lines.poly(e.x, e.y, (int)(20 * intensity), (3f + i.fin() * 14f) * intensity);
|
Lines.circle(e.x, e.y, (3f + i.fin() * 14f) * intensity);
|
||||||
});
|
});
|
||||||
|
|
||||||
Draw.color(Color.GRAY);
|
Draw.color(Color.GRAY);
|
||||||
@@ -1157,21 +1157,21 @@ public class Fx implements ContentList{
|
|||||||
launch = new Effect(28, e -> {
|
launch = new Effect(28, e -> {
|
||||||
Draw.color(Pal.command);
|
Draw.color(Pal.command);
|
||||||
Lines.stroke(e.fout() * 2f);
|
Lines.stroke(e.fout() * 2f);
|
||||||
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f);
|
Lines.circle(e.x, e.y, 4f + e.finpow() * 120f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
});
|
});
|
||||||
|
|
||||||
healWaveMend = new Effect(40, e -> {
|
healWaveMend = new Effect(40, e -> {
|
||||||
Draw.color(e.color);
|
Draw.color(e.color);
|
||||||
Lines.stroke(e.fout() * 2f);
|
Lines.stroke(e.fout() * 2f);
|
||||||
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation);
|
Lines.circle(e.x, e.y, e.finpow() * e.rotation);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
});
|
});
|
||||||
|
|
||||||
overdriveWave = new Effect(50, e -> {
|
overdriveWave = new Effect(50, e -> {
|
||||||
Draw.color(e.color);
|
Draw.color(e.color);
|
||||||
Lines.stroke(e.fout() * 1f);
|
Lines.stroke(e.fout() * 1f);
|
||||||
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation);
|
Lines.circle(e.x, e.y, e.finpow() * e.rotation);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.mindustry.entities.bullet.*;
|
||||||
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.entities.type.base.*;
|
import io.anuke.mindustry.entities.type.base.*;
|
||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.type.UnitType;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Weapon;
|
|
||||||
|
|
||||||
public class UnitTypes implements ContentList{
|
public class UnitTypes implements ContentList{
|
||||||
public static UnitType
|
public static UnitType
|
||||||
@@ -90,31 +91,49 @@ public class UnitTypes implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
crawler = new UnitType("crawler", Crawler.class, Crawler::new){{
|
crawler = new UnitType("crawler", Crawler.class, Crawler::new){{
|
||||||
maxVelocity = 1.25f;
|
maxVelocity = 1.27f;
|
||||||
speed = 0.28f;
|
speed = 0.285f;
|
||||||
drag = 0.4f;
|
drag = 0.4f;
|
||||||
hitsize = 8f;
|
hitsize = 8f;
|
||||||
mass = 1.75f;
|
mass = 1.75f;
|
||||||
health = 100;
|
health = 120;
|
||||||
weapon = new Weapon("bomber"){{
|
weapon = new Weapon("bomber"){{
|
||||||
reload = 12f;
|
reload = 12f;
|
||||||
ejectEffect = Fx.none;
|
ejectEffect = Fx.none;
|
||||||
bullet = Bullets.explode;
|
bullet = new BombBulletType(2f, 3f, "clear"){
|
||||||
|
{
|
||||||
|
hitEffect = Fx.pulverize;
|
||||||
|
lifetime = 30f;
|
||||||
|
speed = 1.1f;
|
||||||
|
splashDamageRadius = 55f;
|
||||||
|
splashDamage = 30f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Bullet b){
|
||||||
|
if(b.getOwner() instanceof Unit){
|
||||||
|
((Unit)b.getOwner()).kill();
|
||||||
|
}
|
||||||
|
b.time(b.lifetime());
|
||||||
|
}
|
||||||
|
};
|
||||||
}};
|
}};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
titan = new UnitType("titan", Titan.class, Titan::new){{
|
titan = new UnitType("titan", Titan.class, Titan::new){{
|
||||||
maxVelocity = 0.8f;
|
maxVelocity = 0.8f;
|
||||||
speed = 0.18f;
|
speed = 0.22f;
|
||||||
drag = 0.4f;
|
drag = 0.4f;
|
||||||
mass = 3.5f;
|
mass = 3.5f;
|
||||||
hitsize = 9f;
|
hitsize = 9f;
|
||||||
|
range = 10f;
|
||||||
rotatespeed = 0.1f;
|
rotatespeed = 0.1f;
|
||||||
health = 440;
|
health = 460;
|
||||||
immunities.add(StatusEffects.burning);
|
immunities.add(StatusEffects.burning);
|
||||||
weapon = new Weapon("flamethrower"){{
|
weapon = new Weapon("flamethrower"){{
|
||||||
length = 1f;
|
length = 1f;
|
||||||
reload = 14f;
|
reload = 14f;
|
||||||
|
range = 30f;
|
||||||
roundrobin = true;
|
roundrobin = true;
|
||||||
recoil = 1f;
|
recoil = 1f;
|
||||||
ejectEffect = Fx.none;
|
ejectEffect = Fx.none;
|
||||||
|
|||||||
@@ -78,14 +78,13 @@ public class Zones implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
saltFlats = new Zone("saltFlats", new MapGenerator("saltFlats")){{
|
saltFlats = new Zone("saltFlats", new MapGenerator("saltFlats")){{
|
||||||
startingItems = ItemStack.list(Items.copper, 200, Items.silicon, 100, Items.lead, 200);
|
startingItems = ItemStack.list(Items.copper, 200, Items.silicon, 200, Items.lead, 200);
|
||||||
alwaysUnlocked = true;
|
|
||||||
conditionWave = 5;
|
|
||||||
launchPeriod = 5;
|
|
||||||
loadout = Loadouts.basicFoundation;
|
loadout = Loadouts.basicFoundation;
|
||||||
|
conditionWave = 10;
|
||||||
|
launchPeriod = 5;
|
||||||
zoneRequirements = ZoneRequirement.with(desertWastes, 60);
|
zoneRequirements = ZoneRequirement.with(desertWastes, 60);
|
||||||
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.draugFactory};
|
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.draugFactory, Blocks.door, Blocks.waterExtractor};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand, Items.titanium};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 1)
|
frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 1)
|
||||||
@@ -114,7 +113,7 @@ public class Zones implements ContentList{
|
|||||||
conditionWave = 20;
|
conditionWave = 20;
|
||||||
launchPeriod = 20;
|
launchPeriod = 20;
|
||||||
zoneRequirements = ZoneRequirement.with(desertWastes, 20, craters, 15);
|
zoneRequirements = ZoneRequirement.with(desertWastes, 20, craters, 15);
|
||||||
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator, Blocks.kiln};
|
blockRequirements = new Block[]{Blocks.graphitePress, Blocks.combustionGenerator, Blocks.kiln, Blocks.mechanicalPump};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.sand};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -125,14 +124,14 @@ public class Zones implements ContentList{
|
|||||||
conditionWave = 10;
|
conditionWave = 10;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
zoneRequirements = ZoneRequirement.with(frozenForest, 15);
|
zoneRequirements = ZoneRequirement.with(frozenForest, 15);
|
||||||
blockRequirements = new Block[]{Blocks.pneumaticDrill};
|
blockRequirements = new Block[]{Blocks.pneumaticDrill, Blocks.powerNode, Blocks.turbineGenerator};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
fungalPass = new Zone("fungalPass", new MapGenerator("fungalPass")){{
|
fungalPass = new Zone("fungalPass", new MapGenerator("fungalPass")){{
|
||||||
startingItems = ItemStack.list(Items.copper, 250, Items.lead, 250, Items.metaglass, 100, Items.graphite, 100);
|
startingItems = ItemStack.list(Items.copper, 250, Items.lead, 250, Items.metaglass, 100, Items.graphite, 100);
|
||||||
zoneRequirements = ZoneRequirement.with(stainedMountains, 15);
|
zoneRequirements = ZoneRequirement.with(stainedMountains, 15);
|
||||||
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.crawlerFactory, Blocks.door};
|
blockRequirements = new Block[]{Blocks.daggerFactory, Blocks.crawlerFactory, Blocks.door, Blocks.siliconSmelter};
|
||||||
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.titanium, Items.sand};
|
resources = new Item[]{Items.copper, Items.lead, Items.coal, Items.titanium, Items.sand};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -153,7 +152,7 @@ public class Zones implements ContentList{
|
|||||||
conditionWave = 15;
|
conditionWave = 15;
|
||||||
launchPeriod = 10;
|
launchPeriod = 10;
|
||||||
zoneRequirements = ZoneRequirement.with(ruinousShores, 20);
|
zoneRequirements = ZoneRequirement.with(ruinousShores, 20);
|
||||||
blockRequirements = new Block[]{Blocks.coalCentrifuge};
|
blockRequirements = new Block[]{Blocks.coalCentrifuge, Blocks.conduit, Blocks.wave};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ public class Zones implements ContentList{
|
|||||||
conditionWave = 3;
|
conditionWave = 3;
|
||||||
launchPeriod = 2;
|
launchPeriod = 2;
|
||||||
zoneRequirements = ZoneRequirement.with(tarFields, 20);
|
zoneRequirements = ZoneRequirement.with(tarFields, 20);
|
||||||
blockRequirements = new Block[]{Blocks.thermalGenerator};
|
blockRequirements = new Block[]{Blocks.thermalGenerator, Blocks.thoriumReactor};
|
||||||
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand, Items.thorium};
|
resources = new Item[]{Items.copper, Items.scrap, Items.lead, Items.coal, Items.titanium, Items.sand, Items.thorium};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.arc.graphics.*;
|
|||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.input.*;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
@@ -48,7 +48,7 @@ public class Control implements ApplicationListener{
|
|||||||
tutorial = new Tutorial();
|
tutorial = new Tutorial();
|
||||||
music = new MusicControl();
|
music = new MusicControl();
|
||||||
|
|
||||||
Unit.dp.product = settings.getInt("uiscale", 100) / 100f;
|
UnitScl.dp.setProduct(settings.getInt("uiscale", 100) / 100f);
|
||||||
|
|
||||||
Core.input.setCatch(KeyCode.BACK, true);
|
Core.input.setCatch(KeyCode.BACK, true);
|
||||||
|
|
||||||
@@ -211,6 +211,7 @@ public class Control implements ApplicationListener{
|
|||||||
public void playZone(Zone zone){
|
public void playZone(Zone zone){
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
Net.reset();
|
||||||
world.loadGenerator(zone.generator);
|
world.loadGenerator(zone.generator);
|
||||||
zone.rules.accept(state.rules);
|
zone.rules.accept(state.rules);
|
||||||
state.rules.zone = zone;
|
state.rules.zone = zone;
|
||||||
@@ -308,7 +309,7 @@ public class Control implements ApplicationListener{
|
|||||||
|
|
||||||
if(state.is(State.menu)){
|
if(state.is(State.menu)){
|
||||||
if(ui.deploy.isShown()){
|
if(ui.deploy.isShown()){
|
||||||
music.silence(); //TODO deploy music
|
music.play(Musics.launch);
|
||||||
}else if(ui.editor.isShown()){
|
}else if(ui.editor.isShown()){
|
||||||
music.play(Musics.editor);
|
music.play(Musics.editor);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public class NetClient implements ApplicationListener{
|
|||||||
private boolean connecting = false;
|
private boolean connecting = false;
|
||||||
/** If true, no message will be shown on disconnect. */
|
/** If true, no message will be shown on disconnect. */
|
||||||
private boolean quiet = false;
|
private boolean quiet = false;
|
||||||
|
/** Whether to supress disconnect events completely.*/
|
||||||
|
private boolean quietReset = false;
|
||||||
/** Counter for data timeout. */
|
/** Counter for data timeout. */
|
||||||
private float timeoutTime = 0f;
|
private float timeoutTime = 0f;
|
||||||
/** Last sent client snapshot ID. */
|
/** Last sent client snapshot ID. */
|
||||||
@@ -94,8 +96,10 @@ public class NetClient implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Net.handleClient(Disconnect.class, packet -> {
|
Net.handleClient(Disconnect.class, packet -> {
|
||||||
state.set(State.menu);
|
if(quietReset) return;
|
||||||
|
|
||||||
connecting = false;
|
connecting = false;
|
||||||
|
state.set(State.menu);
|
||||||
logic.reset();
|
logic.reset();
|
||||||
Platform.instance.updateRPC();
|
Platform.instance.updateRPC();
|
||||||
|
|
||||||
@@ -325,11 +329,11 @@ public class NetClient implements ApplicationListener{
|
|||||||
private void finishConnecting(){
|
private void finishConnecting(){
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
connecting = false;
|
connecting = false;
|
||||||
ui.loadfrag.hide();
|
|
||||||
ui.join.hide();
|
ui.join.hide();
|
||||||
Net.setClientLoaded(true);
|
Net.setClientLoaded(true);
|
||||||
Core.app.post(Call::connectConfirm);
|
Core.app.post(Call::connectConfirm);
|
||||||
Time.runTask(40f, Platform.instance::updateRPC);
|
Time.runTask(40f, Platform.instance::updateRPC);
|
||||||
|
Core.app.post(() -> ui.loadfrag.hide());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reset(){
|
private void reset(){
|
||||||
@@ -337,6 +341,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
removed.clear();
|
removed.clear();
|
||||||
timeoutTime = 0f;
|
timeoutTime = 0f;
|
||||||
connecting = true;
|
connecting = true;
|
||||||
|
quietReset = false;
|
||||||
quiet = false;
|
quiet = false;
|
||||||
lastSent = 0;
|
lastSent = 0;
|
||||||
|
|
||||||
@@ -348,11 +353,18 @@ public class NetClient implements ApplicationListener{
|
|||||||
connecting = true;
|
connecting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Disconnects, resetting state to the menu. */
|
||||||
public void disconnectQuietly(){
|
public void disconnectQuietly(){
|
||||||
quiet = true;
|
quiet = true;
|
||||||
Net.disconnect();
|
Net.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Disconnects, causing no further changes or reset.*/
|
||||||
|
public void disconnectNoReset(){
|
||||||
|
quiet = quietReset = true;
|
||||||
|
Net.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
/** When set, any disconnects will be ignored and no dialogs will be shown. */
|
/** When set, any disconnects will be ignored and no dialogs will be shown. */
|
||||||
public void setQuiet(){
|
public void setQuiet(){
|
||||||
quiet = true;
|
quiet = true;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import io.anuke.arc.graphics.glutils.FrameBuffer;
|
|||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.Rectangle;
|
import io.anuke.arc.math.geom.Rectangle;
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
import io.anuke.arc.math.geom.Vector2;
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.Pools;
|
import io.anuke.arc.util.pooling.Pools;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
@@ -37,7 +38,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
public FrameBuffer shieldBuffer = new FrameBuffer(2, 2);
|
||||||
private Bloom bloom;
|
private Bloom bloom;
|
||||||
private Color clearColor;
|
private Color clearColor;
|
||||||
private float targetscale = io.anuke.arc.scene.ui.layout.Unit.dp.scl(4);
|
private float targetscale = UnitScl.dp.scl(4);
|
||||||
private float camerascale = targetscale;
|
private float camerascale = targetscale;
|
||||||
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
|
private Rectangle rect = new Rectangle(), rect2 = new Rectangle();
|
||||||
private float shakeIntensity, shaketime;
|
private float shakeIntensity, shaketime;
|
||||||
@@ -47,7 +48,6 @@ public class Renderer implements ApplicationListener{
|
|||||||
if(settings.getBool("bloom")){
|
if(settings.getBool("bloom")){
|
||||||
setupBloom();
|
setupBloom();
|
||||||
}
|
}
|
||||||
Lines.setCircleVertices(20);
|
|
||||||
Shaders.init();
|
Shaders.init();
|
||||||
|
|
||||||
Effects.setScreenShakeProvider((intensity, duration) -> {
|
Effects.setScreenShakeProvider((intensity, duration) -> {
|
||||||
@@ -357,7 +357,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clampScale(){
|
public void clampScale(){
|
||||||
float s = io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f);
|
float s = UnitScl.dp.scl(1f);
|
||||||
targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6));
|
targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ import static io.anuke.arc.scene.actions.Actions.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class UI implements ApplicationListener{
|
public class UI implements ApplicationListener{
|
||||||
private static final int cursorScaling = 1, outlineThickness = 3;
|
|
||||||
private static final Color outlineColor = Color.valueOf("444444");
|
|
||||||
|
|
||||||
private FreeTypeFontGenerator generator;
|
private FreeTypeFontGenerator generator;
|
||||||
|
|
||||||
public MenuFragment menufrag;
|
public MenuFragment menufrag;
|
||||||
@@ -99,9 +96,9 @@ public class UI implements ApplicationListener{
|
|||||||
|
|
||||||
/** Called from a static context to make the cursor appear immediately upon startup.*/
|
/** Called from a static context to make the cursor appear immediately upon startup.*/
|
||||||
public static void loadSystemCursors(){
|
public static void loadSystemCursors(){
|
||||||
SystemCursor.arrow.set(Core.graphics.newCursor("cursor", cursorScaling, outlineColor, outlineThickness));
|
SystemCursor.arrow.set(Core.graphics.newCursor("cursor"));
|
||||||
SystemCursor.hand.set(Core.graphics.newCursor("hand", cursorScaling, outlineColor, outlineThickness));
|
SystemCursor.hand.set(Core.graphics.newCursor("hand"));
|
||||||
SystemCursor.ibeam.set(Core.graphics.newCursor("ibeam", cursorScaling, outlineColor, outlineThickness));
|
SystemCursor.ibeam.set(Core.graphics.newCursor("ibeam"));
|
||||||
|
|
||||||
Core.graphics.restoreCursor();
|
Core.graphics.restoreCursor();
|
||||||
}
|
}
|
||||||
@@ -126,15 +123,15 @@ public class UI implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadExtraCursors(){
|
void loadExtraCursors(){
|
||||||
drillCursor = Core.graphics.newCursor("drill", cursorScaling, outlineColor, outlineThickness);
|
drillCursor = Core.graphics.newCursor("drill");
|
||||||
unloadCursor = Core.graphics.newCursor("unload", cursorScaling, outlineColor, outlineThickness);
|
unloadCursor = Core.graphics.newCursor("unload");
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateFonts(Skin skin){
|
void generateFonts(Skin skin){
|
||||||
generator = new FreeTypeFontGenerator(Core.files.internal("fonts/font.ttf"));
|
generator = new FreeTypeFontGenerator(Core.files.internal("fonts/font.ttf"));
|
||||||
|
|
||||||
FreeTypeFontParameter param = new FreeTypeFontParameter(){{
|
FreeTypeFontParameter param = new FreeTypeFontParameter(){{
|
||||||
size = (int)(9 * 2 * Math.max(Unit.dp.scl(1f), 0.5f));
|
size = (int)(UnitScl.dp.scl(18f));
|
||||||
shadowColor = Color.DARK_GRAY;
|
shadowColor = Color.DARK_GRAY;
|
||||||
shadowOffsetY = 2;
|
shadowOffsetY = 2;
|
||||||
incremental = true;
|
incremental = true;
|
||||||
@@ -143,7 +140,7 @@ public class UI implements ApplicationListener{
|
|||||||
FreeTypeFontParameter outlined = new FreeTypeFontParameter(){{
|
FreeTypeFontParameter outlined = new FreeTypeFontParameter(){{
|
||||||
size = param.size;
|
size = param.size;
|
||||||
borderColor = Color.DARK_GRAY;
|
borderColor = Color.DARK_GRAY;
|
||||||
borderWidth = 2f;
|
borderWidth = UnitScl.dp.scl(2f);
|
||||||
spaceX -= borderWidth;
|
spaceX -= borderWidth;
|
||||||
incremental = true;
|
incremental = true;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -1,40 +1,34 @@
|
|||||||
package io.anuke.mindustry.editor;
|
package io.anuke.mindustry.editor;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.collection.StringMap;
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.Pixmap;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.scene.actions.*;
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
import io.anuke.arc.scene.style.*;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
|
||||||
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.TextButton.TextButtonStyle;
|
import io.anuke.arc.scene.ui.TextButton.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.game.*;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.io.JsonIO;
|
import io.anuke.mindustry.io.*;
|
||||||
import io.anuke.mindustry.io.MapIO;
|
import io.anuke.mindustry.maps.*;
|
||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.FileChooser;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.world.Block.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
|
||||||
import io.anuke.mindustry.world.Block.Icon;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.blocks.*;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
import io.anuke.mindustry.world.blocks.storage.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -378,10 +372,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void build(){
|
public void build(){
|
||||||
float amount = 10f, baseSize = 60f;
|
float size = 60f;
|
||||||
|
|
||||||
float size = mobile ? (int)(Math.min(Core.graphics.getHeight(), Core.graphics.getWidth()) / amount / Unit.dp.scl(1f)) :
|
|
||||||
Math.min(Core.graphics.getHeight() / amount, baseSize);
|
|
||||||
|
|
||||||
clearChildren();
|
clearChildren();
|
||||||
table(cont -> {
|
table(cont -> {
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rebuildFilters(){
|
void rebuildFilters(){
|
||||||
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / Unit.dp.scl(290f)), 1);
|
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / UnitScl.dp.scl(290f)), 1);
|
||||||
filterTable.clearChildren();
|
filterTable.clearChildren();
|
||||||
filterTable.top().left();
|
filterTable.top().left();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.anuke.arc.math.geom.*;
|
|||||||
import io.anuke.arc.scene.Element;
|
import io.anuke.arc.scene.Element;
|
||||||
import io.anuke.arc.scene.event.*;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.scene.ui.TextField;
|
import io.anuke.arc.scene.ui.TextField;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
import io.anuke.mindustry.input.Binding;
|
import io.anuke.mindustry.input.Binding;
|
||||||
@@ -258,7 +258,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
float scaling = zoom * Math.min(width, height) / editor.width();
|
float scaling = zoom * Math.min(width, height) / editor.width();
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
Lines.stroke(Unit.dp.scl(2f));
|
Lines.stroke(UnitScl.dp.scl(2f));
|
||||||
|
|
||||||
if((!editor.drawBlock.isMultiblock() || tool == EditorTool.eraser) && tool != EditorTool.fill){
|
if((!editor.drawBlock.isMultiblock() || tool == EditorTool.eraser) && tool != EditorTool.fill){
|
||||||
if(tool == EditorTool.line && drawing){
|
if(tool == EditorTool.line && drawing){
|
||||||
@@ -294,7 +294,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
Lines.stroke(Unit.dp.scl(3f));
|
Lines.stroke(UnitScl.dp.scl(3f));
|
||||||
Lines.rect(x, y, width, height);
|
Lines.rect(x, y, width, height);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
public boolean zoom(float initialDistance, float distance){
|
public boolean zoom(float initialDistance, float distance){
|
||||||
if(!active()) return false;
|
if(!active()) return false;
|
||||||
float nzoom = distance - initialDistance;
|
float nzoom = distance - initialDistance;
|
||||||
zoom += nzoom / 10000f / Unit.dp.scl(1f) * zoom;
|
zoom += nzoom / 10000f / UnitScl.dp.scl(1f) * zoom;
|
||||||
clampZoom();
|
clampZoom();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class Decal extends TimedEntity implements BelowLiquidTrait, Dra
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float lifetime(){
|
public float lifetime(){
|
||||||
return 8200f;
|
return 3600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ public class RubbleDecal extends Decal{
|
|||||||
decal.add();
|
decal.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float lifetime(){
|
||||||
|
return 8200f;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawDecal(){
|
public void drawDecal(){
|
||||||
if(!Core.atlas.isFound(region)){
|
if(!Core.atlas.isFound(region)){
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ScorchDecal extends Decal{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawDecal(){
|
public void drawDecal(){
|
||||||
for(int i = 0; i < 5; i++){
|
for(int i = 0; i < 3; i++){
|
||||||
TextureRegion region = regions[Mathf.randomSeed(id - i, 0, scorches - 1)];
|
TextureRegion region = regions[Mathf.randomSeed(id - i, 0, scorches - 1)];
|
||||||
float rotation = Mathf.randomSeed(id + i, 0, 360);
|
float rotation = Mathf.randomSeed(id + i, 0, 360);
|
||||||
float space = 1.5f + Mathf.randomSeed(id + i + 1, 0, 20) / 10f;
|
float space = 1.5f + Mathf.randomSeed(id + i + 1, 0, 20) / 10f;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.Angles;
|
import io.anuke.arc.math.Angles;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.Pools;
|
import io.anuke.arc.util.pooling.Pools;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -27,7 +28,7 @@ import io.anuke.mindustry.net.NetConnection;
|
|||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -379,7 +380,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
|
|
||||||
boolean ints = font.usesIntegerPositions();
|
boolean ints = font.usesIntegerPositions();
|
||||||
font.setUseIntegerPositions(false);
|
font.setUseIntegerPositions(false);
|
||||||
font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f));
|
font.getData().setScale(0.25f / UnitScl.dp.scl(1f));
|
||||||
layout.setText(font, name);
|
layout.setText(font, name);
|
||||||
Draw.color(0f, 0f, 0f, 0.3f);
|
Draw.color(0f, 0f, 0f, 0.3f);
|
||||||
Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);
|
Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);
|
||||||
@@ -420,7 +421,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
public void drawBuildRequests(){
|
public void drawBuildRequests(){
|
||||||
BuildRequest last = null;
|
BuildRequest last = null;
|
||||||
for(BuildRequest request : buildQueue()){
|
for(BuildRequest request : buildQueue()){
|
||||||
if(request.progress > 0.01f || (buildRequest() == request && (dst(request.x * tilesize, request.y * tilesize) <= placeDistance || state.isEditor()))) continue;
|
if(request.progress > 0.01f || (buildRequest() == request && request.initialized && (dst(request.x * tilesize, request.y * tilesize) <= placeDistance || state.isEditor()))) continue;
|
||||||
|
|
||||||
if(request.breaking){
|
if(request.breaking){
|
||||||
Block block = world.ltile(request.x, request.y).block();
|
Block block = world.ltile(request.x, request.y).block();
|
||||||
@@ -638,7 +639,8 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTouch(){
|
protected void updateTouch(){
|
||||||
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range())){
|
if(Units.invalidateTarget(target, this) &&
|
||||||
|
!(target instanceof TileEntity && ((TileEntity)target).damaged() && target.isValid() && target.getTeam() == team && mech.canHeal && dst(target) < getWeapon().bullet.range() && !(((TileEntity)target).block instanceof BuildBlock))){
|
||||||
target = null;
|
target = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import io.anuke.arc.graphics.*;
|
|||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
@@ -402,7 +403,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
|||||||
Core.scene.skin.getFont("outline").draw(item.amount + "",
|
Core.scene.skin.getFont("outline").draw(item.amount + "",
|
||||||
x + Angles.trnsx(rotation + 180f, backTrns),
|
x + Angles.trnsx(rotation + 180f, backTrns),
|
||||||
y + Angles.trnsy(rotation + 180f, backTrns) - 3,
|
y + Angles.trnsy(rotation + 180f, backTrns) - 3,
|
||||||
Pal.accent, 0.25f * itemtime, false, Align.center
|
Pal.accent, 0.25f * itemtime / UnitScl.dp.scl(1f), false, Align.center
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ public enum Gamemode{
|
|||||||
rules.pvp = true;
|
rules.pvp = true;
|
||||||
rules.enemyCoreBuildRadius = 600f;
|
rules.enemyCoreBuildRadius = 600f;
|
||||||
rules.respawnTime = 60 * 10;
|
rules.respawnTime = 60 * 10;
|
||||||
rules.buildCostMultiplier = 0.5f;
|
rules.buildCostMultiplier = 1f;
|
||||||
rules.buildSpeedMultiplier = 2f;
|
rules.buildSpeedMultiplier = 1f;
|
||||||
rules.playerDamageMultiplier = 0.33f;
|
rules.playerDamageMultiplier = 0.33f;
|
||||||
rules.playerHealthMultiplier = 0.5f;
|
rules.playerHealthMultiplier = 0.5f;
|
||||||
rules.unitBuildSpeedMultiplier = 3f;
|
rules.unitBuildSpeedMultiplier = 2f;
|
||||||
rules.unitHealthMultiplier = 3f;
|
rules.unitHealthMultiplier = 3f;
|
||||||
rules.attackMode = true;
|
rules.attackMode = true;
|
||||||
}, map -> map.teams.size > 1),
|
}, map -> map.teams.size > 1),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.arc.util.*;
|
|||||||
|
|
||||||
/** Controls playback of multiple music tracks.*/
|
/** Controls playback of multiple music tracks.*/
|
||||||
public class MusicControl{
|
public class MusicControl{
|
||||||
private static final float finTime = 80f, foutTime = 80f;
|
private static final float finTime = 120f, foutTime = 120f;
|
||||||
private @Nullable Music current;
|
private @Nullable Music current;
|
||||||
private float fade;
|
private float fade;
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,34 @@ public class Drawf{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void circles(float x, float y, float rad, Color color){
|
public static void circles(float x, float y, float rad, Color color){
|
||||||
int vertices = (int)(rad * 2);
|
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.poly(x, y, vertices, rad);
|
Lines.circle(x, y, rad);
|
||||||
Lines.stroke(1f, color);
|
Lines.stroke(1f, color);
|
||||||
Lines.poly(x, y, vertices, rad);
|
Lines.circle(x, y, rad);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void square(float x, float y, float radius, Color color){
|
||||||
|
Lines.stroke(3f, Pal.gray);
|
||||||
|
Lines.square(x, y, radius + 1f, 45);
|
||||||
|
Lines.stroke(1f, color);
|
||||||
|
Lines.square(x, y, radius + 1f, 45);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void square(float x, float y, float radius){
|
||||||
|
square(x, y, radius, Pal.accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static void square(float x, float y, float radius){
|
||||||
|
Lines.stroke(1f, Pal.gray);
|
||||||
|
Lines.square(x, y - 1f, radius + 1f, 45);
|
||||||
|
Lines.stroke(1f, Pal.accent);
|
||||||
|
Lines.square(x, y, radius + 1f, 45);
|
||||||
|
Draw.reset();
|
||||||
|
}*/
|
||||||
|
|
||||||
public static void arrow(float x, float y, float x2, float y2, float length, float radius){
|
public static void arrow(float x, float y, float x2, float y2, float length, float radius){
|
||||||
float angle = Angles.angle(x, y, x2, y2);
|
float angle = Angles.angle(x, y, x2, y2);
|
||||||
float space = 2f;
|
float space = 2f;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.arc.graphics.Color;
|
|||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.noise.RidgedPerlin;
|
import io.anuke.arc.util.noise.RidgedPerlin;
|
||||||
import io.anuke.arc.util.noise.Simplex;
|
import io.anuke.arc.util.noise.Simplex;
|
||||||
@@ -220,7 +220,7 @@ public class MenuRenderer implements Disposable{
|
|||||||
|
|
||||||
public void render(){
|
public void render(){
|
||||||
time += Time.delta();
|
time += Time.delta();
|
||||||
float scaling = Math.max(Unit.dp.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
|
float scaling = Math.max(UnitScl.dp.scl(4f), Math.max(Core.graphics.getWidth() / ((width - 1f) * tilesize), Core.graphics.getHeight() / ((height - 1f) * tilesize)));
|
||||||
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
|
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
|
||||||
camera.resize(Core.graphics.getWidth() / scaling,
|
camera.resize(Core.graphics.getWidth() / scaling,
|
||||||
Core.graphics.getHeight() / scaling);
|
Core.graphics.getHeight() / scaling);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.graphics.Pixmap.*;
|
|||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
@@ -77,7 +78,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
for(Unit unit : units){
|
for(Unit unit : units){
|
||||||
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
||||||
Draw.color(unit.getTeam().color);
|
Draw.color(unit.getTeam().color);
|
||||||
Fill.rect(x + rx, y + ry, io.anuke.arc.scene.ui.layout.Unit.dp.scl(baseSize / 2f), io.anuke.arc.scene.ui.layout.Unit.dp.scl(baseSize / 2f));
|
Fill.rect(x + rx, y + ry, UnitScl.dp.scl(baseSize / 2f), UnitScl.dp.scl(baseSize / 2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ public class OverlayRenderer{
|
|||||||
float dst = Mathf.dst(player.x, player.y, core.drawx(), core.drawy());
|
float dst = Mathf.dst(player.x, player.y, core.drawx(), core.drawy());
|
||||||
if(dst < state.rules.enemyCoreBuildRadius * 1.5f){
|
if(dst < state.rules.enemyCoreBuildRadius * 1.5f){
|
||||||
Draw.color(Color.DARK_GRAY);
|
Draw.color(Color.DARK_GRAY);
|
||||||
Lines.poly(core.drawx(), core.drawy() - 2, 200, state.rules.enemyCoreBuildRadius);
|
Lines.circle(core.drawx(), core.drawy() - 2, state.rules.enemyCoreBuildRadius);
|
||||||
Draw.color(Pal.accent, enemy.color, 0.5f + Mathf.absin(Time.time(), 10f, 0.5f));
|
Draw.color(Pal.accent, enemy.color, 0.5f + Mathf.absin(Time.time(), 10f, 0.5f));
|
||||||
Lines.poly(core.drawx(), core.drawy(), 200, state.rules.enemyCoreBuildRadius);
|
Lines.circle(core.drawx(), core.drawy(), state.rules.enemyCoreBuildRadius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class Pal{
|
|||||||
lightFlame = Color.valueOf("ffdd55"),
|
lightFlame = Color.valueOf("ffdd55"),
|
||||||
darkFlame = Color.valueOf("db401c"),
|
darkFlame = Color.valueOf("db401c"),
|
||||||
|
|
||||||
|
power2 = Color.valueOf("ff9f6c"),
|
||||||
|
|
||||||
lightPyraFlame = Color.valueOf("ffb855"),
|
lightPyraFlame = Color.valueOf("ffb855"),
|
||||||
darkPyraFlame = Color.valueOf("db661c"),
|
darkPyraFlame = Color.valueOf("db661c"),
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import io.anuke.arc.Core;
|
|||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.Color;
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.graphics.glutils.Shader;
|
import io.anuke.arc.graphics.glutils.Shader;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
|
|
||||||
public class Shaders{
|
public class Shaders{
|
||||||
@@ -41,7 +41,7 @@ public class Shaders{
|
|||||||
setUniformf("u_resolution", Core.graphics.getWidth(), Core.graphics.getHeight());
|
setUniformf("u_resolution", Core.graphics.getWidth(), Core.graphics.getHeight());
|
||||||
setUniformi("u_time", (int)(time += Core.graphics.getDeltaTime() * 60f));
|
setUniformi("u_time", (int)(time += Core.graphics.getDeltaTime() * 60f));
|
||||||
setUniformf("u_uv", Core.atlas.white().getU(), Core.atlas.white().getV());
|
setUniformf("u_uv", Core.atlas.white().getU(), Core.atlas.white().getV());
|
||||||
setUniformf("u_scl", Unit.dp.scl(1f));
|
setUniformf("u_scl", UnitScl.dp.scl(1f));
|
||||||
setUniformf("u_uv2", Core.atlas.white().getU2(), Core.atlas.white().getV2());
|
setUniformf("u_uv2", Core.atlas.white().getU2(), Core.atlas.white().getV2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,8 +117,8 @@ public class Shaders{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(){
|
public void apply(){
|
||||||
setUniformf("u_dp", Unit.dp.scl(1f));
|
setUniformf("u_dp", UnitScl.dp.scl(1f));
|
||||||
setUniformf("u_time", Time.time() / Unit.dp.scl(1f));
|
setUniformf("u_time", Time.time() / UnitScl.dp.scl(1f));
|
||||||
setUniformf("u_offset",
|
setUniformf("u_offset",
|
||||||
Core.camera.position.x - Core.camera.width / 2,
|
Core.camera.position.x - Core.camera.width / 2,
|
||||||
Core.camera.position.y - Core.camera.height / 2);
|
Core.camera.position.y - Core.camera.height / 2);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public enum Binding implements KeyBind{
|
|||||||
diagonal_placement(KeyCode.CONTROL_LEFT),
|
diagonal_placement(KeyCode.CONTROL_LEFT),
|
||||||
pick(KeyCode.MOUSE_MIDDLE),
|
pick(KeyCode.MOUSE_MIDDLE),
|
||||||
dash(KeyCode.SHIFT_LEFT),
|
dash(KeyCode.SHIFT_LEFT),
|
||||||
gridMode(KeyCode.GRAVE),
|
gridMode(KeyCode.BACKTICK),
|
||||||
gridModeShift(KeyCode.ALT_LEFT),
|
gridModeShift(KeyCode.ALT_LEFT),
|
||||||
zoom_hold(KeyCode.CONTROL_LEFT, "view"),
|
zoom_hold(KeyCode.CONTROL_LEFT, "view"),
|
||||||
zoom(new Axis(KeyCode.SCROLL)),
|
zoom(new Axis(KeyCode.SCROLL)),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import io.anuke.arc.math.Mathf;
|
|||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
import io.anuke.arc.scene.actions.Actions;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.Blocks;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
@@ -38,7 +38,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
private static final float maxPanSpeed = 1.3f;
|
private static final float maxPanSpeed = 1.3f;
|
||||||
private static Rectangle r1 = new Rectangle(), r2 = new Rectangle();
|
private static Rectangle r1 = new Rectangle(), r2 = new Rectangle();
|
||||||
/** Distance to edge of screen to start panning. */
|
/** Distance to edge of screen to start panning. */
|
||||||
private final float edgePan = io.anuke.arc.scene.ui.layout.Unit.dp.scl(60f);
|
private final float edgePan = UnitScl.dp.scl(60f);
|
||||||
|
|
||||||
//gesture data
|
//gesture data
|
||||||
private Vector2 vector = new Vector2();
|
private Vector2 vector = new Vector2();
|
||||||
@@ -155,7 +155,6 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
r1.setSize(other.block().size * tilesize);
|
r1.setSize(other.block().size * tilesize);
|
||||||
r1.setCenter(other.worldx() + other.block().offset(), other.worldy() + other.block().offset());
|
r1.setCenter(other.worldx() + other.block().offset(), other.worldy() + other.block().offset());
|
||||||
|
|
||||||
@@ -248,7 +247,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
/** Draws a placement icon for a specific block. */
|
/** Draws a placement icon for a specific block. */
|
||||||
void drawPlace(int x, int y, Block block, int rotation, int prevX, int prevY, int prevRotation){
|
void drawPlace(int x, int y, Block block, int rotation, int prevX, int prevY, int prevRotation){
|
||||||
if(validPlace(x, y, block, rotation)){
|
if(validPlace(x, y, block, rotation) && !checkOverlapPlacement(x, y, block)){
|
||||||
block.getPlaceDraw(placeDraw, rotation, prevX, prevY, prevRotation);
|
block.getPlaceDraw(placeDraw, rotation, prevX, prevY, prevRotation);
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
@@ -509,7 +508,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(mode == placing && isPlacing()){
|
if(mode == placing && isPlacing()){
|
||||||
iterateLine(lineStartX, lineStartY, tileX, tileY, l -> {
|
iterateLine(lineStartX, lineStartY, tileX, tileY, l -> {
|
||||||
Tile tile = world.tile(l.x, l.y);
|
Tile tile = world.tile(l.x, l.y);
|
||||||
if(tile != null && hasRequest(tile)){
|
if(tile != null && checkOverlapPlacement(tile.x, tile.y, block)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +764,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
if(lastDistance == -1) lastDistance = initialDistance;
|
if(lastDistance == -1) lastDistance = initialDistance;
|
||||||
|
|
||||||
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();
|
float amount = (Mathf.sign(distance > lastDistance) * 0.04f) * Time.delta();
|
||||||
renderer.scaleCamera(io.anuke.arc.scene.ui.layout.Unit.dp.scl(amount));
|
renderer.scaleCamera(UnitScl.dp.scl(amount));
|
||||||
lastDistance = distance;
|
lastDistance = distance;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public class MirrorFilter extends GenerateFilter{
|
|||||||
v1.trns(angle - 90, 1f);
|
v1.trns(angle - 90, 1f);
|
||||||
v2.set(v1).scl(-1f);
|
v2.set(v1).scl(-1f);
|
||||||
|
|
||||||
v1.add(in.width/2f, in.height/2f);
|
v1.add(in.width/2f - 0.5f, in.height/2f - 0.5f);
|
||||||
v2.add(in.width/2f, in.height/2f);
|
v2.add(in.width/2f - 0.5f, in.height/2f - 0.5f);
|
||||||
|
|
||||||
v3.set(in.x, in.y);
|
v3.set(in.x, in.y);
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public class MirrorFilter extends GenerateFilter{
|
|||||||
clamper.accept(Tmp.v1.trns(angle - 90, size).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
|
clamper.accept(Tmp.v1.trns(angle - 90, size).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
|
||||||
clamper.accept(Tmp.v2.set(Tmp.v1).sub(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()).rotate(180f).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
|
clamper.accept(Tmp.v2.set(Tmp.v1).sub(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()).rotate(180f).add(image.getWidth()/2f + image.getX(), image.getHeight()/2f + image.getY()));
|
||||||
|
|
||||||
Lines.stroke(Unit.dp.scl(3f), Pal.accent);
|
Lines.stroke(UnitScl.dp.scl(3f), Pal.accent);
|
||||||
Lines.line(Tmp.v1.x, Tmp.v1.y, Tmp.v2.x, Tmp.v2.y);
|
Lines.line(Tmp.v1.x, Tmp.v1.y, Tmp.v2.x, Tmp.v2.y);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public abstract class BasicGenerator extends RandomGenerator{
|
|||||||
int offsetX = x - 4, offsetY = y + 23;
|
int offsetX = x - 4, offsetY = y + 23;
|
||||||
for(int i = ores.size - 1; i >= 0; i--){
|
for(int i = ores.size - 1; i >= 0; i--){
|
||||||
Block entry = ores.get(i);
|
Block entry = ores.get(i);
|
||||||
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), offsetX, offsetY + i*999)) > 0.23f &&
|
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (40 + i * 2), offsetX, offsetY + i*999)) > 0.26f &&
|
||||||
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY - i*999)) > 0.32f){
|
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (30 + i * 4), offsetX, offsetY - i*999)) > 0.37f){
|
||||||
ore = entry;
|
ore = entry;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,11 @@ public class Net{
|
|||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reset(){
|
||||||
|
closeServer();
|
||||||
|
netClient.disconnectNoReset();
|
||||||
|
}
|
||||||
|
|
||||||
public static void disconnect(){
|
public static void disconnect(){
|
||||||
clientProvider.disconnect();
|
clientProvider.disconnect();
|
||||||
server = false;
|
server = false;
|
||||||
|
|||||||
@@ -59,6 +59,26 @@ public class Zone extends UnlockableContent{
|
|||||||
return metCondition() && wave % launchPeriod == 0;
|
return metCondition() && wave % launchPeriod == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUnlock(){
|
||||||
|
if(data.isUnlocked(this)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ZoneRequirement other : zoneRequirements){
|
||||||
|
if(other.zone.bestWave() < other.wave){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Block other : blockRequirements){
|
||||||
|
if(!data.isUnlocked(other)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack[] getLaunchCost(){
|
public ItemStack[] getLaunchCost(){
|
||||||
if(launchCost == null){
|
if(launchCost == null){
|
||||||
updateLaunchCost();
|
updateLaunchCost();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.ui;
|
|||||||
import io.anuke.arc.graphics.Texture;
|
import io.anuke.arc.graphics.Texture;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.scene.ui.Image;
|
import io.anuke.arc.scene.ui.Image;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
|
|
||||||
public class BorderImage extends Image{
|
public class BorderImage extends Image{
|
||||||
@@ -36,7 +36,7 @@ public class BorderImage extends Image{
|
|||||||
|
|
||||||
Draw.color(Pal.gray);
|
Draw.color(Pal.gray);
|
||||||
Draw.alpha(parentAlpha);
|
Draw.alpha(parentAlpha);
|
||||||
Lines.stroke(Unit.dp.scl(thickness));
|
Lines.stroke(UnitScl.dp.scl(thickness));
|
||||||
Lines.rect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
Lines.rect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ public class Minimap extends Table{
|
|||||||
|
|
||||||
add(new Element(){
|
add(new Element(){
|
||||||
{
|
{
|
||||||
setSize(Unit.dp.scl(140f));
|
setSize(UnitScl.dp.scl(140f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
setPosition(Unit.dp.scl(margin), Unit.dp.scl(margin));
|
setPosition(UnitScl.dp.scl(margin), UnitScl.dp.scl(margin));
|
||||||
|
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public class Minimap extends Table{
|
|||||||
|
|
||||||
addListener(new ClickListener(){
|
addListener(new ClickListener(){
|
||||||
{
|
{
|
||||||
tapSquareSize = Unit.dp.scl(11f);
|
tapSquareSize = UnitScl.dp.scl(11f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.scene.Element;
|
import io.anuke.arc.scene.Element;
|
||||||
import io.anuke.arc.scene.ui.Image;
|
import io.anuke.arc.scene.ui.Image;
|
||||||
import io.anuke.arc.scene.ui.layout.Stack;
|
import io.anuke.arc.scene.ui.layout.Stack;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
|
|
||||||
public class ReqImage extends Stack{
|
public class ReqImage extends Stack{
|
||||||
@@ -21,7 +21,7 @@ public class ReqImage extends Stack{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Lines.stroke(Unit.dp.scl(2f), Pal.removeBack);
|
Lines.stroke(UnitScl.dp.scl(2f), Pal.removeBack);
|
||||||
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
||||||
Draw.color(Pal.remove);
|
Draw.color(Pal.remove);
|
||||||
Lines.line(x, y + height, x + width, y);
|
Lines.line(x, y + height, x + width, y);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class CustomGameDialog extends FloatingDialog{
|
|||||||
ScrollPane pane = new ScrollPane(maps);
|
ScrollPane pane = new ScrollPane(maps);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / Unit.dp.scl(200)), 1, 8);
|
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / UnitScl.dp.scl(200)), 1, 8);
|
||||||
float images = 146f;
|
float images = 146f;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.ui.dialogs;
|
|||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.collection.ObjectSet.*;
|
import io.anuke.arc.collection.ObjectSet.*;
|
||||||
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.graphics.*;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
@@ -14,9 +15,11 @@ import io.anuke.arc.scene.utils.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.*;
|
import io.anuke.mindustry.content.*;
|
||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Saves.*;
|
import io.anuke.mindustry.game.Saves.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.io.SaveIO.*;
|
import io.anuke.mindustry.io.SaveIO.*;
|
||||||
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Zone.*;
|
import io.anuke.mindustry.type.Zone.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
@@ -25,19 +28,22 @@ import io.anuke.mindustry.ui.TreeLayout.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class DeployDialog extends FloatingDialog{
|
public class DeployDialog extends FloatingDialog{
|
||||||
private final float nodeSize = Unit.dp.scl(230f);
|
private final float nodeSize = UnitScl.dp.scl(230f);
|
||||||
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
|
private ObjectSet<ZoneNode> nodes = new ObjectSet<>();
|
||||||
private ZoneInfoDialog info = new ZoneInfoDialog();
|
private ZoneInfoDialog info = new ZoneInfoDialog();
|
||||||
private Rectangle bounds = new Rectangle();
|
private Rectangle bounds = new Rectangle();
|
||||||
|
private Texture nomap = new Texture("zones/nomap.png");
|
||||||
|
|
||||||
public DeployDialog(){
|
public DeployDialog(){
|
||||||
super("", "fulldialog");
|
super("", "fulldialog");
|
||||||
|
|
||||||
|
Events.on(DisposeEvent.class, e -> nomap.dispose());
|
||||||
|
|
||||||
ZoneNode root = new ZoneNode(Zones.groundZero, null);
|
ZoneNode root = new ZoneNode(Zones.groundZero, null);
|
||||||
|
|
||||||
TreeLayout layout = new TreeLayout();
|
TreeLayout layout = new TreeLayout();
|
||||||
layout.gapBetweenLevels = layout.gapBetweenNodes = Unit.dp.scl(60f);
|
layout.gapBetweenLevels = layout.gapBetweenNodes = UnitScl.dp.scl(60f);
|
||||||
layout.gapBetweenNodes = Unit.dp.scl(120f);
|
layout.gapBetweenNodes = UnitScl.dp.scl(120f);
|
||||||
layout.layout(root);
|
layout.layout(root);
|
||||||
bounds.set(layout.getBounds());
|
bounds.set(layout.getBounds());
|
||||||
bounds.y += nodeSize*0.4f;
|
bounds.y += nodeSize*0.4f;
|
||||||
@@ -95,6 +101,8 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
|
|
||||||
hide();
|
hide();
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
|
logic.reset();
|
||||||
|
Net.reset();
|
||||||
try{
|
try{
|
||||||
control.saves.getZoneSlot().load();
|
control.saves.getZoneSlot().load();
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
@@ -167,12 +175,13 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
button.setDisabled(() -> hidden(zone));
|
button.setDisabled(() -> hidden(zone));
|
||||||
button.clicked(() -> info.show(zone));
|
button.clicked(() -> info.show(zone));
|
||||||
|
|
||||||
if(zone.unlocked()){
|
if(zone.unlocked() && !hidden(zone)){
|
||||||
button.labelWrap(zone.localizedName()).style("outline").width(140).growX().get().setAlignment(Align.center);
|
button.labelWrap(zone.localizedName()).style("outline").width(140).growX().get().setAlignment(Align.center);
|
||||||
}else{
|
}else{
|
||||||
button.addImage("icon-locked");
|
Consumer<Element> flasher = zone.canUnlock() && !hidden(zone) ? e -> e.update(() -> e.getColor().set(Color.WHITE).lerp(Pal.accent, Mathf.absin(3f, 1f))) : e -> {};
|
||||||
|
flasher.accept(button.addImage("icon-locked").get());
|
||||||
button.row();
|
button.row();
|
||||||
button.add("$locked");
|
flasher.accept(button.add("$locked").get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,13 +199,7 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
stack.setSize(Tmp.v1.x, Tmp.v1.y);
|
||||||
if(node.zone.unlocked() && node.zone.preview != null){
|
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview != null ? node.zone.preview : nomap).setScaling(Scaling.stretch)).color(node.zone.unlocked() ? Color.DARK_GRAY : Color.fromGray(0.2f)).grow()));
|
||||||
stack.add(new Table(t -> t.margin(4f).add(new Image(node.zone.preview)
|
|
||||||
.setScaling(Scaling.stretch)).color(Color.DARK_GRAY).grow()));
|
|
||||||
}else{
|
|
||||||
stack.add(new Table(t -> t.margin(4f).add(new Image("whiteui", Color.BLACK).setScaling(Scaling.stretch)).grow()));
|
|
||||||
}
|
|
||||||
|
|
||||||
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
stack.update(() -> stack.setPosition(node.x + panX + width / 2f, node.y + panY + height / 2f, Align.center));
|
||||||
|
|
||||||
Button button = new Button("square");
|
Button button = new Button("square");
|
||||||
@@ -231,7 +234,8 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
|
|
||||||
for(ZoneNode node : nodes){
|
for(ZoneNode node : nodes){
|
||||||
for(ZoneNode child : node.allChildren){
|
for(ZoneNode child : node.allChildren){
|
||||||
Lines.stroke(Unit.dp.scl(4f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.gray);
|
Lines.stroke(UnitScl.dp.scl(4f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.gray);
|
||||||
|
Draw.alpha(parentAlpha);
|
||||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import io.anuke.arc.graphics.g2d.GlyphLayout;
|
|||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.Pools;
|
import io.anuke.arc.util.pooling.Pools;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.Platform;
|
||||||
@@ -151,7 +151,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
content.add(icontable).expandX().fillX();
|
content.add(icontable).expandX().fillX();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
content.center().add(pane).width(Core.graphics.isPortrait() ? Core.graphics.getWidth() / Unit.dp.scl(1) : Core.graphics.getWidth() / Unit.dp.scl(2)).colspan(3).grow();
|
content.center().add(pane).width(Core.graphics.isPortrait() ? Core.graphics.getWidth() / UnitScl.dp.scl(1) : Core.graphics.getWidth() / UnitScl.dp.scl(2)).colspan(3).grow();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
if(!open){
|
if(!open){
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
|
|
||||||
Time.runTask(2f, () -> {
|
Time.runTask(2f, () -> {
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
Net.reset();
|
||||||
Vars.netClient.beginConnecting();
|
Vars.netClient.beginConnecting();
|
||||||
Net.connect(ip, port, () -> {
|
Net.connect(ip, port, () -> {
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.scene.ui.ScrollPane;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.TextButton;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
import io.anuke.mindustry.game.Saves.*;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.*;
|
||||||
import io.anuke.mindustry.io.SaveIO.SaveException;
|
import io.anuke.mindustry.io.SaveIO.*;
|
||||||
|
import io.anuke.mindustry.net.Net;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -137,7 +137,6 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
for(SaveSlot slot : control.saves.getSaveSlots()) if(!slot.isHidden()) valids = true;
|
for(SaveSlot slot : control.saves.getSaveSlots()) if(!slot.isHidden()) valids = true;
|
||||||
|
|
||||||
if(!valids){
|
if(!valids){
|
||||||
|
|
||||||
slots.row();
|
slots.row();
|
||||||
slots.addButton("$save.none", () -> {
|
slots.addButton("$save.none", () -> {
|
||||||
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
|
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
|
||||||
@@ -170,6 +169,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
|
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
try{
|
try{
|
||||||
|
Net.reset();
|
||||||
slot.load();
|
slot.load();
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
}catch(SaveException e){
|
}catch(SaveException e){
|
||||||
@@ -184,7 +184,6 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
public void modifyButton(TextButton button, SaveSlot slot){
|
public void modifyButton(TextButton button, SaveSlot slot){
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
if(!button.childrenPressed()){
|
if(!button.childrenPressed()){
|
||||||
int build = slot.getBuild();
|
|
||||||
runLoadSave(slot);
|
runLoadSave(slot);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
ScrollPane pane = new ScrollPane(maps);
|
ScrollPane pane = new ScrollPane(maps);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / Unit.dp.scl(230)), 1, 8);
|
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / UnitScl.dp.scl(230)), 1, 8);
|
||||||
float mapsize = 200f;
|
float mapsize = 200f;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -176,7 +176,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
t.row();
|
t.row();
|
||||||
t.add("$editor.author").padRight(10).color(Color.GRAY);
|
t.add("$editor.author").padRight(10).color(Color.GRAY);
|
||||||
t.row();
|
t.row();
|
||||||
t.add(map.author()).growX().wrap().padTop(2);
|
t.add(map.custom && map.author().isEmpty() ? "Anuke" : map.author()).growX().wrap().padTop(2);
|
||||||
t.row();
|
t.row();
|
||||||
t.add("$editor.description").padRight(10).color(Color.GRAY).top();
|
t.add("$editor.description").padRight(10).color(Color.GRAY).top();
|
||||||
t.row();
|
t.row();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.anuke.arc.graphics.g2d.Draw;
|
|||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.KeyCode;
|
||||||
import io.anuke.arc.scene.event.InputEvent;
|
import io.anuke.arc.scene.event.InputEvent;
|
||||||
import io.anuke.arc.scene.event.InputListener;
|
import io.anuke.arc.scene.event.InputListener;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -24,12 +24,13 @@ public class MinimapDialog extends FloatingDialog{
|
|||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
cont.clear();
|
cont.clear();
|
||||||
float size = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / Unit.dp.scl(1f) / 1.3f;
|
float size = Math.min(Core.graphics.getWidth(), Core.graphics.getHeight()) / UnitScl.dp.scl(1f) / 1.3f;
|
||||||
|
|
||||||
cont.table("pane", t -> {
|
cont.table("pane", t -> {
|
||||||
t.addRect((x, y, width, height) -> {
|
t.addRect((x, y, width, height) -> {
|
||||||
if(renderer.minimap.getRegion() == null) return;
|
if(renderer.minimap.getRegion() == null) return;
|
||||||
Draw.color(Color.WHITE);
|
Draw.color(Color.WHITE);
|
||||||
|
Draw.alpha(parentAlpha);
|
||||||
Draw.rect(renderer.minimap.getRegion(), x + width / 2f, y + height / 2f, width, height);
|
Draw.rect(renderer.minimap.getRegion(), x + width / 2f, y + height / 2f, width, height);
|
||||||
|
|
||||||
if(renderer.minimap.getTexture() != null){
|
if(renderer.minimap.getTexture() != null){
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import io.anuke.arc.scene.ui.layout.*;
|
|||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
|
setStyle(Core.scene.skin.get("dialog", WindowStyle.class));
|
||||||
|
|
||||||
hidden(() -> {
|
hidden(() -> {
|
||||||
|
Sounds.back.play();
|
||||||
if(!state.is(State.menu)){
|
if(!state.is(State.menu)){
|
||||||
if(!wasPaused || Net.active())
|
if(!wasPaused || Net.active())
|
||||||
state.set(State.playing);
|
state.set(State.playing);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import io.anuke.mindustry.world.Block.*;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class TechTreeDialog extends FloatingDialog{
|
public class TechTreeDialog extends FloatingDialog{
|
||||||
private final float nodeSize = Unit.dp.scl(60f);
|
private final float nodeSize = UnitScl.dp.scl(60f);
|
||||||
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
|
||||||
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
|
||||||
private Rectangle bounds = new Rectangle();
|
private Rectangle bounds = new Rectangle();
|
||||||
@@ -59,8 +59,8 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
|
|
||||||
void treeLayout(){
|
void treeLayout(){
|
||||||
TreeLayout layout = new TreeLayout();
|
TreeLayout layout = new TreeLayout();
|
||||||
layout.gapBetweenLevels = Unit.dp.scl(60f);
|
layout.gapBetweenLevels = UnitScl.dp.scl(60f);
|
||||||
layout.gapBetweenNodes = Unit.dp.scl(40f);
|
layout.gapBetweenNodes = UnitScl.dp.scl(40f);
|
||||||
LayoutNode node = new LayoutNode(root, null);
|
LayoutNode node = new LayoutNode(root, null);
|
||||||
layout.layout(node);
|
layout.layout(node);
|
||||||
bounds.set(layout.getBounds());
|
bounds.set(layout.getBounds());
|
||||||
@@ -318,7 +318,7 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
for(TechTreeNode child : node.children){
|
for(TechTreeNode child : node.children){
|
||||||
if(!child.visible) continue;
|
if(!child.visible) continue;
|
||||||
|
|
||||||
Lines.stroke(Unit.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
|
Lines.stroke(UnitScl.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
|
||||||
Draw.alpha(parentAlpha);
|
Draw.alpha(parentAlpha);
|
||||||
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,29 +151,9 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
hide();
|
hide();
|
||||||
control.playZone(zone);
|
control.playZone(zone);
|
||||||
}
|
}
|
||||||
}).minWidth(150f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !canUnlock(zone) : !data.hasItems(zone.getLaunchCost())).uniformY().get();
|
}).minWidth(150f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !zone.canUnlock() : !data.hasItems(zone.getLaunchCost())).uniformY().get();
|
||||||
|
|
||||||
button.row();
|
button.row();
|
||||||
button.add(iteminfo);
|
button.add(iteminfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canUnlock(Zone zone){
|
|
||||||
if(data.isUnlocked(zone)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(ZoneRequirement other : zone.zoneRequirements){
|
|
||||||
if(other.zone.bestWave() < other.wave){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Block other : zone.blockRequirements){
|
|
||||||
if(!data.isUnlocked(other)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import io.anuke.arc.scene.ui.Label;
|
|||||||
import io.anuke.arc.scene.ui.Label.LabelStyle;
|
import io.anuke.arc.scene.ui.Label.LabelStyle;
|
||||||
import io.anuke.arc.scene.ui.TextField;
|
import io.anuke.arc.scene.ui.TextField;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.Align;
|
import io.anuke.arc.util.Align;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
@@ -33,9 +33,9 @@ public class ChatFragment extends Table{
|
|||||||
private Label fieldlabel = new Label(">");
|
private Label fieldlabel = new Label(">");
|
||||||
private BitmapFont font;
|
private BitmapFont font;
|
||||||
private GlyphLayout layout = new GlyphLayout();
|
private GlyphLayout layout = new GlyphLayout();
|
||||||
private float offsetx = Unit.dp.scl(4), offsety = Unit.dp.scl(4), fontoffsetx = Unit.dp.scl(2), chatspace = Unit.dp.scl(50);
|
private float offsetx = UnitScl.dp.scl(4), offsety = UnitScl.dp.scl(4), fontoffsetx = UnitScl.dp.scl(2), chatspace = UnitScl.dp.scl(50);
|
||||||
private Color shadowColor = new Color(0, 0, 0, 0.4f);
|
private Color shadowColor = new Color(0, 0, 0, 0.4f);
|
||||||
private float textspacing = Unit.dp.scl(10);
|
private float textspacing = UnitScl.dp.scl(10);
|
||||||
private Array<String> history = new Array<>();
|
private Array<String> history = new Array<>();
|
||||||
private int historyPos = 0;
|
private int historyPos = 0;
|
||||||
private int scrollPos = 0;
|
private int scrollPos = 0;
|
||||||
@@ -123,7 +123,7 @@ public class ChatFragment extends Table{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
float opacity = Core.settings.getInt("chatopacity") / 100f;
|
float opacity = Core.settings.getInt("chatopacity") / 100f;
|
||||||
float textWidth = Math.min(Core.graphics.getWidth()/1.5f, Unit.dp.scl(700f));
|
float textWidth = Math.min(Core.graphics.getWidth()/1.5f, UnitScl.dp.scl(700f));
|
||||||
|
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ public class ChatFragment extends Table{
|
|||||||
font.getCache().setAlphas(opacity);
|
font.getCache().setAlphas(opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fill.crect(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing);
|
Fill.crect(offsetx, theight - layout.height - 2, textWidth + UnitScl.dp.scl(4f), layout.height + textspacing);
|
||||||
Draw.color(shadowColor);
|
Draw.color(shadowColor);
|
||||||
Draw.alpha(opacity * shadowColor.a);
|
Draw.alpha(opacity * shadowColor.a);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.scene.*;
|
import io.anuke.arc.scene.*;
|
||||||
import io.anuke.arc.scene.event.*;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.util.*;
|
|
||||||
|
|
||||||
/** Fades in a black overlay.*/
|
/** Fades in a black overlay.*/
|
||||||
public class FadeInFragment extends Fragment{
|
public class FadeInFragment extends Fragment{
|
||||||
@@ -30,7 +29,7 @@ public class FadeInFragment extends Fragment{
|
|||||||
@Override
|
@Override
|
||||||
public void act(float delta){
|
public void act(float delta){
|
||||||
super.act(delta);
|
super.act(delta);
|
||||||
time += Time.delta() / duration;
|
time += 1f / duration;
|
||||||
if(time > 1){
|
if(time > 1){
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,34 @@
|
|||||||
package io.anuke.mindustry.ui.fragments;
|
package io.anuke.mindustry.ui.fragments;
|
||||||
|
|
||||||
import io.anuke.annotations.Annotations.Loc;
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.annotations.Annotations.Remote;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.Events;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.graphics.g2d.Lines;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.scene.*;
|
||||||
import io.anuke.arc.math.Interpolation;
|
import io.anuke.arc.scene.actions.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.math.geom.Vector2;
|
import io.anuke.arc.scene.style.*;
|
||||||
import io.anuke.arc.scene.Element;
|
|
||||||
import io.anuke.arc.scene.Group;
|
|
||||||
import io.anuke.arc.scene.actions.Actions;
|
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
|
||||||
import io.anuke.arc.scene.style.TextureRegionDrawable;
|
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.scene.utils.Elements;
|
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.*;
|
||||||
import io.anuke.mindustry.entities.type.BaseUnit;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.EventType.StateChangeEvent;
|
import io.anuke.mindustry.game.*;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.game.UnlockableContent;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.input.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
|
||||||
import io.anuke.mindustry.input.Binding;
|
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.net.Packets.AdminAction;
|
import io.anuke.mindustry.net.Packets.*;
|
||||||
import io.anuke.mindustry.type.ContentType;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.UnitType;
|
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -110,7 +102,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
select.addImage("whiteui").color(Pal.gray).width(4f).fillY();
|
select.addImage("whiteui").color(Pal.gray).width(4f).fillY();
|
||||||
|
|
||||||
float size = Unit.dp.scl(dsize);
|
float size = UnitScl.dp.scl(dsize);
|
||||||
Array<Element> children = new Array<>(select.getChildren());
|
Array<Element> children = new Array<>(select.getChildren());
|
||||||
|
|
||||||
//now, you may be wondering, why is this necessary? the answer is, I don't know, but it fixes layout issues somehow
|
//now, you may be wondering, why is this necessary? the answer is, I don't know, but it fixes layout issues somehow
|
||||||
@@ -122,7 +114,7 @@ public class HudFragment extends Fragment{
|
|||||||
if(fi < 4){
|
if(fi < 4){
|
||||||
elem.setSize(size);
|
elem.setSize(size);
|
||||||
}else{
|
}else{
|
||||||
elem.setSize(Unit.dp.scl(4f), size);
|
elem.setSize(UnitScl.dp.scl(4f), size);
|
||||||
}
|
}
|
||||||
elem.setPosition(fi * size, Core.graphics.getHeight(), Align.topLeft);
|
elem.setPosition(fi * size, Core.graphics.getHeight(), Align.topLeft);
|
||||||
return true;
|
return true;
|
||||||
@@ -144,21 +136,14 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
Table wavesMain, editorMain;
|
Table wavesMain, editorMain;
|
||||||
boolean[] prev = {false};
|
|
||||||
|
|
||||||
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight()).update(s -> {
|
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight());
|
||||||
((Table)s.getParent()).getCell(s).height((wavesMain.isVisible() ? wavesMain.getPrefHeight() : editorMain.getPrefHeight()) / Unit.dp.scl(1f));
|
|
||||||
if(prev[0] != wavesMain.isVisible()){
|
|
||||||
s.getParent().pack();
|
|
||||||
prev[0] = wavesMain.isVisible();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
{
|
{
|
||||||
wavesMain.visible(() -> shown && !state.isEditor());
|
wavesMain.visible(() -> shown && !state.isEditor());
|
||||||
wavesMain.left();
|
wavesMain.top().left();
|
||||||
Stack stack = new Stack();
|
Stack stack = new Stack();
|
||||||
TextButton waves = new TextButton("", "wave");
|
Button waves = new Button("wave");
|
||||||
Table btable = new Table().margin(0);
|
Table btable = new Table().margin(0);
|
||||||
|
|
||||||
stack.add(waves);
|
stack.add(waves);
|
||||||
@@ -253,7 +238,7 @@ public class HudFragment extends Fragment{
|
|||||||
//fps display
|
//fps display
|
||||||
cont.table(info -> {
|
cont.table(info -> {
|
||||||
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps"));
|
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps"));
|
||||||
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Unit.dp.scl(dsize * 4 + 3), 0));
|
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -UnitScl.dp.scl(dsize * 4 + 3), 0));
|
||||||
IntFormat fps = new IntFormat("fps");
|
IntFormat fps = new IntFormat("fps");
|
||||||
IntFormat ping = new IntFormat("ping");
|
IntFormat ping = new IntFormat("ping");
|
||||||
|
|
||||||
@@ -327,59 +312,6 @@ public class HudFragment extends Fragment{
|
|||||||
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled);
|
.update(label -> label.getColor().set(Color.ORANGE).lerp(Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)))).touchable(Touchable.disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
//launch button
|
|
||||||
parent.fill(t -> {
|
|
||||||
t.top().right();
|
|
||||||
TextButton[] testb = {null};
|
|
||||||
TextButton button = Elements.newButton("$launch", () -> {
|
|
||||||
FloatingDialog dialog = new FloatingDialog("$launch");
|
|
||||||
dialog.update(() -> {
|
|
||||||
if(!testb[0].isVisible()){
|
|
||||||
dialog.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialog.cont.add("$launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
|
||||||
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
|
||||||
dialog.setFillParent(false);
|
|
||||||
dialog.buttons.addButton("$cancel", dialog::hide);
|
|
||||||
dialog.buttons.addButton("$ok", () -> {
|
|
||||||
dialog.hide();
|
|
||||||
Call.launchZone();
|
|
||||||
});
|
|
||||||
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
|
||||||
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
|
||||||
dialog.show();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
testb[0] = button;
|
|
||||||
|
|
||||||
button.getStyle().disabledFontColor = Color.WHITE;
|
|
||||||
button.margin(16f);
|
|
||||||
button.visible(() ->
|
|
||||||
world.isZone() &&
|
|
||||||
world.getZone().metCondition() &&
|
|
||||||
!Net.client() &&
|
|
||||||
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning());
|
|
||||||
|
|
||||||
button.update(() -> {
|
|
||||||
if(world.getZone() == null){
|
|
||||||
button.setText("");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
button.setText(state.enemies() > 0 ? Core.bundle.format("launch.unable", state.enemies()) : Core.bundle.get("launch") + "\n" +
|
|
||||||
Core.bundle.format("launch.next", state.wave + world.getZone().launchPeriod));
|
|
||||||
|
|
||||||
button.getLabel().setColor(Tmp.c1.set(Color.WHITE).lerp(state.enemies() > 0 ? Color.WHITE : Color.SCARLET,
|
|
||||||
Mathf.absin(Time.time(), 2f, 1f)));
|
|
||||||
});
|
|
||||||
|
|
||||||
button.setDisabled(() -> state.enemies() > 0);
|
|
||||||
button.getLabelCell().left().get().setAlignment(Align.left, Align.left);
|
|
||||||
t.add(button).size(250f, 80f);
|
|
||||||
});
|
|
||||||
|
|
||||||
//paused table
|
//paused table
|
||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
t.top().visible(() -> state.isPaused());
|
t.top().visible(() -> state.isPaused());
|
||||||
@@ -542,6 +474,37 @@ public class HudFragment extends Fragment{
|
|||||||
Core.scene.add(image);
|
Core.scene.add(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showLaunchConfirm(){
|
||||||
|
FloatingDialog dialog = new FloatingDialog("$launch");
|
||||||
|
dialog.update(() -> {
|
||||||
|
if(!inLaunchWave()){
|
||||||
|
dialog.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.cont.add("$launch.confirm").width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||||
|
dialog.buttons.defaults().size(200f, 54f).pad(2f);
|
||||||
|
dialog.setFillParent(false);
|
||||||
|
dialog.buttons.addButton("$cancel", dialog::hide);
|
||||||
|
dialog.buttons.addButton("$ok", () -> {
|
||||||
|
dialog.hide();
|
||||||
|
Call.launchZone();
|
||||||
|
});
|
||||||
|
dialog.keyDown(KeyCode.ESCAPE, dialog::hide);
|
||||||
|
dialog.keyDown(KeyCode.BACK, dialog::hide);
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean inLaunchWave(){
|
||||||
|
return world.isZone() &&
|
||||||
|
world.getZone().metCondition() &&
|
||||||
|
!Net.client() &&
|
||||||
|
state.wave % world.getZone().launchPeriod == 0 && !world.spawner.isSpawning();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canLaunch(){
|
||||||
|
return inLaunchWave() && state.enemies() <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleMenus(){
|
private void toggleMenus(){
|
||||||
if(flip != null){
|
if(flip != null){
|
||||||
flip.getStyle().imageUp = Core.scene.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
|
flip.getStyle().imageUp = Core.scene.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
|
||||||
@@ -553,7 +516,7 @@ public class HudFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWaveTable(TextButton table){
|
private void addWaveTable(Button table){
|
||||||
StringBuilder ibuild = new StringBuilder();
|
StringBuilder ibuild = new StringBuilder();
|
||||||
|
|
||||||
IntFormat wavef = new IntFormat("wave");
|
IntFormat wavef = new IntFormat("wave");
|
||||||
@@ -586,6 +549,22 @@ public class HudFragment extends Fragment{
|
|||||||
builder.append(wavef.get(state.wave));
|
builder.append(wavef.get(state.wave));
|
||||||
builder.append("\n");
|
builder.append("\n");
|
||||||
|
|
||||||
|
if(inLaunchWave()){
|
||||||
|
builder.append("[#");
|
||||||
|
Tmp.c1.set(Color.WHITE).lerp(state.enemies() > 0 ? Color.WHITE : Color.SCARLET, Mathf.absin(Time.time(), 2f, 1f)).toString(builder);
|
||||||
|
builder.append("]");
|
||||||
|
|
||||||
|
if(!canLaunch()){
|
||||||
|
builder.append(Core.bundle.get("launch.unable2"));
|
||||||
|
}else{
|
||||||
|
builder.append(Core.bundle.get("launch"));
|
||||||
|
builder.append("\n");
|
||||||
|
builder.append(Core.bundle.format("launch.next", state.wave + world.getZone().launchPeriod));
|
||||||
|
builder.append("\n");
|
||||||
|
}
|
||||||
|
builder.append("[]\n");
|
||||||
|
}
|
||||||
|
|
||||||
if(state.enemies() > 0){
|
if(state.enemies() > 0){
|
||||||
if(state.enemies() == 1){
|
if(state.enemies() == 1){
|
||||||
builder.append(enemyf.get(state.enemies()));
|
builder.append(enemyf.get(state.enemies()));
|
||||||
@@ -604,8 +583,13 @@ public class HudFragment extends Fragment{
|
|||||||
return builder;
|
return builder;
|
||||||
}).growX().pad(8f);
|
}).growX().pad(8f);
|
||||||
|
|
||||||
table.setDisabled(true);
|
table.setDisabled(() -> !canLaunch());
|
||||||
table.visible(() -> state.rules.waves);
|
table.visible(() -> state.rules.waves);
|
||||||
|
table.clicked(() -> {
|
||||||
|
if(canLaunch()){
|
||||||
|
showLaunchConfirm();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPlayButton(Table table){
|
private void addPlayButton(Table table){
|
||||||
@@ -616,7 +600,6 @@ public class HudFragment extends Fragment{
|
|||||||
state.wavetime = 0f;
|
state.wavetime = 0f;
|
||||||
}
|
}
|
||||||
}).growY().fillX().right().width(40f)
|
}).growY().fillX().right().width(40f)
|
||||||
.visible(() -> state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0
|
.visible(() -> state.rules.waves && ((Net.server() || player.isAdmin) || !Net.active()) && state.enemies() == 0 && !world.spawner.isSpawning() && !inLaunchWave());
|
||||||
&& !world.spawner.isSpawning());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class LoadingFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void show(String text){
|
public void show(String text){
|
||||||
|
table.clearActions();
|
||||||
table.touchable(Touchable.enabled);
|
table.touchable(Touchable.enabled);
|
||||||
table.<Label>find("namelabel").setText(text);
|
table.<Label>find("namelabel").setText(text);
|
||||||
table.visible(true);
|
table.visible(true);
|
||||||
@@ -51,6 +52,7 @@ public class LoadingFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void hide(){
|
public void hide(){
|
||||||
|
table.clearActions();
|
||||||
table.toFront();
|
table.toFront();
|
||||||
table.touchable(Touchable.disabled);
|
table.touchable(Touchable.disabled);
|
||||||
table.actions(Actions.fadeOut(1f), Actions.visible(false));
|
table.actions(Actions.fadeOut(1f), Actions.visible(false));
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ public class MenuFragment extends Fragment{
|
|||||||
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : Version.modifier + " build " + Version.build);
|
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : Version.modifier + " build " + Version.build);
|
||||||
|
|
||||||
parent.fill((x, y, w, h) -> {
|
parent.fill((x, y, w, h) -> {
|
||||||
float logoscl = (int)Unit.dp.scl(1);
|
float logoscl = UnitScl.dp.scl(1);
|
||||||
float logow = Math.min(logo.getWidth() * logoscl, Core.graphics.getWidth() - Unit.dp.scl(20));
|
float logow = Math.min(logo.getWidth() * logoscl, Core.graphics.getWidth() - UnitScl.dp.scl(20));
|
||||||
float logoh = logow * (float)logo.getHeight() / logo.getWidth();
|
float logoh = logow * (float)logo.getHeight() / logo.getWidth();
|
||||||
|
|
||||||
float fx = (int)(Core.graphics.getWidth() / 2f);
|
float fx = (int)(Core.graphics.getWidth() / 2f);
|
||||||
float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Unit.dp.scl(30f) : 0f);
|
float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? UnitScl.dp.scl(30f) : 0f);
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Draw.rect(Draw.wrap(logo), fx, fy, logow, logoh);
|
Draw.rect(Draw.wrap(logo), fx, fy, logow, logoh);
|
||||||
@@ -210,7 +210,7 @@ public class MenuFragment extends Fragment{
|
|||||||
submenu.clearChildren();
|
submenu.clearChildren();
|
||||||
fadeInMenu();
|
fadeInMenu();
|
||||||
//correctly offset the button
|
//correctly offset the button
|
||||||
submenu.add().height((Core.graphics.getHeight() - out[0].getY(Align.topLeft)) / Unit.dp.scl(1f));
|
submenu.add().height((Core.graphics.getHeight() - out[0].getY(Align.topLeft)) / UnitScl.dp.scl(1f));
|
||||||
submenu.row();
|
submenu.row();
|
||||||
buttons(submenu, b.submenu);
|
buttons(submenu, b.submenu);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import io.anuke.arc.scene.Group;
|
|||||||
import io.anuke.arc.scene.event.Touchable;
|
import io.anuke.arc.scene.event.Touchable;
|
||||||
import io.anuke.arc.scene.ui.Image;
|
import io.anuke.arc.scene.ui.Image;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.Interval;
|
import io.anuke.arc.util.Interval;
|
||||||
import io.anuke.arc.util.Scaling;
|
import io.anuke.arc.util.Scaling;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
@@ -84,7 +84,7 @@ public class PlayerListFragment extends Fragment{
|
|||||||
super.draw();
|
super.draw();
|
||||||
Draw.color(Pal.gray);
|
Draw.color(Pal.gray);
|
||||||
Draw.alpha(parentAlpha);
|
Draw.alpha(parentAlpha);
|
||||||
Lines.stroke(Unit.dp.scl(4f));
|
Lines.stroke(UnitScl.dp.scl(4f));
|
||||||
Lines.rect(x, y, width, height);
|
Lines.rect(x, y, width, height);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,17 +230,19 @@ public class Block extends BlockStorage{
|
|||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawPlaceText(String text, int x, int y, boolean valid){
|
protected float drawPlaceText(String text, int x, int y, boolean valid){
|
||||||
if(renderer.pixelator.enabled()) return;
|
if(renderer.pixelator.enabled()) return 0;
|
||||||
|
|
||||||
Color color = valid ? Pal.accent : Pal.remove;
|
Color color = valid ? Pal.accent : Pal.remove;
|
||||||
BitmapFont font = Core.scene.skin.getFont("outline");
|
BitmapFont font = Core.scene.skin.getFont("outline");
|
||||||
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||||
boolean ints = font.usesIntegerPositions();
|
boolean ints = font.usesIntegerPositions();
|
||||||
font.setUseIntegerPositions(false);
|
font.setUseIntegerPositions(false);
|
||||||
font.getData().setScale(1f / 4f);
|
font.getData().setScale(1f / 4f / UnitScl.dp.scl(1f));
|
||||||
layout.setText(font, text);
|
layout.setText(font, text);
|
||||||
|
|
||||||
|
float width = layout.width;
|
||||||
|
|
||||||
font.setColor(color);
|
font.setColor(color);
|
||||||
float dx = x * tilesize + offset(), dy = y * tilesize + offset() + size * tilesize / 2f + 3;
|
float dx = x * tilesize + offset(), dy = y * tilesize + offset() + size * tilesize / 2f + 3;
|
||||||
font.draw(text, dx, dy + layout.height + 1, Align.center);
|
font.draw(text, dx, dy + layout.height + 1, Align.center);
|
||||||
@@ -255,6 +257,7 @@ public class Block extends BlockStorage{
|
|||||||
font.getData().setScale(1f);
|
font.getData().setScale(1f);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
Pools.free(layout);
|
Pools.free(layout);
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
@@ -276,7 +279,8 @@ public class Block extends BlockStorage{
|
|||||||
tempTiles.clear();
|
tempTiles.clear();
|
||||||
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
Geometry.circle(tile.x, tile.y, range, (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile)){
|
if(other != null && other.block instanceof PowerNode && ((PowerNode)other.block).linkValid(other, tile) && !other.entity.proximity().contains(tile) &&
|
||||||
|
!(outputsPower && tile.entity.proximity().contains(p -> p.entity != null && p.entity.power != null && p.entity.power.graph == other.entity.power.graph))){
|
||||||
tempTiles.add(other);
|
tempTiles.add(other);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class Tile implements Position, TargetTrait{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnemyCheat(){
|
public boolean isEnemyCheat(){
|
||||||
return getTeam() == waveTeam && !state.rules.pvp;
|
return getTeam() == waveTeam && state.rules.enemyCheat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLinked(){
|
public boolean isLinked(){
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class MendProjector extends Block{
|
|||||||
|
|
||||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
||||||
|
|
||||||
if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime)){
|
if(entity.cons.optionalValid() && entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){
|
||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,12 +78,12 @@ public class MendProjector extends Block{
|
|||||||
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
float realRange = range + entity.phaseHeat * phaseRangeBoost;
|
||||||
entity.charge = 0f;
|
entity.charge = 0f;
|
||||||
|
|
||||||
int tileRange = (int)(realRange / tilesize);
|
int tileRange = (int)(realRange / tilesize + 1);
|
||||||
healed.clear();
|
healed.clear();
|
||||||
|
|
||||||
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
|
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
|
||||||
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
|
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
|
||||||
if(Mathf.dst(x, y, tile.x, tile.y) > tileRange) continue;
|
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
|
||||||
|
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class OverdriveProjector extends Block{
|
|||||||
|
|
||||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
||||||
|
|
||||||
if(entity.timer.get(timerUse, useTime)){
|
if(entity.timer.get(timerUse, useTime) && entity.power.satisfaction > 0){
|
||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,12 +84,12 @@ public class OverdriveProjector extends Block{
|
|||||||
|
|
||||||
entity.charge = 0f;
|
entity.charge = 0f;
|
||||||
|
|
||||||
int tileRange = (int)(realRange / tilesize);
|
int tileRange = (int)(realRange / tilesize + 1);
|
||||||
healed.clear();
|
healed.clear();
|
||||||
|
|
||||||
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
|
for(int x = -tileRange + tile.x; x <= tileRange + tile.x; x++){
|
||||||
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
|
for(int y = -tileRange + tile.y; y <= tileRange + tile.y; y++){
|
||||||
if(Mathf.dst(x, y, tile.x, tile.y) > tileRange) continue;
|
if(!Mathf.within(x * tilesize, y * tilesize, tile.drawx(), tile.drawy(), realRange)) continue;
|
||||||
|
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class PowerGraph{
|
|||||||
private final ObjectSet<Tile> all = new ObjectSet<>();
|
private final ObjectSet<Tile> all = new ObjectSet<>();
|
||||||
|
|
||||||
private final WindowedMean powerBalance = new WindowedMean(60);
|
private final WindowedMean powerBalance = new WindowedMean(60);
|
||||||
|
private float lastPowerProduced, lastPowerNeeded;
|
||||||
|
|
||||||
private long lastFrameUpdated = -1;
|
private long lastFrameUpdated = -1;
|
||||||
private final int graphID;
|
private final int graphID;
|
||||||
@@ -37,6 +38,23 @@ public class PowerGraph{
|
|||||||
return powerBalance.getMean();
|
return powerBalance.getMean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getLastPowerNeeded(){
|
||||||
|
return lastPowerNeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLastPowerProduced(){
|
||||||
|
return lastPowerProduced;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSatisfaction(){
|
||||||
|
if(Mathf.isZero(lastPowerProduced)){
|
||||||
|
return 0f;
|
||||||
|
}else if(Mathf.isZero(lastPowerNeeded)){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
return Mathf.clamp(lastPowerProduced / lastPowerNeeded);
|
||||||
|
}
|
||||||
|
|
||||||
public float getPowerProduced(){
|
public float getPowerProduced(){
|
||||||
float powerProduced = 0f;
|
float powerProduced = 0f;
|
||||||
for(Tile producer : producers){
|
for(Tile producer : producers){
|
||||||
@@ -164,6 +182,9 @@ public class PowerGraph{
|
|||||||
float powerNeeded = getPowerNeeded();
|
float powerNeeded = getPowerNeeded();
|
||||||
float powerProduced = getPowerProduced();
|
float powerProduced = getPowerProduced();
|
||||||
|
|
||||||
|
lastPowerNeeded = powerNeeded;
|
||||||
|
lastPowerProduced = powerProduced;
|
||||||
|
|
||||||
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
powerBalance.addValue((powerProduced - powerNeeded) / Time.delta());
|
||||||
|
|
||||||
if(consumers.size == 0 && producers.size == 0 && batteries.size == 0){
|
if(consumers.size == 0 && producers.size == 0 && batteries.size == 0){
|
||||||
@@ -188,6 +209,7 @@ public class PowerGraph{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void add(Tile tile){
|
public void add(Tile tile){
|
||||||
|
if(tile.entity == null || tile.entity.power == null) return;
|
||||||
tile.entity.power.graph = this;
|
tile.entity.power.graph = this;
|
||||||
all.add(tile);
|
all.add(tile);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.power;
|
|||||||
|
|
||||||
import io.anuke.annotations.Annotations.*;
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.graphics.*;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
@@ -105,13 +106,20 @@ public class PowerNode extends PowerBlock{
|
|||||||
Call.linkPowerNodes(null, tile, before);
|
Call.linkPowerNodes(null, tile, before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Predicate<Tile> valid = other -> other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)
|
||||||
|
&& !other.entity.proximity().contains(tile) && other.entity.power.graph != tile.entity.power.graph;
|
||||||
|
|
||||||
|
tempTiles.clear();
|
||||||
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
Geometry.circle(tile.x, tile.y, (int)(laserRange + 1), (x, y) -> {
|
||||||
Tile other = world.ltile(x, y);
|
Tile other = world.ltile(x, y);
|
||||||
if(other != null && other != tile && ((!other.block().outputsPower && other.block().consumesPower) || (other.block().outputsPower && !other.block().consumesPower)) && linkValid(tile, other)){
|
if(valid.test(other)){
|
||||||
Call.linkPowerNodes(null, tile, other);
|
tempTiles.add(other);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tempTiles.sort(Structs.comparingFloat(t -> t.dst2(tile)));
|
||||||
|
tempTiles.each(valid, other -> Call.linkPowerNodes(null, tile, other));
|
||||||
|
|
||||||
lastPlaced = tile.pos();
|
lastPlaced = tile.pos();
|
||||||
super.playerPlaced(tile);
|
super.playerPlaced(tile);
|
||||||
}
|
}
|
||||||
@@ -153,13 +161,12 @@ public class PowerNode extends PowerBlock{
|
|||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
Lines.poly(tile.drawx(), tile.drawy(), 50, laserRange * tilesize);
|
Drawf.circles(tile.drawx(), tile.drawy(), laserRange * tilesize);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawConfigure(Tile tile){
|
public void drawConfigure(Tile tile){
|
||||||
TileEntity entity = tile.entity();
|
|
||||||
|
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
|
|
||||||
@@ -177,15 +184,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
if(link != tile && linkValid(tile, link, false)){
|
if(link != tile && linkValid(tile, link, false)){
|
||||||
boolean linked = linked(tile, link);
|
boolean linked = linked(tile, link);
|
||||||
Draw.color(linked ? Pal.place : Pal.breakInvalid);
|
|
||||||
|
|
||||||
Lines.circle(link.drawx(), link.drawy(),
|
if(linked){
|
||||||
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Time.time(), 4f, 1f)));
|
Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 1f, Pal.place);
|
||||||
|
|
||||||
if((entity.power.links.size >= maxNodes || (link.block() instanceof PowerNode && link.entity.power.links.size >= ((PowerNode)link.block()).maxNodes)) && !linked){
|
|
||||||
Draw.color(Pal.breakInvalid);
|
|
||||||
Lines.lineAngleCenter(link.drawx(), link.drawy(), 45, link.block().size * Mathf.sqrt2 * tilesize * 0.9f);
|
|
||||||
Draw.color();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,9 +197,24 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlace(int x, int y, int rotation, boolean valid){
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
Tile tile = world.tile(x, y);
|
||||||
|
|
||||||
|
if(tile == null) return;
|
||||||
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Pal.placing);
|
Draw.color(Pal.placing);
|
||||||
Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize);
|
Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize);
|
||||||
|
|
||||||
|
for(int cx = (int)(x - laserRange - 1); cx <= x + laserRange + 1; cx++){
|
||||||
|
for(int cy = (int)(y - laserRange - 1); cy <= y + laserRange + 1; cy++){
|
||||||
|
Tile link = world.ltile(cx, cy);
|
||||||
|
|
||||||
|
if(link != null && !(link.x == x && link.y == y) && link.block().hasPower && overlaps(x * tilesize + offset(), y *tilesize + offset(), link, laserRange * tilesize)){
|
||||||
|
Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 2f, link.pos() == lastPlaced ? Pal.place : Pal.accent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +243,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean linkValid(Tile tile, Tile link, boolean checkMaxNodes){
|
public boolean linkValid(Tile tile, Tile link, boolean checkMaxNodes){
|
||||||
if(tile == link || link == null || !link.block().hasPower || tile.getTeam() != link.getTeam()) return false;
|
if(tile == link || link == null || link.entity == null || tile.entity == null || !link.block().hasPower || tile.getTeam() != link.getTeam()) return false;
|
||||||
|
|
||||||
if(overlaps(tile, link, laserRange * tilesize) || (link.block() instanceof PowerNode && overlaps(link, tile, link.<PowerNode>cblock().laserRange * tilesize))){
|
if(overlaps(tile, link, laserRange * tilesize) || (link.block() instanceof PowerNode && overlaps(link, tile, link.<PowerNode>cblock().laserRange * tilesize))){
|
||||||
if(checkMaxNodes && link.block() instanceof PowerNode){
|
if(checkMaxNodes && link.block() instanceof PowerNode){
|
||||||
@@ -238,8 +254,12 @@ public class PowerNode extends PowerBlock{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean overlaps(float srcx, float srcy, Tile other, float range){
|
||||||
|
return Intersector.overlaps(Tmp.cr1.set(srcx, srcy, range), other.getHitbox(Tmp.r1));
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean overlaps(Tile src, Tile other, float range){
|
protected boolean overlaps(Tile src, Tile other, float range){
|
||||||
return Intersector.overlaps(Tmp.cr1.set(src.drawx(), src.drawy(), range), other.getHitbox(Tmp.r1));
|
return overlaps(src.drawx(), src.drawy(), other, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawLaser(Tile tile, Tile target){
|
protected void drawLaser(Tile tile, Tile target){
|
||||||
@@ -255,8 +275,10 @@ public class PowerNode extends PowerBlock{
|
|||||||
x2 += t2.x;
|
x2 += t2.x;
|
||||||
y2 += t2.y;
|
y2 += t2.y;
|
||||||
|
|
||||||
Draw.color(Pal.powerLight, Color.WHITE, Mathf.absin(Time.time(), 8f, 0.3f) + 0.2f);
|
float fract = 1f-tile.entity.power.graph.getSatisfaction();
|
||||||
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.6f);
|
|
||||||
|
Draw.color(Color.WHITE, Pal.powerLight, fract*0.86f + Mathf.absin(3f, 0.1f));
|
||||||
|
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.4f);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,8 @@ public class Drill extends Block{
|
|||||||
countOre(tile);
|
countOre(tile);
|
||||||
|
|
||||||
if(returnItem != null){
|
if(returnItem != null){
|
||||||
drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / (drillTime + hardnessDrillMultiplier * returnItem.hardness) * returnCount, 2), x, y, valid);
|
float width = drawPlaceText(Core.bundle.formatFloat("bar.drillspeed", 60f / (drillTime + hardnessDrillMultiplier * returnItem.hardness) * returnCount, 2), x, y, valid);
|
||||||
|
float dx = x * tilesize + offset() - width/2f - 4f, dy = y * tilesize + offset() + size * tilesize / 2f + 5;
|
||||||
float dx = x * tilesize + offset() - 31f, dy = y * tilesize + offset() + size * tilesize / 2f + 5;
|
|
||||||
Draw.mixcol(Color.DARK_GRAY, 1f);
|
Draw.mixcol(Color.DARK_GRAY, 1f);
|
||||||
Draw.rect(returnItem.icon(Item.Icon.large), dx, dy - 1);
|
Draw.rect(returnItem.icon(Item.Icon.large), dx, dy - 1);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ task dist(type: Jar, dependsOn: classes){
|
|||||||
}
|
}
|
||||||
|
|
||||||
task ikZip(type: Zip){
|
task ikZip(type: Zip){
|
||||||
def filename = "$appName-windows-${version}"
|
def filename = "$appName-${getTarget()}-${version}"
|
||||||
|
|
||||||
from "build/libs/$filename"
|
from "build/libs/$filename"
|
||||||
archiveBaseName = "$appName-${getTarget()}"
|
archiveName = "$appName-${getTarget()}-${getVersionString()}.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
task ikdist{
|
task ikdist{
|
||||||
@@ -62,7 +62,7 @@ task ikdist{
|
|||||||
finalizedBy ikZip
|
finalizedBy ikZip
|
||||||
|
|
||||||
doLast{
|
doLast{
|
||||||
def filename = "$appName-windows-${version}"
|
def filename = "$appName-${getTarget()}-${version}"
|
||||||
def folder = "build/libs/$filename"
|
def folder = "build/libs/$filename"
|
||||||
def baseArgs = System.properties['os.name'].toLowerCase().contains('windows') ? [] : ["mono"]
|
def baseArgs = System.properties['os.name'].toLowerCase().contains('windows') ? [] : ["mono"]
|
||||||
def args = baseArgs + ["$IKVM_DIR/ikvmc.exe", "-target:winexe", "-static", "-out:build/libs/${filename}.exe", "build/libs/${filename}.jar"]
|
def args = baseArgs + ["$IKVM_DIR/ikvmc.exe", "-target:winexe", "-static", "-out:build/libs/${filename}.exe", "build/libs/${filename}.jar"]
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package io.anuke.mindustry.desktopsdl;
|
package io.anuke.mindustry.desktopsdl;
|
||||||
import io.anuke.arc.Files.*;
|
import io.anuke.arc.Files.*;
|
||||||
import io.anuke.arc.backends.sdl.*;
|
import io.anuke.arc.backends.sdl.*;
|
||||||
import io.anuke.mindustry.Mindustry;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.*;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
|
|
||||||
public class DesktopLauncher{
|
public class DesktopLauncher{
|
||||||
|
|
||||||
public static void main(String[] arg){
|
public static void main(String[] arg){
|
||||||
try{
|
try{
|
||||||
|
|
||||||
Platform.instance = new DesktopPlatform(arg);
|
Platform.instance = new DesktopPlatform(arg);
|
||||||
|
|
||||||
Net.setClientProvider(new ArcNetClient());
|
Net.setClientProvider(new ArcNetClient());
|
||||||
Net.setServerProvider(new ArcNetServer());
|
Net.setServerProvider(new ArcNetServer());
|
||||||
|
|
||||||
new SdlApplication(new Mindustry(), new SdlConfig(){{
|
new SdlApplication(new Mindustry(), new SdlConfig(){{
|
||||||
title = "Mindustry";
|
title = "Mindustry";
|
||||||
maximized = true;
|
maximized = true;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
|||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.scene.ui.layout.Unit;
|
import io.anuke.arc.scene.ui.layout.UnitScl;
|
||||||
import io.anuke.arc.util.Strings;
|
import io.anuke.arc.util.Strings;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.Platform;
|
||||||
import io.anuke.mindustry.game.Saves.SaveSlot;
|
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||||
@@ -31,9 +31,9 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
Net.setServerProvider(new ArcNetServer());
|
Net.setServerProvider(new ArcNetServer());
|
||||||
|
|
||||||
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
|
if(UIDevice.getCurrentDevice().getUserInterfaceIdiom() == UIUserInterfaceIdiom.Pad){
|
||||||
Unit.dp.addition = 0.5f;
|
UnitScl.dp.addition = 0.5f;
|
||||||
}else{
|
}else{
|
||||||
Unit.dp.addition = -0.5f;
|
UnitScl.dp.addition = -0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.instance = new Platform(){
|
Platform.instance = new Platform(){
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ task dist(type: Jar){
|
|||||||
from{ configurations.compile.collect{ zipTree(it) } }
|
from{ configurations.compile.collect{ zipTree(it) } }
|
||||||
from files(project.assetsDir)
|
from files(project.assetsDir)
|
||||||
exclude("sprites/**")
|
exclude("sprites/**")
|
||||||
|
exclude("music/**")
|
||||||
|
exclude("sounds/**")
|
||||||
exclude("fonts/**")
|
exclude("fonts/**")
|
||||||
exclude("com/badlogic/gdx/**")
|
exclude("com/badlogic/gdx/**")
|
||||||
exclude("bundles/**")
|
exclude("bundles/**")
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ if(!hasProperty("release")){
|
|||||||
use(':Arc:backends:backend-robovm')
|
use(':Arc:backends:backend-robovm')
|
||||||
use(':Arc:backends:backend-headless')
|
use(':Arc:backends:backend-headless')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(new File(settingsDir, '../debug').exists()){
|
if(new File(settingsDir, '../debug').exists()){
|
||||||
use(':debug')
|
use(':debug')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,6 +246,15 @@ task swapColors(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task antialiasImages(){
|
||||||
|
doLast{
|
||||||
|
for(def img : project.getProperty("images").split(",")){
|
||||||
|
println(project.getProperty("startdir") + "/" + img)
|
||||||
|
antialias(new File(project.getProperty("startdir") + "/" + img))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task scaleImages(){
|
task scaleImages(){
|
||||||
doLast{
|
doLast{
|
||||||
for(def img : project.getProperty("images").split(",")){
|
for(def img : project.getProperty("images").split(",")){
|
||||||
|
|||||||