All web version bugs fixed

This commit is contained in:
Anuken
2018-07-31 12:57:34 -04:00
parent cc23378758
commit f3b976bdd1
16 changed files with 29 additions and 35 deletions

View File

@ -24,7 +24,6 @@ dependencies {
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-ai:$aiVersion"
implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
}

View File

@ -26,7 +26,6 @@ allprojects {
appName = 'Mindustry'
gdxVersion = '1.9.8'
roboVMVersion = '2.3.0'
aiVersion = '1.8.1'
uCoreVersion = '239e6a5bad'
getVersionString = {
@ -112,7 +111,6 @@ project(":html") {
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"

View File

@ -11,8 +11,6 @@ text.link.wiki.description=official Mindustry wiki
text.linkfail=Failed to open link!\nThe URL has been copied to your cliboard.
text.editor.web=The web version does not support the editor!\nDownload the game to use it.
text.web.unsupported=The web version does not support this feature! Download the game to use it.
text.multiplayer.web=The web version of the game does not support multiplayer!\nUse the downloadable PC, Android or iOS versions.
text.host.web=The web version does not support hosting games! Download the game to use this feature.
text.gameover=Your core has been destroyed
text.sector.gameover=This sector has been lost. Re-deploy?
text.sector.retry=Retry
@ -87,7 +85,7 @@ text.server.kicked.nameInUse=There is someone with that name\nalready on this se
text.server.kicked.nameEmpty=Your name must contain at least one character or number.
text.server.kicked.idInUse=You are already on this server! Connecting with two accounts is not permitted.
text.server.kicked.customClient=This server does not support custom builds. Download an official version.
text.host.info=The [accent]host[] button hosts a server on ports [scarlet]6567[] and [scarlet]6568.[]\nAnybody on the same [LIGHT_GRAY]wifi or local network[] should be able to see your server in their server list.\n\nIf you want people to be able to connect from anywhere by IP, [accent]port forwarding[] is required.\n\n[LIGHT_GRAY]Note: If someone is experiencing trouble connecting to your LAN game, make sure you have allowed Mindustry access to your local network in your firewall settings.
text.host.info=The [accent]host[] button hosts a server on port [scarlet]6567[]. \nAnybody on the same [LIGHT_GRAY]wifi or local network[] should be able to see your server in their server list.\n\nIf you want people to be able to connect from anywhere by IP, [accent]port forwarding[] is required.\n\n[LIGHT_GRAY]Note: If someone is experiencing trouble connecting to your LAN game, make sure you have allowed Mindustry access to your local network in your firewall settings.
text.join.info=Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[LIGHT_GRAY]Note: There is no automatic global server list; if you want to connect to someone by IP, you would need to ask the host for their IP.
text.hostserver=Host Server
text.host=Host
@ -531,8 +529,10 @@ unit.drone.description=The starter drone unit. Spawns in the core by default. Au
unit.fabricator.name=Fabricator
unit.fabricator.description=An advanced drone unit. Automatically mines ores, collects items and repairs blocks. Significantly more effective than a drone.
unit.scout.name=Scout
unit.scout.description=A basic ground unit. Uses tungsten as ammo.
unit.scout.description=A basic ground unit. Uses lead as ammo.
unit.titan.name=Titan
unit.titan.description=An advanced armored ground unit. Uses carbide as ammo. Attacks both ground and air targets.
unit.monsoon.name=Monsoon
unit.monsoon.description=A heavy carpet bomber. Uses blast compound or pyratite as ammo.
unit.monsoon.description=A heavy carpet bomber. Uses blast compound or pyratite as ammo.
unit.interceptor.name=Interceptor
unit.interceptor.description=A fast, hit-and-run strike unit. Uses lead as ammo.

View File

@ -19,4 +19,6 @@
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.world.meta.BlockBar"/>
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.maps.generation.WorldGenerator"/>
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.entities.StatusController"/>
<extend-configuration-property name="gdx.reflect.include" value="io.anuke.mindustry.maps.Sector"/>
<extend-configuration-property name="gdx.reflect.include" value="com.badlogic.gdx.utils.Predicate"/>
</module>

View File

@ -138,8 +138,6 @@ public class Vars{
String code = stra[i];
if(code.contains("_")){
locales[i] = new Locale(code.split("_")[0], code.split("_")[1]);
}else if(code.contains("-")){
locales[i] = new Locale(code.split("-")[0], code.split("-")[1]);
}else{
locales[i] = new Locale(code);
}

View File

@ -43,10 +43,6 @@ public abstract class Platform {
public String getLocaleName(Locale locale){
return locale.toString();
}
/**Whether joining games is supported.*/
public boolean canJoinGame(){
return true;
}
/**Whether debug mode is enabled.*/
public boolean isDebug(){return false;}
/**Must be a base64 string 8 bytes in length.*/

View File

@ -214,7 +214,7 @@ public class Saves{
}
public boolean isAutosave(){
return Settings.getBool("save-" + index + "-autosave", !gwt);
return Settings.getBool("save-" + index + "-autosave", true);
}
public void setAutosave(boolean save){

View File

@ -62,7 +62,7 @@ public class FogRenderer implements Disposable{
}
}
pixelBuffer = ByteBuffer.allocateDirect(world.width() * world.height() * 3);
pixelBuffer = ByteBuffer.allocateDirect(world.width() * world.height() * 4);
dirty = true;
});
@ -79,7 +79,7 @@ public class FogRenderer implements Disposable{
buffer.begin();
pixelBuffer.position(0);
Gdx.gl.glPixelStorei(GL20.GL_PACK_ALIGNMENT, 1);
Gdx.gl.glReadPixels(padding, padding, world.width(), world.height(), GL20.GL_RGB, GL20.GL_UNSIGNED_BYTE, pixelBuffer);
Gdx.gl.glReadPixels(padding, padding, world.width(), world.height(), GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, pixelBuffer);
pixelBuffer.position(0);
for(int i = 0; i < world.width() * world.height(); i++){
@ -87,7 +87,7 @@ public class FogRenderer implements Disposable{
if(r != 0){
world.tile(i).setVisibility((byte)1);
}
pixelBuffer.position(pixelBuffer.position() + 2);
pixelBuffer.position(pixelBuffer.position() + 3);
}
buffer.end();
}

View File

@ -49,9 +49,7 @@ public class SaveIO{
public static void loadFromSlot(int slot){
if(gwt){
String string = Settings.getString("save-" + slot + "-data", "");
ByteArrayInputStream stream = new ByteArrayInputStream(Base64Coder.decode(string));
load(stream);
load(getSlotStream(slot));
}else{
load(fileFor(slot));
}
@ -113,14 +111,14 @@ public class SaveIO{
}
public static void write(FileHandle file){
write(file.write(false));
write(new DeflaterOutputStream(file.write(false)));
}
public static void write(OutputStream os){
DataOutputStream stream;
try{
stream = new DataOutputStream(new DeflaterOutputStream(os));
stream = new DataOutputStream(os);
getVersion().write(stream);
stream.close();
}catch(Exception e){

View File

@ -38,6 +38,14 @@ public class Net{
private static IntMap<StreamBuilder> streams = new IntMap<>();
public static boolean hasClient(){
return clientProvider != null;
}
public static boolean hasServer(){
return serverProvider != null;
}
/**
* Display a network error.
*/

View File

@ -56,7 +56,7 @@ public class PausedDialog extends FloatingDialog{
if(!gwt){
ui.host.show();
}else{
ui.showInfo("$text.host.web");
ui.showInfo("$text.web.unsupported");
}
}).disabled(b -> Net.active());

View File

@ -109,7 +109,9 @@ public class HudFragment extends Fragment{
t.label(() -> fps.get(Gdx.graphics.getFramesPerSecond())).padRight(10);
t.label(() -> tps.get(threads.getTPS())).visible(() -> threads.isEnabled());
t.row();
t.label(() -> ping.get(Net.getPing())).visible(() -> Net.client() && !gwt).colspan(2);
if(Net.hasClient()){
t.label(() -> ping.get(Net.getPing())).visible(() -> Net.client() && !gwt).colspan(2);
}
}).size(-1).visible(() -> Settings.getBool("fps")).get();
//make wave box appear below rest of menu

View File

@ -153,11 +153,11 @@ public class MenuFragment extends Fragment{
dialog.content().row();
dialog.content().add(new MenuButton("icon-add", "$text.joingame", () -> {
if(Platform.instance.canJoinGame()){
if(!gwt){
ui.join.show();
dialog.hide();
}else{
ui.showInfo("$text.multiplayer.web");
ui.showInfo("$text.web.unsupported");
}
}));

View File

@ -13,6 +13,7 @@ gwt {
compiler {
strict = true
disableCastChecking = true
//style = Style.DETAILED
}
}

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="html">
<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
<inherits name='com.badlogic.gdx.ai' />
<inherits name='com.badlogic.gdx.controllers.controllers-gwt' />
<inherits name='Mindustry' />
<inherits name='uCore' />
<inherits name="com.sksamuel.gwt.GwtWebsockets" />
<entry-point class='io.anuke.mindustry.client.HtmlLauncher' />
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>

View File

@ -115,12 +115,6 @@ public class HtmlLauncher extends GwtApplication {
return NumberFormat.getDecimalFormat().format(number);
}
@Override
public boolean canJoinGame(){
String ref = Document.get().getReferrer();
return !ref.startsWith("https") && !ref.contains("itch.io");
}
@Override
public void downloadFile(String name, byte[] bytes) {
downloadBytes(name, new String(Base64Coder.encode(bytes)));