diff --git a/android/build.gradle b/android/build.gradle index 363b2e1527..cefebf5a0b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,7 +22,7 @@ android { minSdkVersion 9 targetSdkVersion 25 versionCode 18 - versionName "0.9" + versionName "1.0" } buildTypes { release { diff --git a/core/src/com/unciv/civinfo/CityConstructions.java b/core/src/com/unciv/civinfo/CityConstructions.java index 7cb8076879..1b726dc9ad 100644 --- a/core/src/com/unciv/civinfo/CityConstructions.java +++ b/core/src/com/unciv/civinfo/CityConstructions.java @@ -65,7 +65,7 @@ public class CityConstructions currentConstruction = null; if(!construction.isBuildable(this)){ // We can't build this building anymore! (Wonder has been built / resource is gone / etc.) - CivilizationInfo.current().notifications.add("Cannot continue work on "+saveCurrentConstruction); + CivilizationInfo.current().addNotification("Cannot continue work on "+saveCurrentConstruction,cityLocation); chooseNextConstruction(); construction = getConstruction(currentConstruction); } @@ -76,7 +76,7 @@ public class CityConstructions { construction.postBuildEvent(this); inProgressConstructions.remove(currentConstruction); - CivilizationInfo.current().notifications.add(currentConstruction +" has been built in "+getCity().name); + CivilizationInfo.current().addNotification(currentConstruction +" has been built in "+getCity().name,cityLocation); chooseNextConstruction(); } @@ -93,7 +93,7 @@ public class CityConstructions }); if (currentConstruction == null) currentConstruction = Worker; - CivilizationInfo.current().notifications.add("Work has started on "+ currentConstruction); + CivilizationInfo.current().addNotification("Work has started on "+ currentConstruction,cityLocation); } diff --git a/core/src/com/unciv/civinfo/CityInfo.java b/core/src/com/unciv/civinfo/CityInfo.java index 30fbceed53..11ef57d550 100644 --- a/core/src/com/unciv/civinfo/CityInfo.java +++ b/core/src/com/unciv/civinfo/CityInfo.java @@ -60,6 +60,7 @@ public class CityInfo { name = CityNames[civInfo.cities.size()]; this.cityLocation = cityLocation; civInfo.cities.add(this); + CivilizationInfo.current().addNotification(name+" has been founded!",cityLocation); cityConstructions = new CityConstructions(this); if(civInfo.policies.contains("Legalism") && civInfo.cities.size() <= 4) cityConstructions.addCultureBuilding(); if(civInfo.cities.size()==1) { @@ -275,7 +276,7 @@ public class CityInfo { { population--; foodStored = 0; - CivilizationInfo.current().notifications.add(name+" is starving!"); + CivilizationInfo.current().addNotification(name+" is starving!",cityLocation); } if (foodStored >= foodToNextPopulation()) // growth! { @@ -283,7 +284,7 @@ public class CityInfo { if(getBuildingUniques().contains("FoodCarriesOver")) foodStored+=0.4f*foodToNextPopulation(); // Aqueduct special population++; autoAssignWorker(); - CivilizationInfo.current().notifications.add(name+" has grown!"); + CivilizationInfo.current().addNotification(name+" has grown!",cityLocation); } cityConstructions.nextTurn(stats); @@ -291,7 +292,7 @@ public class CityInfo { cultureStored+=stats.culture; if(cultureStored>=getCultureToNextTile()){ addNewTile(); - CivilizationInfo.current().notifications.add(name+" has expanded its borders!"); + CivilizationInfo.current().addNotification(name+" has expanded its borders!",cityLocation); } } diff --git a/core/src/com/unciv/civinfo/CivilizationInfo.java b/core/src/com/unciv/civinfo/CivilizationInfo.java index 3780c04cf3..d53f1b8d53 100644 --- a/core/src/com/unciv/civinfo/CivilizationInfo.java +++ b/core/src/com/unciv/civinfo/CivilizationInfo.java @@ -14,10 +14,14 @@ import com.unciv.models.stats.CivStats; import com.unciv.models.stats.FullStats; import java.util.Collection; +import java.util.Vector; /** * Created by LENOVO on 10/18/2017. */ + + + public class CivilizationInfo { public static CivilizationInfo current(){ return UnCivGame.Current.civInfo; } @@ -34,7 +38,20 @@ public class CivilizationInfo { public LinqCollection policies = new LinqCollection(); public int freePolicies=0; public int turns = 1; - public LinqCollection notifications = new LinqCollection(); + + public class Notification{ + public final String text; + public final Vector2 location; + + Notification(String text, Vector2 location) { + this.text = text; + this.location = location; + } + } + public LinqCollection notifications = new LinqCollection(); + public void addNotification(String text, Vector2 location){ + notifications.add(new Notification(text,location)); + } public LinqCollection tutorial = new LinqCollection(); public LinqCollection cities = new LinqCollection(); @@ -116,7 +133,7 @@ public class CivilizationInfo { public void addGreatPerson(String unitName){ // This is also done by some wonders and social policies, remember tileMap.placeUnitNearTile(cities.get(0).cityLocation,unitName); - notifications.add("A "+unitName+" has been born!"); + addNotification("A "+unitName+" has been born!",cities.get(0).cityLocation); } public void greatPersonPointsForTurn(){ @@ -150,7 +167,7 @@ public class CivilizationInfo { if(getBuildingUniques().contains("GoldenAgeLengthIncrease")) turnsToGoldenAge*=1.5; if(policies.contains("Freedom Complete")) turnsToGoldenAge*=1.5; turnsLeftForCurrentGoldenAge += turnsToGoldenAge; - notifications.add("You have entered a golden age!"); + addNotification("You have entered a golden age!",null); } public CivStats getStatsForNextTurn() { diff --git a/core/src/com/unciv/civinfo/CivilizationTech.java b/core/src/com/unciv/civinfo/CivilizationTech.java index 677bea6d1c..f3aeefdf1e 100644 --- a/core/src/com/unciv/civinfo/CivilizationTech.java +++ b/core/src/com/unciv/civinfo/CivilizationTech.java @@ -47,7 +47,7 @@ public class CivilizationTech{ techsInProgress.remove(CurrentTechnology); techsToResearch.remove(CurrentTechnology); techsResearched.add(CurrentTechnology); - CivilizationInfo.current().notifications.add("Research of "+CurrentTechnology+ " has completed!"); + CivilizationInfo.current().addNotification("Research of "+CurrentTechnology+ " has completed!",null); } } diff --git a/core/src/com/unciv/game/WorldScreen.java b/core/src/com/unciv/game/WorldScreen.java index e6b0404813..1c7b2e3c46 100644 --- a/core/src/com/unciv/game/WorldScreen.java +++ b/core/src/com/unciv/game/WorldScreen.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Touchable; +import com.badlogic.gdx.scenes.scene2d.ui.Cell; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Table; @@ -146,8 +147,8 @@ public class WorldScreen extends CameraStageBaseScreen { private void updateNotificationsList() { notificationsTable.clearChildren(); - for (String notification : game.civInfo.notifications) { - Label label = new Label(notification, skin); + for (final CivilizationInfo.Notification notification : game.civInfo.notifications) { + Label label = new Label(notification.text, skin); label.setColor(Color.WHITE); label.setFontScale(1.2f); Table minitable = new Table(); @@ -156,6 +157,15 @@ public class WorldScreen extends CameraStageBaseScreen { .tint(new Color(0x004085bf))); minitable.add(label).pad(5); + if(notification.location!=null){ + minitable.addListener(new ClickListener(){ + @Override + public void clicked(InputEvent event, float x, float y) { + setCenterPosition(notification.location); + } + }); + } + notificationsTable.add(minitable).pad(5); notificationsTable.row(); } diff --git a/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java b/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java index 5bd4d16791..f57fc27df1 100644 --- a/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java +++ b/core/src/com/unciv/game/pickerscreens/TechPickerScreen.java @@ -68,7 +68,7 @@ public class TechPickerScreen extends PickerScreen { if (isFreeTechPick) { civTech.techsResearched.add(selectedTech.name); civTech.freeTechs-=1; - game.civInfo.notifications.add("We have stumbled upon the discovery of "+selectedTech.name+"!"); + game.civInfo.addNotification("We have stumbled upon the discovery of "+selectedTech.name+"!",null); if(selectedTech.name.equals(civTech.currentTechnology())) civTech.techsToResearch.remove(selectedTech.name); }