Update ModsDialog.java

This commit is contained in:
ThePythonGuy 2020-08-04 11:17:13 +02:00 committed by GitHub
parent dfcd94c4bc
commit 7bfbca7234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -287,43 +287,42 @@ public class ModsDialog extends BaseDialog{
t.top().left();
t.margin(12f);
t.add(new BorderImage(){
{
if(mod.iconTexture != null){
setDrawable(new TextureRegion(mod.iconTexture));
}else{
setDrawable(Tex.clear);
}
}
@Override
public void draw(){
super.draw();
if(mod.iconTexture == null){
Fonts.def.draw(letter, x + width/2f, y + height/2f, Align.center);
}
}
}.border(Pal.accent)).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(2f);
t.defaults().left().top();
t.table(title -> {
title.left();
title.add(new BorderImage(){
{
if(mod.iconTexture != null){
setDrawable(new TextureRegion(mod.iconTexture));
}else{
setDrawable(Tex.clear);
}
border(Pal.accent);
}
@Override
public void draw(){
super.draw();
if(mod.iconTexture == null){
Fonts.def.draw(letter, x + width/2f, y + height/2f, Align.center);
}
}
}).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(8f);
title.add("" + mod.meta.displayName() + "\n[lightgray]v" + mod.meta.version + (mod.enabled() ? "" : "\n" + Core.bundle.get("mod.disabled") + "")).wrap().width(170f).growX();
title.add().growX();
}).growX().left();
title.button(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
t.table(right -> {
right.right();
right.button(mod.enabled() ? "$mod.disable" : "$mod.enable", mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.transt, () -> {
mods.setEnabled(mod, !mod.enabled());
setup();
}).height(50f).margin(8f).width(130f).disabled(!mod.isSupported());
if(steam && !mod.hasSteamID()){
title.button(Icon.download, Styles.clearTransi, () -> {
platform.publish(mod);
}).size(50f);
}
title.button(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
right.button(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
if(!mod.hasSteamID()){
ui.showConfirm("$confirm", "$mod.remove.confirm", () -> {
mods.removeMod(mod);
@ -333,7 +332,14 @@ public class ModsDialog extends BaseDialog{
platform.viewListing(mod);
}
}).size(50f);
}).growX().left();
if(steam && !mod.hasSteamID()){
right.row();
right.button(Icon.download, Styles.clearTransi, () -> {
platform.publish(mod);
}).size(50f);
}
}).growX().right();
t.row();
if(!mod.isSupported()){
@ -346,7 +352,7 @@ public class ModsDialog extends BaseDialog{
t.labelWrap("$mod.erroredcontent").growX();
t.row();
}
}, Styles.clearPartialt, () -> showMod(mod)).size(w, h);
}, Styles.clearPartialt, () -> showMod(mod)).size(w, h).growX().pad(4f);
table.row();
}
});