Placing images based on technology names

Sparth

C2C Team Member
Joined
Oct 6, 2013
Messages
2,314
Im using this code

Spoiler :

Code:
		sGreat = ""
		for i in xrange(Info.getNumUnitNames()):
			sName = Info.getUnitNames(i)
			if CyTranslator().getText(sName, ()) == sUnitName:
				sGreat = sName[8:]
				break

and

Code:
	if sGreat:
			sPortrait = ""
			sIcon = ""
			sArtDef = CyArtFileMgr().getInterfaceArtInfo("ART_DEF_" + sGreat)
			if sArtDef:
				sPortrait = sArtDef.getPath()
			sBack = ""
			sType = Info.getType()
			if sType in self.GreatPeople:
				sIcon = self.GreatPeople[sType]
			sArtDef= CyArtFileMgr().getInterfaceArtInfo(sIcon)
			if sArtDef:
				sBack = sArtDef.getPath()
		else:
			return

and

Code:
		screen.addDDSGFC("GreatPersonPortrait", sPortrait, self.X_PERSON_PORTRAIT, self.Y_PERSON_PORTRAIT, self.W_PERSON_PORTRAIT, self.H_PERSON_PORTRAIT, WidgetTypes.WIDGET_GENERAL, -1, -1)
[/QUOTE]


for displaying great people portraits.

Each time GP is born his name is taken from <UniqueNames> tag from CIV4UnitInfos.xml
Im looking now for similar code for technologies. Every time new technology is discovered I want to display on tech splash screeen specific image.

One more thing: I dont want to use for this function getTechButton () because these images will be different then technology buttons.
 
Just let sGreat = Info.getType() and adjust accordingly.

The art define will then look like ART_DEFINE_TECH_XXX
 
To expand on what Platyping wrote, Info.getType() will return TECH_XXXX which you then remove the "TECH_" from the string to find the name of the file you want.
 
Not necessary to remove the TECH_ portion. I will just leave it there to know this art define is for techs.
 
I suppose it all depends on what you call the file with the picture in it I suppose. It could be TECH_THE_WHEEL.dds without problems.
 
Back
Top Bottom