Added version type
This commit is contained in:
13
build.gradle
13
build.gradle
@@ -22,7 +22,8 @@ allprojects {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
versionNumber = '4.0'
|
versionNumber = '4.0'
|
||||||
versionType = 'alpha'
|
versionModifier = 'alpha'
|
||||||
|
versionType = 'official'
|
||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
@@ -65,12 +66,12 @@ allprojects {
|
|||||||
|
|
||||||
props.load(new FileInputStream(pfile))
|
props.load(new FileInputStream(pfile))
|
||||||
|
|
||||||
String code = getBuildVersion()
|
String buildid = getBuildVersion()
|
||||||
|
|
||||||
props["name"] = appName
|
props["type"] = versionType
|
||||||
props["version"] = versionType
|
props["number"] = versionNumber
|
||||||
props["code"] = versionNumber
|
props["modifier"] = versionModifier
|
||||||
props["build"] = code
|
props["build"] = buildid
|
||||||
|
|
||||||
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
|
props.store(pfile.newWriter(), "Autogenerated file. Do not modify.")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ text.server.hostname=Host: {0}
|
|||||||
text.server.edit=Edit Server
|
text.server.edit=Edit Server
|
||||||
text.server.outdated=[crimson]Outdated Server![]
|
text.server.outdated=[crimson]Outdated Server![]
|
||||||
text.server.outdated.client=[crimson]Outdated Client![]
|
text.server.outdated.client=[crimson]Outdated Client![]
|
||||||
text.server.version=[lightgray]Version: {0}
|
text.server.version=[lightgray]Version: {0} {1}
|
||||||
text.server.custombuild=[yellow]Custom Build
|
text.server.custombuild=[yellow]Custom Build
|
||||||
text.confirmban=Are you sure you want to ban this player?
|
text.confirmban=Are you sure you want to ban this player?
|
||||||
text.confirmunban=Are you sure you want to unban this player?
|
text.confirmunban=Are you sure you want to unban this player?
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ import io.anuke.ucore.util.Strings;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Version{
|
public class Version{
|
||||||
public static String name;
|
/**Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used.*/
|
||||||
public static String type;
|
public static String type;
|
||||||
public static String code;
|
/**Number specifying the major version, e.g. '4.0'*/
|
||||||
|
public static String number;
|
||||||
|
/**Build modifier, e.g. 'alpha' or 'release'*/
|
||||||
|
public static String modifier;
|
||||||
|
/**Build number, e.g. '43'. set to '-1' for custom builds.*/
|
||||||
public static int build = 0;
|
public static int build = 0;
|
||||||
public static String buildName;
|
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
try{
|
try{
|
||||||
@@ -22,12 +25,10 @@ public class Version{
|
|||||||
ObjectMap<String, String> map = new ObjectMap<>();
|
ObjectMap<String, String> map = new ObjectMap<>();
|
||||||
PropertiesUtils.load(map, file.reader());
|
PropertiesUtils.load(map, file.reader());
|
||||||
|
|
||||||
name = map.get("name");
|
type = map.get("type");
|
||||||
type = map.get("version");
|
number = map.get("number");
|
||||||
code = map.get("code");
|
modifier = map.get("modifier");
|
||||||
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
|
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
|
||||||
buildName = build == -1 ? map.get("build") : "build " + build;
|
|
||||||
|
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ public class Host{
|
|||||||
public final int wave;
|
public final int wave;
|
||||||
public final int players;
|
public final int players;
|
||||||
public final int version;
|
public final int version;
|
||||||
|
public final String versionType;
|
||||||
|
|
||||||
public Host(String name, String address, String mapname, int wave, int players, int version){
|
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.players = players;
|
this.players = players;
|
||||||
this.mapname = mapname;
|
this.mapname = mapname;
|
||||||
this.wave = wave;
|
this.wave = wave;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
this.versionType = versionType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,6 +310,8 @@ public class NetworkIO{
|
|||||||
buffer.putInt(playerGroup.size());
|
buffer.putInt(playerGroup.size());
|
||||||
buffer.putInt(state.wave);
|
buffer.putInt(state.wave);
|
||||||
buffer.putInt(Version.build);
|
buffer.putInt(Version.build);
|
||||||
|
buffer.put((byte)Version.type.getBytes().length);
|
||||||
|
buffer.put(Version.type.getBytes());
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +330,11 @@ public class NetworkIO{
|
|||||||
int players = buffer.getInt();
|
int players = buffer.getInt();
|
||||||
int wave = buffer.getInt();
|
int wave = buffer.getInt();
|
||||||
int version = buffer.getInt();
|
int version = buffer.getInt();
|
||||||
|
byte tlength = buffer.get();
|
||||||
|
byte[] tb = new byte[tlength];
|
||||||
|
buffer.get(tb);
|
||||||
|
String vertype = new String(tb);
|
||||||
|
|
||||||
return new Host(host, hostAddress, map, wave, players, version);
|
return new Host(host, hostAddress, map, wave, players, version, vertype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class JoinDialog extends FloatingDialog{
|
|||||||
versionString = Bundles.get("text.server.outdated.client") + "\n" +
|
versionString = Bundles.get("text.server.outdated.client") + "\n" +
|
||||||
Bundles.format("text.server.version", host.version);
|
Bundles.format("text.server.version", host.version);
|
||||||
}else{
|
}else{
|
||||||
versionString = Bundles.format("text.server.version", host.version);
|
versionString = Bundles.format("text.server.version", host.version, host.versionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
server.content.clear();
|
server.content.clear();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class MenuFragment extends Fragment{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//version info
|
//version info
|
||||||
parent.fill(c -> c.bottom().left().add("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName)
|
parent.fill(c -> c.bottom().left().add("Mindustry " + Version.number + "-" + Version.modifier + " " + Version.type + " / " + (Version.build == -1 ? "custom build" : "build " + Version.build))
|
||||||
.visible(() -> state.is(State.menu)));
|
.visible(() -> state.is(State.menu)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ app.version=4.0
|
|||||||
app.id=io.anuke.mindustry
|
app.id=io.anuke.mindustry
|
||||||
app.mainclass=io.anuke.mindustry.IOSLauncher
|
app.mainclass=io.anuke.mindustry.IOSLauncher
|
||||||
app.executable=IOSLauncher
|
app.executable=IOSLauncher
|
||||||
app.build=22
|
app.build=23
|
||||||
app.name=Mindustry
|
app.name=Mindustry
|
||||||
|
|||||||
Reference in New Issue
Block a user