mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-07 14:01:51 +07:00
Disabled 'import github' button on Android because Android is garbage and can't even do something as simple as an HTTP request without 5 workaround for different versions
This commit is contained in:
parent
4e946ae52b
commit
34db321577
@ -14,7 +14,6 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:isGame="true"
|
||||
android:appCategory="game"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/GdxTheme" android:fullBackupContent="@xml/backup_rules">
|
||||
<meta-data android:name="android.max_aspect" android:value="2.1"/>
|
||||
|
@ -29,39 +29,41 @@ public class ModsDialog extends FloatingDialog{
|
||||
|
||||
buttons.addImageTextButton("$mods.guide", Icon.wiki,
|
||||
() -> Core.net.openURI(modGuideURL))
|
||||
.size(210f, 64f);
|
||||
.size(android ? 210f + 250f + 10f : 210, 64f).colspan(android ? 2 : 1);
|
||||
|
||||
buttons.addImageTextButton("$mod.import.github", Icon.github, () -> {
|
||||
ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> {
|
||||
ui.loadfrag.show();
|
||||
Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> {
|
||||
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
||||
if(result.getStatus() != HttpStatus.OK){
|
||||
ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus()));
|
||||
ui.loadfrag.hide();
|
||||
}else{
|
||||
try{
|
||||
FileHandle file = tmpDirectory.child(text.replace("/", "") + ".zip");
|
||||
Streams.copyStream(result.getResultAsStream(), file.write(false));
|
||||
mods.importMod(file);
|
||||
file.delete();
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
mods.reloadContent();
|
||||
setup();
|
||||
ui.loadfrag.hide();
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
}
|
||||
});
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
if(!android){
|
||||
buttons.addImageTextButton("$mod.import.github", Icon.github, () -> {
|
||||
ui.showTextInput("$mod.import.github", "", 64, "Anuken/ExampleMod", text -> {
|
||||
ui.loadfrag.show();
|
||||
Core.net.httpGet("http://api.github.com/repos/" + text + "/zipball/master", loc -> {
|
||||
Core.net.httpGet(loc.getHeader("Location"), result -> {
|
||||
if(result.getStatus() != HttpStatus.OK){
|
||||
ui.showErrorMessage(Core.bundle.format("connectfail", result.getStatus()));
|
||||
ui.loadfrag.hide();
|
||||
}else{
|
||||
try{
|
||||
FileHandle file = tmpDirectory.child(text.replace("/", "") + ".zip");
|
||||
Streams.copyStream(result.getResultAsStream(), file.write(false));
|
||||
mods.importMod(file);
|
||||
file.delete();
|
||||
Core.app.post(() -> {
|
||||
try{
|
||||
mods.reloadContent();
|
||||
setup();
|
||||
ui.loadfrag.hide();
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
}
|
||||
});
|
||||
}catch(Throwable e){
|
||||
ui.showException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, t -> Core.app.post(() -> ui.showException(t)));
|
||||
}, t -> Core.app.post(() -> ui.showException(t)));
|
||||
}, t -> Core.app.post(() -> ui.showException(t)));
|
||||
});
|
||||
}).size(250f, 64f);
|
||||
});
|
||||
}).size(250f, 64f);
|
||||
}
|
||||
|
||||
shown(this::setup);
|
||||
|
||||
|
@ -241,7 +241,7 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
|
||||
public void drawCracks(Tile tile){
|
||||
if(!tile.entity.damaged()) return;
|
||||
if(!tile.entity.damaged() || size > maxCrackSize) return;
|
||||
int id = tile.pos();
|
||||
TextureRegion region = cracks[size - 1][Mathf.clamp((int)((1f - tile.entity.healthf()) * crackRegions), 0, crackRegions-1)];
|
||||
Draw.colorl(0.2f, 0.1f + (1f - tile.entity.healthf())* 0.6f);
|
||||
|
Loading…
Reference in New Issue
Block a user