Improved visuals of science victory screen

Added Scout to game start
Added tutorials
This commit is contained in:
Yair Morgenstern 2018-01-08 18:52:30 +02:00
parent 439efd7a40
commit 6c035c79b6
21 changed files with 99 additions and 63 deletions

View file

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View file

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View file

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

@ -460,7 +460,7 @@
description: "25% of food carried over after a new citizen is born",
requiredBuilding:"Hospital",
maintainance:3,
requiredTech:"Penicillin"
requiredTech:"Pharmaceuticals"
},
{
name:"Research Lab",

View file

@ -264,7 +264,7 @@
name:"Economics",
row:6,
prerequisites:["Banking","Printing Press"],
description:"Camps and Trading Posts provide +1 gold, allows construction of Windmill"
description:"Camps and Trading Posts provide +1 gold, allows construction of Windmill and Big Ben"
},
{
name:"Chemistry",
@ -328,13 +328,13 @@
techCost: 4505,
buildingCost:500,
wonderCost:1250,
techs:[
techs:[/*
{
name:"Refrigeration",
row:4,
prerequisites:["Electricity"],
description:"Does nothing since we have no sea tiles - In theory, allows construction of offshore platforms and submarines"
},
},*/
{
name:"Radio",
row:5,
@ -361,13 +361,13 @@
row:3,
prerequisites:["Biology"],
description:"Allows construction of Research Lab, increasing science"
},
},/*
{
name:"Electronics",
row:5,
prerequisites:["Radio"],
description:"Contributes only war-relatied things - on hold until AI is introduced - todo"
},
},*/
{
name:"Mass Media",
row:6,
@ -389,15 +389,15 @@
buildingCost:500,
techs:[
{
name:"Penicillin",
name:"Pharmaceuticals",
row:3,
prerequisites:["Refrigeration","Biology"],
prerequisites:["Plastics"],
description:"Enables construction of medical labs, alowing for greater city growth"
},
{
name:"Computers",
row:5,
prerequisites:["Electronics","Mass Media"],
prerequisites:["Mass Media"],
description:"+10% science and production in all cities"
},
{
@ -417,7 +417,7 @@
{
name:"Ecology",
row:3,
prerequisites:["Penicillin","Plastics","Electronics"],
prerequisites:["Pharmaceuticals"],
description:"Enables construction of Solar Plants on cities near deserts, increasing production"
},
{
@ -429,7 +429,7 @@
{
name:"Rocketry",
row:6,
prerequisites:["Flight","Electronics"],
prerequisites:["Flight","Computers"],
description:"Allows you to construct the Apollo Project, to find a way off of this planet!"
}
]

View file

@ -13,6 +13,12 @@
cost:106,
hurryCostModifier:20
},
{
name:"Scout",
description: "Has no abilites, can only explore",
unbuildable:true,
movement:2
},
{
name:"Great Artist",
description: "Can start an 8-turn golden age or construcct a landmark (+5 culture)",

View file

@ -21,7 +21,7 @@ android {
applicationId "com.unciv.game"
minSdkVersion 9
targetSdkVersion 25
versionCode 17
versionCode 18
versionName "0.9"
}
buildTypes {

View file

@ -104,8 +104,7 @@ public class CityConstructions
.where(new Predicate<Building>() {
@Override
public boolean evaluate(Building arg0) { return (arg0.isBuildable(self)); }
})
.select(new LinqCollection.Func<Building, String>() {
}).select(new LinqCollection.Func<Building, String>() {
@Override
public String GetBy(Building arg0) {
return arg0.name;

View file

@ -3,7 +3,14 @@ package com.unciv.civinfo;
import com.unciv.models.LinqCounter;
public class ScienceVictory{
public LinqCounter<String> requiredParts = new LinqCounter<String>();
public LinqCounter<String> requiredParts = new LinqCounter<String>(){
{
add("SS Booster",3);
add("SS Cockpit",1);
add("SS Engine",1);
add("SS Statis Chamber",1);
}
};
public LinqCounter<String> currentParts = new LinqCounter<String>();
public LinqCounter<String> unconstructedParts() {

View file

@ -440,31 +440,6 @@ public class CityScreen extends CameraStageBaseScreen {
}
// TextButton actionButton = new TextButton("Request improvement", skin);
// actionButton.getLabel().setFontScale(buttonScale);
// actionButton.addListener(action);
// if (selectedTile.unit.currentMovement == 0 || !canAct) {
// actionButton.setColor(Color.GRAY);
// actionButton.setTouchable(Touchable.disabled);
// }
//
// tileTable.row();
// tileTable.add(actionButton).colspan(2)
// .size(actionButton.getWidth() * buttonScale, actionButton.getHeight() * buttonScale);
//
// addUnitAction(tileTable,improvementButtonText, !selectedTile.isCityCenter() ||
// GameBasics.TileImprovements.linqValues().any(new Predicate<TileImprovement>() {
// @Override
// public boolean evaluate(TileImprovement arg0) {
// return selectedTile.canBuildImprovement(arg0);
// }
// })
// ,new ClickListener() {
//
// @Override
// public void clicked(InputEvent event, float x, float y) {game.setScreen(new ImprovementPickerScreen(game, selectedTile));}
// } );
TileTable.pack();
TileTable.setPosition(stage.getWidth()-10- TileTable.getWidth(), 10);

View file

@ -3,32 +3,47 @@ package com.unciv.game;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.unciv.civinfo.CivilizationInfo;
import com.unciv.game.pickerscreens.PickerScreen;
import com.unciv.models.LinqCollection;
import com.unciv.models.LinqCounter;
import java.util.ArrayList;
public class ScienceVictoryScreen extends PickerScreen {
public ScienceVictoryScreen() {
LinqCounter<String> builtSpaceshipParts = game.civInfo.scienceVictory.currentParts.clone();
for (int i = 0; i < 3; i++) {
addPartButton("SS Booster",builtSpaceshipParts);
}
addPartButton("SS Cockpit",builtSpaceshipParts);
addPartButton("SS Engine",builtSpaceshipParts);
addPartButton("SS Statis Chamber",builtSpaceshipParts);
for (String key: game.civInfo.scienceVictory.requiredParts.keySet()) // can't take the keyset because we would be modifying it!
for(int i = 0; i < game.civInfo.scienceVictory.requiredParts.get(key); i++)
addPartButton(key,builtSpaceshipParts);
rightSideButton.setVisible(false);
if(!game.civInfo.getBuildingUniques().contains("ApolloProject"))
descriptionLabel.setText("You must build the Apollo Project before you can build spaceship parts!");
else descriptionLabel.setText("Apollo project is built - you may construct spaceship parts in your cities!");
if(!game.civInfo.getBuildingUniques().contains("ApolloProgram"))
descriptionLabel.setText("You must build the Apollo Program before you can build spaceship parts!");
else descriptionLabel.setText("Apollo program is built - you may construct spaceship parts in your cities!");
LinqCollection<String> tutorial = new LinqCollection<String>();
tutorial.add("This is the science victory screen, where you" +
"\r\n can see your progress towards constructing a " +
"\r\n spaceship to propel you towards the stars.");
tutorial.add("There are 6 spaceship parts you must build, " +
"\r\n and they all require advanced technologies");
if(!CivilizationInfo.current().getBuildingUniques().contains("ApolloProgram"))
tutorial.add("You can start constructing spaceship parts" +
"\r\n only after you have finished the Apollo Program");
displayTutorials("ScienceVictoryScreenEntered",tutorial);
}
private void addPartButton(String partName, LinqCounter<String> parts){
topTable.row();
TextButton button = new TextButton(partName,skin);
button.setTouchable(Touchable.disabled);
if (parts.get(partName)>0){
if(!game.civInfo.getBuildingUniques().contains("ApolloProgram"))
button.setColor(Color.GRAY);
else if (parts.get(partName)>0){
button.setColor(Color.GREEN);
parts.add(partName,-1);
}

View file

@ -76,7 +76,7 @@ public class TileGroup extends Group {
}
if (tileInfo.explored && tileInfo.unit != null && unitImage == null) {
unitImage = ImageGetter.getImage("StatIcons/" + tileInfo.unit.name.replace(" ","_") + "_(Civ5).png");
unitImage = ImageGetter.getImage("UnitIcons/" + tileInfo.unit.name.replace(" ","_") + "_(Civ5).png");
addActor(unitImage);
unitImage.setSize(20, 20); // not moved - is at bottom left
}

View file

@ -52,6 +52,7 @@ public class UnCivGame extends Game {
public void startNewGame(){
civInfo = new CivilizationInfo();
civInfo.tileMap.placeUnitNearTile(Vector2.Zero,"Settler");
civInfo.tileMap.placeUnitNearTile(Vector2.Zero,"Scout");
worldScreen = new WorldScreen();
setWorldScreen();

View file

@ -92,8 +92,10 @@ public class WorldScreen extends CameraStageBaseScreen {
beginningTutorial.add("This is the world map, which is made up of multiple tiles." +
"\r\nEach tile can contain units, as well as resources" +
"\r\n and improvements, which we'll get to later");
beginningTutorial.add("You start out with a single unit - a Settler - who can found a city." +
"\r\nClick on the central tile to assign orders to it!");
beginningTutorial.add("You start out with two units -" +
"\r\n a Settler - who can found a city," +
"\r\n and a scout, for exploring the area." +
"\r\n Click on a tile to assign orders the unit!");
displayTutorials("NewGame",beginningTutorial);
}
@ -323,6 +325,14 @@ public class WorldScreen extends CameraStageBaseScreen {
unitTile = null;
GameSaver.SaveGame(game, "Autosave");
update();
LinqCollection<String> tutorial = new LinqCollection<String>();
tutorial.add("In your first couple of turns," +
"\r\n you will have very little options," +
"\r\n but as your civilization grows, so do the " +
"\r\n number of things requiring your attention");
displayTutorials("NextTurn",tutorial);
}
});
nextTurnButton.setPosition(stage.getWidth() - nextTurnButton.getWidth() - 10,
@ -498,12 +508,12 @@ public class WorldScreen extends CameraStageBaseScreen {
"\r\nCities are the lifeblood of your empire," +
"\r\n providing gold and science empire-wide," +
"\r\n which are displayed on the top bar.");
tutorial.add("You can click the city name to enter" +
"\r\n the city screen to assign population," +
"\r\n choose production, and see information on the city");
tutorial.add("Science is used to research technologies." +
"\r\nYou can enter the technology screen by clicking" +
"\r\n on the button on the top-left, underneath the bar");
tutorial.add("You can click the city name to enter" +
"\r\n the city screen to assign population," +
"\r\n choose production, and see information on the city");
displayTutorials("CityFounded",tutorial);

View file

@ -12,8 +12,8 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Predicate;
import com.unciv.civinfo.CityInfo;
import com.unciv.civinfo.CivilizationInfo;
import com.unciv.game.UnCivGame;
import com.unciv.game.utils.ImageGetter;
import com.unciv.models.LinqCollection;
import com.unciv.models.gamebasics.GameBasics;
import com.unciv.models.gamebasics.Policy;
import com.unciv.models.gamebasics.PolicyBranch;
@ -24,6 +24,19 @@ public class PolicyPickerScreen extends PickerScreen {
private Policy pickedPolicy;
public PolicyPickerScreen() {
LinqCollection<String> tutorial = new LinqCollection<String>();
tutorial.add("Each turn, the culture you gain from all your " +
"\r\n cities is added to your Civilization's culture." +
"\r\nWhen you have enough culture, you may pick a " +
"\r\n Social Policy, each one giving you a certain bonus.");
tutorial.add("The policies are organized into branches, with each" +
"\r\n branch providing a bonus ability when all policies " +
"\r\n in the branch have been adopted.");
tutorial.add("With each policy adopted, and with each city built," +
"\r\n the cost of adopting another policy rises - so choose wisely!");
displayTutorials("PolicyPickerScreen",tutorial);
rightSideButton.setText("Adopt policy\r\n(" + ((int) game.civInfo.civStats.culture) + "/" + game.civInfo.getCultureNeededForNextPolicy() + ")");
if(CivilizationInfo.current().freePolicies>0) {

View file

@ -66,28 +66,35 @@ public class CameraStageBaseScreen implements Screen {
@Override
public void dispose() { }
private LinqCollection<String> tutorialTexts = new LinqCollection<String>();
public void displayTutorials(String name, LinqCollection<String> texts){
if(CivilizationInfo.current().tutorial.contains(name)) return;
CivilizationInfo.current().tutorial.add(name);
displayTutorial(texts);
tutorialTexts.addAll(texts);
if(!isTutorialShowing) displayTutorial();
}
public void displayTutorial(final LinqCollection<String> texts){
boolean isTutorialShowing=false;
public void displayTutorial(){
isTutorialShowing=true;
final Table tutorialTable = new Table().pad(10);
tutorialTable.background(ImageGetter.getDrawable("skin/tileTableBackground.png")
.tint(new Color(0x101050cf)));
Label label = new Label(texts.get(0),skin);
Label label = new Label(tutorialTexts.get(0),skin);
label.setFontScale(1.5f);
label.setAlignment(Align.center);
texts.remove(0);
tutorialTexts.remove(0);
tutorialTable.add(label).pad(10).row();
TextButton button = new TextButton("Close",skin);
button.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
tutorialTable.remove();
if(!texts.isEmpty()) displayTutorial(texts);
if(!tutorialTexts.isEmpty()) displayTutorial();
else isTutorialShowing=false;
}
});
tutorialTable.add(button).pad(10);

View file

@ -6,6 +6,7 @@ import com.unciv.civinfo.CivilizationInfo;
import com.unciv.civinfo.CityConstructions;
import com.unciv.civinfo.IConstruction;
import com.unciv.civinfo.TileInfo;
import com.unciv.game.ScienceVictoryScreen;
import com.unciv.game.UnCivGame;
import com.unciv.game.VictoryScreen;
import com.unciv.game.pickerscreens.PolicyPickerScreen;
@ -196,15 +197,17 @@ public class Building extends NamedStats implements IConstruction, ICivilopedia
if("SpaceshipPart".equals(unique)){
if(!civInfo.getBuildingUniques().contains("ApolloProgram")) return false;
if(civInfo.scienceVictory.requiredParts.get(name)==0) return false; // Don't need to build any more of these!
if(civInfo.scienceVictory.unconstructedParts().get(name) ==0) return false; // Don't need to build any more of these!
}
return true;
}
@Override
public void postBuildEvent(CityConstructions constructions) {
if("ApolloProgram".equals(unique)) UnCivGame.Current.setScreen(new ScienceVictoryScreen());
if("SpaceshipPart".equals(unique)) {
CivilizationInfo.current().scienceVictory.currentParts.add(name, 1);
UnCivGame.Current.setScreen(new ScienceVictoryScreen());
if(CivilizationInfo.current().scienceVictory.unconstructedParts().isEmpty())
UnCivGame.Current.setScreen(new VictoryScreen());
return;