mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
remove overrided drawBackground()
This commit is contained in:
@@ -18,18 +18,8 @@ public class SUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String floatFormat(float number){
|
public static String floatFormat(float number){
|
||||||
if(number >= 10000) return UI.formatAmount((long)number);
|
if(number >= 1000) return UI.formatAmount((long)number);
|
||||||
if(String.valueOf(number).split("[.]")[1].matches("0")) return String.valueOf(number).split("[.]")[0];
|
if(String.valueOf(number).split("[.]")[1].matches("0")) return String.valueOf(number).split("[.]")[0];
|
||||||
return Strings.fixed(number, 1);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ public class HudUi {
|
|||||||
public void addWeaponTable(Table table){
|
public void addWeaponTable(Table table){
|
||||||
table.table().update(t -> {
|
table.table().update(t -> {
|
||||||
t.clear();
|
t.clear();
|
||||||
t.add(new Table(Tex.button, tt -> {
|
t.add(new Table(((NinePatchDrawable)Tex.button).tint(Tmp.c1.set(((NinePatchDrawable)Tex.button).getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)), tt -> {
|
||||||
tt.defaults().width(Scl.scl(modUiScale) * 8 * 8f).minHeight(Scl.scl(modUiScale) * 4 * 8f).align(Align.left);
|
tt.defaults().width(Scl.scl(modUiScale) * 8 * 8f).minHeight(Scl.scl(modUiScale) * 4 * 8f).align(Align.left);
|
||||||
tt.visibility = () -> settings.getBool("weaponui") && getTarget() instanceof Unit u && u.type != null && u.type.weapons.size > 0;
|
tt.visibility = () -> settings.getBool("weaponui") && getTarget() instanceof Unit u && u.type != null && u.type.weapons.size > 0;
|
||||||
if(settings.getBool("weaponui") && getTarget() instanceof Unit u && u.type != null) {
|
if(settings.getBool("weaponui") && getTarget() instanceof Unit u && u.type != null) {
|
||||||
@@ -686,15 +686,7 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}){
|
}));
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y) {
|
|
||||||
if(getBackground() == null) return;
|
|
||||||
Color color = this.color;
|
|
||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
|
||||||
getBackground().draw(x, y, width, height);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,22 +747,22 @@ public class HudUi {
|
|||||||
public void addUnitTable(){
|
public void addUnitTable(){
|
||||||
if(uiIndex != 0) return;
|
if(uiIndex != 0) return;
|
||||||
unitTable = new Table(table -> {
|
unitTable = new Table(table -> {
|
||||||
table.left().defaults().width(scaledScale * 27 * 8f).maxHeight(scaledScale * 35 * 8f).align(Align.left);
|
table.left().defaults().width(scaledScale * 27 * 8f).maxHeight(scaledScale * 35 * 8f);
|
||||||
addBars();
|
addBars();
|
||||||
Table table1 = new Table(Tex.button, t -> {
|
Table table1 = new Table(Tex.button, t -> {
|
||||||
|
t.left();
|
||||||
t.table(Tex.underline2, tt -> {
|
t.table(Tex.underline2, tt -> {
|
||||||
Stack stack = new Stack(){{
|
Stack stack = new Stack(){{
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
ttt.setSize(Scl.scl(modUiScale) * 4f * 8f);
|
|
||||||
ttt.image(() -> {
|
ttt.image(() -> {
|
||||||
TextureRegion region = clear;
|
TextureRegion region = clear;
|
||||||
if(getTarget() instanceof Unit u && u.type != null) region = ((Unit) getTarget()).type().uiIcon;
|
if(getTarget() instanceof Unit u && u.type != null) region = u.type.uiIcon;
|
||||||
else if(getTarget() instanceof Building b && b.block != null) {
|
else if(getTarget() instanceof Building b) {
|
||||||
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
|
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
|
||||||
else region = b.block.uiIcon;
|
else if(b.block != null) region = b.block.uiIcon;
|
||||||
}
|
}
|
||||||
return region;
|
return region;
|
||||||
});
|
}).size(Scl.scl(modUiScale) * 4 * 8f);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
add(new Table(ttt -> {
|
add(new Table(ttt -> {
|
||||||
@@ -794,13 +786,12 @@ public class HudUi {
|
|||||||
Label label = new Label(() -> {
|
Label label = new Label(() -> {
|
||||||
String name = "";
|
String name = "";
|
||||||
if(getTarget() instanceof Unit u && u.type != null)
|
if(getTarget() instanceof Unit u && u.type != null)
|
||||||
name = "[accent]" + u.type.localizedName + "[]";
|
name = u.type.localizedName;
|
||||||
if(getTarget() instanceof Building b && b.block != null) {
|
if(getTarget() instanceof Building b && b.block != null) {
|
||||||
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) name = "[accent]" + cb.current.localizedName + "[]";
|
if(getTarget() instanceof ConstructBlock.ConstructBuild cb) name = cb.current.localizedName;
|
||||||
else name = "[accent]" + b.block.localizedName + "[]";
|
else name = b.block.localizedName;
|
||||||
}
|
}
|
||||||
if(name.length() > 12) return name.substring(0, 12) + "...";
|
return "[accent]" + (name.length() > 9 ? name.substring(0, 9) + "..." : name) + "[]";
|
||||||
return name;
|
|
||||||
});
|
});
|
||||||
label.setFontScale(scaledScale);
|
label.setFontScale(scaledScale);
|
||||||
|
|
||||||
@@ -814,7 +805,6 @@ public class HudUi {
|
|||||||
button.visibility = () -> getTarget() != null;
|
button.visibility = () -> getTarget() != null;
|
||||||
button.update(()->{
|
button.update(()->{
|
||||||
lockButton.getStyle().imageUp = Icon.lock.tint(locked ? Pal.accent : Color.white);
|
lockButton.getStyle().imageUp = Icon.lock.tint(locked ? Pal.accent : Color.white);
|
||||||
lockButton.getStyle().imageDown = Icon.lock.tint(locked ? Pal.accent : Color.white);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
lockButton = Elem.newImageButton(Styles.clearPartiali, Icon.lock.tint(locked ? Pal.accent : Color.white), 3 * 8f * Scl.scl(modUiScale), () -> {
|
lockButton = Elem.newImageButton(Styles.clearPartiali, Icon.lock.tint(locked ? Pal.accent : Color.white), 3 * 8f * Scl.scl(modUiScale), () -> {
|
||||||
@@ -867,15 +857,12 @@ public class HudUi {
|
|||||||
t.setColor(t.color.cpy().a(1f));
|
t.setColor(t.color.cpy().a(1f));
|
||||||
|
|
||||||
t.background(Tex.button);
|
t.background(Tex.button);
|
||||||
}){
|
|
||||||
@Override
|
t.update(() -> {
|
||||||
protected void drawBackground(float x, float y) {
|
NinePatchDrawable patch = (NinePatchDrawable)Tex.button;
|
||||||
if(getBackground() == null) return;
|
t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)));
|
||||||
Color color = this.color;
|
});
|
||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
});
|
||||||
getBackground().draw(x, y, width, height);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
table.table(t -> t.stack(table1, addInfoTable(t)));
|
table.table(t -> t.stack(table1, addInfoTable(t)));
|
||||||
table.row();
|
table.row();
|
||||||
table.table(this::addWeaponTable);
|
table.table(this::addWeaponTable);
|
||||||
@@ -1053,15 +1040,13 @@ public class HudUi {
|
|||||||
|
|
||||||
waveTable = new Table(table -> {
|
waveTable = new Table(table -> {
|
||||||
table.left().defaults().width(scaledScale * 32 * 8f).maxHeight(scaledScale * 32 * 8f).align(Align.left);
|
table.left().defaults().width(scaledScale * 32 * 8f).maxHeight(scaledScale * 32 * 8f).align(Align.left);
|
||||||
table.add(new Table(Tex.button, t -> t.add(wavePane)){
|
table.add(new Table(Tex.button, t -> {
|
||||||
@Override
|
t.add(wavePane);
|
||||||
protected void drawBackground(float x, float y) {
|
t.update(() -> {
|
||||||
if(getBackground() == null) return;
|
NinePatchDrawable patch = (NinePatchDrawable)Tex.button;
|
||||||
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
|
t.setBackground(patch.tint(Tmp.c1.set(patch.getPatch().getColor()).a(settings.getInt("uiopacity") / 100f)));
|
||||||
getBackground().draw(x, y, width, height);
|
});
|
||||||
Draw.reset();
|
})).padRight(scaledScale * 39 * 8f);
|
||||||
}
|
|
||||||
}).padRight(scaledScale * 39 * 8f);
|
|
||||||
|
|
||||||
table.fillParent = true;
|
table.fillParent = true;
|
||||||
table.visibility = () -> uiIndex == 1;
|
table.visibility = () -> uiIndex == 1;
|
||||||
@@ -1069,7 +1054,8 @@ public class HudUi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setItem(Table table){
|
public void setItem(Table table){
|
||||||
table.table(t -> {
|
table.table().update(t -> {
|
||||||
|
t.clear();
|
||||||
for(int i = 0; i < coreItems.tables.size; i++){
|
for(int i = 0; i < coreItems.tables.size; i++){
|
||||||
if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue;
|
if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue;
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class SettingS {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
addGraphicCheckSetting("spathfinder", true);
|
addGraphicCheckSetting("spathfinder", true);
|
||||||
addGraphicSlideSetting("infoUiScale", 100, 50, 200, 10, s -> s + "%");
|
addGraphicSlideSetting("infoUiScale", 100, 50, 100, 5, s -> s + "%");
|
||||||
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec");
|
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec");
|
||||||
addGraphicCheckSetting("pastwave", false);
|
addGraphicCheckSetting("pastwave", false);
|
||||||
addGraphicCheckSetting("emptywave", true);
|
addGraphicCheckSetting("emptywave", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user