diff --git a/assets/mod.json b/assets/mod.json index 308dca2..c440761 100644 --- a/assets/mod.json +++ b/assets/mod.json @@ -5,7 +5,7 @@ "description": "The mod displays more information in-game, such as unit/building, wave, core, tile, item/unit total info etc", "version": "1.4", "main": "UnitInfo.core.Main", - "minGameVersion": "130.1", + "minGameVersion": "131", "dependencies": [], "hidden": true, "java": true diff --git a/assets/shaders/line.frag b/assets/shaders/line.frag new file mode 100644 index 0000000..9a72f9d --- /dev/null +++ b/assets/shaders/line.frag @@ -0,0 +1,24 @@ +#define HIGHP + +uniform sampler2D u_texture; +uniform vec2 u_texsize; +uniform vec2 u_invsize; +uniform float u_time; +uniform float u_dp; +uniform vec2 u_offset; +varying vec2 v_texCoords; + +void main(){ + vec2 T = v_texCoords.xy; + vec2 coords = (T * u_texsize) + u_offset; + vec4 color = texture2D(u_texture, T); + vec2 v = u_invsize; + vec4 maxed = max(max(max( + texture2D(u_texture, T + vec2(0, 2.0) * v), + texture2D(u_texture, T + vec2(0, -2.0) * v)), + texture2D(u_texture, T + vec2(2.0, 0) * v)), + texture2D(u_texture, T + vec2(-2.0, 0) * v)); + + color.a *= (0.5 + abs(sin(u_time / 15.0)) * .05 + 0.2 * (step(mod(coords.x / u_dp + coords.y / u_dp + u_time / 4.0, 10.0), 3.0))); + gl_FragColor = color; +} \ No newline at end of file diff --git a/assets/shaders/turretrange.frag b/assets/shaders/turretrange.frag new file mode 100644 index 0000000..ecacdb7 --- /dev/null +++ b/assets/shaders/turretrange.frag @@ -0,0 +1,28 @@ +#define HIGHP + +uniform sampler2D u_texture; +uniform vec2 u_texsize; +uniform vec2 u_invsize; +uniform float u_time; +uniform float u_dp; +uniform vec2 u_offset; +varying vec2 v_texCoords; + +void main(){ + vec2 T = v_texCoords.xy; + vec2 coords = (T * u_texsize) + u_offset; + vec4 color = texture2D(u_texture, T); + vec2 v = u_invsize; + vec4 maxed = max(max(max( + texture2D(u_texture, T + vec2(0, 2.0) * v), + texture2D(u_texture, T + vec2(0, -2.0) * v)), + texture2D(u_texture, T + vec2(2.0, 0) * v)), + texture2D(u_texture, T + vec2(-2.0, 0) * v)); + + if(texture2D(u_texture, T).a < 0.9 && maxed.a > 0.9){ + gl_FragColor = vec4(maxed.rgb, maxed.a * 100.0); + }else{ + color.a *= (0.37 + abs(sin(u_time / 15.0)) * .05 + 0.2 * (step(mod(coords.x / u_dp + coords.y / u_dp + u_time / 4.0, 10.0), 3.0))); + gl_FragColor = color; + } +} \ No newline at end of file diff --git a/src/UnitInfo/SVars.java b/src/UnitInfo/SVars.java index 2b103fb..4091b99 100644 --- a/src/UnitInfo/SVars.java +++ b/src/UnitInfo/SVars.java @@ -1,6 +1,7 @@ package UnitInfo; import UnitInfo.core.*; +import UnitInfo.shaders.LineShader; import UnitInfo.shaders.RangeShader; import arc.graphics.g2d.TextureRegion; @@ -14,5 +15,6 @@ public class SVars { public static TextureRegion clear = atlas.find("clear"); public static TextureRegion error = atlas.find("error"); public static RangeShader turretRange; + public static LineShader lineShader; public static boolean jsonGen = false; } diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index dd6a9ee..53f416d 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -60,6 +60,8 @@ public class HudUi { ImageButton lockButton; boolean locked = false; + boolean waveShown; + float a; int uiIndex = 0; @@ -291,7 +293,12 @@ public class HudUi { Table statusTable = Version.number >= 131 ? (Table)scene.find("statustable") : (Table)waveTable.getChildren().get(1); waveTable.removeChild(statusTable); table.row(); - table.stack(waveInfoTable, statusTable.top(), pathlineTable).fillX().colspan(table.getColumns()); + table.stack( + new Table(tt -> tt.collapser(t -> t.stack(waveInfoTable, statusTable.top(), pathlineTable), true, () -> waveShown)).top(), + new Table(tt -> tt.button(Icon.downOpen, Styles.clearToggleTransi, () -> waveShown = !waveShown).size(4 * 8f).checked(b -> { + b.getImage().setDrawable(waveShown ? Icon.upOpen : Icon.downOpen); + return waveShown; + })).left().top()); } public void reset(int index, Seq