Stained mountains remake submission / WIP wave graph improvements

This commit is contained in:
Anuken 2024-09-02 14:16:39 -04:00
parent ef4d515333
commit ee01e36560
9 changed files with 51 additions and 9 deletions

View File

@ -18,7 +18,7 @@ See [CONTRIBUTING](CONTRIBUTING.md).
Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases). Bleeding-edge builds are generated automatically for every commit. You can see them [here](https://github.com/Anuken/MindustryBuilds/releases).
If you'd rather compile on your own, follow these instructions. If you'd rather compile on your own, follow these instructions.
First, make sure you have [JDK 16-17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands: First, make sure you have [JDK 17](https://adoptium.net/archive.html?variant=openjdk17&jvmVariant=hotspot) installed. **Other JDK versions will not work.** Open a terminal in the Mindustry directory and run the following commands:
### Windows ### Windows

View File

@ -145,7 +145,7 @@ public class Vars implements Loadable{
"modeSurvival", "commandRally", "commandAttack", "modeSurvival", "commandRally", "commandAttack",
}; };
/** maximum TCP packet size */ /** maximum TCP packet size */
public static final int maxTcpSize = 900; public static final int maxTcpSize = 1100;
/** default server port */ /** default server port */
public static final int port = 6567; public static final int port = 6567;
/** multicast discovery port.*/ /** multicast discovery port.*/

View File

@ -1,8 +1,10 @@
package mindustry.editor; package mindustry.editor;
import arc.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*;
import arc.scene.ui.*; import arc.scene.ui.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*; import arc.struct.*;
@ -26,12 +28,16 @@ public class WaveGraph extends Table{
private float maxHealth; private float maxHealth;
private Table colors; private Table colors;
private ObjectSet<UnitType> hidden = new ObjectSet<>(); private ObjectSet<UnitType> hidden = new ObjectSet<>();
private StringBuilder countStr = new StringBuilder();
public WaveGraph(){ public WaveGraph(){
background(Tex.pane); background(Tex.pane);
rect((x, y, width, height) -> { rect((x, y, width, height) -> {
Lines.stroke(Scl.scl(3f)); Lines.stroke(Scl.scl(3f));
countStr.setLength(0);
Vec2 mouse = stageToLocalCoordinates(Core.input.mouse());
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
Font font = Fonts.outline; Font font = Fonts.outline;
@ -50,6 +56,8 @@ public class WaveGraph extends Table{
float graphX = x + offsetX, graphY = y + offsetY, graphW = width - offsetX, graphH = height - offsetY; float graphX = x + offsetX, graphY = y + offsetY, graphW = width - offsetX, graphH = height - offsetY;
float spacing = graphW / (values.length - 1); float spacing = graphW / (values.length - 1);
int selcol = Rect.contains(x, y, width, height, mouse.x, mouse.y) ? Mathf.round((mouse.x - graphX) / spacing) : -1;
if(mode == Mode.counts){ if(mode == Mode.counts){
for(UnitType type : used.orderedItems()){ for(UnitType type : used.orderedItems()){
Draw.color(color(type)); Draw.color(color(type));
@ -97,6 +105,23 @@ public class WaveGraph extends Table{
Lines.endLine(); Lines.endLine();
} }
if(selcol >= 0 && selcol < values.length){
Draw.color(1f, 0f, 0f, 0.2f);
Fill.crect(selcol * spacing + graphX - spacing/2f, graphY, spacing, graphH);
Draw.color();
font.getData().setScale(1.5f);
for(UnitType type : used.orderedItems()){
int amount = values[Mathf.clamp(selcol, 0, values.length - 1)][type.id];
if(amount > 0){
countStr.append(type.emoji()).append(" ").append(amount).append("\n");
}
}
float pad = Scl.scl(5f);
font.draw(countStr, selcol * spacing + graphX - spacing/2f + pad, graphY + graphH - pad);
font.getData().setScale(1f);
}
//how many numbers can fit here //how many numbers can fit here
float totalMarks = Mathf.clamp(maxY, 1, 10); float totalMarks = Mathf.clamp(maxY, 1, 10);
@ -123,7 +148,7 @@ public class WaveGraph extends Table{
float cy = y + fh, cx = graphX + graphW / (values.length - 1) * i; float cy = y + fh, cx = graphX + graphW / (values.length - 1) * i;
Lines.line(cx, cy, cx, cy + len); Lines.line(cx, cy, cx, cy + len);
if(i == values.length / 2){ if(i == selcol){
font.draw("" + (i + from + 1), cx, cy - Scl.scl(2f), Align.center); font.draw("" + (i + from + 1), cx, cy - Scl.scl(2f), Align.center);
} }
} }

View File

@ -6,6 +6,7 @@ import arc.graphics.*;
import arc.input.*; import arc.input.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.scene.*;
import arc.scene.event.*; import arc.scene.event.*;
import arc.scene.style.*; import arc.scene.style.*;
import arc.scene.ui.*; import arc.scene.ui.*;
@ -201,6 +202,19 @@ public class WaveInfoDialog extends BaseDialog{
cont.add(graph = new WaveGraph()).grow(); cont.add(graph = new WaveGraph()).grow();
graph.scrolled((scroll) -> {
view(Mathf.sign(scroll));
});
graph.touchable = Touchable.enabled;
graph.addListener(new InputListener(){
@Override
public void enter(InputEvent event, float x, float y, int pointer, Element fromActor){
graph.requestScroll();
}
});
buildGroups(); buildGroups();
} }

View File

@ -62,12 +62,13 @@ public class Mods implements Loadable{
return mainLoader; return mainLoader;
} }
/** @return the folder where configuration files for this mod should go. The folder may not exist yet; call mkdirs() before writing to it. /** @return the folder where configuration files for this mod should go. Call this in init(). */
* Call this in init(). */
public Fi getConfigFolder(Mod mod){ public Fi getConfigFolder(Mod mod){
ModMeta load = metas.get(mod.getClass()); ModMeta load = metas.get(mod.getClass());
if(load == null) throw new IllegalArgumentException("Mod is not loaded yet (or missing)!"); if(load == null) throw new IllegalArgumentException("Mod is not loaded yet (or missing)!");
return modDirectory.child(load.name); Fi result = modDirectory.child(load.name);
result.mkdirs();
return result;
} }
/** @return a file named 'config.json' in the config folder for the specified mod. /** @return a file named 'config.json' in the config folder for the specified mod.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -47,6 +47,8 @@ task dist(type: Jar, dependsOn: configurations.runtimeClasspath){
exclude("icons/icon.ico") exclude("icons/icon.ico")
exclude("icons/icon_64.png") exclude("icons/icon_64.png")
duplicatesStrategy = 'exclude'
manifest{ manifest{
attributes 'Main-Class': project.mainClassName attributes 'Main-Class': project.mainClassName
} }

View File

@ -1,5 +1,5 @@
if(JavaVersion.current().ordinal() < JavaVersion.VERSION_16.ordinal()){ if(JavaVersion.current().ordinal() < JavaVersion.VERSION_17.ordinal()){
throw new Exception("!!! YOU MUST USE JAVA 16 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}") throw new Exception("!!! YOU MUST USE JAVA 17 OR ABOVE TO COMPILE AND RUN MINDUSTRY !!! Read the README. Your version: ${System.properties["java.version"]}")
} }
include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests' include 'desktop', 'core', 'server', 'ios', 'annotations', 'tools', 'tests'