示例#1
0
	def colorCivicTexts(self, iHoverCivic, bHoverOn):
		screen = self.getScreen()
		player = gc.getPlayer(self.iActivePlayer)
		iHoverCategory = gc.getCivicInfo(iHoverCivic).getCivicOptionType()
		
		for iCivic in range(iNumCivics):
			if iCivic % 7 == 0: continue
		
			iCategory = gc.getCivicInfo(iCivic).getCivicOptionType()
			if iCategory == iHoverCategory:
				continue
			iX, iY = self.getPosition(iCategory)
			xPos = iX + self.W_CIVIC_CATEGORY - self.BUTTON_SMALL - self.MARGIN
			iLine = iY + self.MARGIN + (iCivic % 7 - 1) * self.LINE
			
			sName = "CivicName" + str(iCivic)
			sText = gc.getCivicInfo(iCivic).getDescription()
			iCombovalue = Stability.getCivicStability(self.iActivePlayer, [iHoverCivic, iCivic])
			bGood = iCombovalue > 0
			bBad = iCombovalue < 0
			
			if bHoverOn:
				if bGood:
					if player.canDoCivics(iCivic):
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_GREEN'))
					else:
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_PLAYER_MIDDLE_GREEN'))
				elif bBad:
					if player.canDoCivics(iCivic):
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_RED'))
					else:
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_PLAYER_CANADA_RED'))
				else:
					if player.canDoCivics(iCivic):
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('WHITE'))
					else:
						sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_LIGHT_GREY'))
			else:
				if self.SelectedCivics[iCategory] == iCivic:
					screen.show("CivicButton" + str(iCivic))
					sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_YELLOW'))
				elif player.canDoCivics(iCivic):
					screen.show("CivicButton" + str(iCivic))
					sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_WHITE'))
				else:
					screen.hide("CivicButton" + str(iCivic))
					sText = CyTranslator().changeTextColor(sText, gc.getInfoTypeForString('COLOR_LIGHT_GREY'))
			screen.setText(sName, "", sText, CvUtil.FONT_RIGHT_JUSTIFY, xPos - self.MARGIN, iLine, 0, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)