Renamed 'android' usage to 'mobile'

This commit is contained in:
Anuken
2018-04-28 11:22:35 -04:00
parent 0db22f2cff
commit cbbd5ffc62
27 changed files with 55 additions and 50 deletions

View File

@@ -23,10 +23,12 @@ import java.util.Locale;
public class Vars{
public static final boolean testAndroid = false;
public static final boolean testMobile = false;
//shorthand for whether or not this is running on android
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) ||
Gdx.app.getType() == ApplicationType.iOS|| testAndroid;
public static final boolean mobile = (Gdx.app.getType() == ApplicationType.Android) ||
Gdx.app.getType() == ApplicationType.iOS || testMobile;
public static final boolean ios = Gdx.app.getType() == ApplicationType.iOS;
public static final boolean android = Gdx.app.getType() == ApplicationType.Android;
//shorthand for whether or not this is running on GWT
public static final boolean gwt = (Gdx.app.getType() == ApplicationType.WebGL);
//whether to send block state change events to players
@@ -36,7 +38,7 @@ public class Vars{
//respawn time in frames
public static final float respawnduration = 60*4;
//time between waves in frames (on normal mode)
public static final float wavespace = 60*60*(android ? 1 : 1);
public static final float wavespace = 60*60*(mobile ? 1 : 1);
//waves can last no longer than 3 minutes, otherwise the next one spawns
public static final float maxwavespace = 60*60*4f;
//advance time the pathfinding starts at

View File

@@ -57,7 +57,7 @@ public class Control extends Module{
Gdx.input.setCatchBackKey(true);
if(android){
if(mobile){
input = new AndroidInput();
}else{
input = new DesktopInput();
@@ -115,7 +115,7 @@ public class Control extends Module{
Settings.defaultList(
"ip", "localhost",
"port", port+"",
"name", android || gwt ? "player" : UCore.getProperty("user.name"),
"name", mobile || gwt ? "player" : UCore.getProperty("user.name"),
"servers", "",
"color", Color.rgba8888(playerColors[8]),
"lastVersion", "3.2",
@@ -130,7 +130,7 @@ public class Control extends Module{
player = new Player();
player.name = Settings.getString("name");
player.isAndroid = android;
player.isAndroid = mobile;
player.color.set(Settings.getInt("color"));
player.isLocal = true;

View File

@@ -69,7 +69,7 @@ public class NetClient extends Module {
ConnectPacket c = new ConnectPacket();
c.name = player.name;
c.android = android;
c.android = mobile;
c.color = Color.rgba8888(player.color);
c.uuid = Platform.instance.getUUID();

View File

@@ -121,7 +121,7 @@ public class Renderer extends RendererModule{
if(!smoothcam){
setCamera(player.x, player.y);
}else{
smoothCamera(player.x, player.y, android ? 0.3f : 0.14f);
smoothCamera(player.x, player.y, mobile ? 0.3f : 0.14f);
}
}else{
smoothCamera(world.getCore().worldx(), world.getCore().worldy(), 0.4f);
@@ -137,7 +137,7 @@ public class Renderer extends RendererModule{
float deltax = camera.position.x - prex, deltay = camera.position.y - prey;
if(android){
if(mobile){
player.x += camera.position.x - prevx;
player.y += camera.position.y - prevy;
}
@@ -403,7 +403,7 @@ public class Renderer extends RendererModule{
int tilex = control.input().getBlockX();
int tiley = control.input().getBlockY();
if(android){
if(mobile){
Vector2 vec = Graphics.world(Gdx.input.getX(0), Gdx.input.getY(0));
tilex = Mathf.scl2(vec.x, tilesize);
tiley = Mathf.scl2(vec.y, tilesize);
@@ -412,7 +412,7 @@ public class Renderer extends RendererModule{
InputHandler input = control.input();
//draw placement box
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || android)
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || mobile)
&& control.input().drawPlace())){
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(),
@@ -434,7 +434,7 @@ public class Renderer extends RendererModule{
}else if(input.breakMode.delete && control.input().drawPlace()
&& (input.recipe == null || !state.inventory.hasItems(input.recipe.requirements))
&& (input.placeMode.delete || input.breakMode.both || !android)){
&& (input.placeMode.delete || input.breakMode.both || !mobile)){
if(input.breakMode == PlaceMode.holdDelete)
input.breakMode.draw(tilex, tiley, 0, 0);

View File

@@ -1,7 +1,6 @@
package io.anuke.mindustry.game;
import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
@@ -102,7 +101,7 @@ public class Tutorial{
if(current < 0 || current >= Stage.values().length){
break;
}else if(android == Stage.values()[current].androidOnly || android != Stage.values()[current].desktopOnly){
}else if(mobile == Stage.values()[current].androidOnly || mobile != Stage.values()[current].desktopOnly){
stage = Stage.values()[current];
stage.onSwitch();
break;
@@ -119,7 +118,7 @@ public class Tutorial{
if(current < 0 || current >= Stage.values().length){
return false;
}else if(android == Stage.values()[current].androidOnly || android != Stage.values()[current].desktopOnly){
}else if(mobile == Stage.values()[current].androidOnly || mobile != Stage.values()[current].desktopOnly){
return true;
}
}

View File

@@ -292,7 +292,7 @@ public class BlockRenderer{
public void handlePreview(Block block, float rotation, float drawx, float drawy, int tilex, int tiley) {
if(control.input().recipe != null && state.inventory.hasItems(control.input().recipe.requirements)
&& control.input().validPlace(tilex, tiley, block) && (android || control.input().cursorNear())) {
&& control.input().validPlace(tilex, tiley, block) && (mobile || control.input().cursorNear())) {
if(block.isMultiblock()) {
float halfBlockWidth = (block.width * tilesize) / 2;

View File

@@ -20,8 +20,8 @@ public abstract class InputHandler extends InputAdapter{
public float breaktime = 0;
public Recipe recipe;
public int rotation;
public PlaceMode placeMode = android ? PlaceMode.cursor : PlaceMode.hold;
public PlaceMode breakMode = android ? PlaceMode.none : PlaceMode.holdDelete;
public PlaceMode placeMode = mobile ? PlaceMode.cursor : PlaceMode.hold;
public PlaceMode breakMode = mobile ? PlaceMode.none : PlaceMode.holdDelete;
public PlaceMode lastPlaceMode = placeMode;
public PlaceMode lastBreakMode = breakMode;

View File

@@ -28,7 +28,7 @@ public enum PlaceMode{
float x = tilex * tilesize;
float y = tiley * tilesize;
boolean valid = control.input().validPlace(tilex, tiley, control.input().recipe.result) && (android || control.input().cursorNear());
boolean valid = control.input().validPlace(tilex, tiley, control.input().recipe.result) && (mobile || control.input().cursorNear());
Vector2 offset = control.input().recipe.result.getPlaceOffset();
@@ -89,7 +89,7 @@ public enum PlaceMode{
tile = tile.getLinked();
float fin = control.input().breaktime / tile.getBreakTime();
if(android && control.input().breaktime > 0){
if(mobile && control.input().breaktime > 0){
Draw.color(Colors.get("breakStart"), Colors.get("break"), fin);
Lines.poly(tile.drawx(), tile.drawy(), 25, 4 + (1f - fin) * 26);
}
@@ -170,7 +170,7 @@ public enum PlaceMode{
tilex = this.tilex; tiley = this.tiley;
endx = this.endx; endy = this.endy;
if(android){
if(mobile){
ToolFragment t = ui.toolfrag;
if(!t.confirming || t.px != tilex || t.py != tiley || t.px2 != endx || t.py2 != endy) {
t.confirming = true;
@@ -236,7 +236,7 @@ public enum PlaceMode{
}
public void draw(int tilex, int tiley, int endx, int endy){
if(android && !Gdx.input.isTouched(0) && !control.showCursor()){
if(mobile && !Gdx.input.isTouched(0) && !control.showCursor()){
return;
}

View File

@@ -114,7 +114,7 @@ public class Save12 extends SaveFileVersion {
state.wave = wave;
state.wavetime = wavetime;
if(!android)
if(!mobile)
Vars.player.add();
//map

View File

@@ -118,7 +118,7 @@ public class Save13 extends SaveFileVersion {
state.wave = wave;
state.wavetime = wavetime;
if(!android)
if(!mobile)
Vars.player.add();
//map

View File

@@ -132,7 +132,7 @@ public class Save14 extends SaveFileVersion{
state.wave = wave;
state.wavetime = wavetime;
if(!android)
if(!mobile)
Vars.player.add();
//map

View File

@@ -148,7 +148,7 @@ public class Save15 extends SaveFileVersion {
state.wave = wave;
state.wavetime = wavetime;
if(!android && !headless)
if(!mobile && !headless)
player.add();
//map

View File

@@ -85,7 +85,7 @@ public class MapEditorDialog extends Dialog{
Pixmaps.write(editor.pixmap(), result);
}catch (Exception e){
ui.showError(Bundles.format("text.editor.errorimagesave", Strings.parseException(e, false)));
if(!android) Log.err(e);
if(!mobile) Log.err(e);
}
ui.loadfrag.hide();
});

View File

@@ -105,7 +105,7 @@ public class Recipes {
public static Array<Recipe> getBy(Section section, Array<Recipe> r){
for(Recipe recipe : list){
if(recipe.section == section && !(Vars.android && recipe.desktopOnly))
if(recipe.section == section && !(Vars.mobile && recipe.desktopOnly))
r.add(recipe);
}

View File

@@ -44,6 +44,11 @@ public class ChangelogDialog extends FloatingDialog{
table.row();
table.add("$text.changelog.error.android").padTop(8);
}
if(Vars.ios){
table.row();
table.add("$text.changelog.error.ios").padTop(8);
}
}else{
for(VersionInfo info : versions){
Table in = new Table("clear");

View File

@@ -35,7 +35,7 @@ public class PausedDialog extends FloatingDialog{
if(!Net.active()) state.set(State.paused);
});
if(!android){
if(!mobile){
content().defaults().width(220).height(50);
content().addButton("$text.back", () -> {

View File

@@ -85,7 +85,7 @@ public class SettingsMenuDialog extends SettingsDialog{
menu.addButton("$text.settings.graphics", () -> visible(1));
menu.row();
menu.addButton("$text.settings.sound", () -> visible(2));
if(!Vars.android) {
if(!Vars.mobile) {
menu.row();
menu.addButton("$text.settings.controls", ui.controls::show);
}
@@ -143,7 +143,7 @@ public class SettingsMenuDialog extends SettingsDialog{
}
}
if(!android && !gwt) {
if(!mobile && !gwt) {
graphics.checkPref("vsync", true, b -> Gdx.graphics.setVSync(b));
graphics.checkPref("fullscreen", false, b -> {
if (b) {

View File

@@ -186,7 +186,7 @@ public class BlocksFragment implements Fragment{
row();
if(!android) {
if(!mobile) {
weapons = new table("button").margin(0).fillX().end().get();
}
@@ -199,7 +199,7 @@ public class BlocksFragment implements Fragment{
}
public void updateWeapons(){
if(android) return;
if(mobile) return;
weapons.clearChildren();
weapons.left();

View File

@@ -107,12 +107,12 @@ public class ChatFragment extends Table implements Fragment{
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
if(Vars.android) {
if(Vars.mobile) {
marginBottom(105f);
marginRight(240f);
}
if(Vars.android) {
if(Vars.mobile) {
addImageButton("icon-arrow-right", 14 * 2, this::toggle).size(46f, 51f).visible(() -> chatOpen).pad(2f);
}
}

View File

@@ -66,14 +66,14 @@ public class HudFragment implements Fragment{
}).get();
new imagebutton("icon-pause", isize, () -> {
if(android) DebugFragment.printDebugInfo();
if (Net.active() && android) {
if(mobile) DebugFragment.printDebugInfo();
if (Net.active() && mobile) {
ui.listfrag.visible = !ui.listfrag.visible;
} else {
state.set(state.is(State.paused) ? State.playing : State.paused);
}
}).update(i -> {
if (Net.active() && android) {
if (Net.active() && mobile) {
i.getStyle().imageUp = Core.skin.getDrawable("icon-players");
} else {
i.setDisabled(Net.active());
@@ -82,7 +82,7 @@ public class HudFragment implements Fragment{
}).get();
new imagebutton("icon-settings", isize, () -> {
if (Net.active() && android) {
if (Net.active() && mobile) {
if (ui.chatfrag.chatOpen()) {
ui.chatfrag.hide();
} else {
@@ -92,7 +92,7 @@ public class HudFragment implements Fragment{
ui.settings.show();
}
}).update(i -> {
if (Net.active() && android) {
if (Net.active() && mobile) {
i.getStyle().imageUp = Core.skin.getDrawable("icon-chat");
} else {
i.getStyle().imageUp = Core.skin.getDrawable("icon-settings");

View File

@@ -18,7 +18,7 @@ public class MenuFragment implements Fragment{
new table(){{
visible(() -> state.is(State.menu));
if(!android){
if(!mobile){
new table(){{
float w = 200f;

View File

@@ -29,7 +29,7 @@ public class PlacementFragment implements Fragment{
Label modelabel;
public void build(){
if(!android) return;
if(!mobile) return;
InputHandler input = control.input();

View File

@@ -63,7 +63,7 @@ public class PlayerListFragment implements Fragment{
}}.end();
update(t -> {
if(!android){
if(!mobile){
visible = Inputs.keyDown("player_list");
}
if(!(Net.active() && !state.is(State.menu))){

View File

@@ -11,8 +11,6 @@ import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.scene.ui.layout.Table;
import static io.anuke.mindustry.Vars.*;
public class ToolFragment implements Fragment{
private Table tools;
public int px, py, px2, py2;
@@ -50,7 +48,7 @@ public class ToolFragment implements Fragment{
Core.scene.add(tools);
tools.setVisible(() ->
!state.is(State.menu) && android && ((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) &&
!state.is(State.menu) && mobile && ((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) &&
input.placeMode == PlaceMode.cursor) || confirming)
);

View File

@@ -77,7 +77,7 @@ public class WorldGenerator {
}
if(color == Hue.rgb(Color.PURPLE)){
if(!Vars.android) new Enemy(EnemyTypes.target).set(x * tilesize, y * tilesize).add();
if(!Vars.mobile) new Enemy(EnemyTypes.target).set(x * tilesize, y * tilesize).add();
floor = Blocks.stone;
}

View File

@@ -29,7 +29,7 @@ public class WeaponFactory extends Block{
@Override
public boolean isConfigurable(Tile tile){
return !Vars.android;
return !Vars.mobile;
}
@Override