Power-based ammo / Refactoring / IP kicks / Fixes

This commit is contained in:
Anuken
2020-09-24 13:05:39 -04:00
parent db94acdb83
commit 0a07458186
28 changed files with 322 additions and 126 deletions

View File

@@ -21,7 +21,7 @@ public class Bar extends Element{
public Bar(String name, Color color, Floatp fraction){
this.fraction = fraction;
this.name = Core.bundle.get(name);
this.name = Core.bundle.get(name, name);
this.blinkColor.set(color);
lastValue = value = fraction.get();
setColor(color);

View File

@@ -130,7 +130,7 @@ public class ContentDisplay{
public static void displayUnit(Table table, UnitType unit){
table.table(title -> {
title.image(unit.icon(Cicon.xlarge));
title.image(unit.icon(Cicon.xlarge)).size(8 * 6).scaling(Scaling.fit);
title.add("[accent]" + unit.localizedName).padLeft(5);
});

View File

@@ -30,6 +30,7 @@ public class JoinDialog extends BaseDialog{
Table global = new Table();
Table hosts = new Table();
int totalHosts;
int refreshes;
public JoinDialog(){
super("@joingame");
@@ -95,6 +96,8 @@ public class JoinDialog extends BaseDialog{
}
void refreshAll(){
refreshes ++;
refreshLocal();
refreshRemote();
refreshGlobal();
@@ -327,12 +330,15 @@ public class JoinDialog extends BaseDialog{
}
void refreshGlobal(){
int cur = refreshes;
global.clear();
global.background(null);
for(String host : defaultServers){
String resaddress = host.contains(":") ? host.split(":")[0] : host;
int resport = host.contains(":") ? Strings.parseInt(host.split(":")[1]) : port;
net.pingHost(resaddress, resport, res -> {
if(refreshes != cur) return;
res.port = resport;
addGlobalHost(res);
}, e -> {});

View File

@@ -93,7 +93,7 @@ public class SettingsMenuDialog extends SettingsDialog{
ObjectMap<String, Object> map = new ObjectMap<>();
for(String value : Core.settings.keys()){
if(value.contains("usid") || value.contains("uuid")){
map.put(value, Core.settings.getString(value));
map.put(value, Core.settings.get(value, null));
}
}
Core.settings.clear();

View File

@@ -741,7 +741,7 @@ public class HudFragment extends Fragment{
t.add(new SideBar(() -> player.unit().healthf(), () -> true, true)).width(bw).growY().padRight(pad);
t.image(() -> player.icon()).scaling(Scaling.bounded).grow().maxWidth(54f);
t.add(new SideBar(() -> player.dead() ? 0f : player.displayAmmo() ? player.unit().ammof() : player.unit().healthf(), () -> !player.displayAmmo(), false)).width(bw).growY().padLeft(pad).update(b -> {
b.color.set(player.displayAmmo() ? Pal.ammo : Pal.health);
b.color.set(player.displayAmmo() ? player.dead() ? Pal.ammo : player.unit().type().ammoType.color : Pal.health);
});
t.getChildren().get(1).toFront();