Mobile placement guide / Bugfixes / Switched mobile test to arg

This commit is contained in:
Anuken 2018-07-02 13:06:52 -04:00
parent e9436426b7
commit cf0a25fdfc
9 changed files with 101 additions and 4 deletions

View file

@ -22,6 +22,27 @@ text.level.delete.title=Confirm Delete
text.map.delete=Are you sure you want to delete the map "[orange]{0}[]"?
text.level.select=Level Select
text.level.mode=Gamemode:
text.construction.title=Block Construction Guide
text.construction=\
You've just selected [accent]block construction mode[].\n\n\
To begin placing, simply tap a valid location near your ship.\n\
Once you have selected some blocks, press the checkbox to confirm, and your ship will begin constructing them.\n\
\n\
- [accent]Remove blocks[] from your selection by tapping them.\n\
- [accent]Shift the selection[] by holding and dragging any block in the selection.\n\
- [accent]Place blocks in a line[] by tapping and holding an empty spot, then dragging in a direction.\n\
- [accent]Cancel construction or selection[] by pressing the X at the bottom left.
text.deconstruction.title=Block Deconstruction Guide
text.deconstruction=\
You've just selected [accent]block deconstruction mode[].\n\n\
To begin breaking, simply tap a block near your ship.\n\
Once you have selected some blocks, press the checkbox to confirm, and your ship will begin de-constructing them.\n\
\n\
- [accent]Remove blocks[] from your selection by tapping them.\n\
- [accent]Remove blocks in an area[] by tapping and holding an empty spot, then dragging in a direction.\n\
- [accent]Cancel deconstruction or selection[] by pressing the X at the bottom left.
text.showagain=Don't show again next session
text.unlocks=Unlocks
text.savegame=Save Game
text.loadgame=Load Game
@ -417,6 +438,10 @@ text.item.radioactivity=[LIGHT_GRAY]Radioactivity: {0}
text.item.fluxiness=[LIGHT_GRAY]Flux Power: {0}
text.item.hardness=[LIGHT_GRAY]Hardness: {0}
text.liquid.heatcapacity=[LIGHT_GRAY]Heat Capacity: {0}
text.liquid.viscosity=[LIGHT_GRAY]Viscosity: {0}
text.liquid.temperature=[LIGHT_GRAY]Temperature: {0}
block.tungsten-wall.name=Tungsten Wall
block.tungsten-wall-large.name=Large Tungsten Wall
block.carbide-wall.name=Carbide Wall

View file

@ -27,7 +27,7 @@ import io.anuke.ucore.util.OS;
import java.util.Locale;
public class Vars{
public static final boolean testMobile = false;
public static boolean testMobile;
//shorthand for whether or not this is running on android or ios
public static boolean mobile;
public static boolean ios;

View file

@ -49,7 +49,7 @@ public class Liquids implements ContentList {
cryofluid = new Liquid("cryofluid", Color.SKY) {
{
heatCapacity = 0.75f;
temperature = 0.5f;
temperature = 0.4f;
tier = 1;
effect = StatusEffects.freezing;
}

View file

@ -6,8 +6,9 @@ public enum Difficulty {
easy(4f, 2f, 1f),
normal(2f, 1f, 1f),
hard(1.5f, 0.5f, 0.75f),
insane(0.5f, 0.25f, 0.5f),
purge(0.25f, 0.01f, 0.25f);
insane(0.5f, 0.25f, 0.5f);
//purge removed due to new wave system
/*purge(0.25f, 0.01f, 0.25f)*/;
/**The scaling of how many waves it takes for one more enemy of a type to appear.
* For example: with enemeyScaling = 2 and the default scaling being 2, it would take 4 waves for

View file

@ -10,6 +10,7 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.core.GameState.State;
@ -22,6 +23,7 @@ import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.input.PlaceUtils.NormalizeDrawResult;
import io.anuke.mindustry.input.PlaceUtils.NormalizeResult;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.*;
@ -49,6 +51,8 @@ public class AndroidInput extends InputHandler implements GestureListener{
private Vector2 vector = new Vector2();
private float initzoom = -1;
private boolean zoomed = false;
/**Set of completed guides.*/
private ObjectSet<String> guides = new ObjectSet<>();
/**Position where the player started dragging a line.*/
private int lineStartX, lineStartY;
@ -182,6 +186,22 @@ public class AndroidInput extends InputHandler implements GestureListener{
}
}
void showGuide(String type){
if(!guides.contains(type) && !Settings.getBool(type, false)){
FloatingDialog dialog = new FloatingDialog("$text." + type + ".title");
dialog.addCloseButton();
dialog.content().left();
dialog.content().add("$text." + type).growX().wrap();
dialog.content().row();
dialog.content().addCheck("$text.showagain", false, checked -> {
Settings.putBool(type, checked);
Settings.save();
}).growX().left();
dialog.show();
guides.add(type);
}
}
//endregion
//region UI and drawing
@ -213,6 +233,9 @@ public class AndroidInput extends InputHandler implements GestureListener{
new imagebutton("icon-break", "toggle", 16 * 2f, () -> {
mode = mode == breaking ? recipe == null ? none : placing : breaking;
lastRecipe = recipe;
if(mode == breaking){
showGuide("deconstruction");
}
}).update(l -> l.setChecked(mode == breaking));
}}.end();
@ -264,6 +287,11 @@ public class AndroidInput extends InputHandler implements GestureListener{
return selection.size > 0 || removals.size > 0 || lineMode || player.target != null;
}
@Override
public boolean isPlacing() {
return super.isPlacing() && mode == placing;
}
@Override
public void drawOutlined(){
@ -567,6 +595,10 @@ public class AndroidInput extends InputHandler implements GestureListener{
mode = placing;
}
if(recipe != null){
showGuide("construction");
}
//automatically switch to placing after a new recipe is selected
if(lastRecipe != recipe && mode == breaking && recipe != null){
mode = placing;

View file

@ -16,6 +16,7 @@ public class Liquid implements UnlockableContent{
public final Color color;
public final String name;
public final String description;
public final int id;
/**0-1, 0 is completely inflammable, anything above that may catch fire when exposed to heat, 0.5+ is very flammable.*/
@ -42,6 +43,7 @@ public class Liquid implements UnlockableContent{
this.color = new Color(color);
this.id = liquids.size;
this.description = Bundles.getOrNull("liquid." + name + ".description");
Liquid.liquids.add(this);
}

View file

@ -106,6 +106,37 @@ public class ContentDisplay {
public static void displayLiquid(Table table, Liquid liquid){
table.table(title -> {
title.addImage(liquid.getContentIcon()).size(8 * 6);
title.add("[accent]" + liquid.localizedName()).padLeft(5);
});
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
if(liquid.description != null){
table.add(liquid.description).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row();
table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX();
table.row();
}
table.left().defaults().fillX();
table.add(Bundles.format("text.item.explosiveness", (int)(liquid.explosiveness * 100)));
table.row();
table.add(Bundles.format("text.item.flammability", (int)(liquid.flammability * 100)));
table.row();
table.add(Bundles.format("text.liquid.heatcapacity", (int)(liquid.heatCapacity * 100)));
table.row();
table.add(Bundles.format("text.liquid.temperature", (int)(liquid.temperature * 100)));
table.row();
table.add(Bundles.format("text.liquid.viscosity", (int)(liquid.viscosity * 100)));
table.row();
}
public static void displayMech(Table table, Mech mech){

View file

@ -18,6 +18,8 @@ public class LoadingFragment implements Fragment {
public void build(Group parent) {
table = new table("loadDim"){{
add().height(70f).row();
touchable(Touchable.enabled);
get().addImage("white").growX()
.height(3f).pad(4f).growX().get().setColor(Palette.accent);

View file

@ -4,8 +4,10 @@ import club.minnced.discord.rpc.DiscordEventHandlers;
import club.minnced.discord.rpc.DiscordRPC;
import club.minnced.discord.rpc.DiscordRichPresence;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Base64Coder;
import io.anuke.kryonet.DefaultThreadImpl;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
@ -34,6 +36,8 @@ public class DesktopPlatform extends Platform {
public DesktopPlatform(String[] args){
this.args = args;
Vars.testMobile = Array.with(args).contains("-testMobile", false);
if(useDiscord) {
DiscordEventHandlers handlers = new DiscordEventHandlers();
DiscordRPC.INSTANCE.Discord_Initialize(applicationId, handlers, true, "");