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;
|
Teamc lockedTarget;
|
||||||
ImageButton lockButton;
|
ImageButton lockButton;
|
||||||
boolean locked = false;
|
boolean locked = false;
|
||||||
|
|
||||||
float charge;
|
float charge;
|
||||||
float a;
|
float a;
|
||||||
int uiIndex = 0;
|
int uiIndex = 0;
|
||||||
@@ -59,7 +60,6 @@ public class HudUi {
|
|||||||
int waveamount;
|
int waveamount;
|
||||||
int coreamount;
|
int coreamount;
|
||||||
|
|
||||||
BarInfo info = new BarInfo();
|
|
||||||
Seq<String> strings = new Seq<>(new String[]{"","","","","",""});
|
Seq<String> strings = new Seq<>(new String[]{"","","","","",""});
|
||||||
Seq<Float> numbers = new Seq<>(new Float[]{0f,0f,0f,0f,0f,0f});
|
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});
|
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));
|
}).padRight(Scl.scl(24 * 8f));
|
||||||
table.row();
|
table.row();
|
||||||
table.update(() -> {
|
table.update(() -> {
|
||||||
strings = info.returnStrings(getTarget());
|
strings = BarInfo.returnStrings(getTarget());
|
||||||
numbers = info.returnNumbers(getTarget());
|
numbers = BarInfo.returnNumbers(getTarget());
|
||||||
colors = info.returnColors(getTarget());
|
colors = BarInfo.returnColors(getTarget());
|
||||||
if(getTarget() instanceof Turret.TurretBuild){
|
if(getTarget() instanceof Turret.TurretBuild){
|
||||||
if(((Turret.TurretBuild) getTarget()).charging) charge += Time.delta;
|
if(((Turret.TurretBuild) getTarget()).charging) charge += Time.delta;
|
||||||
else charge = 0f;
|
else charge = 0f;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package UnitInfo.core;
|
|||||||
|
|
||||||
import UnitInfo.SVars;
|
import UnitInfo.SVars;
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
|
import arc.struct.ObjectMap;
|
||||||
import arc.struct.Seq;
|
import arc.struct.Seq;
|
||||||
import mindustry.Vars;
|
import mindustry.Vars;
|
||||||
import mindustry.game.EventType;
|
import mindustry.game.EventType;
|
||||||
@@ -14,20 +15,19 @@ import org.hjson.Stringify;
|
|||||||
import static UnitInfo.SVars.modRoot;
|
import static UnitInfo.SVars.modRoot;
|
||||||
|
|
||||||
public class PlayerParser{
|
public class PlayerParser{
|
||||||
|
ObjectMap<Player, Seq<String>> chats = new ObjectMap<>();
|
||||||
public void setEvent() {
|
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);
|
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, ()->{
|
Events.run(EventType.Trigger.update, ()->{
|
||||||
if(Vars.net.active())
|
if(Vars.net.active()) Groups.player.each(this::writeJson);
|
||||||
Groups.player.each(this::writeJson);
|
|
||||||
|
save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,17 +46,18 @@ public class PlayerParser{
|
|||||||
names.add(player1.name);
|
names.add(player1.name);
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
JsonObject data = new JsonObject();
|
JsonObject data = new JsonObject();
|
||||||
SVars.playerInfos.each(pi->{
|
SVars.playerInfos.each(pi->{
|
||||||
JsonArray arr = new JsonArray();
|
JsonArray arr = new JsonArray();
|
||||||
|
JsonArray chatArr = new JsonArray();
|
||||||
pi.names.each(arr::add);
|
pi.names.each(arr::add);
|
||||||
|
if(chats.get(pi.player) != null) chats.get(pi.player).each(chatArr::add);
|
||||||
data.add("names", arr);
|
data.add("names", arr);
|
||||||
|
data.add("chats", chatArr);
|
||||||
});
|
});
|
||||||
|
|
||||||
modRoot.child("players.hjson").writeString(data.toString(Stringify.HJSON));
|
modRoot.child("players.hjson").writeString(data.toString(Stringify.HJSON));
|
||||||
}
|
}
|
||||||
public static class PlayerInfo{
|
public static class PlayerInfo{
|
||||||
|
|||||||
Reference in New Issue
Block a user