Merge branches 'master' and 'new-ui' of https://github.com/Anuken/Mindustry
@@ -146,7 +146,7 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
InputStream inStream;
|
InputStream inStream;
|
||||||
if(myFile != null) inStream = new FileInputStream(myFile);
|
if(myFile != null) inStream = new FileInputStream(myFile);
|
||||||
else inStream = getContentResolver().openInputStream(uri);
|
else inStream = getContentResolver().openInputStream(uri);
|
||||||
Core.app.post(() -> {
|
Core.app.post(() -> Core.app.post(() -> {
|
||||||
if(save){ //open save
|
if(save){ //open save
|
||||||
System.out.println("Opening save.");
|
System.out.println("Opening save.");
|
||||||
FileHandle file = Core.files.local("temp-save." + saveExtension);
|
FileHandle file = Core.files.local("temp-save." + saveExtension);
|
||||||
@@ -172,7 +172,7 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
ui.editor.beginEditMap(file);
|
ui.editor.beginEditMap(file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 589 B After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 299 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 4.8 KiB |
BIN
core/assets-raw/sprites/ui/button-red.9.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 202 B |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 143 B |
BIN
core/assets-raw/sprites/ui/flat-down-base.9.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
core/assets-raw/sprites/ui/icons/icon-changelog.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 73 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 2.9 KiB |
@@ -4,6 +4,7 @@ contributors = Translators and Contributors
|
|||||||
discord = Join the Mindustry Discord!
|
discord = Join the Mindustry Discord!
|
||||||
link.discord.description = The official Mindustry Discord chatroom
|
link.discord.description = The official Mindustry Discord chatroom
|
||||||
link.github.description = Game source code
|
link.github.description = Game source code
|
||||||
|
link.changelog.description = List of update changes
|
||||||
link.dev-builds.description = Unstable development builds
|
link.dev-builds.description = Unstable development builds
|
||||||
link.trello.description = Official Trello board for planned features
|
link.trello.description = Official Trello board for planned features
|
||||||
link.itch.io.description = itch.io page with PC downloads and web version
|
link.itch.io.description = itch.io page with PC downloads and web version
|
||||||
@@ -195,6 +196,7 @@ editor.description = Description:
|
|||||||
editor.waves = Waves:
|
editor.waves = Waves:
|
||||||
editor.rules = Rules:
|
editor.rules = Rules:
|
||||||
editor.ingame = Edit In-Game
|
editor.ingame = Edit In-Game
|
||||||
|
editor.newmap = New Map
|
||||||
waves.title = Waves
|
waves.title = Waves
|
||||||
waves.remove = Remove
|
waves.remove = Remove
|
||||||
waves.never = <never>
|
waves.never = <never>
|
||||||
@@ -298,6 +300,7 @@ width = Width:
|
|||||||
height = Height:
|
height = Height:
|
||||||
menu = Menu
|
menu = Menu
|
||||||
play = Play
|
play = Play
|
||||||
|
campaign = Campaign
|
||||||
load = Load
|
load = Load
|
||||||
save = Save
|
save = Save
|
||||||
fps = FPS: {0}
|
fps = FPS: {0}
|
||||||
@@ -378,6 +381,7 @@ blocks.booster = Booster
|
|||||||
block.unknown = [LIGHT_GRAY]???
|
block.unknown = [LIGHT_GRAY]???
|
||||||
blocks.powercapacity = Power Capacity
|
blocks.powercapacity = Power Capacity
|
||||||
blocks.powershot = Power/Shot
|
blocks.powershot = Power/Shot
|
||||||
|
blocks.damage = Damage
|
||||||
blocks.targetsair = Targets Air
|
blocks.targetsair = Targets Air
|
||||||
blocks.targetsground = Targets Ground
|
blocks.targetsground = Targets Ground
|
||||||
blocks.itemsmoved = Move Speed
|
blocks.itemsmoved = Move Speed
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 709 B |
BIN
core/assets/sprites/logo.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 254 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 277 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 53 KiB |
@@ -36,17 +36,17 @@
|
|||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { r: 0, g: 0, b: 0, a: 0 }
|
color: { r: 0, g: 0, b: 0, a: 0 }
|
||||||
},
|
},
|
||||||
flat: {
|
flat-trans: {
|
||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { r: 0.0, g: 0.0, b: 0.0, a: 0.6 }
|
color: { r: 0.0, g: 0.0, b: 0.0, a: 0.6 }
|
||||||
},
|
},
|
||||||
|
flat: {
|
||||||
|
name: whiteui,
|
||||||
|
color: { r: 0.0, g: 0.0, b: 0.0, a: 1 }
|
||||||
|
},
|
||||||
flat-over: {
|
flat-over: {
|
||||||
name: whiteui,
|
name: whiteui,
|
||||||
color: { hex: "#ffffff82" }
|
color: { hex: "#454545ff" }
|
||||||
},
|
|
||||||
flat-down: {
|
|
||||||
name: whiteui,
|
|
||||||
color: { hex: "#ffd37fff" }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ButtonStyle: {
|
ButtonStyle: {
|
||||||
@@ -71,12 +71,12 @@
|
|||||||
up: button
|
up: button
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
disabled: content-background-locked,
|
disabled: button,
|
||||||
font: default-font,
|
font: default-font,
|
||||||
fontColor: white,
|
fontColor: white,
|
||||||
disabledFontColor: gray,
|
disabledFontColor: gray,
|
||||||
up: content-background,
|
up: button-over,
|
||||||
over: content-background-over
|
over: button-down
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
over: button-right-over,
|
over: button-right-over,
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
},
|
},
|
||||||
clear-partial: {
|
clear-partial: {
|
||||||
down: whiteui,
|
down: whiteui,
|
||||||
up: button-select,
|
up: pane,
|
||||||
over: flat-down,
|
over: flat-down,
|
||||||
font: default-font,
|
font: default-font,
|
||||||
fontColor: white,
|
fontColor: white,
|
||||||
@@ -138,6 +138,16 @@
|
|||||||
over: flat-over,
|
over: flat-over,
|
||||||
disabled: flat,
|
disabled: flat,
|
||||||
disabledFontColor: gray
|
disabledFontColor: gray
|
||||||
|
},
|
||||||
|
clear-toggle-menu: {
|
||||||
|
font: default-font,
|
||||||
|
fontColor: white,
|
||||||
|
checked: flat-down,
|
||||||
|
down: flat-down,
|
||||||
|
up: clear,
|
||||||
|
over: flat-over,
|
||||||
|
disabled: flat,
|
||||||
|
disabledFontColor: gray
|
||||||
}
|
}
|
||||||
toggle: {
|
toggle: {
|
||||||
font: default-font,
|
font: default-font,
|
||||||
@@ -159,8 +169,8 @@
|
|||||||
imageUpColor: white
|
imageUpColor: white
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
up: content-background,
|
up: button-over,
|
||||||
over: content-background-over
|
over: button-down
|
||||||
},
|
},
|
||||||
right: {
|
right: {
|
||||||
over: button-right-over,
|
over: button-right-over,
|
||||||
@@ -200,7 +210,7 @@
|
|||||||
},
|
},
|
||||||
clear-full: {
|
clear-full: {
|
||||||
down: whiteui,
|
down: whiteui,
|
||||||
up: button-select,
|
up: pane,
|
||||||
over: flat-down
|
over: flat-down
|
||||||
},
|
},
|
||||||
clear-partial: {
|
clear-partial: {
|
||||||
@@ -214,6 +224,17 @@
|
|||||||
up: flat,
|
up: flat,
|
||||||
over: flat-over
|
over: flat-over
|
||||||
},
|
},
|
||||||
|
clear-trans: {
|
||||||
|
down: flat-down,
|
||||||
|
up: flat-trans,
|
||||||
|
over: flat-over
|
||||||
|
},
|
||||||
|
clear-toggle-trans: {
|
||||||
|
down: flat-down,
|
||||||
|
checked: flat-down,
|
||||||
|
up: flat-trans,
|
||||||
|
over: flat-over
|
||||||
|
},
|
||||||
clear-toggle-partial: {
|
clear-toggle-partial: {
|
||||||
down: flat-down,
|
down: flat-down,
|
||||||
checked: flat-down,
|
checked: flat-down,
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Vars{
|
|||||||
/** size of UI icons (small)*/
|
/** size of UI icons (small)*/
|
||||||
public static final int iconsizesmall = 32;
|
public static final int iconsizesmall = 32;
|
||||||
/** size of UI icons (medium)*/
|
/** size of UI icons (medium)*/
|
||||||
public static final int iconsizemed = 42;
|
public static final int iconsizemed = 30;
|
||||||
/** units outside of this bound will simply die instantly */
|
/** units outside of this bound will simply die instantly */
|
||||||
public static final float finalWorldBounds = worldBounds + 500;
|
public static final float finalWorldBounds = worldBounds + 500;
|
||||||
/** ticks spent out of bound until self destruct. */
|
/** ticks spent out of bound until self destruct. */
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import io.anuke.arc.collection.IntArray;
|
|||||||
import io.anuke.arc.collection.IntQueue;
|
import io.anuke.arc.collection.IntQueue;
|
||||||
import io.anuke.arc.math.geom.Geometry;
|
import io.anuke.arc.math.geom.Geometry;
|
||||||
import io.anuke.arc.math.geom.Point2;
|
import io.anuke.arc.math.geom.Point2;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.Structs;
|
||||||
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
@@ -95,7 +96,7 @@ public class Pathfinder{
|
|||||||
*/
|
*/
|
||||||
private void update(Tile tile, Team team){
|
private void update(Tile tile, Team team){
|
||||||
//make sure team exists
|
//make sure team exists
|
||||||
if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
|
if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null && Structs.inBounds(tile.x, tile.y, paths[team.ordinal()].weights)){
|
||||||
PathData path = paths[team.ordinal()];
|
PathData path = paths[team.ordinal()];
|
||||||
|
|
||||||
if(path.weights[tile.x][tile.y] <= 0.1f){
|
if(path.weights[tile.x][tile.y] <= 0.1f){
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import io.anuke.mindustry.entities.bullet.BulletType;
|
|||||||
import io.anuke.mindustry.game.ContentList;
|
import io.anuke.mindustry.game.ContentList;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.blocks.*;
|
import io.anuke.mindustry.world.blocks.*;
|
||||||
import io.anuke.mindustry.world.blocks.defense.*;
|
import io.anuke.mindustry.world.blocks.defense.*;
|
||||||
import io.anuke.mindustry.world.blocks.defense.turrets.*;
|
import io.anuke.mindustry.world.blocks.defense.turrets.*;
|
||||||
@@ -310,11 +309,11 @@ public class Blocks implements ContentList{
|
|||||||
saltRocks = new StaticWall("saltrocks"){{
|
saltRocks = new StaticWall("saltrocks"){{
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sporePine = new StaticWall("spore-pine"){{
|
sporePine = new StaticTree("spore-pine"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
pine = new StaticWall("pine"){{
|
pine = new StaticTree("pine"){{
|
||||||
variants = 0;
|
variants = 0;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -6,26 +6,28 @@ import io.anuke.arc.Graphics.Cursor.SystemCursor;
|
|||||||
import io.anuke.arc.freetype.FreeTypeFontGenerator;
|
import io.anuke.arc.freetype.FreeTypeFontGenerator;
|
||||||
import io.anuke.arc.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
import io.anuke.arc.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.Consumer;
|
||||||
import io.anuke.arc.graphics.Color;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.graphics.Colors;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.g2d.BitmapFont;
|
import io.anuke.arc.graphics.g2d.TextureAtlas.AtlasRegion;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.KeyCode;
|
||||||
import io.anuke.arc.math.Interpolation;
|
import io.anuke.arc.math.Interpolation;
|
||||||
import io.anuke.arc.scene.*;
|
import io.anuke.arc.scene.*;
|
||||||
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.style.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.TextField.TextFieldFilter;
|
import io.anuke.arc.scene.ui.TextField.TextFieldFilter;
|
||||||
import io.anuke.arc.scene.ui.Tooltip.Tooltips;
|
import io.anuke.arc.scene.ui.Tooltip.Tooltips;
|
||||||
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.core.GameState.State;
|
||||||
import io.anuke.mindustry.editor.MapEditorDialog;
|
import io.anuke.mindustry.editor.MapEditorDialog;
|
||||||
import io.anuke.mindustry.game.EventType.ResizeEvent;
|
import io.anuke.mindustry.game.EventType.ResizeEvent;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
import io.anuke.mindustry.graphics.Pal;
|
||||||
import io.anuke.mindustry.ui.dialogs.*;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
import io.anuke.mindustry.ui.fragments.*;
|
import io.anuke.mindustry.ui.fragments.*;
|
||||||
|
|
||||||
import static io.anuke.arc.scene.actions.Actions.*;
|
import static io.anuke.arc.scene.actions.Actions.sequence;
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class UI implements ApplicationListener{
|
public class UI implements ApplicationListener{
|
||||||
@@ -35,9 +37,10 @@ public class UI implements ApplicationListener{
|
|||||||
public HudFragment hudfrag;
|
public HudFragment hudfrag;
|
||||||
public ChatFragment chatfrag;
|
public ChatFragment chatfrag;
|
||||||
public PlayerListFragment listfrag;
|
public PlayerListFragment listfrag;
|
||||||
public BackgroundFragment backfrag;
|
|
||||||
public LoadingFragment loadfrag;
|
public LoadingFragment loadfrag;
|
||||||
|
|
||||||
|
public WidgetGroup menuGroup, hudGroup;
|
||||||
|
|
||||||
public AboutDialog about;
|
public AboutDialog about;
|
||||||
public GameOverDialog restart;
|
public GameOverDialog restart;
|
||||||
public CustomGameDialog custom;
|
public CustomGameDialog custom;
|
||||||
@@ -54,7 +57,6 @@ public class UI implements ApplicationListener{
|
|||||||
public BansDialog bans;
|
public BansDialog bans;
|
||||||
public AdminsDialog admins;
|
public AdminsDialog admins;
|
||||||
public TraceDialog traces;
|
public TraceDialog traces;
|
||||||
public ChangelogDialog changelog;
|
|
||||||
public DatabaseDialog database;
|
public DatabaseDialog database;
|
||||||
public ContentInfoDialog content;
|
public ContentInfoDialog content;
|
||||||
public DeployDialog deploy;
|
public DeployDialog deploy;
|
||||||
@@ -66,6 +68,7 @@ public class UI implements ApplicationListener{
|
|||||||
public UI(){
|
public UI(){
|
||||||
Skin skin = new Skin(Core.atlas);
|
Skin skin = new Skin(Core.atlas);
|
||||||
generateFonts(skin);
|
generateFonts(skin);
|
||||||
|
loadExtraStyle(skin);
|
||||||
skin.load(Core.files.internal("sprites/uiskin.json"));
|
skin.load(Core.files.internal("sprites/uiskin.json"));
|
||||||
|
|
||||||
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
for(BitmapFont font : skin.getAll(BitmapFont.class).values()){
|
||||||
@@ -75,23 +78,8 @@ public class UI implements ApplicationListener{
|
|||||||
Core.scene = new Scene(skin);
|
Core.scene = new Scene(skin);
|
||||||
Core.input.addProcessor(Core.scene);
|
Core.input.addProcessor(Core.scene);
|
||||||
|
|
||||||
Dialog.setShowAction(() -> sequence(
|
Dialog.setShowAction(() -> sequence());
|
||||||
alpha(0f),
|
Dialog.setHideAction(() -> sequence());
|
||||||
originCenter(),
|
|
||||||
moveToAligned(Core.graphics.getWidth() / 2f, Core.graphics.getHeight() / 2f, Align.center),
|
|
||||||
scaleTo(0.0f, 1f),
|
|
||||||
parallel(
|
|
||||||
scaleTo(1f, 1f, 0.1f, Interpolation.fade),
|
|
||||||
fadeIn(0.1f, Interpolation.fade)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
Dialog.setHideAction(() -> sequence(
|
|
||||||
parallel(
|
|
||||||
scaleTo(0.01f, 0.01f, 0.1f, Interpolation.fade),
|
|
||||||
fadeOut(0.1f, Interpolation.fade)
|
|
||||||
)
|
|
||||||
));
|
|
||||||
|
|
||||||
Tooltips.getInstance().animations = false;
|
Tooltips.getInstance().animations = false;
|
||||||
|
|
||||||
@@ -106,6 +94,25 @@ public class UI implements ApplicationListener{
|
|||||||
loadCursors();
|
loadCursors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadExtraStyle(Skin skin){
|
||||||
|
AtlasRegion region = Core.atlas.find("flat-down-base");
|
||||||
|
int[] splits = region.splits;
|
||||||
|
|
||||||
|
ScaledNinePatchDrawable copy = new ScaledNinePatchDrawable(new NinePatch(region, splits[0], splits[1], splits[2], splits[3])){
|
||||||
|
public float getLeftWidth(){ return 0; }
|
||||||
|
public float getRightWidth(){ return 0; }
|
||||||
|
public float getTopHeight(){ return 0; }
|
||||||
|
public float getBottomHeight(){ return 0; }
|
||||||
|
};
|
||||||
|
copy.setMinWidth(0);
|
||||||
|
copy.setMinHeight(0);
|
||||||
|
copy.setTopHeight(0);
|
||||||
|
copy.setRightWidth(0);
|
||||||
|
copy.setBottomHeight(0);
|
||||||
|
copy.setLeftWidth(0);
|
||||||
|
skin.add("flat-down", copy, Drawable.class);
|
||||||
|
}
|
||||||
|
|
||||||
void loadCursors(){
|
void loadCursors(){
|
||||||
int cursorScaling = 1, outlineThickness = 3;
|
int cursorScaling = 1, outlineThickness = 3;
|
||||||
Color outlineColor = Color.valueOf("444444");
|
Color outlineColor = Color.valueOf("444444");
|
||||||
@@ -143,11 +150,13 @@ public class UI implements ApplicationListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
menuGroup = new WidgetGroup();
|
||||||
|
hudGroup = new WidgetGroup();
|
||||||
|
|
||||||
menufrag = new MenuFragment();
|
menufrag = new MenuFragment();
|
||||||
hudfrag = new HudFragment();
|
hudfrag = new HudFragment();
|
||||||
chatfrag = new ChatFragment();
|
chatfrag = new ChatFragment();
|
||||||
listfrag = new PlayerListFragment();
|
listfrag = new PlayerListFragment();
|
||||||
backfrag = new BackgroundFragment();
|
|
||||||
loadfrag = new LoadingFragment();
|
loadfrag = new LoadingFragment();
|
||||||
|
|
||||||
editor = new MapEditorDialog();
|
editor = new MapEditorDialog();
|
||||||
@@ -162,7 +171,6 @@ public class UI implements ApplicationListener{
|
|||||||
settings = new SettingsMenuDialog();
|
settings = new SettingsMenuDialog();
|
||||||
host = new HostDialog();
|
host = new HostDialog();
|
||||||
paused = new PausedDialog();
|
paused = new PausedDialog();
|
||||||
changelog = new ChangelogDialog();
|
|
||||||
about = new AboutDialog();
|
about = new AboutDialog();
|
||||||
bans = new BansDialog();
|
bans = new BansDialog();
|
||||||
admins = new AdminsDialog();
|
admins = new AdminsDialog();
|
||||||
@@ -175,12 +183,21 @@ public class UI implements ApplicationListener{
|
|||||||
|
|
||||||
Group group = Core.scene.root;
|
Group group = Core.scene.root;
|
||||||
|
|
||||||
backfrag.build(group);
|
menuGroup.setFillParent(true);
|
||||||
control.input().getFrag().build(group);
|
menuGroup.touchable(Touchable.childrenOnly);
|
||||||
hudfrag.build(group);
|
menuGroup.visible(() -> state.is(State.menu));
|
||||||
menufrag.build(group);
|
hudGroup.setFillParent(true);
|
||||||
chatfrag.container().build(group);
|
hudGroup.touchable(Touchable.childrenOnly);
|
||||||
listfrag.build(group);
|
hudGroup.visible(() -> !state.is(State.menu));
|
||||||
|
|
||||||
|
Core.scene.add(menuGroup);
|
||||||
|
Core.scene.add(hudGroup);
|
||||||
|
|
||||||
|
control.input().getFrag().build(hudGroup);
|
||||||
|
hudfrag.build(hudGroup);
|
||||||
|
menufrag.build(menuGroup);
|
||||||
|
chatfrag.container().build(hudGroup);
|
||||||
|
listfrag.build(hudGroup);
|
||||||
loadfrag.build(group);
|
loadfrag.build(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import io.anuke.mindustry.Vars;
|
|||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.Blocks;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
|
|
||||||
public enum EditorTool{
|
public enum EditorTool{
|
||||||
zoom,
|
zoom,
|
||||||
@@ -107,6 +108,11 @@ public enum EditorTool{
|
|||||||
|
|
||||||
//mode 0 or 1, fill everything with the floor/tile or replace it
|
//mode 0 or 1, fill everything with the floor/tile or replace it
|
||||||
if(mode == 0 || mode == -1){
|
if(mode == 0 || mode == -1){
|
||||||
|
//can't fill parts or multiblocks
|
||||||
|
if(tile.block() instanceof BlockPart || tile.block().isMultiblock()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Predicate<Tile> tester;
|
Predicate<Tile> tester;
|
||||||
Consumer<Tile> setter;
|
Consumer<Tile> setter;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import io.anuke.mindustry.io.MapIO;
|
|||||||
import io.anuke.mindustry.maps.Map;
|
import io.anuke.mindustry.maps.Map;
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.blocks.BlockPart;
|
import io.anuke.mindustry.world.blocks.BlockPart;
|
||||||
import io.anuke.mindustry.world.blocks.Floor;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
@@ -238,71 +237,6 @@ public class MapEditor{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw_DEPRECATED(int x, int y, boolean paint, Block drawBlock, double chance){
|
|
||||||
boolean isfloor = drawBlock instanceof Floor && drawBlock != Blocks.air;
|
|
||||||
Tile[][] tiles = world.getTiles();
|
|
||||||
|
|
||||||
if(drawBlock.isMultiblock()){
|
|
||||||
x = Mathf.clamp(x, (drawBlock.size - 1) / 2, width() - drawBlock.size / 2 - 1);
|
|
||||||
y = Mathf.clamp(y, (drawBlock.size - 1) / 2, height() - drawBlock.size / 2 - 1);
|
|
||||||
|
|
||||||
int offsetx = -(drawBlock.size - 1) / 2;
|
|
||||||
int offsety = -(drawBlock.size - 1) / 2;
|
|
||||||
|
|
||||||
for(int dx = 0; dx < drawBlock.size; dx++){
|
|
||||||
for(int dy = 0; dy < drawBlock.size; dy++){
|
|
||||||
int worldx = dx + offsetx + x;
|
|
||||||
int worldy = dy + offsety + y;
|
|
||||||
|
|
||||||
if(Structs.inBounds(worldx, worldy, width(), height())){
|
|
||||||
Tile tile = tiles[worldx][worldy];
|
|
||||||
|
|
||||||
Block block = tile.block();
|
|
||||||
|
|
||||||
//bail out if there's anything blocking the way
|
|
||||||
if(block.isMultiblock() || block instanceof BlockPart){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.updatePoint(worldx, worldy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
world.setBlock(tiles[x][y], drawBlock, drawTeam);
|
|
||||||
}else{
|
|
||||||
for(int rx = -brushSize; rx <= brushSize; rx++){
|
|
||||||
for(int ry = -brushSize; ry <= brushSize; ry++){
|
|
||||||
if(Mathf.dst(rx, ry) <= brushSize - 0.5f && (chance >= 0.999 || Mathf.chance(chance))){
|
|
||||||
int wx = x + rx, wy = y + ry;
|
|
||||||
|
|
||||||
if(wx < 0 || wy < 0 || wx >= width() || wy >= height() || (paint && !isfloor && tiles[wx][wy].block() == Blocks.air)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tile tile = tiles[wx][wy];
|
|
||||||
|
|
||||||
if(!isfloor && (tile.isLinked() || tile.block().isMultiblock())){
|
|
||||||
world.removeBlock(tile.link());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isfloor){
|
|
||||||
tile.setFloor((Floor)drawBlock);
|
|
||||||
}else{
|
|
||||||
tile.setBlock(drawBlock);
|
|
||||||
if(drawBlock.synthetic()){
|
|
||||||
tile.setTeam(drawTeam);
|
|
||||||
}
|
|
||||||
if(drawBlock.rotate){
|
|
||||||
tile.rotation((byte)rotation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapRenderer renderer(){
|
public MapRenderer renderer(){
|
||||||
return renderer;
|
return renderer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
private void save(){
|
private void save(){
|
||||||
String name = editor.getTags().get("name", "").trim();
|
String name = editor.getTags().get("name", "").trim();
|
||||||
editor.getTags().put("rules", JsonIO.write(state.rules));
|
editor.getTags().put("rules", JsonIO.write(state.rules));
|
||||||
|
editor.getTags().remove("width");
|
||||||
|
editor.getTags().remove("height");
|
||||||
player.dead = true;
|
player.dead = true;
|
||||||
|
|
||||||
if(name.isEmpty()){
|
if(name.isEmpty()){
|
||||||
|
|||||||
@@ -286,7 +286,9 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removed(){
|
public void removed(){
|
||||||
map.remove(tile.pos());
|
if(tile != null){
|
||||||
|
map.remove(tile.pos());
|
||||||
|
}
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ public interface BuilderTrait extends Entity, TeamTrait{
|
|||||||
buildQueue().clear();
|
buildQueue().clear();
|
||||||
|
|
||||||
for(BuildRequest request : removal){
|
for(BuildRequest request : removal){
|
||||||
if(!((request.breaking && world.tile(request.x, request.y).block() == Blocks.air) ||
|
Tile tile = world.tile(request.x, request.y);
|
||||||
(!request.breaking && (world.tile(request.x, request.y).rotation() == request.rotation || !request.block.rotate)
|
|
||||||
&& world.tile(request.x, request.y).block() == request.block))){
|
if(!(tile == null || (request.breaking && tile.block() == Blocks.air) ||
|
||||||
|
(!request.breaking && (tile.rotation() == request.rotation || !request.block.rotate) && tile.block() == request.block))){
|
||||||
buildQueue().addLast(request);
|
buildQueue().addLast(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public abstract class FlyingUnit extends BaseUnit{
|
|||||||
if(target == null){
|
if(target == null){
|
||||||
setState(patrol);
|
setState(patrol);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if(target != null){
|
if(target != null){
|
||||||
attack(type.attackLength);
|
attack(type.attackLength);
|
||||||
|
|||||||
302
core/src/io/anuke/mindustry/graphics/MenuRenderer.java
Normal file
@@ -0,0 +1,302 @@
|
|||||||
|
package io.anuke.mindustry.graphics;
|
||||||
|
|
||||||
|
import io.anuke.arc.Core;
|
||||||
|
import io.anuke.arc.collection.Array;
|
||||||
|
import io.anuke.arc.function.PositionConsumer;
|
||||||
|
import io.anuke.arc.graphics.Camera;
|
||||||
|
import io.anuke.arc.graphics.Color;
|
||||||
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
|
import io.anuke.arc.graphics.glutils.FrameBuffer;
|
||||||
|
import io.anuke.arc.math.*;
|
||||||
|
import io.anuke.arc.scene.ui.layout.Unit;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
import io.anuke.arc.util.noise.RidgedPerlin;
|
||||||
|
import io.anuke.arc.util.noise.Simplex;
|
||||||
|
import io.anuke.mindustry.content.Blocks;
|
||||||
|
import io.anuke.mindustry.content.UnitTypes;
|
||||||
|
import io.anuke.mindustry.type.UnitType;
|
||||||
|
import io.anuke.mindustry.world.*;
|
||||||
|
import io.anuke.mindustry.world.blocks.Floor;
|
||||||
|
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
|
public class MenuRenderer implements Disposable{
|
||||||
|
private static final float darkness = 0.3f;
|
||||||
|
private final int width = !mobile ? 100 : 60, height = !mobile ? 50 : 40;
|
||||||
|
|
||||||
|
private int cacheFloor, cacheWall;
|
||||||
|
private Camera camera = new Camera();
|
||||||
|
private Matrix3 mat = new Matrix3();
|
||||||
|
private FrameBuffer shadows;
|
||||||
|
private CacheBatch batch;
|
||||||
|
private float time = 0f;
|
||||||
|
private float flyerRot = 45f;
|
||||||
|
private int flyers = Mathf.chance(0.2) ? Mathf.random(30) : Mathf.random(12);
|
||||||
|
private UnitType flyerType = Structs.select(UnitTypes.wraith, UnitTypes.wraith, UnitTypes.ghoul, UnitTypes.phantom, UnitTypes.phantom, UnitTypes.revenant);
|
||||||
|
|
||||||
|
public MenuRenderer(){
|
||||||
|
Time.mark();
|
||||||
|
generate();
|
||||||
|
cache();
|
||||||
|
Log.info("Time to generate menu: {0}", Time.elapsed());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generate(){
|
||||||
|
Tile[][] tiles = world.createTiles(width, height);
|
||||||
|
Array<Block> ores = content.blocks().select(b -> b instanceof OreBlock);
|
||||||
|
shadows = new FrameBuffer(width, height);
|
||||||
|
int offset = Mathf.random(100000);
|
||||||
|
Simplex s1 = new Simplex(offset);
|
||||||
|
Simplex s2 = new Simplex(offset + 1);
|
||||||
|
Simplex s3 = new Simplex(offset + 2);
|
||||||
|
RidgedPerlin rid = new RidgedPerlin(1 + offset, 1);
|
||||||
|
Block[] selected = Structs.select(
|
||||||
|
new Block[]{Blocks.sand, Blocks.sandRocks},
|
||||||
|
new Block[]{Blocks.shale, Blocks.shaleRocks},
|
||||||
|
new Block[]{Blocks.ice, Blocks.icerocks},
|
||||||
|
new Block[]{Blocks.sand, Blocks.sandRocks},
|
||||||
|
new Block[]{Blocks.shale, Blocks.shaleRocks},
|
||||||
|
new Block[]{Blocks.ice, Blocks.icerocks},
|
||||||
|
new Block[]{Blocks.moss, Blocks.sporePine}
|
||||||
|
);
|
||||||
|
Block[] selected2 = Structs.select(
|
||||||
|
new Block[]{Blocks.ignarock, Blocks.duneRocks},
|
||||||
|
new Block[]{Blocks.ignarock, Blocks.duneRocks},
|
||||||
|
new Block[]{Blocks.stone, Blocks.rocks},
|
||||||
|
new Block[]{Blocks.stone, Blocks.rocks},
|
||||||
|
new Block[]{Blocks.moss, Blocks.sporerocks},
|
||||||
|
new Block[]{Blocks.salt, Blocks.saltRocks}
|
||||||
|
);
|
||||||
|
|
||||||
|
Block ore1 = ores.random();
|
||||||
|
ores.remove(ore1);
|
||||||
|
Block ore2 = ores.random();
|
||||||
|
|
||||||
|
double tr1 = Mathf.random(0.65f, 0.85f);
|
||||||
|
double tr2 = Mathf.random(0.65f, 0.85f);
|
||||||
|
boolean doheat = Mathf.chance(0.25);
|
||||||
|
boolean tendrils = Mathf.chance(0.25);
|
||||||
|
boolean tech = Mathf.chance(0.25);
|
||||||
|
int secSize = 10;
|
||||||
|
|
||||||
|
Block floord = selected[0], walld = selected[1];
|
||||||
|
Block floord2 = selected2[0], walld2 = selected2[1];
|
||||||
|
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
Block floor = floord;
|
||||||
|
Block ore = Blocks.air;
|
||||||
|
Block wall = Blocks.air;
|
||||||
|
|
||||||
|
if(s1.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
|
||||||
|
wall = walld;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(s3.octaveNoise2D(3, 0.5, 1/20.0, x, y) > 0.5){
|
||||||
|
floor = floord2;
|
||||||
|
if(wall != Blocks.air){
|
||||||
|
wall = walld2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(s2.octaveNoise2D(3, 0.3, 1/30.0, x, y) > tr1){
|
||||||
|
ore = ore1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(s2.octaveNoise2D(2, 0.2, 1/15.0, x, y+99999) > tr2){
|
||||||
|
ore = ore2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(doheat){
|
||||||
|
double heat = s3.octaveNoise2D(4, 0.6, 1 / 50.0, x, y + 9999);
|
||||||
|
double base = 0.65;
|
||||||
|
|
||||||
|
if(heat > base){
|
||||||
|
ore = Blocks.air;
|
||||||
|
wall = Blocks.air;
|
||||||
|
floor = Blocks.ignarock;
|
||||||
|
|
||||||
|
if(heat > base + 0.1){
|
||||||
|
floor = Blocks.hotrock;
|
||||||
|
|
||||||
|
if(heat > base + 0.15){
|
||||||
|
floor = Blocks.magmarock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tech){
|
||||||
|
int mx = x % secSize, my = y % secSize;
|
||||||
|
int sclx = x / secSize, scly = y / secSize;
|
||||||
|
if(s1.octaveNoise2D(2, 1f / 10f, 0.5f, sclx, scly) > 0.4f && (mx == 0 || my == 0 || mx == secSize - 1 || my == secSize - 1)){
|
||||||
|
floor = Blocks.darkPanel3;
|
||||||
|
if(Mathf.dst(mx, my, secSize/2, secSize/2) > secSize/2f + 1){
|
||||||
|
floor = Blocks.darkPanel4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(wall != Blocks.air && Mathf.chance(0.7)){
|
||||||
|
wall = Blocks.darkMetal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tendrils){
|
||||||
|
if(rid.getValue(x, y, 1f / 17f) > 0f){
|
||||||
|
floor = Mathf.chance(0.2) ? Blocks.sporeMoss : Blocks.moss;
|
||||||
|
|
||||||
|
if(wall != Blocks.air){
|
||||||
|
wall = Blocks.sporerocks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Tile tile;
|
||||||
|
tiles[x][y] = (tile = new CachedTile());
|
||||||
|
tile.x = (short)x;
|
||||||
|
tile.y = (short)y;
|
||||||
|
tile.setFloor((Floor) floor);
|
||||||
|
tile.setBlock(wall);
|
||||||
|
tile.setOverlay(ore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cache(){
|
||||||
|
|
||||||
|
//draw shadows
|
||||||
|
Draw.proj().setOrtho(0, 0, shadows.getWidth(), shadows.getHeight());
|
||||||
|
shadows.beginDraw(Color.CLEAR);
|
||||||
|
Draw.color(Color.BLACK);
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
if(world.rawTile(x, y).block() != Blocks.air){
|
||||||
|
Fill.rect(x + 0.5f, y + 0.5f, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Draw.color();
|
||||||
|
shadows.endDraw();
|
||||||
|
|
||||||
|
SpriteBatch prev = Core.batch;
|
||||||
|
|
||||||
|
Core.batch = batch = new CacheBatch(new SpriteCache(width * height * 6, false));
|
||||||
|
batch.beginCache();
|
||||||
|
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
Tile tile = world.rawTile(x, y);
|
||||||
|
tile.floor().draw(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
Tile tile = world.rawTile(x, y);
|
||||||
|
if(tile.overlay() != Blocks.air){
|
||||||
|
tile.overlay().draw(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheFloor = batch.endCache();
|
||||||
|
batch.beginCache();
|
||||||
|
|
||||||
|
for(int x = 0; x < width; x++){
|
||||||
|
for(int y = 0; y < height; y++){
|
||||||
|
Tile tile = world.rawTile(x, y);
|
||||||
|
if(tile.block() != Blocks.air){
|
||||||
|
tile.block().draw(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Draw.rect("error", world.width() * tilesize/2f, world.height() * tilesize/2f, 100f, 100f);
|
||||||
|
|
||||||
|
cacheWall = batch.endCache();
|
||||||
|
|
||||||
|
Core.batch = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(){
|
||||||
|
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)));
|
||||||
|
camera.position.set(width * tilesize / 2f, height * tilesize / 2f);
|
||||||
|
camera.resize(Core.graphics.getWidth() / scaling,
|
||||||
|
Core.graphics.getHeight() / scaling);
|
||||||
|
|
||||||
|
mat.set(Draw.proj());
|
||||||
|
Draw.flush();
|
||||||
|
Draw.proj(camera.projection());
|
||||||
|
batch.setProjection(camera.projection());
|
||||||
|
batch.beginDraw();
|
||||||
|
batch.drawCache(cacheFloor);
|
||||||
|
batch.endDraw();
|
||||||
|
Draw.rect(Draw.wrap(shadows.getTexture()),
|
||||||
|
width * tilesize / 2f - 4f, height * tilesize / 2f - 4f,
|
||||||
|
width * tilesize, -height * tilesize);
|
||||||
|
Draw.flush();
|
||||||
|
batch.beginDraw();
|
||||||
|
batch.drawCache(cacheWall);
|
||||||
|
batch.endDraw();
|
||||||
|
|
||||||
|
drawFlyers();
|
||||||
|
|
||||||
|
Draw.proj(mat);
|
||||||
|
Draw.color(0f, 0f, 0f, darkness);
|
||||||
|
Fill.crect(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawFlyers(){
|
||||||
|
Draw.color(0f, 0f, 0f, 0.4f);
|
||||||
|
|
||||||
|
float size = Math.max(flyerType.iconRegion.getWidth(), flyerType.iconRegion.getHeight()) * Draw.scl * 1.6f;
|
||||||
|
|
||||||
|
flyers((x, y) -> {
|
||||||
|
Draw.rect(flyerType.region, x - 12f, y - 13f, flyerRot - 90);
|
||||||
|
});
|
||||||
|
|
||||||
|
flyers((x, y) -> {
|
||||||
|
Draw.rect("circle-shadow", x, y, size, size);
|
||||||
|
});
|
||||||
|
Draw.color();
|
||||||
|
|
||||||
|
flyers((x, y) -> {
|
||||||
|
float engineOffset = flyerType.engineOffset, engineSize = flyerType.engineSize, rotation = flyerRot;
|
||||||
|
|
||||||
|
Draw.color(Pal.engine);
|
||||||
|
Fill.circle(x + Angles.trnsx(rotation + 180, engineOffset), y + Angles.trnsy(rotation + 180, engineOffset),
|
||||||
|
engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f));
|
||||||
|
|
||||||
|
Draw.color(Color.WHITE);
|
||||||
|
Fill.circle(x + Angles.trnsx(rotation + 180, engineOffset - 1f), y + Angles.trnsy(rotation + 180, engineOffset - 1f),
|
||||||
|
(engineSize + Mathf.absin(Time.time(), 2f, engineSize / 4f)) / 2f);
|
||||||
|
Draw.color();
|
||||||
|
|
||||||
|
Draw.rect(flyerType.region, x, y, flyerRot - 90);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void flyers(PositionConsumer cons){
|
||||||
|
float tw = width * tilesize * 2;
|
||||||
|
float th = height * tilesize * 2;
|
||||||
|
float range = 500f;
|
||||||
|
float offset = -600f;
|
||||||
|
|
||||||
|
for(int i = 0; i < flyers; i++){
|
||||||
|
Tmp.v1.trns(flyerRot, time * (2.5f + flyerType.speed));
|
||||||
|
|
||||||
|
cons.accept((Mathf.randomSeedRange(i, range) + Tmp.v1.x + Mathf.absin(time + Mathf.randomSeedRange(i + 2, 500), 10f, 3.4f) + offset) % tw,
|
||||||
|
(Mathf.randomSeedRange(i + 1, range) + Tmp.v1.y + Mathf.absin(time + Mathf.randomSeedRange(i + 3, 500), 10f, 3.4f) + offset) % th);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose(){
|
||||||
|
batch.dispose();
|
||||||
|
shadows.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -129,6 +129,7 @@ public class MinimapRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int colorFor(Tile tile){
|
private int colorFor(Tile tile){
|
||||||
|
if(tile == null) return 0;
|
||||||
tile = tile.link();
|
tile = tile.link();
|
||||||
return MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam());
|
return MapIO.colorFor(tile.floor(), tile.block(), tile.overlay(), tile.getTeam());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class Pal{
|
|||||||
bar = Color.SLATE,
|
bar = Color.SLATE,
|
||||||
accent = Color.valueOf("ffd37f"),
|
accent = Color.valueOf("ffd37f"),
|
||||||
stat = Color.valueOf("ffd37f"),
|
stat = Color.valueOf("ffd37f"),
|
||||||
locked = Color.valueOf("989aa4"),
|
gray = Color.valueOf("454545"),
|
||||||
accentBack = Color.valueOf("d4816b"),
|
accentBack = Color.valueOf("d4816b"),
|
||||||
place = Color.valueOf("6335f8"),
|
place = Color.valueOf("6335f8"),
|
||||||
remove = Color.valueOf("e55454"),
|
remove = Color.valueOf("e55454"),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public abstract class InputHandler implements InputProcessor{
|
|||||||
/** Distance on the back from where items originate. */
|
/** Distance on the back from where items originate. */
|
||||||
final static float backTrns = 3f;
|
final static float backTrns = 3f;
|
||||||
|
|
||||||
public final OverlayFragment frag = new OverlayFragment(this);
|
public final OverlayFragment frag = new OverlayFragment();
|
||||||
|
|
||||||
public Block block;
|
public Block block;
|
||||||
public int rotation;
|
public int rotation;
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildUI(Table table){
|
public void buildUI(Table table){
|
||||||
table.addImage("blank").color(Pal.accent).height(3f).colspan(4).growX();
|
table.addImage("whiteui").color(Pal.gray).height(4f).colspan(4).growX();
|
||||||
table.row();
|
table.row();
|
||||||
table.left().margin(0f).defaults().size(48f);
|
table.left().margin(0f).defaults().size(48f);
|
||||||
|
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package io.anuke.mindustry.io;
|
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
|
||||||
import io.anuke.arc.collection.Array;
|
|
||||||
import io.anuke.arc.function.Consumer;
|
|
||||||
import io.anuke.arc.util.serialization.JsonReader;
|
|
||||||
import io.anuke.arc.util.serialization.JsonValue;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.releasesURL;
|
|
||||||
|
|
||||||
public class Changelogs{
|
|
||||||
|
|
||||||
public static void getChangelog(Consumer<Array<VersionInfo>> success, Consumer<Throwable> fail){
|
|
||||||
Core.net.httpGet(releasesURL, result -> {
|
|
||||||
JsonReader reader = new JsonReader();
|
|
||||||
JsonValue value = reader.parse(result.getResultAsString()).child;
|
|
||||||
Array<VersionInfo> out = new Array<>();
|
|
||||||
|
|
||||||
while(value != null){
|
|
||||||
String name = value.getString("name");
|
|
||||||
String description = value.getString("body").replace("\r", "");
|
|
||||||
int id = value.getInt("id");
|
|
||||||
int build = Integer.parseInt(value.getString("tag_name").substring(1));
|
|
||||||
out.add(new VersionInfo(name, description, id, build, value.getString("published_at")));
|
|
||||||
value = value.next;
|
|
||||||
}
|
|
||||||
|
|
||||||
success.accept(out);
|
|
||||||
}, fail);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class VersionInfo{
|
|
||||||
public final String name, description, date;
|
|
||||||
public final int id, build;
|
|
||||||
|
|
||||||
public VersionInfo(String name, String description, int id, int build, String date){
|
|
||||||
this.name = name;
|
|
||||||
this.description = description;
|
|
||||||
this.id = id;
|
|
||||||
this.build = build;
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
return "VersionInfo{" +
|
|
||||||
"name='" + name + '\'' +
|
|
||||||
", description='" + description + '\'' +
|
|
||||||
", id=" + id +
|
|
||||||
", build=" + build +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.io;
|
package io.anuke.mindustry.io;
|
||||||
|
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.util.Log;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.arc.util.io.CounterInputStream;
|
import io.anuke.arc.util.io.CounterInputStream;
|
||||||
import io.anuke.mindustry.entities.Entities;
|
import io.anuke.mindustry.entities.Entities;
|
||||||
@@ -253,7 +254,6 @@ public abstract class SaveVersion extends SaveFileReader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void readContentHeader(DataInput stream) throws IOException{
|
public void readContentHeader(DataInput stream) throws IOException{
|
||||||
|
|
||||||
byte mapped = stream.readByte();
|
byte mapped = stream.readByte();
|
||||||
|
|
||||||
MappableContent[][] map = new MappableContent[ContentType.values().length][0];
|
MappableContent[][] map = new MappableContent[ContentType.values().length][0];
|
||||||
|
|||||||