mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-24 05:21:15 -08:00
Added build revision
This commit is contained in:
parent
14e9a94061
commit
75d2ea1519
2 changed files with 16 additions and 2 deletions
|
|
@ -17,6 +17,8 @@ public class Version{
|
|||
public static int number;
|
||||
/**Build number, e.g. '43'. set to '-1' for custom builds.*/
|
||||
public static int build = 0;
|
||||
/**Revision number. Used for hotfixes. Does not affect server compatibility.*/
|
||||
public static int revision = 0;
|
||||
|
||||
public static void init(){
|
||||
try{
|
||||
|
|
@ -28,7 +30,18 @@ public class Version{
|
|||
type = map.get("type");
|
||||
number = Integer.parseInt(map.get("number"));
|
||||
modifier = map.get("modifier");
|
||||
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
|
||||
if(map.get("build").contains(".")){
|
||||
String[] split = map.get("build").split("\\.");
|
||||
try{
|
||||
build = Integer.parseInt(split[0]);
|
||||
revision = Integer.parseInt(split[1]);
|
||||
}catch(Throwable e){
|
||||
e.printStackTrace();
|
||||
build = -1;
|
||||
}
|
||||
}else{
|
||||
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
|
||||
}
|
||||
}catch(IOException e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ public class MenuFragment extends Fragment{
|
|||
}
|
||||
|
||||
//version info
|
||||
parent.fill(c -> c.bottom().left().add(Strings.formatArgs("Mindustry v{0} {1}-{2} {3}", Version.number, Version.modifier, Version.type, (Version.build == -1 ? "custom build" : "build " + Version.build)))
|
||||
parent.fill(c -> c.bottom().left().add(Strings.formatArgs("Mindustry v{0} {1}-{2} {3}{4}", Version.number, Version.modifier, Version.type,
|
||||
(Version.build == -1 ? "custom build" : "build " + Version.build), Version.revision == 0 ? "" : "." + Version.revision))
|
||||
.visible(() -> state.is(State.menu)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue