diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 8a892a3627..e767330769 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -181,6 +181,12 @@ public class Control implements ApplicationListener, Loadable{ Time.run(Fx.coreLand.lifetime, () -> { Fx.launch.at(core); Effect.shake(5f, 5f, core); + + if(state.isCampaign()){ + ui.announce("[accent]" + state.rules.sector.name() + "\n" + + (state.rules.sector.info.resources.any() ? "[lightgray]" + bundle.get("sectors.resources") + "[white] " + + state.rules.sector.info.resources.toString(" ", u -> u.emoji()) : ""), 5); + } }); }); diff --git a/core/src/mindustry/core/NetClient.java b/core/src/mindustry/core/NetClient.java index 3c6214fd85..13dc4c1221 100644 --- a/core/src/mindustry/core/NetClient.java +++ b/core/src/mindustry/core/NetClient.java @@ -293,6 +293,13 @@ public class NetClient implements ApplicationListener{ setHudText(message); } + @Remote(variants = Variant.both) + public static void announce(String message){ + if(message == null) return; + + ui.announce(message); + } + @Remote(variants = Variant.both) public static void infoMessage(String message){ if(message == null) return; diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index f0a4757966..1ccc39d4c3 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -487,13 +487,19 @@ public class UI implements ApplicationListener, Loadable{ dialog.show(); } + /** Display text in the middle of the screen, then fade out. */ public void announce(String text){ - Table t = new Table(); + announce(text, 3); + } + + /** Display text in the middle of the screen, then fade out. */ + public void announce(String text, float duration){ + Table t = new Table(Styles.black3); t.touchable = Touchable.disabled; - t.background(Styles.black3).margin(8f) - .add(text).style(Styles.outlineLabel).labelAlign(Align.center); + t.margin(8f).add(text).style(Styles.outlineLabel).labelAlign(Align.center); t.update(() -> t.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f, Align.center)); - t.actions(Actions.fadeOut(3, Interp.pow4In), Actions.remove()); + t.actions(Actions.fadeOut(duration, Interp.pow4In), Actions.remove()); + t.pack(); Core.scene.add(t); } diff --git a/core/src/mindustry/core/World.java b/core/src/mindustry/core/World.java index 3640307c2b..60beec266b 100644 --- a/core/src/mindustry/core/World.java +++ b/core/src/mindustry/core/World.java @@ -331,7 +331,6 @@ public class World{ state.rules.weather.add(new WeatherEntry(Weathers.sporestorm)); } - Log.info("saving resources as @ -> @ / @", sector.info.resources, content.asArray(), sector.info.hashCode()); sector.info.resources = content.asArray(); sector.info.resources.sort(Structs.comps(Structs.comparing(Content::getContentType), Structs.comparingInt(c -> c.id))); sector.saveInfo(); diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index ad1d4ec538..07c3875140 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -382,8 +382,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ stable.row(); } - Log.info("sector resources = @ / @", sector.info.resources, sector.info.hashCode()); - if(sector.save != null && sector.info.resources.any()){ stable.add("@sectors.resources").row(); stable.table(t -> {