Added version info to main menu
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="io.anuke.mindustry"
|
package="io.anuke.mindustry"
|
||||||
android:versionCode="70"
|
android:versionCode="71"
|
||||||
android:versionName="3.3b19" >
|
android:versionName="3.3b20" >
|
||||||
|
|
||||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||||
<uses-permission android:name="com.android.vending.BILLING" />
|
<uses-permission android:name="com.android.vending.BILLING" />
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
|
public static final String versionName = "Mindustry";
|
||||||
|
public static final byte versionBuild = 20;
|
||||||
|
public static final byte versionMajor = 3;
|
||||||
|
public static final byte versionMinor = 3;
|
||||||
|
public static final String versionType = "Beta";
|
||||||
|
|
||||||
public static final boolean testAndroid = false;
|
public static final boolean testAndroid = false;
|
||||||
//shorthand for whether or not this is running on android
|
//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) || testAndroid;
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ public class NetServer extends Module{
|
|||||||
|
|
||||||
Net.handleServer(ConnectPacket.class, (id, packet) -> {
|
Net.handleServer(ConnectPacket.class, (id, packet) -> {
|
||||||
|
|
||||||
if(packet.version != Net.version){
|
if(packet.version != versionBuild){
|
||||||
Net.kickConnection(id, packet.version > Net.version ? KickReason.serverOutdated : KickReason.clientOutdated);
|
Net.kickConnection(id, packet.version > versionBuild ? KickReason.serverOutdated : KickReason.clientOutdated);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import java.io.IOException;
|
|||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class Net{
|
public class Net{
|
||||||
public static final int version = 20;
|
|
||||||
|
|
||||||
private static boolean server;
|
private static boolean server;
|
||||||
private static boolean active;
|
private static boolean active;
|
||||||
private static boolean clientLoaded;
|
private static boolean clientLoaded;
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import io.anuke.ucore.entities.EntityGroup;
|
|||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.versionBuild;
|
||||||
|
|
||||||
/**Class for storing all packets.*/
|
/**Class for storing all packets.*/
|
||||||
public class Packets {
|
public class Packets {
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ public class Packets {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(ByteBuffer buffer) {
|
public void write(ByteBuffer buffer) {
|
||||||
buffer.putInt(Net.version);
|
buffer.putInt(versionBuild);
|
||||||
buffer.put((byte)name.getBytes().length);
|
buffer.put((byte)name.getBytes().length);
|
||||||
buffer.put(name.getBytes());
|
buffer.put(name.getBytes());
|
||||||
buffer.put(android ? (byte)1 : 0);
|
buffer.put(android ? (byte)1 : 0);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.ui.fragments;
|
package io.anuke.mindustry.ui.fragments;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
@@ -17,7 +18,7 @@ public class BackgroundFragment implements Fragment {
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
TextureRegion back = Draw.region("background");
|
TextureRegion back = Draw.region("background");
|
||||||
float backscl = Unit.dp.scl(5f);
|
float backscl = Math.max(Gdx.graphics.getWidth() / (float)back.getRegionWidth() * 1.5f, Unit.dp.scl(5f));
|
||||||
|
|
||||||
Draw.alpha(0.7f);
|
Draw.alpha(0.7f);
|
||||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.mindustry.io.Platform;
|
|||||||
import io.anuke.mindustry.ui.MenuButton;
|
import io.anuke.mindustry.ui.MenuButton;
|
||||||
import io.anuke.mindustry.ui.PressGroup;
|
import io.anuke.mindustry.ui.PressGroup;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
|
import io.anuke.ucore.scene.builders.label;
|
||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -93,5 +94,11 @@ public class MenuFragment implements Fragment{
|
|||||||
new imagebutton("icon-info", 30f, ui.about::show).margin(14);
|
new imagebutton("icon-info", 30f, ui.about::show).margin(14);
|
||||||
}
|
}
|
||||||
}}.end().visible(()->state.is(State.menu));
|
}}.end().visible(()->state.is(State.menu));
|
||||||
|
|
||||||
|
//version info
|
||||||
|
new table(){{
|
||||||
|
abottom().aleft();
|
||||||
|
new label(versionName + " " + versionMajor + "." + versionMinor + " " + versionType + " | build " + versionBuild);
|
||||||
|
}}.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user