def BUGConstants(self):

        if self.bBUGConstants:
            return

        self.bBUGConstants = True

        # BUG additions
        self.hammerIcon = u"%c" % (gc.getYieldInfo(
            YieldTypes.YIELD_PRODUCTION).getChar())

        # Special symbols for building, wonder and project views
        self.objectIsPresent = "x"
        self.objectIsNotPresent = "-"
        self.objectCanBeBuild = "o"
        self.objectUnderConstruction = self.hammerIcon

        # add the colors dependant on the statuses
        self.objectHave = localText.changeTextColor(
            self.objectIsPresent, gc.getInfoTypeForString("COLOR_GREEN"))  #"x"
        self.objectNotPossible = localText.changeTextColor(
            self.objectIsNotPresent,
            gc.getInfoTypeForString("COLOR_RED"))  #"-"
        self.objectPossible = localText.changeTextColor(
            self.objectCanBeBuild, gc.getInfoTypeForString("COLOR_BLUE"))  #"o"
        self.objectHaveObsolete = localText.changeTextColor(
            self.objectIsPresent, gc.getInfoTypeForString("COLOR_WHITE"))  #"x"
        self.objectNotPossibleConcurrent = localText.changeTextColor(
            self.objectIsNotPresent,
            gc.getInfoTypeForString("COLOR_YELLOW"))  #"-"
        self.objectPossibleConcurrent = localText.changeTextColor(
            self.objectCanBeBuild,
            gc.getInfoTypeForString("COLOR_YELLOW"))  #"o"

        self.szCities = localText.getText("TXT_KEY_BUG_RELIGIOUS_CITY", ())
        self.szTemples = localText.getText("TXT_KEY_BUG_RELIGIOUS_TEMPLE", ())
        self.szMonastaries = localText.getText(
            "TXT_KEY_BUG_RELIGIOUS_MONASTARY", ())
        self.szMissionaries = localText.getText(
            "TXT_KEY_BUG_RELIGIOUS_MISSIONARY", ())

        self.zoomArt = ArtFileMgr.getInterfaceArtInfo(
            "INTERFACE_BUTTONS_CITYSELECTION").getPath()
        self.sCity = localText.getText("TXT_KEY_WONDER_CITY", ())

        # scroll offset
        if ReligionUtil.getNumReligions() > 7:
            self.H_SCROLL_OFFSET = 20
        else:
            self.H_SCROLL_OFFSET = 0
Beispiel #2
0
    def BUGConstants(self):

        if self.bBUGConstants:
            return

        self.bBUGConstants = True

        # BUG additions
        self.hammerIcon = u"%c" % (gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar())

        # Special symbols for building, wonder and project views
        self.objectIsPresent = "x"
        self.objectIsNotPresent = "-"
        self.objectCanBeBuild = "o"
        self.objectUnderConstruction = self.hammerIcon

        # add the colors dependant on the statuses
        self.objectHave = localText.changeTextColor(self.objectIsPresent, gc.getInfoTypeForString("COLOR_GREEN"))  # "x"
        self.objectNotPossible = localText.changeTextColor(
            self.objectIsNotPresent, gc.getInfoTypeForString("COLOR_RED")
        )  # "-"
        self.objectPossible = localText.changeTextColor(
            self.objectCanBeBuild, gc.getInfoTypeForString("COLOR_BLUE")
        )  # "o"
        self.objectHaveObsolete = localText.changeTextColor(
            self.objectIsPresent, gc.getInfoTypeForString("COLOR_WHITE")
        )  # "x"
        self.objectNotPossibleConcurrent = localText.changeTextColor(
            self.objectIsNotPresent, gc.getInfoTypeForString("COLOR_YELLOW")
        )  # "-"
        self.objectPossibleConcurrent = localText.changeTextColor(
            self.objectCanBeBuild, gc.getInfoTypeForString("COLOR_YELLOW")
        )  # "o"

        self.szCities = localText.getText("TXT_KEY_BUG_RELIGIOUS_CITY", ())
        self.szTemples = localText.getText("TXT_KEY_BUG_RELIGIOUS_TEMPLE", ())
        self.szMonastaries = localText.getText("TXT_KEY_BUG_RELIGIOUS_MONASTARY", ())
        self.szMissionaries = localText.getText("TXT_KEY_BUG_RELIGIOUS_MISSIONARY", ())

        self.zoomArt = ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CITYSELECTION").getPath()
        self.sCity = localText.getText("TXT_KEY_WONDER_CITY", ())

        # scroll offset
        if ReligionUtil.getNumReligions() > 7:
            self.H_SCROLL_OFFSET = 20
        else:
            self.H_SCROLL_OFFSET = 0
Beispiel #3
0
	def drawCityInfo(self, iReligion):

		if (not self.bScreenUp):
			return

		screen = self.getScreen()

		if (iReligion == gc.getNumReligionInfos()):
			iLinkReligion = -1
		else:
			iLinkReligion = iReligion

		if AdvisorOpt.isReligious():
# Zappara start - make space for horizontal slider
			screen.addPanel(self.AREA1_ID, "", "", True, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.H_RELIGION_AREA + self.H_SCROLL_OFFSET + 3, self.W_RELIGION_AREA, self.H_CITY_AREA - self.H_SCROLL_OFFSET + 20, PanelStyles.PANEL_STYLE_MAIN)
			#screen.addPanel(self.AREA1_ID, "", "", True, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.H_RELIGION_AREA + 3, self.W_RELIGION_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)
# Zappara end
		else:
			screen.addPanel(self.AREA1_ID, "", "", True, True, self.X_CITY1_AREA, self.Y_CITY_AREA, self.W_CITY_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)
			screen.addPanel(self.AREA2_ID, "", "", True, True, self.X_CITY2_AREA, self.Y_CITY_AREA, self.W_CITY_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)

		szArea = self.RELIGION_PANEL_ID
		for iRel in self.RELIGIONS:
			if (self.iReligionSelected == iRel):
				screen.setState(self.getReligionButtonName(iRel), True)
			else:
				screen.setState(self.getReligionButtonName(iRel), False)

		if (self.iReligionSelected == gc.getNumReligionInfos()):
			screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), True)
		else:
			screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), False)

		iPlayer = PyPlayer(self.iActivePlayer)
		cityList = iPlayer.getCityList()

# start of BUG indent for new code
		if AdvisorOpt.isReligious():
			# create religion table
			screen.addTableControlGFC(self.TABLE_ID, self.TABLE_COLUMNS, self.X_RELIGION_AREA + 15, self.Y_RELIGION_AREA + self.H_RELIGION_AREA + self.H_SCROLL_OFFSET + 3 + 15, self.W_RELIGION_AREA - 2 * 15, self.H_CITY_AREA - self.H_SCROLL_OFFSET - 5,
						  True, True, 24,24, TableStyles.TABLE_STYLE_STANDARD)
			screen.enableSort(self.TABLE_ID)
			
			screen.setTableColumnHeader(self.TABLE_ID, self.COL_ZOOM_CITY, "", 30)
			screen.setTableColumnHeader(self.TABLE_ID, self.COL_CITY_NAME, self.sCity, 115)

			for iRel in range(self.NUM_RELIGIONS):   # columns for religious icons
				if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
					szReligionIcon = u"<font=2>%c</font>" %(gc.getReligionInfo(iRel).getChar())
					screen.setTableColumnHeader(self.TABLE_ID, self.COL_FIRST_RELIGION + iRel, szReligionIcon, 25)

			# columns for units (missionaries)
			for type in ReligionUtil.getUnitTypes():
				screen.setTableColumnHeader(self.TABLE_ID, self.COL_FIRST_UNIT + type.index, u"<font=2>%s</font>" % type.icon, 30)

			# columns for buildings (temples, monasteries, cathedral, shrine)
			for type in ReligionUtil.getBuildingTypes():
				screen.setTableColumnHeader(self.TABLE_ID, self.COL_FIRST_BUILDING + type.index, u"<font=2>%s</font>" % type.icon, 30)

			# column for religious impact
			screen.setTableColumnHeader(self.TABLE_ID, self.COL_EFFECTS, "", 400)
			
			# Loop through the cities
			for iCity in range(len(cityList)):
				pLoopCity = cityList[iCity]

				screen.appendTableRow(self.TABLE_ID)
				screen.setTableText(self.TABLE_ID, self.COL_ZOOM_CITY, iCity, "" , self.zoomArt, WidgetTypes.WIDGET_ZOOM_CITY, pLoopCity.getOwner(), pLoopCity.getID(), CvUtil.FONT_LEFT_JUSTIFY)
				screen.setTableText(self.TABLE_ID, self.COL_CITY_NAME, iCity, pLoopCity.getName(), "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

				lHolyCity = pLoopCity.getHolyCity()
				lReligions = pLoopCity.getReligions()

				for iRel in range(self.NUM_RELIGIONS):
					if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
						szReligionIcon = ""
						if iRel in lHolyCity:
							szReligionIcon = u"<font=2>%c</font>" %(gc.getReligionInfo(iRel).getHolyCityChar())
						elif iRel in lReligions:
							szReligionIcon = u"<font=2>%c</font>" %(gc.getReligionInfo(iRel).getChar())

						screen.setTableText(self.TABLE_ID, self.COL_FIRST_RELIGION + iRel, iCity, szReligionIcon, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY)

				if ReligionUtil.isValid(iReligion):
					# check for missionaries
					for i in range(ReligionUtil.getNumUnitTypes()):
						iUnit = ReligionUtil.getUnit(iReligion, i)
						if pLoopCity.GetCy().getFirstUnitOrder(iUnit) != -1:
							sUnit = self.objectUnderConstruction
						elif pLoopCity.GetCy().canTrain(iUnit, False, False):
							sUnit = self.objectPossible
						else:
							sUnit = self.objectNotPossible
						screen.setTableText(self.TABLE_ID, self.COL_FIRST_UNIT + i, iCity, sUnit, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY)
					
					# check for temples, cathedral, monasteries, shrine
					for i in range(ReligionUtil.getNumBuildingTypes()):
						iBldg = ReligionUtil.getBuilding(iReligion, i)
						sBldg = self.calculateBuilding(pLoopCity, iBldg)
						screen.setTableText(self.TABLE_ID, self.COL_FIRST_BUILDING + i, iCity, sBldg, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_CENTER_JUSTIFY)

				# advc: Moved into subroutine
				sHelp = self.cityHelp(lReligions, pLoopCity.GetCy(), iLinkReligion)

				screen.setTableText(self.TABLE_ID, self.COL_EFFECTS, iCity, sHelp, "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

# start of BUG indent of original code
		else:
			# Loop through the cities
			szLeftCities = u""
			szRightCities = u""
			for i in range(len(cityList)):

				bFirstColumn = (i % 2 == 0)

				pLoopCity = cityList[i]

				# Constructing the City name...
				szCityName = u""
				if pLoopCity.isCapital():
					szCityName += u"%c" % CyGame().getSymbolID(FontSymbols.STAR_CHAR)

				lHolyCity = pLoopCity.getHolyCity()
				if lHolyCity:
					for iI in range(len(lHolyCity)):
						szCityName += u"%c" %(gc.getReligionInfo(lHolyCity[iI]).getHolyCityChar())

				lReligions = pLoopCity.getReligions()
				if lReligions:
					for iI in range(len(lReligions)):
						if lReligions[iI] not in lHolyCity:
							szCityName += u"%c" %(gc.getReligionInfo(lReligions[iI]).getChar())

				szCityName += pLoopCity.getName()[0:17] + "  "
				# advc: Moved into subroutine
				szCityName += self.cityHelp(lReligions, pLoopCity.GetCy(), iLinkReligion)

				if bFirstColumn:
					szLeftCities += u"<font=3>" + szCityName + u"</font>\n"
				else:
					szRightCities += u"<font=3>" + szCityName + u"</font>\n"

			screen.addMultilineText("Child" + self.AREA1_ID, szLeftCities, self.X_CITY1_AREA+5, self.Y_CITY_AREA+5, self.W_CITY_AREA-10, self.H_CITY_AREA-10, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
			screen.addMultilineText("Child" + self.AREA2_ID, szRightCities, self.X_CITY2_AREA+5, self.Y_CITY_AREA+5, self.W_CITY_AREA-10, self.H_CITY_AREA-10, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
# end of BUG indent of original code

		# Convert Button....
		iLink = 0
		if (gc.getPlayer(self.iActivePlayer).canChangeReligion()):
			iLink = 1

		if (not self.canConvert(iLinkReligion) or iLinkReligion == self.iReligionOriginal):			
			screen.setText(self.CONVERT_NAME, "Background", self.EXIT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)
			screen.hide(self.CANCEL_NAME)
			szAnarchyTime = CyGameTextMgr().setConvertHelp(self.iActivePlayer, iLinkReligion)
		else:
			screen.setText(self.CONVERT_NAME, "Background", self.CONVERT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CONVERT, iLinkReligion, 1)
			screen.show(self.CANCEL_NAME)
			szAnarchyTime = localText.getText("TXT_KEY_ANARCHY_TURNS", (gc.getPlayer(self.iActivePlayer).getReligionAnarchyLength(), ))

		# Turns of Anarchy Text...
		screen.setLabel(self.RELIGION_ANARCHY_WIDGET, "Background", u"<font=3>" + szAnarchyTime + u"</font>", CvUtil.FONT_LEFT_JUSTIFY, self.X_ANARCHY, self.Y_ANARCHY, self.Z_TEXT, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
Beispiel #4
0
	def drawHelpInfo(self):
		
		screen = self.getScreen()
		szArea = "ReligionList"

		## johny smith
		## This attaches the text to the panel
		## This is for every line of font
		# Founded...
		screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_DATE_FOUNDED", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		# Date Founded:
		xLoop = self.X_RELIGION_START
		for iRel in self.RELIGIONS:
			if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
				szFounded = CyGameTextMgr().getTimeStr(gc.getGame().getReligionGameTurnFounded(iRel), false)
				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
			xLoop += self.DX_RELIGION

#		screen.setLabelAt("", szArea, "", CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		# Holy City...
		screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_HOLY_CITY", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		xLoop = self.X_RELIGION_START
		for iRel in self.RELIGIONS:
			if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
				pHolyCity = gc.getGame().getHolyCity(iRel)
				if pHolyCity.isNone():
					szFounded = localText.getText("TXT_KEY_NONE", ())
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				elif not pHolyCity.isRevealed(gc.getPlayer(self.iActivePlayer).getTeam(), True): # advc.001d: Call isRevealed with bDebug=True to compensate for the problems with switching iActivePlayer (see comment in handleInput)
					szFounded = localText.getText("TXT_KEY_UNKNOWN", ())
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				else:
					szFounded = pHolyCity.getName()
					screen.setLabelAt("", szArea, u"(%s)" % gc.getPlayer(pHolyCity.getOwner()).getCivilizationAdjective(0), CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY+8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY-8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
#			else:
#				szFounded = "-"
#				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
			xLoop += self.DX_RELIGION

		# Influence...
		screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_INFLUENCE", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		xLoop = self.X_RELIGION_START
		for iRel in self.RELIGIONS:
			if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
				szFounded = str(gc.getGame().calculateReligionPercent(iRel)) + "%"
				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
#			else:
#				szFounded = "-"
#				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
			xLoop += self.DX_RELIGION

		if AdvisorOpt.isReligious():
			# Count the number of temples and monastery
			self.BUGConstants()
			iPlayer = PyPlayer(self.iActivePlayer)
			cityList = iPlayer.getCityList()
# BUG - start
			iCities = [0] * self.NUM_RELIGIONS
			iTemple = [0] * self.NUM_RELIGIONS
			iMonastery = [0] * self.NUM_RELIGIONS
			iMissionaries_Active = [0] * self.NUM_RELIGIONS
			iMissionaries_Construct = [0] * self.NUM_RELIGIONS
			
			for pLoopCity in cityList:
				lHolyCity = pLoopCity.getHolyCity()
				lReligions = pLoopCity.getReligions()

				for iRel in self.RELIGIONS:
					# count the number of cities
					if iRel in lReligions:
						iCities[iRel] += 1

					# count the number of temples
					iBldg = ReligionUtil.getBuilding(iRel, ReligionUtil.BUILDING_TEMPLE)
					if self.calculateBuilding(pLoopCity, iBldg) == self.objectHave:
						iTemple[iRel] += 1

					# count the number of monasteries
					iBldg = ReligionUtil.getBuilding(iRel, ReligionUtil.BUILDING_MONASTERY)
					if self.calculateBuilding(pLoopCity, iBldg) == self.objectHave:
						iMonastery[iRel] += 1

					# count the number of missionaries under construction
					iUnit = ReligionUtil.getUnit(iRel, ReligionUtil.UNIT_MISSIONARY)
					if pLoopCity.GetCy().getFirstUnitOrder(iUnit) != -1:
						iMissionaries_Construct[iRel] += 1

			# count the number of active missionaries
			for iUnit in PlayerUtil.playerUnits(self.iActivePlayer):  
				for iRel in self.RELIGIONS:
					if iUnit.getUnitType() == ReligionUtil.getUnit(iRel, ReligionUtil.UNIT_MISSIONARY):
						iMissionaries_Active[iRel] += 1

			# number of cities...
			iY = self.Y_INFLUENCE + 20
			sCities = "%s [%i]:" % (self.szCities, len(cityList))
			screen.setLabelAt("", szArea, sCities, CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

			xLoop = self.X_RELIGION_START
			for iRel in self.RELIGIONS:
				if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
					szFounded = "%i" % (iCities[iRel])
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				xLoop += self.DX_RELIGION

			# number of temples...
			iY = self.Y_INFLUENCE + 40
			screen.setLabelAt("", szArea, self.szTemples, CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

			xLoop = self.X_RELIGION_START
			for iRel in self.RELIGIONS:
				if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
					szFounded = "%i" % (iTemple[iRel])
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				xLoop += self.DX_RELIGION

			# number of monasteries...
			iY = self.Y_INFLUENCE + 60
			screen.setLabelAt("", szArea, self.szMonastaries, CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

			xLoop = self.X_RELIGION_START
			for iRel in self.RELIGIONS:
				if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
					szFounded = "%i" % (iMonastery[iRel])
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				xLoop += self.DX_RELIGION

			# number of missionaries...
			iY = self.Y_INFLUENCE + 80
			screen.setLabelAt("", szArea, self.szMissionaries, CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

			xLoop = self.X_RELIGION_START
			for iRel in self.RELIGIONS:
				if (gc.getGame().getReligionGameTurnFounded(iRel) >= 0):
					szFounded = "%i [%i]" % (iMissionaries_Active[iRel], iMissionaries_Construct[iRel])
					screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, iY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
				xLoop += self.DX_RELIGION

		self.iReligionSelected = gc.getPlayer(self.iActivePlayer).getStateReligion()
		if (self.iReligionSelected == -1):
			self.iReligionSelected = gc.getNumReligionInfos()
		self.iReligionExamined = self.iReligionSelected
		self.iReligionOriginal = self.iReligionSelected
Beispiel #5
0
	def interfaceScreen (self):

		self.SCREEN_ART = ArtFileMgr.getInterfaceArtInfo("TECH_BG").getPath()
		self.NO_STATE_BUTTON_ART = ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CANCEL").getPath()
		self.EXIT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper() + "</font>"
		self.CONVERT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_RELIGION_CONVERT", ()).upper() + "</font>"
		self.CANCEL_TEXT = u"<font=4>" + localText.getText("TXT_KEY_SCREEN_CANCEL", ()).upper() + "</font>"

		self.iActivePlayer = gc.getGame().getActivePlayer()
		
# BUG - start
		if self.NUM_RELIGIONS == -1:
			self.NUM_RELIGIONS = ReligionUtil.getNumReligions()
			self.COL_FIRST_UNIT = self.COL_FIRST_RELIGION + self.NUM_RELIGIONS
			self.COL_FIRST_BUILDING = self.COL_FIRST_UNIT + ReligionUtil.getNumUnitTypes()
			self.COL_EFFECTS = self.COL_FIRST_BUILDING + ReligionUtil.getNumBuildingTypes()
			self.TABLE_COLUMNS = self.COL_EFFECTS + 1
# BUG - end

		self.bScreenUp = True

		screen = self.getScreen()
		if screen.isActive():
			return
		screen.setRenderInterfaceOnly(True);
		screen.showScreen( PopupStates.POPUPSTATE_IMMEDIATE, False)

		# Set the background and exit button, and show the screen
		screen.setDimensions(screen.centerX(0), screen.centerY(0), self.W_SCREEN, self.H_SCREEN)

		screen.addDDSGFC(self.BACKGROUND_ID, ArtFileMgr.getInterfaceArtInfo("MAINMENU_SLIDESHOW_LOAD").getPath(), 0, 0, self.W_SCREEN, self.H_SCREEN, WidgetTypes.WIDGET_GENERAL, -1, -1 )
		screen.addPanel( "TechTopPanel", u"", u"", True, False, 0, 0, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_TOPBAR )
		screen.addPanel( "TechBottomPanel", u"", u"", True, False, 0, 713, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_BOTTOMBAR )
		screen.setText(self.CANCEL_NAME, "Background", self.CANCEL_TEXT, CvUtil.FONT_CENTER_JUSTIFY, self.X_CANCEL, self.Y_CANCEL, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)

		screen.showWindowBackground(False)

		# Header...
		screen.setLabel(self.HEADER_NAME, "Background", u"<font=4b>" + localText.getText("TXT_KEY_RELIGION_SCREEN_TITLE", ()).upper() + u"</font>", CvUtil.FONT_CENTER_JUSTIFY, self.X_SCREEN, self.Y_TITLE, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

		# Make the scrollable areas for the city list...

		if (CyGame().isDebugMode()):
			self.szDropdownName = self.DEBUG_DROPDOWN_ID
			screen.addDropDownBoxGFC(self.szDropdownName, 22, 12, 300, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
			for j in range(gc.getMAX_PLAYERS()):
				if (gc.getPlayer(j).isAlive()):
					screen.addPullDownString(self.szDropdownName, gc.getPlayer(j).getName(), j, j, False )

		if AdvisorOpt.isReligious():
			self.X_RELIGION_AREA = 45
			self.Y_RELIGION_AREA = 84 - 40
			self.W_RELIGION_AREA = 934
			self.H_RELIGION_AREA = 175 + 75
#			screen.addPanel(szArea, "", "", False, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA - 40, self.W_RELIGION_AREA, self.H_RELIGION_AREA + 80, PanelStyles.PANEL_STYLE_MAIN)
			if AdvisorOpt.isShowAllReligions():
				self.RELIGIONS = ReligionUtil.getAllReligions()
			elif AdvisorOpt.isShowFoundedReligions():
				self.RELIGIONS = ReligionUtil.getFoundedReligions()
			else:
				self.RELIGIONS = ReligionUtil.getPlayerReligions(gc.getPlayer(self.iActivePlayer))
		else:
			self.X_RELIGION_AREA = 45
			self.Y_RELIGION_AREA = 84
			self.W_RELIGION_AREA = 934
			self.H_RELIGION_AREA = 175
			# self.RELIGIONS = ReligionUtil.getAllReligions() + (ReligionUtil.getNumReligions(),)
			# K-Mod. the original BUG code simply doesn't run. (advc, note: Also fixed in BUG 4.5.)
			self.RELIGIONS = range(gc.getNumReligionInfos())

		# Make the scrollable area for the religions list...
		screen.addPanel(self.RELIGION_PANEL_ID, "", "", False, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA, self.W_RELIGION_AREA, self.H_RELIGION_AREA+5, PanelStyles.PANEL_STYLE_MAIN)
		screen.addScrollPanel( "ReligionList", u"", self.X_RELIGION_AREA, self.Y_RELIGION_AREA, self.W_RELIGION_AREA, self.H_RELIGION_AREA, PanelStyles.PANEL_STYLE_EXTERNAL )
		screen.setActivation( "ReligionList", ActivationTypes.ACTIVATE_NORMAL )

		# Draw Religion info
		self.drawReligionInfo()

		self.drawHelpInfo()
		
		self.drawCityInfo(self.iReligionSelected)
Beispiel #6
0
    def drawCityInfo(self, iReligion):

        if not self.bScreenUp:
            return

        screen = self.getScreen()

        if iReligion == gc.getNumReligionInfos():
            iLinkReligion = -1
        else:
            iLinkReligion = iReligion

        if AdvisorOpt.isReligious():
            # Zappara start - make space for horizontal slider
            screen.addPanel(
                self.AREA1_ID,
                "",
                "",
                True,
                True,
                self.X_RELIGION_AREA,
                self.Y_RELIGION_AREA + self.H_RELIGION_AREA + self.H_SCROLL_OFFSET + 3,
                self.W_RELIGION_AREA,
                self.H_CITY_AREA - self.H_SCROLL_OFFSET + 20,
                PanelStyles.PANEL_STYLE_MAIN,
            )
            # screen.addPanel(self.AREA1_ID, "", "", True, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.H_RELIGION_AREA + 3, self.W_RELIGION_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)
        # Zappara end
        else:
            screen.addPanel(
                self.AREA1_ID,
                "",
                "",
                True,
                True,
                self.X_CITY1_AREA,
                self.Y_CITY_AREA,
                self.W_CITY_AREA,
                self.H_CITY_AREA,
                PanelStyles.PANEL_STYLE_MAIN,
            )
            screen.addPanel(
                self.AREA2_ID,
                "",
                "",
                True,
                True,
                self.X_CITY2_AREA,
                self.Y_CITY_AREA,
                self.W_CITY_AREA,
                self.H_CITY_AREA,
                PanelStyles.PANEL_STYLE_MAIN,
            )

        szArea = self.RELIGION_PANEL_ID
        for iRel in self.RELIGIONS:
            if self.iReligionSelected == iRel:
                screen.setState(self.getReligionButtonName(iRel), True)
            else:
                screen.setState(self.getReligionButtonName(iRel), False)

        if self.iReligionSelected == gc.getNumReligionInfos():
            screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), True)
        else:
            screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), False)

        iPlayer = PyPlayer(self.iActivePlayer)
        cityList = iPlayer.getCityList()

        # start of BUG indent for new code
        if AdvisorOpt.isReligious():
            # create religion table
            screen.addTableControlGFC(
                self.TABLE_ID,
                self.TABLE_COLUMNS,
                self.X_RELIGION_AREA + 15,
                self.Y_RELIGION_AREA + self.H_RELIGION_AREA + self.H_SCROLL_OFFSET + 3 + 15,
                self.W_RELIGION_AREA - 2 * 15,
                self.H_CITY_AREA - self.H_SCROLL_OFFSET - 5,
                True,
                True,
                24,
                24,
                TableStyles.TABLE_STYLE_STANDARD,
            )
            screen.enableSort(self.TABLE_ID)

            screen.setTableColumnHeader(self.TABLE_ID, self.COL_ZOOM_CITY, "", 30)
            screen.setTableColumnHeader(self.TABLE_ID, self.COL_CITY_NAME, self.sCity, 115)

            for iRel in range(self.NUM_RELIGIONS):  # columns for religious icons
                if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                    szReligionIcon = u"<font=2>%c</font>" % (gc.getReligionInfo(iRel).getChar())
                    screen.setTableColumnHeader(self.TABLE_ID, self.COL_FIRST_RELIGION + iRel, szReligionIcon, 25)

                    # columns for units (missionaries)
            for type in ReligionUtil.getUnitTypes():
                screen.setTableColumnHeader(
                    self.TABLE_ID, self.COL_FIRST_UNIT + type.index, u"<font=2>%s</font>" % type.icon, 30
                )

                # columns for buildings (temples, monasteries, cathedral, shrine)
            for type in ReligionUtil.getBuildingTypes():
                screen.setTableColumnHeader(
                    self.TABLE_ID, self.COL_FIRST_BUILDING + type.index, u"<font=2>%s</font>" % type.icon, 30
                )

                # column for religious impact
            screen.setTableColumnHeader(self.TABLE_ID, self.COL_EFFECTS, "", 400)

            # Loop through the cities
            for iCity in range(len(cityList)):
                pLoopCity = cityList[iCity]

                screen.appendTableRow(self.TABLE_ID)
                screen.setTableText(
                    self.TABLE_ID,
                    self.COL_ZOOM_CITY,
                    iCity,
                    "",
                    self.zoomArt,
                    WidgetTypes.WIDGET_ZOOM_CITY,
                    pLoopCity.getOwner(),
                    pLoopCity.getID(),
                    CvUtil.FONT_LEFT_JUSTIFY,
                )
                screen.setTableText(
                    self.TABLE_ID,
                    self.COL_CITY_NAME,
                    iCity,
                    pLoopCity.getName(),
                    "",
                    WidgetTypes.WIDGET_GENERAL,
                    -1,
                    -1,
                    CvUtil.FONT_LEFT_JUSTIFY,
                )

                lHolyCity = pLoopCity.getHolyCity()
                lReligions = pLoopCity.getReligions()

                for iRel in range(self.NUM_RELIGIONS):
                    if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                        szReligionIcon = ""
                        if iRel in lHolyCity:
                            szReligionIcon = u"<font=2>%c</font>" % (gc.getReligionInfo(iRel).getHolyCityChar())
                        elif iRel in lReligions:
                            szReligionIcon = u"<font=2>%c</font>" % (gc.getReligionInfo(iRel).getChar())

                        screen.setTableText(
                            self.TABLE_ID,
                            self.COL_FIRST_RELIGION + iRel,
                            iCity,
                            szReligionIcon,
                            "",
                            WidgetTypes.WIDGET_GENERAL,
                            -1,
                            -1,
                            CvUtil.FONT_CENTER_JUSTIFY,
                        )

                if ReligionUtil.isValid(iReligion):
                    # check for missionaries
                    for i in range(ReligionUtil.getNumUnitTypes()):
                        iUnit = ReligionUtil.getUnit(iReligion, i)
                        if pLoopCity.GetCy().getFirstUnitOrder(iUnit) != -1:
                            sUnit = self.objectUnderConstruction
                        elif pLoopCity.GetCy().canTrain(iUnit, False, False):
                            sUnit = self.objectPossible
                        else:
                            sUnit = self.objectNotPossible
                        screen.setTableText(
                            self.TABLE_ID,
                            self.COL_FIRST_UNIT + i,
                            iCity,
                            sUnit,
                            "",
                            WidgetTypes.WIDGET_GENERAL,
                            -1,
                            -1,
                            CvUtil.FONT_CENTER_JUSTIFY,
                        )

                        # check for temples, cathedral, monasteries, shrine
                    for i in range(ReligionUtil.getNumBuildingTypes()):
                        iBldg = ReligionUtil.getBuilding(iReligion, i)
                        sBldg = self.calculateBuilding(pLoopCity, iBldg)
                        screen.setTableText(
                            self.TABLE_ID,
                            self.COL_FIRST_BUILDING + i,
                            iCity,
                            sBldg,
                            "",
                            WidgetTypes.WIDGET_GENERAL,
                            -1,
                            -1,
                            CvUtil.FONT_CENTER_JUSTIFY,
                        )

                if iLinkReligion == -1:
                    bFirst = True
                    sHelp = ""
                    for iI in range(len(lReligions)):
                        szTempBuffer = CyGameTextMgr().getReligionHelpCity(
                            lReligions[iI], pLoopCity.GetCy(), False, False, False, True
                        )
                        if szTempBuffer:
                            if not bFirst:
                                sHelp += u", "
                            sHelp += szTempBuffer
                            bFirst = False
                else:
                    sHelp = CyGameTextMgr().getReligionHelpCity(
                        iLinkReligion, pLoopCity.GetCy(), False, False, True, False
                    )

                screen.setTableText(
                    self.TABLE_ID,
                    self.COL_EFFECTS,
                    iCity,
                    sHelp,
                    "",
                    WidgetTypes.WIDGET_GENERAL,
                    -1,
                    -1,
                    CvUtil.FONT_LEFT_JUSTIFY,
                )

        # start of BUG indent of original code
        else:
            # Loop through the cities
            szLeftCities = u""
            szRightCities = u""
            for i in range(len(cityList)):

                bFirstColumn = i % 2 == 0

                pLoopCity = cityList[i]

                # Constructing the City name...
                szCityName = u""
                if pLoopCity.isCapital():
                    szCityName += u"%c" % CyGame().getSymbolID(FontSymbols.STAR_CHAR)

                lHolyCity = pLoopCity.getHolyCity()
                if lHolyCity:
                    for iI in range(len(lHolyCity)):
                        szCityName += u"%c" % (gc.getReligionInfo(lHolyCity[iI]).getHolyCityChar())

                lReligions = pLoopCity.getReligions()
                if lReligions:
                    for iI in range(len(lReligions)):
                        if lReligions[iI] not in lHolyCity:
                            szCityName += u"%c" % (gc.getReligionInfo(lReligions[iI]).getChar())

                szCityName += pLoopCity.getName()[0:17] + "  "

                if iLinkReligion == -1:
                    bFirst = True
                    for iI in range(len(lReligions)):
                        szTempBuffer = CyGameTextMgr().getReligionHelpCity(
                            lReligions[iI], pLoopCity.GetCy(), False, False, False, True
                        )
                        if szTempBuffer:
                            if not bFirst:
                                szCityName += u", "
                            szCityName += szTempBuffer
                            bFirst = False
                else:
                    szCityName += CyGameTextMgr().getReligionHelpCity(
                        iLinkReligion, pLoopCity.GetCy(), False, False, True, False
                    )

                if bFirstColumn:
                    szLeftCities += u"<font=3>" + szCityName + u"</font>\n"
                else:
                    szRightCities += u"<font=3>" + szCityName + u"</font>\n"

            screen.addMultilineText(
                "Child" + self.AREA1_ID,
                szLeftCities,
                self.X_CITY1_AREA + 5,
                self.Y_CITY_AREA + 5,
                self.W_CITY_AREA - 10,
                self.H_CITY_AREA - 10,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
                CvUtil.FONT_LEFT_JUSTIFY,
            )
            screen.addMultilineText(
                "Child" + self.AREA2_ID,
                szRightCities,
                self.X_CITY2_AREA + 5,
                self.Y_CITY_AREA + 5,
                self.W_CITY_AREA - 10,
                self.H_CITY_AREA - 10,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
                CvUtil.FONT_LEFT_JUSTIFY,
            )
        # end of BUG indent of original code

        # Convert Button....
        iLink = 0
        if gc.getPlayer(self.iActivePlayer).canChangeReligion():
            iLink = 1

        if not self.canConvert(iLinkReligion) or iLinkReligion == self.iReligionOriginal:
            screen.setText(
                self.CONVERT_NAME,
                "Background",
                self.EXIT_TEXT,
                CvUtil.FONT_RIGHT_JUSTIFY,
                self.X_EXIT,
                self.Y_EXIT,
                self.Z_TEXT,
                FontTypes.TITLE_FONT,
                WidgetTypes.WIDGET_GENERAL,
                1,
                0,
            )
            screen.hide(self.CANCEL_NAME)
            szAnarchyTime = CyGameTextMgr().setConvertHelp(self.iActivePlayer, iLinkReligion)
        else:
            screen.setText(
                self.CONVERT_NAME,
                "Background",
                self.CONVERT_TEXT,
                CvUtil.FONT_RIGHT_JUSTIFY,
                self.X_EXIT,
                self.Y_EXIT,
                self.Z_TEXT,
                FontTypes.TITLE_FONT,
                WidgetTypes.WIDGET_CONVERT,
                iLinkReligion,
                1,
            )
            screen.show(self.CANCEL_NAME)
            szAnarchyTime = localText.getText(
                "TXT_KEY_ANARCHY_TURNS", (gc.getPlayer(self.iActivePlayer).getReligionAnarchyLength(),)
            )

            # Turns of Anarchy Text...
        screen.setLabel(
            self.RELIGION_ANARCHY_WIDGET,
            "Background",
            u"<font=3>" + szAnarchyTime + u"</font>",
            CvUtil.FONT_LEFT_JUSTIFY,
            self.X_ANARCHY,
            self.Y_ANARCHY,
            self.Z_TEXT,
            FontTypes.GAME_FONT,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )
Beispiel #7
0
    def drawHelpInfo(self):

        screen = self.getScreen()
        szArea = "ReligionList"

        ## johny smith
        ## This attaches the text to the panel
        ## This is for every line of font
        # Founded...
        screen.setLabelAt(
            "",
            szArea,
            localText.getText("TXT_KEY_RELIGION_SCREEN_DATE_FOUNDED", ()),
            CvUtil.FONT_LEFT_JUSTIFY,
            self.LEFT_EDGE_TEXT,
            self.Y_FOUNDED,
            self.DZ,
            FontTypes.SMALL_FONT,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )

        # Date Founded:
        xLoop = self.X_RELIGION_START
        for iRel in self.RELIGIONS:
            if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                szFounded = CyGameTextMgr().getTimeStr(gc.getGame().getReligionGameTurnFounded(iRel), false)
                screen.setLabelAt(
                    "",
                    szArea,
                    szFounded,
                    CvUtil.FONT_CENTER_JUSTIFY,
                    xLoop,
                    self.Y_FOUNDED,
                    self.DZ,
                    FontTypes.SMALL_FONT,
                    WidgetTypes.WIDGET_GENERAL,
                    -1,
                    -1,
                )
            xLoop += self.DX_RELIGION

        # 		screen.setLabelAt("", szArea, "", CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        # Holy City...
        screen.setLabelAt(
            "",
            szArea,
            localText.getText("TXT_KEY_RELIGION_SCREEN_HOLY_CITY", ()),
            CvUtil.FONT_LEFT_JUSTIFY,
            self.LEFT_EDGE_TEXT,
            self.Y_HOLY_CITY,
            self.DZ,
            FontTypes.SMALL_FONT,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )

        xLoop = self.X_RELIGION_START
        for iRel in self.RELIGIONS:
            if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                pHolyCity = gc.getGame().getHolyCity(iRel)
                if pHolyCity.isNone():
                    szFounded = localText.getText("TXT_KEY_NONE", ())
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        self.Y_HOLY_CITY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                elif not pHolyCity.isRevealed(gc.getPlayer(self.iActivePlayer).getTeam(), False):
                    szFounded = localText.getText("TXT_KEY_UNKNOWN", ())
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        self.Y_HOLY_CITY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                else:
                    szFounded = pHolyCity.getName()
                    screen.setLabelAt(
                        "",
                        szArea,
                        u"(%s)" % gc.getPlayer(pHolyCity.getOwner()).getCivilizationAdjective(0),
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        self.Y_HOLY_CITY + 8,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        self.Y_HOLY_CITY - 8,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
            # 			else:
            # 				szFounded = "-"
            # 				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            xLoop += self.DX_RELIGION

            # Influence...
        screen.setLabelAt(
            "",
            szArea,
            localText.getText("TXT_KEY_RELIGION_SCREEN_INFLUENCE", ()),
            CvUtil.FONT_LEFT_JUSTIFY,
            self.LEFT_EDGE_TEXT,
            self.Y_INFLUENCE,
            self.DZ,
            FontTypes.SMALL_FONT,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )

        xLoop = self.X_RELIGION_START
        for iRel in self.RELIGIONS:
            if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                szFounded = str(gc.getGame().calculateReligionPercent(iRel)) + "%"
                screen.setLabelAt(
                    "",
                    szArea,
                    szFounded,
                    CvUtil.FONT_CENTER_JUSTIFY,
                    xLoop,
                    self.Y_INFLUENCE,
                    self.DZ,
                    FontTypes.SMALL_FONT,
                    WidgetTypes.WIDGET_GENERAL,
                    -1,
                    -1,
                )
            # 			else:
            # 				szFounded = "-"
            # 				screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            xLoop += self.DX_RELIGION

        if AdvisorOpt.isReligious():
            # Count the number of temples and monastery
            self.BUGConstants()
            iPlayer = PyPlayer(self.iActivePlayer)
            cityList = iPlayer.getCityList()
            # BUG - start
            iCities = [0] * self.NUM_RELIGIONS
            iTemple = [0] * self.NUM_RELIGIONS
            iMonastery = [0] * self.NUM_RELIGIONS
            iMissionaries_Active = [0] * self.NUM_RELIGIONS
            iMissionaries_Construct = [0] * self.NUM_RELIGIONS

            for pLoopCity in cityList:
                lHolyCity = pLoopCity.getHolyCity()
                lReligions = pLoopCity.getReligions()

                for iRel in self.RELIGIONS:
                    # count the number of cities
                    if iRel in lReligions:
                        iCities[iRel] += 1

                        # count the number of temples
                    iBldg = ReligionUtil.getBuilding(iRel, ReligionUtil.BUILDING_TEMPLE)
                    if self.calculateBuilding(pLoopCity, iBldg) == self.objectHave:
                        iTemple[iRel] += 1

                        # count the number of monasteries
                    iBldg = ReligionUtil.getBuilding(iRel, ReligionUtil.BUILDING_MONASTERY)
                    if self.calculateBuilding(pLoopCity, iBldg) == self.objectHave:
                        iMonastery[iRel] += 1

                        # count the number of missionaries under construction
                    iUnit = ReligionUtil.getUnit(iRel, ReligionUtil.UNIT_MISSIONARY)
                    if pLoopCity.GetCy().getFirstUnitOrder(iUnit) != -1:
                        iMissionaries_Construct[iRel] += 1

                        # count the number of active missionaries
            for iUnit in PlayerUtil.playerUnits(self.iActivePlayer):
                for iRel in self.RELIGIONS:
                    if iUnit.getUnitType() == ReligionUtil.getUnit(iRel, ReligionUtil.UNIT_MISSIONARY):
                        iMissionaries_Active[iRel] += 1

                        # number of cities...
            iY = self.Y_INFLUENCE + 20
            sCities = "%s [%i]:" % (self.szCities, len(cityList))
            screen.setLabelAt(
                "",
                szArea,
                sCities,
                CvUtil.FONT_LEFT_JUSTIFY,
                self.LEFT_EDGE_TEXT,
                iY,
                self.DZ,
                FontTypes.SMALL_FONT,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
            )

            xLoop = self.X_RELIGION_START
            for iRel in self.RELIGIONS:
                if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                    szFounded = "%i" % (iCities[iRel])
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        iY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                xLoop += self.DX_RELIGION

                # number of temples...
            iY = self.Y_INFLUENCE + 40
            screen.setLabelAt(
                "",
                szArea,
                self.szTemples,
                CvUtil.FONT_LEFT_JUSTIFY,
                self.LEFT_EDGE_TEXT,
                iY,
                self.DZ,
                FontTypes.SMALL_FONT,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
            )

            xLoop = self.X_RELIGION_START
            for iRel in self.RELIGIONS:
                if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                    szFounded = "%i" % (iTemple[iRel])
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        iY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                xLoop += self.DX_RELIGION

                # number of monasteries...
            iY = self.Y_INFLUENCE + 60
            screen.setLabelAt(
                "",
                szArea,
                self.szMonastaries,
                CvUtil.FONT_LEFT_JUSTIFY,
                self.LEFT_EDGE_TEXT,
                iY,
                self.DZ,
                FontTypes.SMALL_FONT,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
            )

            xLoop = self.X_RELIGION_START
            for iRel in self.RELIGIONS:
                if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                    szFounded = "%i" % (iMonastery[iRel])
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        iY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                xLoop += self.DX_RELIGION

                # number of missionaries...
            iY = self.Y_INFLUENCE + 80
            screen.setLabelAt(
                "",
                szArea,
                self.szMissionaries,
                CvUtil.FONT_LEFT_JUSTIFY,
                self.LEFT_EDGE_TEXT,
                iY,
                self.DZ,
                FontTypes.SMALL_FONT,
                WidgetTypes.WIDGET_GENERAL,
                -1,
                -1,
            )

            xLoop = self.X_RELIGION_START
            for iRel in self.RELIGIONS:
                if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                    szFounded = "%i [%i]" % (iMissionaries_Active[iRel], iMissionaries_Construct[iRel])
                    screen.setLabelAt(
                        "",
                        szArea,
                        szFounded,
                        CvUtil.FONT_CENTER_JUSTIFY,
                        xLoop,
                        iY,
                        self.DZ,
                        FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL,
                        -1,
                        -1,
                    )
                xLoop += self.DX_RELIGION

        self.iReligionSelected = gc.getPlayer(self.iActivePlayer).getStateReligion()
        if self.iReligionSelected == -1:
            self.iReligionSelected = gc.getNumReligionInfos()
        self.iReligionExamined = self.iReligionSelected
        self.iReligionOriginal = self.iReligionSelected
Beispiel #8
0
    def interfaceScreen(self):

        self.SCREEN_ART = ArtFileMgr.getInterfaceArtInfo("TECH_BG").getPath()
        self.NO_STATE_BUTTON_ART = ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CANCEL").getPath()
        self.EXIT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper() + "</font>"
        self.CONVERT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_RELIGION_CONVERT", ()).upper() + "</font>"
        self.CANCEL_TEXT = u"<font=4>" + localText.getText("TXT_KEY_SCREEN_CANCEL", ()).upper() + "</font>"

        self.iActivePlayer = gc.getGame().getActivePlayer()

        # BUG - start
        if self.NUM_RELIGIONS == -1:
            self.NUM_RELIGIONS = ReligionUtil.getNumReligions()
            self.COL_FIRST_UNIT = self.COL_FIRST_RELIGION + self.NUM_RELIGIONS
            self.COL_FIRST_BUILDING = self.COL_FIRST_UNIT + ReligionUtil.getNumUnitTypes()
            self.COL_EFFECTS = self.COL_FIRST_BUILDING + ReligionUtil.getNumBuildingTypes()
            self.TABLE_COLUMNS = self.COL_EFFECTS + 1
        # BUG - end

        self.bScreenUp = True

        screen = self.getScreen()
        if screen.isActive():
            return
        screen.setRenderInterfaceOnly(True)
        screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)

        # Set the background and exit button, and show the screen
        screen.setDimensions(screen.centerX(0), screen.centerY(0), self.W_SCREEN, self.H_SCREEN)

        screen.addDDSGFC(
            self.BACKGROUND_ID,
            ArtFileMgr.getInterfaceArtInfo("MAINMENU_SLIDESHOW_LOAD").getPath(),
            0,
            0,
            self.W_SCREEN,
            self.H_SCREEN,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )
        screen.addPanel("TechTopPanel", u"", u"", True, False, 0, 0, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_TOPBAR)
        screen.addPanel(
            "TechBottomPanel", u"", u"", True, False, 0, 713, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_BOTTOMBAR
        )
        screen.setText(
            self.CANCEL_NAME,
            "Background",
            self.CANCEL_TEXT,
            CvUtil.FONT_CENTER_JUSTIFY,
            self.X_CANCEL,
            self.Y_CANCEL,
            self.Z_TEXT,
            FontTypes.TITLE_FONT,
            WidgetTypes.WIDGET_GENERAL,
            1,
            0,
        )

        screen.showWindowBackground(False)

        # Header...
        screen.setLabel(
            self.HEADER_NAME,
            "Background",
            u"<font=4b>" + localText.getText("TXT_KEY_RELIGION_SCREEN_TITLE", ()).upper() + u"</font>",
            CvUtil.FONT_CENTER_JUSTIFY,
            self.X_SCREEN,
            self.Y_TITLE,
            self.Z_TEXT,
            FontTypes.TITLE_FONT,
            WidgetTypes.WIDGET_GENERAL,
            -1,
            -1,
        )

        # Make the scrollable areas for the city list...

        if CyGame().isDebugMode():
            self.szDropdownName = self.DEBUG_DROPDOWN_ID
            screen.addDropDownBoxGFC(
                self.szDropdownName, 22, 12, 300, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT
            )
            for j in range(gc.getMAX_PLAYERS()):
                if gc.getPlayer(j).isAlive():
                    screen.addPullDownString(self.szDropdownName, gc.getPlayer(j).getName(), j, j, False)

        if AdvisorOpt.isReligious():
            self.X_RELIGION_AREA = 45
            self.Y_RELIGION_AREA = 84 - 40
            self.W_RELIGION_AREA = 934
            self.H_RELIGION_AREA = 175 + 75
            # 			screen.addPanel(szArea, "", "", False, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA - 40, self.W_RELIGION_AREA, self.H_RELIGION_AREA + 80, PanelStyles.PANEL_STYLE_MAIN)
            if AdvisorOpt.isShowAllReligions():
                self.RELIGIONS = ReligionUtil.getAllReligions()
            elif AdvisorOpt.isShowFoundedReligions():
                self.RELIGIONS = ReligionUtil.getFoundedReligions()
            else:
                self.RELIGIONS = ReligionUtil.getPlayerReligions(gc.getPlayer(self.iActivePlayer))
        else:
            self.X_RELIGION_AREA = 45
            self.Y_RELIGION_AREA = 84
            self.W_RELIGION_AREA = 934
            self.H_RELIGION_AREA = 175
            self.RELIGIONS = ReligionUtil.getAllReligions() + (ReligionUtil.getNumReligions(),)

            # Make the scrollable area for the religions list...
        screen.addPanel(
            self.RELIGION_PANEL_ID,
            "",
            "",
            False,
            True,
            self.X_RELIGION_AREA,
            self.Y_RELIGION_AREA,
            self.W_RELIGION_AREA,
            self.H_RELIGION_AREA + 5,
            PanelStyles.PANEL_STYLE_MAIN,
        )
        screen.addScrollPanel(
            "ReligionList",
            u"",
            self.X_RELIGION_AREA,
            self.Y_RELIGION_AREA,
            self.W_RELIGION_AREA,
            self.H_RELIGION_AREA,
            PanelStyles.PANEL_STYLE_EXTERNAL,
        )
        screen.setActivation("ReligionList", ActivationTypes.ACTIVATE_NORMAL)

        # Draw Religion info
        self.drawReligionInfo()

        self.drawHelpInfo()

        self.drawCityInfo(self.iReligionSelected)