mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
clean up
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package UnitInfo;
|
||||
|
||||
import arc.graphics.g2d.NinePatch;
|
||||
import arc.graphics.g2d.TextureAtlas;
|
||||
import arc.scene.style.Drawable;
|
||||
import arc.scene.style.ScaledNinePatchDrawable;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.util.Strings;
|
||||
import mindustry.core.UI;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
public class SUtils {
|
||||
public static Drawable getDrawable(TextureAtlas.AtlasRegion region, int left, int right, int top, int bottom){
|
||||
int[] splits = {left, right, top, bottom};
|
||||
@@ -22,4 +22,14 @@ public class SUtils {
|
||||
if(String.valueOf(number).split("[.]")[1].matches("0")) return String.valueOf(number).split("[.]")[0];
|
||||
return Strings.fixed(number, 1);
|
||||
}
|
||||
|
||||
public static Object getFinalStatic(Field field) throws Exception {
|
||||
field.setAccessible(true);
|
||||
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
|
||||
|
||||
return field.get(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package UnitInfo.core;
|
||||
|
||||
import UnitInfo.SUtils;
|
||||
import UnitInfo.ui.*;
|
||||
import arc.*;
|
||||
import arc.func.Cons;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.input.*;
|
||||
|
||||
@@ -12,6 +12,7 @@ import static UnitInfo.SVars.modRoot;
|
||||
|
||||
public class PlayerParser{
|
||||
ObjectMap<Player, Seq<String>> chats = new ObjectMap<>();
|
||||
|
||||
public void setEvent() {
|
||||
Events.on(EventType.PlayerChatEvent.class, e -> {
|
||||
if(chats.containsKey(e.player)) chats.get(e.player).add(e.message);
|
||||
@@ -56,6 +57,7 @@ public class PlayerParser{
|
||||
});
|
||||
modRoot.child("players.hjson").writeString(data.toString(Stringify.HJSON));
|
||||
}
|
||||
|
||||
public static class PlayerInfo{
|
||||
Player player;
|
||||
Seq<String> names = new Seq<>();
|
||||
|
||||
@@ -11,6 +11,7 @@ import arc.scene.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.util.Align;
|
||||
import arc.util.Tmp;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
@@ -111,27 +112,24 @@ public class SBar extends Element{
|
||||
Draw.colorl(0.1f);
|
||||
bar.draw(x, y, width, height);
|
||||
|
||||
Draw.color(color.cpy().mul(Pal.lightishGray), blinkColor, blink);
|
||||
Draw.color(Tmp.c1.set(color).mul(Pal.lightishGray), blinkColor, blink);
|
||||
float topWidth = width * value;
|
||||
if(topWidth > spriteWidth){
|
||||
top.draw(x, y, topWidth, height);
|
||||
}else{
|
||||
if(ScissorStack.push(scissor.set(x, y, topWidth, height))){
|
||||
} else if(ScissorStack.push(scissor.set(x, y, topWidth, height))){
|
||||
top.draw(x, y, spriteWidth, height);
|
||||
ScissorStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
Draw.color(color, blinkColor, blink);
|
||||
float topWidthReal = width * (Math.min(value, computed));
|
||||
if(topWidthReal > spriteWidth){
|
||||
top.draw(x, y, topWidthReal, height);
|
||||
}else{
|
||||
if(ScissorStack.push(scissor.set(x, y, topWidthReal, height))){
|
||||
} else if(ScissorStack.push(scissor.set(x, y, topWidthReal, height))){
|
||||
top.draw(x, y, spriteWidth, height);
|
||||
ScissorStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
Fonts.outline.draw(name, x + width / 2f, y + height * 0.75f, Color.white, Scl.scl(modUiScale < 1 ? modUiScale : 1), false, Align.center);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user