Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markers update #9348

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/assets/bundles/bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ lst.setprop = Sets a property of a unit or building.
lst.effect = Create a particle effect.
lst.sync = Sync a variable across the network.\nLimited to 20 times a second per variable.
lst.makemarker = Create a new logic marker in the world.\nAn ID to identify this marker must be provided.\nMarkers currently limited to 20,000 per world.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.
lst.setmarker = Set a property for a marker.\nThe ID used must be the same as in the Make Marker instruction.\n[accent]null []values are being ignored instead of converting to 0.
lst.localeprint = Add map locale property value to the text buffer.\nTo set map locale bundles in map editor, check [accent]Map Info > Locale Bundles[].\nIf client is a mobile device, tries to print a property ending in ".mobile" first.

logic.nounitbuild = [red]Unit building logic is not allowed here.
Expand Down Expand Up @@ -2479,3 +2479,7 @@ lenum.build = Build a structure.
lenum.getblock = Fetch a building, floor and type at coordinates.\nUnit must be in range of position.\nSolid non-buildings will have the type [accent]@solid[].
lenum.within = Check if unit is near a position.
lenum.boost = Start/stop boosting.

lenum.texture = Texture name straight from game's texture atlas (using kebab-case naming style).\nSecond and third arguments are additional suffixes added using "-" separator.\nIf additional arguments are not strings, nothing is added to first string.
lenum.texturesize = Size of texture in tiles. Zero value scales marker width to original texture's size.
lenum.autoscale = Whether to scale marker corresponding to player's zoom level.
11 changes: 11 additions & 0 deletions core/src/mindustry/core/Renderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,17 @@ public void draw(){
});
}

//draw objective markers
state.rules.objectives.eachRunning(obj -> {
for(var marker : obj.markers) marker.draw();
});

for(var marker : state.markers.values()){
if(marker != null) marker.draw();
}

Draw.reset();

Draw.draw(Layer.overlayUI, overlays::drawTop);
if(state.rules.fog) Draw.draw(Layer.fogOfWar, fog::drawFog);
Draw.draw(Layer.space, this::drawLanding);
Expand Down
47 changes: 28 additions & 19 deletions core/src/mindustry/editor/MapLocalesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import arc.graphics.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.Button.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
import arc.scene.utils.*;
import arc.struct.*;
Expand All @@ -23,6 +25,15 @@
public class MapLocalesDialog extends BaseDialog{
/** Width of UI property card. */
private static final float cardWidth = 400f;
/** Style for filter options buttons */
private static final TextButtonStyle filterStyle = new TextButtonStyle(){{
up = down = checked = over = Tex.whitePane;
font = Fonts.outline;
fontColor = Color.lightGray;
overFontColor = Pal.accent;
disabledFontColor = Color.gray;
disabled = Styles.black;
}};
/** Icons for use in map locales dialog. */
private static final ContentType[] contentIcons = {ContentType.item, ContentType.block, ContentType.liquid, ContentType.status, ContentType.unit};

Expand Down Expand Up @@ -168,7 +179,7 @@ private void buildLocalesTable(){
String name = loc.toString();

if(locales.containsKey(name)){
p.button(loc.getDisplayName(), Styles.flatTogglet, () -> {
p.button(loc.getDisplayName(Core.bundle.getLocale()), Styles.flatTogglet, () -> {
if(name.equals(selectedLocale)) return;

selectedLocale = name;
Expand All @@ -195,8 +206,8 @@ private void buildMain(){

main.image().color(Pal.gray).height(3f).growX().expandY().top().row();
main.pane(p -> {
int cols = (Core.graphics.getWidth() - 380) / ((int)cardWidth + 10);
if(props.size == 0 || cols == 0){
int cols = Math.max(1, (Core.graphics.getWidth() - 630) / ((int)cardWidth + 10));
if(props.size == 0){
main.add("@empty").center().row();
return;
}
Expand Down Expand Up @@ -343,7 +354,7 @@ private void addLocaleDialog(){
String name = loc.toString();

if(!locales.containsKey(name)){
t.button(loc.getDisplayName(), Styles.flatTogglet, () -> {
t.button(loc.getDisplayName(Core.bundle.getLocale()), Styles.flatTogglet, () -> {
if(name.equals(selectedLocale)) return;

locales.put(name, new StringMap());
Expand Down Expand Up @@ -524,12 +535,12 @@ private void buildPropView(String key){
if(status == PropertyStatus.same && !showSame) continue;

if(status != PropertyStatus.missing){
var comparsionString = (searchByValue ? locales.get(name).get(key).toLowerCase() : loc.getDisplayName().toLowerCase());
var comparsionString = (searchByValue ? locales.get(name).get(key).toLowerCase() : loc.getDisplayName(Core.bundle.getLocale()).toLowerCase());
if(!searchString.isEmpty() && !comparsionString.contains(searchString.toLowerCase())) continue;
}

colTables[i].table(Tex.whitePane, t -> {
t.add(loc.getDisplayName()).left().color(Pal.accent).row();
t.add(loc.getDisplayName(Core.bundle.getLocale())).left().color(Pal.accent).row();
t.image().color(Pal.accent).fillX().row();

if(status == PropertyStatus.missing){
Expand Down Expand Up @@ -576,26 +587,24 @@ private void filterDialog(Runnable hidden){
}).padTop(5f);
}).row();

dialog.cont.table(Tex.whitePane, t ->
t.button("@locales.showcorrect", Icon.ok, Styles.nonet, () -> showCorrect = !showCorrect).update(b -> {
dialog.cont.button("@locales.showcorrect", Icon.ok, filterStyle, () -> showCorrect = !showCorrect).update(b -> {
((Image)b.getChildren().get(1)).setDrawable(showCorrect ? Icon.ok : Icon.cancel);
b.setChecked(showCorrect);
}).grow().pad(15f)).size(450f, 100f).color(Pal.gray).padTop(50f);
}).size(450f, 100f).color(Pal.gray).padTop(65f);

dialog.cont.row();

dialog.cont.table(Tex.whitePane, t ->
t.button("@locales.showmissing", Icon.ok, Styles.nonet, () -> showMissing = !showMissing).update(b -> {
((Image)b.getChildren().get(1)).setDrawable(showMissing ? Icon.ok : Icon.cancel);
b.setChecked(showMissing);
}).grow().pad(15f)).size(450f, 100f).color(Pal.accent).padTop(50f);
dialog.cont.button("@locales.showmissing", Icon.ok, filterStyle, () -> showMissing = !showMissing).update(b -> {
((Image)b.getChildren().get(1)).setDrawable(showMissing ? Icon.ok : Icon.cancel);
b.setChecked(showMissing);
}).size(450f, 100f).color(Pal.accent).padTop(65f);

dialog.cont.row();
dialog.cont.table(Tex.whitePane, t ->
t.button("@locales.showsame", Icon.ok, Styles.nonet, () -> showSame = !showSame).update(b -> {
((Image)b.getChildren().get(1)).setDrawable(showSame ? Icon.ok : Icon.cancel);
b.setChecked(showSame);
}).grow().pad(15f)).size(450f, 100f).color(Pal.techBlue).padTop(50f);

dialog.cont.button("@locales.showsame", Icon.ok, filterStyle, () -> showSame = !showSame).update(b -> {
((Image)b.getChildren().get(1)).setDrawable(showSame ? Icon.ok : Icon.cancel);
b.setChecked(showSame);
}).size(450f, 100f).color(Pal.techBlue).padTop(65f);

dialog.buttons.button("@back", Icon.left, () -> {
hidden.run();
Expand Down
Loading