mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 20:19:26 +02:00
h
This commit is contained in:
@@ -51,6 +51,7 @@ public class HudUi {
|
||||
Teamc lockedTarget;
|
||||
ImageButton lockButton;
|
||||
boolean locked = false;
|
||||
|
||||
float charge;
|
||||
float a;
|
||||
int uiIndex = 0;
|
||||
@@ -59,7 +60,6 @@ public class HudUi {
|
||||
int waveamount;
|
||||
int coreamount;
|
||||
|
||||
BarInfo info = new BarInfo();
|
||||
Seq<String> strings = new Seq<>(new String[]{"","","","","",""});
|
||||
Seq<Float> numbers = new Seq<>(new Float[]{0f,0f,0f,0f,0f,0f});
|
||||
Seq<Color> colors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear});
|
||||
@@ -475,9 +475,9 @@ public class HudUi {
|
||||
}).padRight(Scl.scl(24 * 8f));
|
||||
table.row();
|
||||
table.update(() -> {
|
||||
strings = info.returnStrings(getTarget());
|
||||
numbers = info.returnNumbers(getTarget());
|
||||
colors = info.returnColors(getTarget());
|
||||
strings = BarInfo.returnStrings(getTarget());
|
||||
numbers = BarInfo.returnNumbers(getTarget());
|
||||
colors = BarInfo.returnColors(getTarget());
|
||||
if(getTarget() instanceof Turret.TurretBuild){
|
||||
if(((Turret.TurretBuild) getTarget()).charging) charge += Time.delta;
|
||||
else charge = 0f;
|
||||
|
||||
@@ -2,6 +2,7 @@ package UnitInfo.core;
|
||||
|
||||
import UnitInfo.SVars;
|
||||
import arc.Events;
|
||||
import arc.struct.ObjectMap;
|
||||
import arc.struct.Seq;
|
||||
import mindustry.Vars;
|
||||
import mindustry.game.EventType;
|
||||
@@ -14,20 +15,19 @@ import org.hjson.Stringify;
|
||||
import static UnitInfo.SVars.modRoot;
|
||||
|
||||
public class PlayerParser{
|
||||
|
||||
ObjectMap<Player, Seq<String>> chats = new ObjectMap<>();
|
||||
public void setEvent() {
|
||||
Events.on(EventType.PlayerJoin.class, e -> {
|
||||
Events.on(EventType.PlayerChatEvent.class, e -> {
|
||||
if(chats.containsKey(e.player)) chats.get(e.player).add(e.message);
|
||||
else chats.put(e.player, Seq.with(e.message));
|
||||
writeJson(e.player);
|
||||
save();
|
||||
});
|
||||
Events.on(EventType.ServerLoadEvent.class, e->{
|
||||
Groups.player.each(this::writeJson);
|
||||
});
|
||||
Events.on(EventType.WorldLoadEvent.class, e->{
|
||||
if(Vars.net.active()) Groups.player.each(this::writeJson);
|
||||
});
|
||||
|
||||
Events.run(EventType.Trigger.update, ()->{
|
||||
if(Vars.net.active())
|
||||
Groups.player.each(this::writeJson);
|
||||
if(Vars.net.active()) Groups.player.each(this::writeJson);
|
||||
|
||||
save();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,17 +46,18 @@ public class PlayerParser{
|
||||
names.add(player1.name);
|
||||
}});
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
JsonObject data = new JsonObject();
|
||||
SVars.playerInfos.each(pi->{
|
||||
JsonArray arr = new JsonArray();
|
||||
JsonArray chatArr = new JsonArray();
|
||||
pi.names.each(arr::add);
|
||||
if(chats.get(pi.player) != null) chats.get(pi.player).each(chatArr::add);
|
||||
data.add("names", arr);
|
||||
data.add("chats", chatArr);
|
||||
});
|
||||
|
||||
modRoot.child("players.hjson").writeString(data.toString(Stringify.HJSON));
|
||||
}
|
||||
public static class PlayerInfo{
|
||||
|
||||
Reference in New Issue
Block a user