Sector land announcement

This commit is contained in:
Anuken 2020-10-25 12:00:57 -04:00
parent b801093597
commit 2a0af620be
5 changed files with 23 additions and 7 deletions

View File

@ -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);
}
});
});

View File

@ -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;

View File

@ -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);
}

View File

@ -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();

View File

@ -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 -> {