mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-18 23:32:08 -08:00
Added version info to main menu
This commit is contained in:
parent
c3d262f2ab
commit
2059fb39f7
7 changed files with 22 additions and 8 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="io.anuke.mindustry"
|
||||
android:versionCode="70"
|
||||
android:versionName="3.3b19" >
|
||||
android:versionCode="71"
|
||||
android:versionName="3.3b20" >
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ import io.anuke.ucore.scene.ui.layout.Unit;
|
|||
import java.util.Locale;
|
||||
|
||||
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;
|
||||
//shorthand for whether or not this is running on android
|
||||
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) -> {
|
||||
|
||||
if(packet.version != Net.version){
|
||||
Net.kickConnection(id, packet.version > Net.version ? KickReason.serverOutdated : KickReason.clientOutdated);
|
||||
if(packet.version != versionBuild){
|
||||
Net.kickConnection(id, packet.version > versionBuild ? KickReason.serverOutdated : KickReason.clientOutdated);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ import java.io.IOException;
|
|||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Net{
|
||||
public static final int version = 20;
|
||||
|
||||
private static boolean server;
|
||||
private static boolean active;
|
||||
private static boolean clientLoaded;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import io.anuke.ucore.entities.EntityGroup;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.versionBuild;
|
||||
|
||||
/**Class for storing all packets.*/
|
||||
public class Packets {
|
||||
|
||||
|
|
@ -56,7 +58,7 @@ public class Packets {
|
|||
|
||||
@Override
|
||||
public void write(ByteBuffer buffer) {
|
||||
buffer.putInt(Net.version);
|
||||
buffer.putInt(versionBuild);
|
||||
buffer.put((byte)name.getBytes().length);
|
||||
buffer.put(name.getBytes());
|
||||
buffer.put(android ? (byte)1 : 0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.ucore.core.Core;
|
||||
|
|
@ -17,7 +18,7 @@ public class BackgroundFragment implements Fragment {
|
|||
Draw.color();
|
||||
|
||||
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);
|
||||
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.PressGroup;
|
||||
import io.anuke.ucore.scene.builders.imagebutton;
|
||||
import io.anuke.ucore.scene.builders.label;
|
||||
import io.anuke.ucore.scene.builders.table;
|
||||
|
||||
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);
|
||||
}
|
||||
}}.end().visible(()->state.is(State.menu));
|
||||
|
||||
//version info
|
||||
new table(){{
|
||||
abottom().aleft();
|
||||
new label(versionName + " " + versionMajor + "." + versionMinor + " " + versionType + " | build " + versionBuild);
|
||||
}}.end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue