iOS fixes

This commit is contained in:
Anuken
2018-04-27 23:42:59 -04:00
parent d8d8552176
commit 8cc3a865e2
11 changed files with 102 additions and 69 deletions

View File

@@ -25,7 +25,8 @@ public class Vars{
public static final boolean testAndroid = false;
//shorthand for whether or not this is running on android
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) ||
Gdx.app.getType() == ApplicationType.iOS|| testAndroid;
//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

View File

@@ -1,12 +1,15 @@
package io.anuke.mindustry.io;
import com.badlogic.gdx.utils.Base64Coder;
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.entities.Entity;
import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.scene.ui.TextField;
import java.util.Date;
import java.util.Locale;
import java.util.Random;
public abstract class Platform {
public static Platform instance = new Platform() {};
@@ -31,7 +34,18 @@ public abstract class Platform {
}
public boolean isDebug(){return false;}
/**Must be 8 bytes in length.*/
public byte[] getUUID(){return null;}
public byte[] getUUID(){
String uuid = Settings.getString("uuid", "");
if(uuid.isEmpty()){
byte[] result = new byte[8];
new Random().nextBytes(result);
uuid = new String(Base64Coder.encode(result));
Settings.putString("uuid", uuid);
Settings.save();
return result;
}
return Base64Coder.decode(uuid);
}
public ThreadProvider getThreadProvider(){
return new ThreadProvider() {
@Override public boolean isOnThread() {return true;}