Added block description panel, disabled deselecting, updated uCore
@ -79,8 +79,7 @@ project(":core") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//compile fileTree(dir: '../core/lib', include: '*.jar')
|
compile 'com.github.anuken:ucore:532dc82873'
|
||||||
compile 'com.github.anuken:ucore:627f0c756d'
|
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
|
||||||
}
|
}
|
||||||
|
BIN
core/assets-raw/sprites/titanium1.png
Normal file
After Width: | Height: | Size: 251 B |
BIN
core/assets-raw/sprites/titanium2.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
core/assets-raw/sprites/titanium3.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
core/assets-raw/sprites/titaniumblock.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
core/assets-raw/sprites/titaniumdrill.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
core/assets-raw/ui/icon-menu.png
Normal file
After Width: | Height: | Size: 191 B |
BIN
core/assets-raw/ui/icon-pause.png
Normal file
After Width: | Height: | Size: 175 B |
BIN
core/assets-raw/ui/icon-settings.png
Normal file
After Width: | Height: | Size: 213 B |
@ -508,6 +508,41 @@ stonewall
|
|||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
titanium1
|
||||||
|
rotate: false
|
||||||
|
xy: 180, 13
|
||||||
|
size: 8, 8
|
||||||
|
orig: 8, 8
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
titanium2
|
||||||
|
rotate: false
|
||||||
|
xy: 180, 3
|
||||||
|
size: 8, 8
|
||||||
|
orig: 8, 8
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
titanium3
|
||||||
|
rotate: false
|
||||||
|
xy: 190, 13
|
||||||
|
size: 8, 8
|
||||||
|
orig: 8, 8
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
titaniumblock
|
||||||
|
rotate: false
|
||||||
|
xy: 190, 3
|
||||||
|
size: 8, 8
|
||||||
|
orig: 8, 8
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
titaniumdrill
|
||||||
|
rotate: false
|
||||||
|
xy: 200, 13
|
||||||
|
size: 8, 8
|
||||||
|
orig: 8, 8
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
turret
|
turret
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 163, 21
|
xy: 163, 21
|
||||||
@ -517,7 +552,7 @@ turret
|
|||||||
index: -1
|
index: -1
|
||||||
water
|
water
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 180, 13
|
xy: 200, 3
|
||||||
size: 8, 8
|
size: 8, 8
|
||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
@ -531,28 +566,28 @@ wateredge
|
|||||||
index: -1
|
index: -1
|
||||||
weapon-blaster
|
weapon-blaster
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 180, 3
|
xy: 210, 13
|
||||||
size: 8, 8
|
size: 8, 8
|
||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
weapon-flamethrower
|
weapon-flamethrower
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 190, 13
|
xy: 210, 3
|
||||||
size: 8, 8
|
size: 8, 8
|
||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
weapon-multigun
|
weapon-multigun
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 190, 3
|
xy: 220, 13
|
||||||
size: 8, 8
|
size: 8, 8
|
||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
weapon-trishot
|
weapon-trishot
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 200, 13
|
xy: 220, 3
|
||||||
size: 8, 8
|
size: 8, 8
|
||||||
orig: 8, 8
|
orig: 8, 8
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 7.0 KiB |
@ -358,13 +358,27 @@ icon-distribution
|
|||||||
orig: 10, 10
|
orig: 10, 10
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
icon-production
|
icon-menu
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 383, 2
|
xy: 383, 2
|
||||||
size: 10, 10
|
size: 10, 10
|
||||||
orig: 10, 10
|
orig: 10, 10
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
icon-pause
|
||||||
|
rotate: false
|
||||||
|
xy: 395, 2
|
||||||
|
size: 10, 10
|
||||||
|
orig: 10, 10
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
|
icon-production
|
||||||
|
rotate: false
|
||||||
|
xy: 407, 2
|
||||||
|
size: 10, 10
|
||||||
|
orig: 10, 10
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
icon-rotate
|
icon-rotate
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 405, 15
|
xy: 405, 15
|
||||||
@ -372,6 +386,13 @@ icon-rotate
|
|||||||
orig: 14, 14
|
orig: 14, 14
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
icon-settings
|
||||||
|
rotate: false
|
||||||
|
xy: 419, 2
|
||||||
|
size: 10, 10
|
||||||
|
orig: 10, 10
|
||||||
|
offset: 0, 0
|
||||||
|
index: -1
|
||||||
list-selection
|
list-selection
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 220, 3
|
xy: 220, 3
|
||||||
@ -556,7 +577,7 @@ slider-knob-over
|
|||||||
index: -1
|
index: -1
|
||||||
slider-vertical
|
slider-vertical
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 343, 62
|
xy: 421, 14
|
||||||
size: 8, 1
|
size: 8, 1
|
||||||
orig: 8, 1
|
orig: 8, 1
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
@ -571,14 +592,14 @@ slot
|
|||||||
index: -1
|
index: -1
|
||||||
splitpane
|
splitpane
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 343, 59
|
xy: 431, 14
|
||||||
size: 8, 1
|
size: 8, 1
|
||||||
orig: 8, 1
|
orig: 8, 1
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
splitpane-over
|
splitpane-over
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 343, 56
|
xy: 343, 62
|
||||||
size: 8, 1
|
size: 8, 1
|
||||||
orig: 8, 1
|
orig: 8, 1
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
@ -637,7 +658,7 @@ touchpad-knob
|
|||||||
index: -1
|
index: -1
|
||||||
tree-minus
|
tree-minus
|
||||||
rotate: false
|
rotate: false
|
||||||
xy: 395, 2
|
xy: 431, 2
|
||||||
size: 10, 10
|
size: 10, 10
|
||||||
orig: 10, 10
|
orig: 10, 10
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
|
@ -34,7 +34,7 @@ io.anuke.ucore.scene.ui.TextButton$TextButtonStyle: {
|
|||||||
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: grey }
|
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: grey }
|
||||||
},
|
},
|
||||||
io.anuke.ucore.scene.ui.ImageButton$ImageButtonStyle: {
|
io.anuke.ucore.scene.ui.ImageButton$ImageButtonStyle: {
|
||||||
default: {down: button-down, up: button },
|
default: {down: button-down, up: button, over: button-over },
|
||||||
static: {up: button },
|
static: {up: button },
|
||||||
static-down: {up: button-down },
|
static-down: {up: button-down },
|
||||||
blue: {down: button-blue-down, up: button-blue },
|
blue: {down: button-blue-down, up: button-blue },
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -23,10 +23,10 @@ import io.anuke.ucore.core.*;
|
|||||||
import io.anuke.ucore.entities.Entities;
|
import io.anuke.ucore.entities.Entities;
|
||||||
import io.anuke.ucore.entities.Entity;
|
import io.anuke.ucore.entities.Entity;
|
||||||
import io.anuke.ucore.graphics.Atlas;
|
import io.anuke.ucore.graphics.Atlas;
|
||||||
import io.anuke.ucore.modules.RendererModule;
|
import io.anuke.ucore.modules.ControlModule;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class Control extends RendererModule{
|
public class Control extends ControlModule{
|
||||||
public int rangex = 10, rangey = 10;
|
public int rangex = 10, rangey = 10;
|
||||||
public float targetzoom = 1f;
|
public float targetzoom = 1f;
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@ import io.anuke.ucore.entities.Entity;
|
|||||||
import io.anuke.ucore.graphics.Cache;
|
import io.anuke.ucore.graphics.Cache;
|
||||||
import io.anuke.ucore.graphics.Caches;
|
import io.anuke.ucore.graphics.Caches;
|
||||||
import io.anuke.ucore.scene.utils.Cursors;
|
import io.anuke.ucore.scene.utils.Cursors;
|
||||||
import io.anuke.ucore.util.*;
|
import io.anuke.ucore.util.GridMap;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
public class Renderer{
|
public class Renderer{
|
||||||
private static int chunksize = 32;
|
private static int chunksize = 32;
|
||||||
@ -110,7 +112,7 @@ public class Renderer{
|
|||||||
|
|
||||||
public static void renderPixelOverlay(){
|
public static void renderPixelOverlay(){
|
||||||
|
|
||||||
if(player.recipe != null && (!ui.hasMouse() || android)){
|
if(player.recipe != null && Inventory.hasItems(player.recipe.requirements) && (!ui.hasMouse() || android)){
|
||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
|
|
||||||
|
@ -6,13 +6,12 @@ import static io.anuke.ucore.scene.actions.Actions.*;
|
|||||||
import com.badlogic.gdx.Application.ApplicationType;
|
import com.badlogic.gdx.Application.ApplicationType;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.math.Interpolation;
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import com.badlogic.gdx.utils.Timer;
|
|
||||||
import com.badlogic.gdx.utils.Timer.Task;
|
|
||||||
|
|
||||||
import io.anuke.mindustry.GameState.State;
|
import io.anuke.mindustry.GameState.State;
|
||||||
import io.anuke.mindustry.entities.Weapon;
|
import io.anuke.mindustry.entities.Weapon;
|
||||||
@ -20,21 +19,18 @@ import io.anuke.mindustry.input.AndroidInput;
|
|||||||
import io.anuke.mindustry.resource.*;
|
import io.anuke.mindustry.resource.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.*;
|
||||||
import io.anuke.ucore.function.Listenable;
|
|
||||||
import io.anuke.ucore.function.VisibilityProvider;
|
import io.anuke.ucore.function.VisibilityProvider;
|
||||||
import io.anuke.ucore.graphics.Hue;
|
import io.anuke.ucore.graphics.Hue;
|
||||||
import io.anuke.ucore.graphics.Textures;
|
import io.anuke.ucore.graphics.Textures;
|
||||||
import io.anuke.ucore.modules.SceneModule;
|
import io.anuke.ucore.modules.SceneModule;
|
||||||
import io.anuke.ucore.scene.Element;
|
|
||||||
import io.anuke.ucore.scene.Scene;
|
|
||||||
import io.anuke.ucore.scene.actions.Actions;
|
import io.anuke.ucore.scene.actions.Actions;
|
||||||
import io.anuke.ucore.scene.builders.*;
|
import io.anuke.ucore.scene.builders.*;
|
||||||
import io.anuke.ucore.scene.event.InputEvent;
|
|
||||||
import io.anuke.ucore.scene.ui.*;
|
import io.anuke.ucore.scene.ui.*;
|
||||||
import io.anuke.ucore.scene.ui.layout.*;
|
import io.anuke.ucore.scene.ui.layout.*;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
public class UI extends SceneModule{
|
public class UI extends SceneModule{
|
||||||
Table itemtable, weapontable, tools, loadingtable;
|
Table itemtable, weapontable, tools, loadingtable, desctable;
|
||||||
SettingsDialog prefs;
|
SettingsDialog prefs;
|
||||||
KeybindDialog keys;
|
KeybindDialog keys;
|
||||||
Dialog about, menu, restart, tutorial, levels, upgrades, load;
|
Dialog about, menu, restart, tutorial, levels, upgrades, load;
|
||||||
@ -62,6 +58,10 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
Textures.load("sprites/");
|
Textures.load("sprites/");
|
||||||
Textures.repeatWrap("conveyort", Gdx.app.getType() == ApplicationType.WebGL ? "back-web" : "back");
|
Textures.repeatWrap("conveyort", Gdx.app.getType() == ApplicationType.WebGL ? "back-web" : "back");
|
||||||
|
|
||||||
|
Colors.put("description", Color.WHITE);
|
||||||
|
Colors.put("turretinfo", Color.ORANGE);
|
||||||
|
Colors.put("missingitems", Color.SCARLET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawBackground(){
|
void drawBackground(){
|
||||||
@ -114,7 +114,6 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
//TODO just move these dialogs to different files
|
|
||||||
|
|
||||||
load = new LoadDialog();
|
load = new LoadDialog();
|
||||||
|
|
||||||
@ -146,19 +145,17 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
tutorial = new TutorialDialog();
|
tutorial = new TutorialDialog();
|
||||||
|
|
||||||
restart = new Dialog("The core was destroyed.", "dialog"){
|
restart = new Dialog("The core was destroyed.", "dialog");
|
||||||
public Dialog show(Scene scene){
|
|
||||||
super.show(scene);
|
restart.shown(()->{
|
||||||
restart.content().clearChildren();
|
restart.content().clearChildren();
|
||||||
if(control.isHighScore()){
|
if(control.isHighScore()){
|
||||||
restart.content().add("[YELLOW]New highscore!").pad(6);
|
restart.content().add("[YELLOW]New highscore!").pad(6);
|
||||||
restart.content().row();
|
restart.content().row();
|
||||||
}
|
|
||||||
restart.content().add("You lasted until wave [GREEN]" + control.getWave() + "[].").pad(6);
|
|
||||||
restart.pack();
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
};
|
restart.content().add("You lasted until wave [GREEN]" + control.getWave() + "[].").pad(6);
|
||||||
|
restart.pack();
|
||||||
|
});
|
||||||
|
|
||||||
restart.getButtonTable().addButton("Back to menu", ()->{
|
restart.getButtonTable().addButton("Back to menu", ()->{
|
||||||
restart.hide();
|
restart.hide();
|
||||||
@ -179,10 +176,16 @@ public class UI extends SceneModule{
|
|||||||
new table(){{
|
new table(){{
|
||||||
abottom();
|
abottom();
|
||||||
aright();
|
aright();
|
||||||
|
|
||||||
|
new table("button"){{
|
||||||
|
visible(()->player.recipe != null);
|
||||||
|
desctable = get();
|
||||||
|
fillX();
|
||||||
|
}}.end().uniformX();
|
||||||
|
|
||||||
|
row();
|
||||||
|
|
||||||
new table(){{
|
new table("button"){{
|
||||||
|
|
||||||
get().background("button");
|
|
||||||
|
|
||||||
int rows = 3;
|
int rows = 3;
|
||||||
int maxcol = 0;
|
int maxcol = 0;
|
||||||
@ -202,12 +205,18 @@ public class UI extends SceneModule{
|
|||||||
recipes.clear();
|
recipes.clear();
|
||||||
Recipe.getBy(sec, recipes);
|
Recipe.getBy(sec, recipes);
|
||||||
|
|
||||||
|
Table table = new Table();
|
||||||
|
|
||||||
ImageButton button = new ImageButton("icon-"+sec.name(), "toggle");
|
ImageButton button = new ImageButton("icon-"+sec.name(), "toggle");
|
||||||
|
button.clicked(()->{
|
||||||
|
if(!table.isVisible() && player.recipe != null){
|
||||||
|
player.recipe = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
add(button).fill().height(54).padTop(-10).units(Unit.dp);
|
add(button).fill().height(54).padTop(-10).units(Unit.dp);
|
||||||
button.getImageCell().size(40).padBottom(4).units(Unit.dp);
|
button.getImageCell().size(40).padBottom(4).units(Unit.dp);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
|
|
||||||
Table table = new Table();
|
|
||||||
table.pad(4);
|
table.pad(4);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -216,8 +225,10 @@ public class UI extends SceneModule{
|
|||||||
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
|
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
|
||||||
|
|
||||||
image.clicked(()->{
|
image.clicked(()->{
|
||||||
if(Inventory.hasItems(r.requirements))
|
if(Inventory.hasItems(r.requirements)){
|
||||||
player.recipe = r;
|
player.recipe = r;
|
||||||
|
updateRecipe();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
table.add(image).size(size+8).pad(4).units(Unit.dp);
|
table.add(image).size(size+8).pad(4).units(Unit.dp);
|
||||||
@ -236,67 +247,6 @@ public class UI extends SceneModule{
|
|||||||
table.row();
|
table.row();
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
Table tiptable = new Table();
|
|
||||||
|
|
||||||
Listenable run = ()->{
|
|
||||||
tiptable.clearChildren();
|
|
||||||
|
|
||||||
String description = r.result.description();
|
|
||||||
|
|
||||||
tiptable.background("button");
|
|
||||||
tiptable.add("[PURPLE]" + r.result.name(), 0.75f*fontscale*2f).left().padBottom(2f).units(Unit.dp);
|
|
||||||
|
|
||||||
ItemStack[] req = r.requirements;
|
|
||||||
for(ItemStack s : req){
|
|
||||||
tiptable.row();
|
|
||||||
int amount = Math.min(Inventory.getAmount(s.item), s.amount);
|
|
||||||
tiptable.add(
|
|
||||||
(amount >= s.amount ? "[YELLOW]" : "[RED]")
|
|
||||||
+s.item + ": " + amount + " / " +s.amount, fontscale).left();
|
|
||||||
}
|
|
||||||
|
|
||||||
tiptable.row();
|
|
||||||
tiptable.add().size(10).units(Unit.px);
|
|
||||||
tiptable.row();
|
|
||||||
tiptable.add("[scarlet]Health: " + r.result.health).left();
|
|
||||||
tiptable.row();
|
|
||||||
tiptable.add().size(6).units(Unit.px);
|
|
||||||
tiptable.row();
|
|
||||||
tiptable.add("[ORANGE]" + description).left();
|
|
||||||
tiptable.pad(Unit.dp.inPixels(10f));
|
|
||||||
};
|
|
||||||
|
|
||||||
run.listen();
|
|
||||||
|
|
||||||
Tooltip tip = new Tooltip(tiptable, run){
|
|
||||||
public void enter (InputEvent event, float x, float y, int pointer, Element fromActor) {
|
|
||||||
if(tooltip != this)
|
|
||||||
hideTooltip();
|
|
||||||
Element actor = event.getListenerActor();
|
|
||||||
if (fromActor != null && fromActor.isDescendantOf(actor)) return;
|
|
||||||
setContainerPosition(actor, x, y);
|
|
||||||
manager.enter(this);
|
|
||||||
run.listen();
|
|
||||||
|
|
||||||
tooltip = this;
|
|
||||||
|
|
||||||
if(android){
|
|
||||||
|
|
||||||
Timer.schedule(new Task(){
|
|
||||||
@Override
|
|
||||||
public void run(){
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
}, 1.5f);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
tip.setInstant(true);
|
|
||||||
|
|
||||||
image.addListener(tip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//additional padding
|
//additional padding
|
||||||
@ -336,18 +286,19 @@ public class UI extends SceneModule{
|
|||||||
atop();
|
atop();
|
||||||
aleft();
|
aleft();
|
||||||
|
|
||||||
defaults().size(60).units(Unit.dp);
|
defaults().size(66).units(Unit.dp);
|
||||||
|
|
||||||
new button("M", ()->{
|
//TODO menu buttons!
|
||||||
|
new imagebutton("icon-menu", 40, ()->{
|
||||||
|
showMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
new button("P", ()->{
|
new imagebutton("icon-settings", 40, ()->{
|
||||||
|
prefs.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
new button("S", ()->{
|
new imagebutton("icon-pause", 40, ()->{
|
||||||
|
//TODO pause
|
||||||
});
|
});
|
||||||
|
|
||||||
row();
|
row();
|
||||||
@ -370,7 +321,7 @@ public class UI extends SceneModule{
|
|||||||
new table(){{
|
new table(){{
|
||||||
get().background("button");
|
get().background("button");
|
||||||
|
|
||||||
new label(()->"[YELLOW]Wave " + control.getWave()).scale(fontscale*2f).left();
|
new label(()->"[orange]Wave " + control.getWave()).scale(fontscale*2f).left();
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
@ -385,9 +336,8 @@ public class UI extends SceneModule{
|
|||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
|
|
||||||
//if(Gdx.app.getType() != ApplicationType.Android){
|
|
||||||
//+- table
|
//+- table
|
||||||
//TODO refactor to make this less messy
|
//TODO refactor to make this less messy?
|
||||||
new table(){{
|
new table(){{
|
||||||
aleft();
|
aleft();
|
||||||
abottom();
|
abottom();
|
||||||
@ -408,7 +358,6 @@ public class UI extends SceneModule{
|
|||||||
|
|
||||||
get().setVisible(play);
|
get().setVisible(play);
|
||||||
}}.end();
|
}}.end();
|
||||||
//}
|
|
||||||
|
|
||||||
//menu table
|
//menu table
|
||||||
new table(){{
|
new table(){{
|
||||||
@ -472,7 +421,6 @@ public class UI extends SceneModule{
|
|||||||
}
|
}
|
||||||
|
|
||||||
new table(){{
|
new table(){{
|
||||||
//atop();
|
|
||||||
new table(){{
|
new table(){{
|
||||||
get().background("button");
|
get().background("button");
|
||||||
|
|
||||||
@ -528,6 +476,55 @@ public class UI extends SceneModule{
|
|||||||
build.end();
|
build.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateRecipe(){
|
||||||
|
Recipe recipe = player.recipe;
|
||||||
|
desctable.clear();
|
||||||
|
|
||||||
|
desctable.defaults().left();
|
||||||
|
desctable.left();
|
||||||
|
desctable.pad(12);
|
||||||
|
|
||||||
|
desctable.add(recipe.result.formalName);
|
||||||
|
desctable.row();
|
||||||
|
desctable.addImage(Draw.region(recipe.result.name)).size(8*5).padTop(4);
|
||||||
|
desctable.row();
|
||||||
|
|
||||||
|
desctable.add().pad(2);
|
||||||
|
|
||||||
|
Table requirements = new Table();
|
||||||
|
|
||||||
|
desctable.row();
|
||||||
|
|
||||||
|
desctable.add(requirements);
|
||||||
|
desctable.left();
|
||||||
|
|
||||||
|
for(ItemStack stack : recipe.requirements){
|
||||||
|
ItemStack fs = stack;
|
||||||
|
requirements.addImage(Draw.region("icon-"+stack.item.name())).size(8*3);
|
||||||
|
Label reqlabel = new Label("");
|
||||||
|
|
||||||
|
reqlabel.update(()->{
|
||||||
|
int current = Inventory.getAmount(fs.item);
|
||||||
|
String text = Mathf.clamp(current, 0, stack.amount) + "/" + stack.amount;
|
||||||
|
|
||||||
|
reqlabel.setColor(current < stack.amount ? Colors.get("missingitems") : Color.WHITE);
|
||||||
|
|
||||||
|
reqlabel.setText(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
requirements.add(reqlabel);
|
||||||
|
requirements.row();
|
||||||
|
}
|
||||||
|
|
||||||
|
desctable.row();
|
||||||
|
|
||||||
|
if(recipe.result.description() != null){
|
||||||
|
Label label = new Label(recipe.result.description());
|
||||||
|
label.setWrap(true);
|
||||||
|
desctable.add(label).width(170).padTop(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateWeapons(){
|
public void updateWeapons(){
|
||||||
weapontable.clearChildren();
|
weapontable.clearChildren();
|
||||||
|
|
||||||
|
@ -36,10 +36,7 @@ public class Input{
|
|||||||
|
|
||||||
player.rotation %= 4;
|
player.rotation %= 4;
|
||||||
|
|
||||||
if(player.recipe != null && !Inventory.hasItems(player.recipe.requirements)){
|
//TODO restore cursor when requirements are back
|
||||||
player.recipe = null;
|
|
||||||
Cursors.restoreCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 9; i ++)
|
for(int i = 0; i < 9; i ++)
|
||||||
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && i < control.getWeapons().size){
|
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && i < control.getWeapons().size){
|
||||||
@ -48,7 +45,8 @@ public class Input{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null &&
|
if(Inputs.buttonUp(Buttons.LEFT) && player.recipe != null &&
|
||||||
World.validPlace(World.tilex(), World.tiley(), player.recipe.result) && !ui.hasMouse()){
|
World.validPlace(World.tilex(), World.tiley(), player.recipe.result) && !ui.hasMouse() &&
|
||||||
|
Inventory.hasItems(player.recipe.requirements)){
|
||||||
Tile tile = World.tile(World.tilex(), World.tiley());
|
Tile tile = World.tile(World.tilex(), World.tiley());
|
||||||
|
|
||||||
if(tile == null)
|
if(tile == null)
|
||||||
@ -64,9 +62,8 @@ public class Input{
|
|||||||
for(ItemStack stack : player.recipe.requirements){
|
for(ItemStack stack : player.recipe.requirements){
|
||||||
Inventory.removeItem(stack);
|
Inventory.removeItem(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Inventory.hasItems(player.recipe.requirements)){
|
if(!Inventory.hasItems(player.recipe.requirements)){
|
||||||
player.recipe = null;
|
|
||||||
Cursors.restoreCursor();
|
Cursors.restoreCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ import io.anuke.ucore.entities.Entity;
|
|||||||
*/
|
*/
|
||||||
public class SaveIO{
|
public class SaveIO{
|
||||||
/**Save file version ID. Should be incremented every breaking release.*/
|
/**Save file version ID. Should be incremented every breaking release.*/
|
||||||
private static final int fileVersionID = 4;
|
private static final int fileVersionID = 5;
|
||||||
|
|
||||||
private static FormatProvider provider = null;
|
private static FormatProvider provider = null;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package io.anuke.mindustry.resource;
|
package io.anuke.mindustry.resource;
|
||||||
|
|
||||||
public enum Item{
|
public enum Item{
|
||||||
stone, iron, coal, steel, titanium;
|
stone, iron, coal, steel, titanium, hypanium;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ public class Block{
|
|||||||
protected static TextureRegion temp = new TextureRegion();
|
protected static TextureRegion temp = new TextureRegion();
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
public String formalName;
|
||||||
public boolean solid, update, rotate, breakable;
|
public boolean solid, update, rotate, breakable;
|
||||||
public int health = 40;
|
public int health = 40;
|
||||||
public String shadow = "shadow";
|
public String shadow = "shadow";
|
||||||
@ -38,6 +39,7 @@ public class Block{
|
|||||||
blocks.add(this);
|
blocks.add(this);
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.formalName = name;
|
||||||
this.solid = false;
|
this.solid = false;
|
||||||
this.id = lastid++;
|
this.id = lastid++;
|
||||||
}
|
}
|
||||||
@ -51,7 +53,7 @@ public class Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String description(){
|
public String description(){
|
||||||
return "[no description]";
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String errorMessage(Tile tile){
|
public String errorMessage(Tile tile){
|
||||||
|
@ -95,17 +95,27 @@ public class Blocks{
|
|||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
health = 50;
|
health = 50;
|
||||||
|
formalName = "stone wall";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
ironwall = new Block("ironwall"){{
|
ironwall = new Block("ironwall"){{
|
||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
health = 80;
|
health = 80;
|
||||||
|
formalName = "iron wall";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
steelwall = new Block("steelwall"){{
|
steelwall = new Block("steelwall"){{
|
||||||
solid = true;
|
solid = true;
|
||||||
update = true;
|
update = true;
|
||||||
health = 100;
|
health = 110;
|
||||||
|
formalName = "steel wall";
|
||||||
|
}},
|
||||||
|
|
||||||
|
titaniumwall = new Block("titaniumwall"){{
|
||||||
|
solid = true;
|
||||||
|
update = true;
|
||||||
|
health = 140;
|
||||||
|
formalName = "titanium wall";
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class Conveyor extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String description(){
|
public String description(){
|
||||||
return "Moves Items";
|
return "Moves items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,6 +40,7 @@ public class ProductionBlocks{
|
|||||||
steelconveyor = new Conveyor("steelconveyor"){{
|
steelconveyor = new Conveyor("steelconveyor"){{
|
||||||
update = true;
|
update = true;
|
||||||
speed = 0.04f;
|
speed = 0.04f;
|
||||||
|
formalName = "steel conveyor";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
router = new Block("router"){
|
router = new Block("router"){
|
||||||
@ -131,29 +132,47 @@ public class ProductionBlocks{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
crucible = new Crafter("crucible"){
|
||||||
|
{
|
||||||
|
health = 90;
|
||||||
|
requirements = new Item[]{Item.titanium, Item.steel};
|
||||||
|
result = Item.hypanium;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description(){
|
||||||
|
return "Takes in steel + titanium, outputs hypanium.";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
stonedrill = new Drill("stonedrill"){{
|
stonedrill = new Drill("stonedrill"){{
|
||||||
resource = Blocks.stone;
|
resource = Blocks.stone;
|
||||||
result = Item.stone;
|
result = Item.stone;
|
||||||
|
formalName = "stone drill";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
irondrill = new Drill("irondrill"){{
|
irondrill = new Drill("irondrill"){{
|
||||||
resource = Blocks.iron;
|
resource = Blocks.iron;
|
||||||
result = Item.iron;
|
result = Item.iron;
|
||||||
|
formalName = "iron drill";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
coaldrill = new Drill("coaldrill"){{
|
coaldrill = new Drill("coaldrill"){{
|
||||||
resource = Blocks.coal;
|
resource = Blocks.coal;
|
||||||
result = Item.coal;
|
result = Item.coal;
|
||||||
|
formalName = "coal drill";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
titaniumdrill = new Drill("titaniumdrill"){{
|
titaniumdrill = new Drill("titaniumdrill"){{
|
||||||
resource = Blocks.titanium;
|
resource = Blocks.titanium;
|
||||||
result = Item.titanium;
|
result = Item.titanium;
|
||||||
|
formalName = "titanium drill";
|
||||||
}},
|
}},
|
||||||
|
|
||||||
omnidrill = new Drill("omnidrill"){
|
omnidrill = new Drill("omnidrill"){
|
||||||
{
|
{
|
||||||
time = 4;
|
time = 4;
|
||||||
|
formalName = "omnidrill";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,6 +64,6 @@ public class RepairTurret extends Turret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String description(){
|
public String description(){
|
||||||
return "[green]Range: " + (int)range + "\n[orange]Heals nearby tiles.";
|
return "[turretinfo]Range: " + (int)range + "\n[description]Heals nearby tiles.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class Turret extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String description(){
|
public String description(){
|
||||||
return "[green]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + bullet.damage;
|
return "[turretinfo]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + bullet.damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
turret = new Turret("turret"){
|
turret = new Turret("turret"){
|
||||||
{
|
{
|
||||||
|
formalName = "turret";
|
||||||
range = 50;
|
range = 50;
|
||||||
reload = 10f;
|
reload = 10f;
|
||||||
bullet = BulletType.stone;
|
bullet = BulletType.stone;
|
||||||
@ -21,6 +22,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
doubleturret = new Turret("doubleturret"){
|
doubleturret = new Turret("doubleturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "double turret";
|
||||||
range = 40;
|
range = 40;
|
||||||
reload = 13f;
|
reload = 13f;
|
||||||
bullet = BulletType.stone;
|
bullet = BulletType.stone;
|
||||||
@ -42,6 +44,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
machineturret = new Turret("machineturret"){
|
machineturret = new Turret("machineturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "gattling turret";
|
||||||
range = 65;
|
range = 65;
|
||||||
reload = 7f;
|
reload = 7f;
|
||||||
bullet = BulletType.iron;
|
bullet = BulletType.iron;
|
||||||
@ -52,6 +55,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
shotgunturret = new Turret("shotgunturret"){
|
shotgunturret = new Turret("shotgunturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "splitter turret";
|
||||||
range = 50;
|
range = 50;
|
||||||
reload = 30f;
|
reload = 30f;
|
||||||
bullet = BulletType.iron;
|
bullet = BulletType.iron;
|
||||||
@ -73,6 +77,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
flameturret = new Turret("flameturret"){
|
flameturret = new Turret("flameturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "flamer turret";
|
||||||
range = 35f;
|
range = 35f;
|
||||||
reload = 5f;
|
reload = 5f;
|
||||||
bullet = BulletType.flame;
|
bullet = BulletType.flame;
|
||||||
@ -83,6 +88,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
sniperturret = new Turret("sniperturret"){
|
sniperturret = new Turret("sniperturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "railgun turret";
|
||||||
range = 120;
|
range = 120;
|
||||||
reload = 60f;
|
reload = 60f;
|
||||||
bullet = BulletType.sniper;
|
bullet = BulletType.sniper;
|
||||||
@ -93,6 +99,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
repairturret = new RepairTurret("repairturret"){
|
repairturret = new RepairTurret("repairturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "heal turret";
|
||||||
range = 30;
|
range = 30;
|
||||||
reload = 40f;
|
reload = 40f;
|
||||||
health = 60;
|
health = 60;
|
||||||
@ -101,6 +108,7 @@ public class WeaponBlocks{
|
|||||||
|
|
||||||
megarepairturret = new RepairTurret("megarepairturret"){
|
megarepairturret = new RepairTurret("megarepairturret"){
|
||||||
{
|
{
|
||||||
|
formalName = "heal turret II";
|
||||||
range = 50;
|
range = 50;
|
||||||
reload = 20f;
|
reload = 20f;
|
||||||
health = 90;
|
health = 90;
|
||||||
|