def __init__(self, iThisPlayer, iTargetPlayer):
     pActiveTeam = gc.getTeam(gc.getActivePlayer().getTeam())
     iThisTeam = gc.getPlayer(iThisPlayer).getTeam()
     pThisTeam = gc.getTeam(iThisTeam)
     iTargetTeam = gc.getPlayer(iTargetPlayer).getTeam()
     self.iThisPlayer = iThisPlayer
     self.iTargetPlayer = iTargetPlayer
     self.iAttitudeSum = 0
     self.iAttitudeModifiers = {}
     self.bHasActiveMetBoth = CyGame().isDebugMode() or (pActiveTeam.isHasMet(iThisTeam) and pActiveTeam.isHasMet(iTargetTeam))
     self.eAttitudeType = AttitudeTypes.NO_ATTITUDE
     # This might be better off being something descriptive such as
     # "players have not met" or "players are the same"
     self.sAttitudeString = ""
     # keldath fix attitude call on selfs - already checked
     if iThisPlayer != iTargetPlayer and pThisTeam.isHasMet(iTargetTeam):
         self.eAttitudeType = gc.getPlayer(iThisPlayer).AI_getAttitude(iTargetPlayer)
         self.sAttitudeString = CyGameTextMgr().getAttitudeString(iThisPlayer, iTargetPlayer)
         for sLine in self.sAttitudeString.split("\n"):
             #BugUtil.debug(u"LINE: %s" % (sLine))
             pMatch = re.match("^.*>([-\+]\d+)\s?:\s+(\".+\")<.*$", sLine, re.UNICODE)
             if (pMatch):
                 #BugUtil.debug(u"MATCH: (%s) (%s)" %(pMatch.group(1), pMatch.group(2)))
                 iValue = int(pMatch.group(1))
                 sString = unicode(pMatch.group(2))
                 self.iAttitudeSum += iValue
                 if sString in MODIFIER_STRING_TO_KEY:
                     self.iAttitudeModifiers[MODIFIER_STRING_TO_KEY[sString]] = iValue
                     #BugUtil.debug(u"Attitude::init() - Added to dict: %s" % (sString))
                 else:
                     BugUtil.debug(u"Attitude::init() - Attitude string contains unknown modifier text: %s" % (sString))
     #BugUtil.debug(u"Attitude::init() complete.")
     BugUtil.debug(u"%s" % (self))
Beispiel #2
0
    def placeTraits(self):
        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_PEDIA_TRAITS",
                                                     ()), "", True, False,
                        self.X_TRAITS, self.Y_TRAITS, self.W_TRAITS,
                        self.H_TRAITS, PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        iNumCivs = 0
        iLeaderCiv = -1
        for iCiv in xrange(gc.getNumCivilizationInfos()):
            civ = gc.getCivilizationInfo(iCiv)
            if civ.isLeaders(self.iLeader):
                iNumCivs += 1
                iLeaderCiv = iCiv

        if iNumCivs == 1:
            szSpecialText = CyGameTextMgr().parseLeaderTraits(
                self.iLeader, iLeaderCiv, False, True)
        else:
            szSpecialText = CyGameTextMgr().parseLeaderTraits(
                self.iLeader, -1, False, True)
        szSpecialText = szSpecialText[1:]
        screen.addMultilineText(listName, szSpecialText, self.X_TRAITS + 5,
                                self.Y_TRAITS + 30, self.W_TRAITS - 10,
                                self.H_TRAITS - 35, WidgetTypes.WIDGET_GENERAL,
                                -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName,
                        localText.getText("TXT_KEY_PEDIA_EFFECTS", ()), "",
                        True, False, self.X_EFFECTS_PANE, self.Y_EFFECTS_PANE,
                        self.W_EFFECTS_PANE, self.H_EFFECTS_PANE,
                        PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()
        screen.attachListBoxGFC(panelName, listName, "",
                                TableStyles.TABLE_STYLE_EMPTY)
        screen.enableSelect(listName, False)

        # original code
        # szSpecialText = CyGameTextMgr().getBonusHelp(self.iBonus, True)
        # splitText = string.split(szSpecialText, "\n")
        # for special in splitText:
        #     if special:
        #         screen.appendListBoxString(listName, special, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
        # K-Mod
        szSpecialText = CyGameTextMgr().getBonusHelp(self.iBonus, True)[1:]
        screen.addMultilineText(
            listName, szSpecialText, self.X_EFFECTS_PANE + 5,
            self.Y_EFFECTS_PANE + 30, self.W_EFFECTS_PANE - 10,
            self.H_EFFECTS_PANE - 35, WidgetTypes.WIDGET_GENERAL, -1, -1,
            CvUtil.FONT_LEFT_JUSTIFY)
Beispiel #4
0
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName,
                        localText.getText("TXT_KEY_PEDIA_EFFECTS",
                                          ()), "", True, False, self.X_SPECIAL,
                        self.Y_SPECIAL, self.W_SPECIAL, self.H_SPECIAL,
                        PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()
        screen.attachListBoxGFC(panelName, listName, "",
                                TableStyles.TABLE_STYLE_EMPTY)
        screen.enableSelect(listName, False)

        szSpecialText = CyGameTextMgr().parseReligionInfo(self.iReligion, True)
        splitText = string.split(szSpecialText, "\n")
        for special in splitText:
            if len(special) != 0:
                screen.appendListBoxString(listName, special,
                                           WidgetTypes.WIDGET_GENERAL, -1, -1,
                                           CvUtil.FONT_LEFT_JUSTIFY)

        # Special Units
        if self.iReligion == gc.getInfoTypeForString("RELIGION_JUDAISM"):
            iUnit = gc.getInfoTypeForString("UNIT_STADTWACHE_ISRAEL")
            special = localText.getText(
                "TXT_KEY_PEDIA_REL_UNIT",
                ()) + " " + gc.getUnitInfo(iUnit).getDescription()
            screen.appendListBoxString(listName, special,
                                       WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT,
                                       iUnit, 1, CvUtil.FONT_LEFT_JUSTIFY)
Beispiel #5
0
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, localText.getText("TXT_KEY_PEDIA_YIELDS",
                                                     ()), "", True, False,
                        self.X_SPECIAL, self.Y_SPECIAL, self.W_SPECIAL,
                        self.H_SPECIAL, PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()
        screen.attachListBoxGFC(panelName, listName, "",
                                TableStyles.TABLE_STYLE_EMPTY)
        screen.enableSelect(listName, False)

        szSpecialText = CyGameTextMgr().getSpecialistHelp(
            self.iSpecialist, True)
        ### Anzeige der Geburtspunkte Great Person (von Kathy)
        iGreatPersonClass = gc.getSpecialistInfo(
            self.iSpecialist).getGreatPeopleUnitClass()
        if iGreatPersonClass > -1:
            szText = gc.getUnitClassInfo(iGreatPersonClass).getDescription()
            szSpecialText += " (" + szText + ")"
### ----------------------------------
        splitText = string.split(szSpecialText, "\n")
        for special in splitText:
            if len(special) != 0:
                screen.appendListBoxString(listName, special,
                                           WidgetTypes.WIDGET_GENERAL, -1, -1,
                                           CvUtil.FONT_LEFT_JUSTIFY)
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName,
                        localText.getText("TXT_KEY_PEDIA_EFFECTS",
                                          ()), "", True, False, self.X_EFFECTS,
                        self.Y_EFFECTS, self.W_EFFECTS, self.H_EFFECTS,
                        PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        szSpecialText = CyGameTextMgr().getImprovementHelp(
            self.iImprovement, True)

        # PAE : isFreshWaterValid
        if gc.getImprovementInfo(self.iImprovement).isFreshWaterMakesValid():
            szSpecialText += u"\n" + localText.getText(
                "TXT_KEY_INFO_FRESHWATERMAKESVALID", ())
        # PAE: Latifundien (Prätis bauen es, Sklaven beschleunigen es)
        if self.iImprovement in Latifundien:
            szSpecialText += u"\n" + localText.getText(
                "TXT_KEY_INFO_IMPROVEMENT_LATIFUNDIEN", ())
        if self.iImprovement in LImprFortSentry:
            szSpecialText += u"\n" + localText.getText(
                "TXT_KEY_INFO_IMPROVEMENT_SENTRY", ())

        # Text wird hier ausgegeben
        screen.addMultilineText(listName, szSpecialText, self.X_EFFECTS + 5,
                                self.Y_EFFECTS + 35, self.W_EFFECTS - 10,
                                self.H_EFFECTS - 35,
                                WidgetTypes.WIDGET_GENERAL, -1, -1,
                                CvUtil.FONT_LEFT_JUSTIFY)
    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 xrange(gc.getNumReligionInfos()):
            if gc.getGame().getReligionGameTurnFounded(iRel) >= 0:
                szFounded = CyGameTextMgr().getTimeStr(gc.getGame().getReligionGameTurnFounded(iRel), False)
                screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, self.X_RELIGION_AREA + xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1) # kmod: xLoop,
                xLoop += self.DX_RELIGION

        # 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 xrange(gc.getNumReligionInfos()):
            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)

            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 xrange(gc.getNumReligionInfos()):
            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)
            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
        def placeSpecial(self):

                screen = self.top.getScreen()

                panelName = self.top.getNextWidgetName()
                screen.addPanel( panelName, localText.getText("TXT_KEY_PEDIA_SPECIAL_ABILITIES", ()), "", True, False,
                                 self.X_SPECIAL_PANE, self.Y_SPECIAL_PANE, self.W_SPECIAL_PANE, self.H_SPECIAL_PANE, PanelStyles.PANEL_STYLE_BLUE50 )

                listName = self.top.getNextWidgetName()

                szSpecialText = CyGameTextMgr().getUnitHelp( self.iUnit, True, False, False, None )[1:]
                screen.addMultilineText(listName, szSpecialText, self.X_SPECIAL_PANE+5, self.Y_SPECIAL_PANE+30, self.W_SPECIAL_PANE-10, self.H_SPECIAL_PANE-35, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
    def drawHelpText(self, iCivicOption):

        activePlayer = gc.getPlayer(self.iActivePlayer)
        iCivic = self.m_paeDisplayCivics[iCivicOption]

        # szPaneID = "CivicsHelpTextBackground" + str(iCivicOption)
        screen = self.getScreen()

        szHelpText = u""

        # Upkeep string
        if ((gc.getCivicInfo(iCivic).getUpkeep() != -1)
                and not activePlayer.isNoCivicUpkeep(iCivicOption)):
            szHelpText = gc.getUpkeepInfo(
                gc.getCivicInfo(iCivic).getUpkeep()).getDescription()
        else:
            szHelpText = localText.getText("TXT_KEY_CIVICS_SCREEN_NO_UPKEEP",
                                           ())

        szHelpText += CyGameTextMgr().parseCivicInfo(iCivic, False, True, True)

        fX = self.HEADINGS_SPACING + (self.HEADINGS_WIDTH +
                                      self.HEADINGS_SPACING) * iCivicOption

        screen.setLabel(
            self.HELP_HEADER_NAME + str(iCivicOption), "Background",
            u"<font=3>" + gc.getCivicInfo(self.m_paeDisplayCivics[iCivicOption]
                                          ).getDescription().upper() +
            u"</font>", CvUtil.FONT_CENTER_JUSTIFY,
            fX + self.HEADINGS_WIDTH / 2, self.HELP_TOP + self.TEXT_MARGIN, 0,
            FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        fY = self.HELP_TOP - self.BIG_BUTTON_SIZE
        szHelpImageID = self.HELP_IMAGE_NAME + str(iCivicOption)
        screen.setImageButton(
            szHelpImageID,
            gc.getCivicInfo(iCivic).getButton(),
            fX + self.HEADINGS_WIDTH / 2 - self.BIG_BUTTON_SIZE / 2, fY,
            self.BIG_BUTTON_SIZE, self.BIG_BUTTON_SIZE,
            WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, iCivic, 1)

        fY = self.HELP_TOP + 3 * self.TEXT_MARGIN
        szHelpAreaID = self.HELP_AREA_NAME + str(iCivicOption)
        screen.addMultilineText(szHelpAreaID, szHelpText, fX + 5, fY,
                                self.HEADINGS_WIDTH - 7,
                                self.HELP_BOTTOM - fY - 2,
                                WidgetTypes.WIDGET_GENERAL, -1, -1,
                                CvUtil.FONT_LEFT_JUSTIFY)
Beispiel #10
0
  def placeSpecial(self):

    screen = self.top.getScreen()

    panelName = self.top.getNextWidgetName()
    screen.addPanel( panelName, localText.getText("TXT_KEY_PEDIA_SPECIAL_ABILITIES", ()), "", True, False, self.X_SPECIAL_PANE, self.Y_SPECIAL_PANE, self.W_SPECIAL_PANE, self.H_SPECIAL_PANE, PanelStyles.PANEL_STYLE_BLUE50 )

    listName = self.top.getNextWidgetName()
    screen.attachListBoxGFC( panelName, listName, "", TableStyles.TABLE_STYLE_EMPTY )
    screen.enableSelect(listName, False)

    szSpecialText = CyGameTextMgr().getTerrainHelp(self.iTerrain, True)
    splitText = string.split( szSpecialText, "\n" )
    for special in splitText:
      if len( special ) != 0:
        screen.appendListBoxString( listName, special, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY )
 def placeHints(self):
     screen = self.getScreen()
     self.getScreen().deleteWidget("PediaMainItemList")
     szHintBox = self.getNextWidgetName()
     screen.addListBoxGFC(szHintBox, "", self.X_ITEMS,
                          self.Y_PEDIA_PAGE - 10,
                          self.W_SCREEN - self.X_ITEMS,
                          self.H_PEDIA_PAGE + 23,
                          TableStyles.TABLE_STYLE_STANDARD)
     screen.enableSelect(szHintBox, False)
     szHintsText = CyGameTextMgr().buildHintsList()
     hintText = string.split(szHintsText, "\n")
     for hint in hintText:
         if len(hint) != 0:
             screen.appendListBoxStringNoUpdate(szHintBox, hint,
                                                WidgetTypes.WIDGET_GENERAL,
                                                -1, -1,
                                                CvUtil.FONT_LEFT_JUSTIFY)
     screen.updateListBox(szHintBox)
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName,
                        localText.getText("TXT_KEY_PEDIA_EFFECTS",
                                          ()), "", True, False, self.X_SPECIAL,
                        self.Y_SPECIAL, self.W_SPECIAL, self.H_SPECIAL,
                        PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        szSpecialText = CyGameTextMgr().parseCorporationInfo(
            self.iCorporation, True)[1:]
        screen.addMultilineText(listName, szSpecialText, self.X_SPECIAL + 5,
                                self.Y_SPECIAL + 30, self.W_SPECIAL - 10,
                                self.H_SPECIAL - 35,
                                WidgetTypes.WIDGET_GENERAL, -1, -1,
                                CvUtil.FONT_LEFT_JUSTIFY)
Beispiel #13
0
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(
            panelName, localText.getText("TXT_KEY_PEDIA_SPECIAL_ABILITIES",
                                         ()), "", True, False,
            self.X_SPECIAL_PANE, self.Y_SPECIAL_PANE, self.W_SPECIAL_PANE,
            self.H_SPECIAL_PANE, PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        szSpecialText = ""

        # PAE - Part of Victory type
        iBuildingClassType = gc.getBuildingInfo(
            self.iBuilding).getBuildingClassType()
        for iLoopVC in xrange(gc.getNumVictoryInfos()):
            victory = gc.getVictoryInfo(iLoopVC)
            if (gc.getBuildingClassInfo(
                    iBuildingClassType).getVictoryThreshold(iLoopVC) > 0):
                szSpecialText += localText.getText(
                    "TXT_KEY_BUILDING_PART_OF_VICTORY",
                    (victory.getDescription(), )) + localText.getText(
                        "[NEWLINE]", ())

        # PAE - negative food storage
        if gc.getBuildingInfo(self.iBuilding).getFoodKept() < 0:
            szSpecialText += localText.getText(
                "TXT_KEY_BUILDING_STORES_FOOD2", (gc.getBuildingInfo(
                    self.iBuilding).getFoodKept(), )) + localText.getText(
                        "[NEWLINE]", ())

        szSpecialText += CyGameTextMgr().getBuildingHelp(
            self.iBuilding, True, False, False, None)[1:]
        screen.addMultilineText(
            listName, szSpecialText, self.X_SPECIAL_PANE + 5,
            self.Y_SPECIAL_PANE + 30, self.W_SPECIAL_PANE - 10,
            self.H_SPECIAL_PANE - 35, WidgetTypes.WIDGET_GENERAL, -1, -1,
            CvUtil.FONT_LEFT_JUSTIFY)
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName,
                        localText.getText("TXT_KEY_PEDIA_EFFECTS",
                                          ()), "", True, False, self.X_SPECIAL,
                        self.Y_SPECIAL, self.W_SPECIAL, self.H_SPECIAL,
                        PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()
        screen.attachListBoxGFC(panelName, listName, "",
                                TableStyles.TABLE_STYLE_EMPTY)
        screen.enableSelect(listName, False)

        szSpecialText = CyGameTextMgr().parseCivicInfo(self.iCivic, True,
                                                       False, True)
        screen.addMultilineText(listName, szSpecialText[1:],
                                self.X_SPECIAL + 5, self.Y_SPECIAL + 25,
                                self.W_SPECIAL - 10, self.H_SPECIAL - 30,
                                WidgetTypes.WIDGET_GENERAL, -1, -1,
                                CvUtil.FONT_LEFT_JUSTIFY)
Beispiel #15
0
    def interfaceScreen(self, iTech):

        self.EXIT_TEXT = localText.getText("TXT_KEY_SCREEN_CONTINUE", ())
        self.nTechs = CyGlobalContext().getNumTechInfos()
        self.iTech = iTech
        self.nWidgetCount = 0

        # Create screen

        screen = self.getScreen()

        techInfo = CyGlobalContext().getTechInfo(self.iTech)

        screen.setSound(techInfo.getSound())
        screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, False)
        screen.enableWorldSounds( False )

#       screen.setHelpTextArea(self.W_HELP_AREA, FontTypes.SMALL_FONT, self.X_UNIT_PANE, self.Y_UNIT_PANE, self.Z_HELP_AREA, 1, CyArtFileMgr().getInterfaceArtInfo("POPUPS_BACKGROUND_TRANSPARENT").getPath(), True, True, CvUtil.FONT_LEFT_JUSTIFY, 0 )
#       screen.addDDSGFC( "TechSplashBackground", CyArtFileMgr().getInterfaceArtInfo("TEMP_BG").getPath(), 0, 0, self.W_SCREEN, self.H_SCREEN, WidgetTypes.WIDGET_GENERAL, -1, -1 )
        screen.showWindowBackground( False )
        screen.setDimensions(screen.centerX(0), screen.centerY(0), self.W_SCREEN, self.H_SCREEN)

        # Create panels

        # Main Panel
        szMainPanel = "TechSplashMainPanel"
        screen.addPanel( szMainPanel, "", "", True, True,
            self.X_MAIN_PANEL, self.Y_MAIN_PANEL, self.W_MAIN_PANEL, self.H_MAIN_PANEL, PanelStyles.PANEL_STYLE_MAIN )

        # Top Panel
        szHeaderPanel = "TechSplashHeaderPanel"
        screen.addPanel( szHeaderPanel, "", "", True, True,
            self.X_UPPER_PANEL, self.Y_UPPER_PANEL, self.W_UPPER_PANEL, self.H_UPPER_PANEL, PanelStyles.PANEL_STYLE_DAWNBOTTOM )
        screen.setStyle(szHeaderPanel, "Panel_DawnBottom_Style")

        # Icon Panel
        szIconPanel = "IconPanel"
        screen.addPanel( szIconPanel, "", "", True, True,
            self.X_ICON_PANEL, self.Y_ICON_PANEL, self.W_UPPER_PANEL-(self.iMarginSpace * 2), self.H_UPPER_PANEL-(self.iMarginSpace * 4), PanelStyles.PANEL_STYLE_MAIN_TAN15 )
        screen.setStyle(szIconPanel, "Panel_TechDiscover_Style")

        # Icon Panel
        szIconPanel = "IconPanelGlow"
        screen.addPanel( szIconPanel, "", "", True, True,
            self.X_ICON_PANEL, self.Y_ICON_PANEL, self.W_ICON_PANEL, self.H_ICON_PANEL, PanelStyles.PANEL_STYLE_MAIN_TAN15 )
        screen.setStyle(szIconPanel, "Panel_TechDiscoverGlow_Style")

        # Bottom Panel
        szTextPanel = "TechSplashTextPanel"
        screen.addPanel( szTextPanel, "", "", True, True,
            self.X_LOWER_PANEL+self.iMarginSpace, self.Y_LOWER_PANEL, self.W_LOWER_PANEL-(self.iMarginSpace * 2), self.H_LOWER_PANEL, PanelStyles.PANEL_STYLE_MAIN )
        screen.setStyle(szTextPanel, "Panel_TanT_Style")

        # Exit Button
        screen.setButtonGFC("Exit", localText.getText("TXT_KEY_SCREEN_CONTINUE", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT , self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )

        # Special Panel
        szSpecialPanel = "TechSplashSpecialPanel"
        screen.addPanel( szSpecialPanel, "", "", True, True,
                self.X_SPECIAL_PANEL+self.iMarginSpace, self.Y_SPECIAL_PANEL, self.W_SPECIAL_PANEL-(self.iMarginSpace * 2), self.H_SPECIAL_PANEL, PanelStyles.PANEL_STYLE_IN )
        screen.setStyle(szSpecialPanel, "Panel_Black25_Style")

#---Eingefügt START - kann komplett gelöscht werden-----------------
        # Allows PanelSIR
        panelNameSIR = "SIR"
        screen.addPanel( panelNameSIR, "", "", False, True,
                                 self.X_ALLOWS_PANELSIR+self.iMarginSpace, self.Y_ALLOWS_PANELSIR, self.W_ALLOWS_PANELSIR-(self.iMarginSpace * 2), self.H_ALLOWS_PANELSIR, PanelStyles.PANEL_STYLE_IN )
        screen.setStyle(panelNameSIR, "Panel_Black25_Style")
#---Eingefügt ENDE -------------------------------------------------

        # Allows Panel
        panelName = self.getNextWidgetName()
        screen.addPanel( panelName, "", "", False, True,
                                 self.X_ALLOWS_PANEL+self.iMarginSpace, self.Y_ALLOWS_PANEL, self.W_ALLOWS_PANEL-(self.iMarginSpace * 2), self.H_ALLOWS_PANEL, PanelStyles.PANEL_STYLE_IN )
        screen.setStyle(panelName, "Panel_Black25_Style")

#---Eingefügt START - kann komplett gelöscht werden-----------------
        # Allows Panel2
        panelName2 = "SIR2"
        screen.addPanel( panelName2, "", "", False, True,
                                 self.X_ALLOWS_PANEL+self.iMarginSpace, self.Y_ALLOWS_PANEL2, self.W_ALLOWS_PANEL-(self.iMarginSpace * 2), self.H_ALLOWS_PANEL, PanelStyles.PANEL_STYLE_IN )
        screen.setStyle(panelName2, "Panel_Black25_Style")

        # Allows Panel3
        panelName3 = "SIR3"
        screen.addPanel( panelName3, "", "", False, True,
                                 self.X_ALLOWS_PANEL+self.iMarginSpace, self.Y_ALLOWS_PANEL3, self.W_ALLOWS_PANEL-(self.iMarginSpace * 2), self.H_ALLOWS_PANEL, PanelStyles.PANEL_STYLE_IN )
        screen.setStyle(panelName3, "Panel_Black25_Style")
#---Eingefügt ENDE -------------------------------------------------

        # Add Contents

        # Title
        szTech = techInfo.getDescription()
        screen.setLabel(self.getNextWidgetName(), "Background", u"<font=4>" + szTech.upper() + u"</font>", CvUtil.FONT_CENTER_JUSTIFY,
            self.X_TITLE, self.Y_TITLE, self.Z_CONTROLS, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )

        # Tech Icon
        screen.addDDSGFC(self.getNextWidgetName(), techInfo.getButton(), self.X_ICON, self.Y_ICON, self.W_ICON, self.H_ICON, WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, self.iTech, -1 )

        # Tech Quote
        szTechQuote = techInfo.getQuote()
        iTextOffset = 0
        if TechWindowOpt.isShowCivilopediaText():
            szTechQuote += "\n\n" + techInfo.getCivilopedia()
        else:
            iTextOffset = 20
        screen.addMultilineText( "Text", szTechQuote,
                        self.X_QUOTE, self.Y_QUOTE + iTextOffset, self.W_QUOTE, self.H_QUOTE - iTextOffset, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

        # Special
        szSpecialTitle = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_SPECIAL_ABILITIES", ()) + u"</font>"
        szSpecialTitleWidget = "SpecialTitle"
        screen.setText(szSpecialTitleWidget, "", szSpecialTitle, CvUtil.FONT_LEFT_JUSTIFY,
                   self.X_SPECIAL_PANEL+self.iMarginSpace, self.Y_SPECIAL_PANEL - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        listName = self.getNextWidgetName()

        szSpecialText = CyGameTextMgr().getTechHelp(self.iTech, True, False, False, True, -1)[1:]
        screen.addMultilineText(listName, szSpecialText, self.X_SPECIAL_PANEL+10, self.Y_SPECIAL_PANEL+5, self.W_SPECIAL_PANEL-20, self.H_SPECIAL_PANEL-20, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

#---Eingefügt START - kann komplett gelöscht werden --------------
        # Allows -> LeadsTo
        szAllowsTitleDescSIR = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_LEADS_TO", ()) + ":" + u"</font>"
        szAllowsTitleWidgetSIR = "AllowsTitleSIR"
        screen.setText(szAllowsTitleWidgetSIR, "", szAllowsTitleDescSIR, CvUtil.FONT_LEFT_JUSTIFY,
                   self.X_ALLOWS_PANELSIR+self.iMarginSpace, self.Y_ALLOWS_PANELSIR - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        for j in xrange(CyGlobalContext().getNumTechInfos()):
            for k in xrange(CyGlobalContext().getDefineINT("NUM_OR_TECH_PREREQS")):
                iPrereq = CyGlobalContext().getTechInfo(j).getPrereqOrTechs(k)
                if (iPrereq == self.iTech):
                        screen.attachImageButton( panelNameSIR, "", CyGlobalContext().getTechInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_DERIVED_TECH, j, self.iTech, False )
            for k in xrange(CyGlobalContext().getDefineINT("NUM_AND_TECH_PREREQS")):
                iPrereq = CyGlobalContext().getTechInfo(j).getPrereqAndTechs(k)
                if (iPrereq == self.iTech):
                        screen.attachImageButton( panelNameSIR, "", CyGlobalContext().getTechInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_DERIVED_TECH, j, self.iTech, False )

#---Eingefügt ENDE ------------------------------------------------
        # Allows
        # szAllowsTitleDesc = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_ALLOWS", ()) + ":" + u"</font>"
        # szAllowsTitleWidget = "AllowsTitle"
        # screen.setText(szAllowsTitleWidget, "", szAllowsTitleDesc, CvUtil.FONT_LEFT_JUSTIFY,
        #          self.X_ALLOWS_PANEL+self.iMarginSpace, self.Y_ALLOWS_PANEL - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        # Units Enabled
        szUnitsTitleDesc = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_UNITS_ENABLED", ()) + ":" + u"</font>"
        szUnitsTitleWidget = "UnitsTitle"
        screen.setText(szUnitsTitleWidget, "", szUnitsTitleDesc, CvUtil.FONT_LEFT_JUSTIFY,
                   self.X_ALLOWS_PANEL + self.iMarginSpace, self.Y_ALLOWS_PANEL - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        for j in xrange( CyGlobalContext().getNumUnitClassInfos() ):
            eLoopUnit = CyGlobalContext().getCivilizationInfo(CyGlobalContext().getGame().getActiveCivilizationType()).getCivilizationUnits(j)
            if (eLoopUnit != -1):
                if (isTechRequiredForUnit(self.iTech, eLoopUnit)):
                        screen.attachImageButton( panelName, "", CyGlobalContext().getUnitInfo(eLoopUnit).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                                  WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, eLoopUnit, 1, False )

        # Buildings Enabled
        szBuildingsTitleDesc = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_BUILDINGS_ENABLED", ()) + ":" + u"</font>"
        szBuildingsTitleWidget = "BuildingsTitle"
        screen.setText(szBuildingsTitleWidget, "", szBuildingsTitleDesc, CvUtil.FONT_LEFT_JUSTIFY,
                   self.X_ALLOWS_PANEL + self.iMarginSpace, self.Y_ALLOWS_PANEL2 - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        for j in xrange(CyGlobalContext().getNumBuildingClassInfos()):
            bTechFound = 0
            eLoopBuilding = CyGlobalContext().getCivilizationInfo(CyGlobalContext().getGame().getActiveCivilizationType()).getCivilizationBuildings(j)
            if (eLoopBuilding != -1):
                if (isTechRequiredForBuilding(self.iTech, eLoopBuilding)):
                        screen.attachImageButton( panelName2, "", CyGlobalContext().getBuildingInfo(eLoopBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                                  WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, eLoopBuilding, 1, False )

        # Improvements
        szImprovesTitleDesc = u"<font=3b>" + localText.getText("TXT_KEY_PEDIA_CATEGORY_IMPROVEMENT", ()) + ":" + u"</font>"
        szImprovesTitleWidget = "ImprovesTitle"
        screen.setText(szImprovesTitleWidget, "", szImprovesTitleDesc, CvUtil.FONT_LEFT_JUSTIFY,
                   self.X_ALLOWS_PANEL + self.iMarginSpace, self.Y_ALLOWS_PANEL3 - 20, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        for j in xrange(CyGlobalContext().getNumProjectInfos()):
            bTechFound = 0
            if (isTechRequiredForProject(self.iTech, j)):
                screen.attachImageButton( panelName3, "", CyGlobalContext().getProjectInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                              WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, j, 1, False )

        for j in xrange(CyGlobalContext().getNumPromotionInfos()):
            if (CyGlobalContext().getPromotionInfo(j).getTechPrereq() == self.iTech):
                screen.attachImageButton( panelName3, "", CyGlobalContext().getPromotionInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                              WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROMOTION, j, 1, False )

#---Eingefügt START - kann komplett gelöscht werden --------------

        # Improvements
        for j in xrange(CyGlobalContext().getNumBuildInfos()):
                bTechFound = 0;
                if (CyGlobalContext().getBuildInfo(j).getTechPrereq() == -1):
                    bTechFound = 0
                    for k in xrange(CyGlobalContext().getNumFeatureInfos()):
                        if (CyGlobalContext().getBuildInfo(j).getFeatureTech(k) == self.iTech):
                            bTechFound = 1
                else:
                    if (CyGlobalContext().getBuildInfo(j).getTechPrereq() == self.iTech):
                        bTechFound = 1

                if (bTechFound == 1):
                    if (CyGlobalContext().getBuildInfo(j).getImprovement() == -1):
                        screen.attachImageButton( panelName3, "", CyGlobalContext().getBuildInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_HELP_IMPROVEMENT, j, 1, False )
                    else:
                        screen.attachImageButton( panelName3, "", CyGlobalContext().getBuildInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_IMPROVEMENT, CyGlobalContext().getBuildInfo(j).getImprovement(), 1, False )

        # Bonuses
        for j in xrange(CyGlobalContext().getNumBonusInfos()):
            if (CyGlobalContext().getBonusInfo(j).getTechReveal() == self.iTech):
                screen.attachImageButton( panelName3, "", CyGlobalContext().getBonusInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                              WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, j, 1, False )

        # Civic
        for j in xrange(CyGlobalContext().getNumCivicInfos()):
            if (CyGlobalContext().getCivicInfo(j).getTechPrereq() == self.iTech):
                screen.attachImageButton( panelName3, "", CyGlobalContext().getCivicInfo(j).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM,
                              WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, j, 1, False )
    def rebuildComponentPanel(self):
        screen = CyGInterfaceScreen( "SpaceShipScreen", CvScreenEnums.SPACE_SHIP_SCREEN)
        self.removeComponentsPanel()

        #check if already landed spaceship
        activeTeam = gc.getGame().getActiveTeam()
        victoryCountdown = gc.getTeam(activeTeam).getVictoryCountdown(self.spaceVictory)
        gameState = gc.getGame().getGameState()
        if(not (((gameState == GameStateTypes.GAMESTATE_EXTENDED) and (victoryCountdown > 0)) or (victoryCountdown == 0))):

            #loop through each panel
            for i in xrange(self.numComponents):
                index = self.componentProjects[i]
                component = gc.getProjectInfo(index)
                xPosition = self.X_SCREEN + self.componentPanelXOffset
                yPosition = self.Y_SCREEN + self.componentPanelYOffset + i * self.componentPanelHeight

                #panel
                xPositionOffset = 0
                if(index == self.activeProject):
                    xPositionOffset = 80
                screen.addPanel("ComponentPanel" + str(i), "", "", True, True, xPosition - xPositionOffset, yPosition, self.componentPanelWidth + xPositionOffset, self.componentPanelHeight + self.componentPanelHeightExtra, PanelStyles.PANEL_STYLE_TECH)
                screen.setLabel("ComponentLabel" + str(i), "ComponentPanel" + str(i), "<color=255,255,0><font=3b>" + component.getDescription() + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, xPosition - xPositionOffset + self.componentNameXOffset, yPosition + self.componentNameYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #completed
                completed = gc.getTeam(activeTeam).getProjectCount(index)
                totalAllowed = component.getMaxTeamInstances()
                screen.setLabel("ComponentCompletedLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_COMPLETED_LABEL", (completed, totalAllowed)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentCompletedLabelXOffset, yPosition + self.componentCompletedLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #required
                required = component.getVictoryMinThreshold(self.spaceVictory)
                screen.setLabel("ComponentRequiredLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_REQUIRED_LABEL", (required,)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentRequiredLabelXOffset, yPosition + self.componentRequiredLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #in production
                inProduction = gc.getTeam(activeTeam).getProjectMaking(index)
                screen.setLabel("ComponentInProductionLabel" + str(i), "ComponentPanel" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_IN_PRODUCTION_LABEL", (inProduction,)), CvUtil.FONT_LEFT_JUSTIFY, xPosition + self.componentInProductionLabelXOffset, yPosition + self.componentInProductionLabelYOffset, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

                #panel color
                if(completed >= required): #green
                    screen.setPanelColor("ComponentPanel" + str(i), 85, 150, 87)
                else: #check if can build
                    canBuild = True
                    if(not gc.getTeam(activeTeam).isHasTech(component.getTechPrereq())):
                        canBuild = False
                    else:
                        for j in xrange(gc.getNumProjectInfos()):
                            if(gc.getTeam(activeTeam).getProjectCount(j) < component.getProjectsNeeded(j)):
                                canBuild = False

                    if(not canBuild): #grey
                        screen.setPanelColor("ComponentPanel" + str(i), 128, 128, 128)

                #type button if necessary
                if(screen.spaceShipCanChangeType(index) and (victoryCountdown < 0)):
                    screen.setButtonGFC("ComponentTypeButton" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_TYPE_BUTTON", ()), "", xPosition + self.componentTypeXOffset, yPosition + self.componentTypeYOffset, self.componentTypeWidth, self.componentTypeHeight, WidgetTypes.WIDGET_GENERAL, self.TYPE_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #zoom button
                if(victoryCountdown < 0):
                    screen.setButtonGFC("ComponentZoomButton" + str(i), localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ZOOM_BUTTON", ()), "", xPosition + self.componentZoomXOffset, yPosition + self.componentZoomYOffset, self.componentZoomWidth, self.componentZoomHeight, WidgetTypes.WIDGET_GENERAL, self.ZOOM_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #add button
                if(index == self.activeProject):
                    screen.setButtonGFC("ComponentAddButton", localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ADD_BUTTON", ()), "", xPosition - xPositionOffset + self.componentAddXOffset, yPosition + self.componentAddYOffset, self.componentAddWidth, self.componentAddHeight, WidgetTypes.WIDGET_GENERAL, self.ADD_BUTTON, i, ButtonStyles.BUTTON_STYLE_STANDARD )

                #component model
                modelType = gc.getTeam(activeTeam).getProjectDefaultArtType(index)
                screen.addSpaceShipWidgetGFC("ComponentModel" + str(i), xPosition + self.componentModelXOffset, yPosition + self.componentModelYOffset, self.componentModelWidth, self.componentModelHeight, index, modelType, WidgetTypes.WIDGET_GENERAL, -1, -1)

            #launch button
            activeTeam = gc.getGame().getActiveTeam()
            if(victoryCountdown > 0):
                victoryDate = CyGameTextMgr().getTimeStr(gc.getGame().getGameTurn() + victoryCountdown, False)
                screen.setLabel("ArrivalLabel1", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_ARRIVAL", ()) + ": " + victoryDate + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL1, self.Y_LAUNCH_LABEL1, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setLabel("ArrivalLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_REPLAY_SCREEN_TURNS", ()) + ": " + str(victoryCountdown) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL2, self.Y_LAUNCH_LABEL2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            elif(gc.getTeam(gc.getGame().getActiveTeam()).canLaunch(self.spaceVictory)):
                delay = gc.getTeam(gc.getGame().getActiveTeam()).getVictoryDelay(self.spaceVictory)
                screen.setLabel("LaunchLabel1", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACESHIP_CHANCE_OF_SUCCESS", (gc.getTeam(gc.getGame().getActiveTeam()).getLaunchSuccessRate(self.spaceVictory), )) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL1, self.Y_LAUNCH_LABEL1, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setLabel("LaunchLabel2", "SpaceShipMainPanel", "<color=255,255,0><font=3b>" + localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_TRAVEL_TIME_LABEL", (delay,)) + "</font></color>", CvUtil.FONT_LEFT_JUSTIFY, self.X_LAUNCH_LABEL2, self.Y_LAUNCH_LABEL2, 0, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
                screen.setButtonGFC("LaunchButton", localText.getText("TXT_KEY_SPACE_SHIP_SCREEN_LAUNCH_BUTTON", ()), "", self.X_LAUNCH, self.Y_LAUNCH, self.W_LAUNCH, self.H_LAUNCH, WidgetTypes.WIDGET_GENERAL, self.LAUNCH_BUTTON, -1, ButtonStyles.BUTTON_STYLE_STANDARD )



        #exit button
        screen.setButtonGFC("ExitButton", localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()), "", self.X_EXIT, self.Y_EXIT, self.W_EXIT, self.H_EXIT, WidgetTypes.WIDGET_CLOSE_SCREEN, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
Beispiel #17
0
    def placeSpecial(self):

        screen = self.top.getScreen()

        panelName = self.top.getNextWidgetName()
        screen.addPanel(panelName, "", "", True, False, self.X_SPECIAL_PANE,
                        self.Y_SPECIAL_PANE, self.W_SPECIAL_PANE,
                        self.H_SPECIAL_PANE, PanelStyles.PANEL_STYLE_BLUE50)

        listName = self.top.getNextWidgetName()

        szSpecialText = CyGameTextMgr().getTechHelp(self.iTech, True, False,
                                                    False, False, -1)[1:]

        # Obsolete Unit
        if self.iTech == gc.getInfoTypeForString("TECH_GRENZHEER"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_TECH_OBSOLETES",
                (gc.getUnitInfo(gc.getInfoTypeForString(
                    "UNIT_PRAETORIAN")).getDescription(), ))

        # Spionagemissionen (werden erst im Spiel angezeigt, da Spionage auch ausgeschaltet sein kann -> getNumEspionageMissionInfos() = 0)
        for eLoopEspionage in xrange(gc.getNumEspionageMissionInfos()):
            if gc.getEspionageMissionInfo(
                    eLoopEspionage).getTechPrereq() == self.iTech:
                if szSpecialText != "": szSpecialText += "\n"
                szSpecialText += CyTranslator().getText(
                    "TXT_KEY_MESSAGE_TECH_ESPIONAGE_MISSIONS",
                    (gc.getEspionageMissionInfo(
                        eLoopEspionage).getDescription(), ))

        # Freie Einheit bei Kult
        if self.iTech == gc.getInfoTypeForString(
                "TECH_FRUCHTBARKEIT") or self.iTech == gc.getInfoTypeForString(
                    "TECH_GLADIATOR"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_UNIT_1", ())

        # Freie Einheit bei Religion
        if self.iTech == gc.getInfoTypeForString("TECH_RELIGION_CELTIC") or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_NORDIC") \
        or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_SUMER") or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_GREEK") \
        or self.iTech == gc.getInfoTypeForString("TECH_RELIGION_HINDU") or self.iTech == gc.getInfoTypeForString("TECH_DUALISMUS"):
            if szSpecialText != "": szSpecialText += "\n"
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_UNIT_2", ())

        # PAE - Tradeable/conquerable
        if szSpecialText != "": szSpecialText += "\n"
        if gc.getTechInfo(self.iTech).isTrade():
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_TRADEABLE", ())
        else:
            szSpecialText += CyTranslator().getText(
                "TXT_KEY_MESSAGE_TECH_NOT_TRADEABLE", ())

        # BTS: Auflistung
        screen.addMultilineText(
            listName, szSpecialText, self.X_SPECIAL_PANE + 5,
            self.Y_SPECIAL_PANE + 20, self.W_SPECIAL_PANE - 30,
            self.H_SPECIAL_PANE - 10, WidgetTypes.WIDGET_GENERAL, -1, -1,
            CvUtil.FONT_LEFT_JUSTIFY)
    def drawHelpInfo(self):

        screen = self.getScreen()

        # johny smith
        # This attaches the text to the panel
        # This is for every line of font
        # Great Person
        xLoop = self.X_CORPORATION_START
        for i in xrange(gc.getNumCorporationInfos()):
            if gc.getGame().getCorporationGameTurnFounded(i) >= 0:
                szGreatPerson = ""
                for iBuilding in xrange(gc.getNumBuildingInfos()):
                    if (gc.getBuildingInfo(iBuilding).getFoundsCorporation() ==
                            i):
                        break
                for iUnit in xrange(gc.getNumUnitInfos()):
                    if gc.getUnitInfo(iUnit).getBuildings(
                            iBuilding) or gc.getUnitInfo(
                                iUnit).getForceBuildings(iBuilding):
                        szGreatPerson = gc.getUnitInfo(iUnit).getDescription()
                        break
                screen.setLabelAt("", "CivicList", szGreatPerson,
                                  CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                  self.Y_GREAT_PERSON, self.DZ,
                                  FontTypes.SMALL_FONT,
                                  WidgetTypes.WIDGET_GENERAL, -1, -1)

                xLoop += self.DX_CORPORATION

        # Bonuses
        xLoop = self.X_CORPORATION_START
        for i in xrange(gc.getNumCorporationInfos()):
            if gc.getGame().getCorporationGameTurnFounded(i) >= 0:
                szListLabels = []
                iNum = 0
                szList = u""
                for iRequired in xrange(
                        gc.getDefineINT("NUM_CORPORATION_PREREQ_BONUSES")):
                    eBonus = gc.getCorporationInfo(i).getPrereqBonus(iRequired)
                    if -1 != eBonus:
                        if iNum == 0:
                            szList = u""
                        else:
                            szList += u", "
                        iNum += 1
                        szList += u"%c" % (gc.getBonusInfo(eBonus).getChar(), )

                        if iNum > 3:
                            iNum = 0
                            szListLabels.append(szList)
                            szList = u""

                if len(szList) > 0:
                    szListLabels.append(szList)

                iRow = 0
                for szList in szListLabels:
                    screen.setLabelAt("", "CivicList", szList,
                                      CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                      self.Y_BONUSES + iRow, self.DZ,
                                      FontTypes.SMALL_FONT,
                                      WidgetTypes.WIDGET_GENERAL, -1, -1)
                    iRow += 16

                xLoop += self.DX_CORPORATION

        # Founded...
        screen.setLabelAt(
            "", "CivicList",
            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_CORPORATION_START
        for i in xrange(gc.getNumCorporationInfos()):
            if (gc.getGame().getCorporationGameTurnFounded(i) >= 0):
                szFounded = CyGameTextMgr().getTimeStr(
                    gc.getGame().getCorporationGameTurnFounded(i), False)
                screen.setLabelAt("", "CivicList", szFounded,
                                  CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                  self.Y_FOUNDED, self.DZ,
                                  FontTypes.SMALL_FONT,
                                  WidgetTypes.WIDGET_GENERAL, -1, -1)

                xLoop += self.DX_CORPORATION

        # Headquarters
        screen.setLabelAt(
            "", "CivicList",
            localText.getText("TXT_KEY_CORPORATION_SCREEN_HEADQUARTERS", ()),
            CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_HEADQUARTERS,
            self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        xLoop = self.X_CORPORATION_START
        for i in xrange(gc.getNumCorporationInfos()):
            if (gc.getGame().getCorporationGameTurnFounded(i) >= 0):
                pHeadquarters = gc.getGame().getHeadquarters(i)
                if pHeadquarters.isNone():
                    szFounded = u"-"
                    screen.setLabelAt("", "CivicList", szFounded,
                                      CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                      self.Y_HEADQUARTERS, self.DZ,
                                      FontTypes.SMALL_FONT,
                                      WidgetTypes.WIDGET_GENERAL, -1, -1)
                elif not pHeadquarters.isRevealed(
                        gc.getPlayer(self.iActivePlayer).getTeam(), False):
                    szFounded = localText.getText("TXT_KEY_UNKNOWN", ())
                    screen.setLabelAt("", "CivicList", szFounded,
                                      CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                      self.Y_HEADQUARTERS, self.DZ,
                                      FontTypes.SMALL_FONT,
                                      WidgetTypes.WIDGET_GENERAL, -1, -1)
                else:
                    szFounded = pHeadquarters.getName()
                    screen.setLabelAt(
                        "", "CivicList",
                        "(%s)" % gc.getPlayer(pHeadquarters.getOwner()
                                              ).getCivilizationAdjective(0),
                        CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                        self.Y_HEADQUARTERS + 8, self.DZ, FontTypes.SMALL_FONT,
                        WidgetTypes.WIDGET_GENERAL, -1, -1)
                    screen.setLabelAt("", "CivicList", szFounded,
                                      CvUtil.FONT_CENTER_JUSTIFY, xLoop,
                                      self.Y_HEADQUARTERS - 8, self.DZ,
                                      FontTypes.SMALL_FONT,
                                      WidgetTypes.WIDGET_GENERAL, -1, -1)
                xLoop += self.DX_CORPORATION

        self.iCorporationSelected = -1
        self.iCorporationExamined = self.iCorporationSelected
        self.iCorporationOriginal = self.iCorporationSelected
Beispiel #19
0
    def refreshUnitSelection(self, bReload):
        screen = self.getScreen()

        screen.minimapClearAllFlashingTiles()

        if bReload:
            if self.bUnitDetails:
                screen.setButtonGFC(self.UNIT_BUTTON_ID, u"", "",
                                    self.X_TEXT + self.MAP_MARGIN,
                                    self.Y_TEXT + self.MAP_MARGIN / 2, 20, 20,
                                    WidgetTypes.WIDGET_GENERAL, -1, -1,
                                    ButtonStyles.BUTTON_STYLE_CITY_MINUS)
                screen.setLabel(
                    self.UNIT_BUTTON_LABEL_ID, "",
                    localText.getText(
                        "TXT_KEY_MILITARY_ADVISOR_UNIT_TOGGLE_OFF",
                        ()), CvUtil.FONT_LEFT_JUSTIFY,
                    self.X_TEXT + self.MAP_MARGIN + 22,
                    self.Y_TEXT + self.MAP_MARGIN / 2 + 2, 0,
                    FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            else:
                screen.setButtonGFC(self.UNIT_BUTTON_ID, u"", "",
                                    self.X_TEXT + self.MAP_MARGIN,
                                    self.Y_TEXT + self.MAP_MARGIN / 2, 20, 20,
                                    WidgetTypes.WIDGET_GENERAL, -1, -1,
                                    ButtonStyles.BUTTON_STYLE_CITY_PLUS)
                screen.setLabel(
                    self.UNIT_BUTTON_LABEL_ID, "",
                    localText.getText(
                        "TXT_KEY_MILITARY_ADVISOR_UNIT_TOGGLE_ON",
                        ()), CvUtil.FONT_LEFT_JUSTIFY,
                    self.X_TEXT + self.MAP_MARGIN + 22,
                    self.Y_TEXT + self.MAP_MARGIN / 2 + 2, 0,
                    FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)

        # self.unitsList[iUnit][0] is the UnitCombatGroup (e.g. Melee)
        # self.unitsList[iUnit][1] is the unit type (e.g. Warrior)
        # self.unitsList[iUnit][2] is a list of the active player's actual units
        # self.unitsList[iUnit][3] is the total number of those units seen by the active player (not only his own)

        if bReload:
            # PAE - Sum of all units (globality necessary)
            self.iPAESum = 0
            for iUnit in xrange(gc.getNumUnitInfos()):
                self.unitsList[iUnit] = (
                    gc.getUnitInfo(iUnit).getUnitCombatType(), iUnit, [], 0)

            for iPlayer in xrange(gc.getMAX_PLAYERS()):
                player = PyPlayer(iPlayer)
                if player.isAlive():
                    unitList = player.getUnitList()
                    for loopUnit in unitList:
                        unitType = loopUnit.getUnitType()

                        bVisible = False
                        plot = loopUnit.plot()
                        if not plot.isNone():
                            # f1rpo: Changed the two bDebug arguments from False to True
                            bVisible = plot.isVisible(
                                gc.getPlayer(self.iActivePlayer).getTeam(),
                                True) and not loopUnit.isInvisible(
                                    gc.getPlayer(self.iActivePlayer).getTeam(),
                                    True)

                        if unitType >= 0 and unitType < gc.getNumUnitInfos(
                        ) and bVisible:
                            iNumUnits = self.unitsList[unitType][3]
                            if iPlayer == self.iActivePlayer:
                                iNumUnits += 1
                            if loopUnit.getVisualOwner(
                            ) in self.selectedPlayerList:
                                self.unitsList[unitType][2].append(loopUnit)
                                # PAE Sum
                                self.iPAESum += 1

                            self.unitsList[unitType] = (
                                self.unitsList[unitType][0],
                                self.unitsList[unitType][1],
                                self.unitsList[unitType][2], iNumUnits)

            # sort by unit combat type
            self.unitsList.sort()

        szText = localText.getText("TXT_KEY_PEDIA_ALL_UNITS", ()).upper()

        # PAE - Sum of Units
        szText = szText + u" (" + unicode(self.iPAESum) + u")"

        if -1 in self.selectedGroupList:
            szText = localText.changeTextColor(
                u"<u>" + szText + u"</u>",
                gc.getInfoTypeForString("COLOR_YELLOW"))
        if bReload:
            screen.addListBoxGFC(self.UNIT_LIST_ID, "",
                                 self.X_TEXT + self.MAP_MARGIN,
                                 self.Y_TEXT + self.MAP_MARGIN + 15,
                                 self.W_TEXT - 2 * self.MAP_MARGIN,
                                 self.H_TEXT - 2 * self.MAP_MARGIN - 15,
                                 TableStyles.TABLE_STYLE_STANDARD)
            screen.enableSelect(self.UNIT_LIST_ID, False)
            screen.setStyle(self.UNIT_LIST_ID, "Table_StandardCiv_Style")
            screen.appendListBoxString(self.UNIT_LIST_ID, szText,
                                       WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                                       -1, CvUtil.FONT_LEFT_JUSTIFY)
        else:
            screen.setListBoxStringGFC(self.UNIT_LIST_ID, 0, szText,
                                       WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                                       -1, CvUtil.FONT_LEFT_JUSTIFY)

        iPrevUnitCombat = -2
        iItem = 1
        for iUnit in xrange(gc.getNumUnitInfos()):
            if self.unitsList[iUnit][2]:
                if iPrevUnitCombat != self.unitsList[iUnit][
                        0] and self.unitsList[iUnit][0] != -1:
                    iPrevUnitCombat = self.unitsList[iUnit][0]

                    # PAE - Sum of Units of this type (locality suffices)
                    iPAESumTypes = 0
                    for n in xrange(gc.getNumUnitInfos()):
                        if self.unitsList[n][2]:
                            if iPrevUnitCombat == self.unitsList[n][0]:
                                #iPAESum += self.unitsList[n][3]
                                iPAESumTypes += len(self.unitsList[n][2])
                    szDescription = gc.getUnitCombatInfo(
                        self.unitsList[iUnit][0]).getDescription().upper(
                        ) + u" (" + unicode(iPAESumTypes) + u")"

                    if self.isSelectedGroup(self.unitsList[iUnit][0], False):
                        szDescription = u"   <u>" + szDescription + u"</u>"
                    else:
                        szDescription = u"   " + szDescription
                    if self.isSelectedGroup(self.unitsList[iUnit][0], True):
                        szDescription = localText.changeTextColor(
                            szDescription,
                            gc.getInfoTypeForString("COLOR_YELLOW"))
                    if bReload:
                        screen.appendListBoxString(
                            self.UNIT_LIST_ID, szDescription,
                            WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                            self.unitsList[iUnit][0] + gc.getNumUnitInfos(),
                            CvUtil.FONT_LEFT_JUSTIFY)
                    else:
                        screen.setListBoxStringGFC(
                            self.UNIT_LIST_ID, iItem, szDescription,
                            WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                            self.unitsList[iUnit][0] + gc.getNumUnitInfos(),
                            CvUtil.FONT_LEFT_JUSTIFY)
                    iItem += 1

                szDescription = gc.getUnitInfo(
                    self.unitsList[iUnit][1]).getDescription(
                    ) + u" (" + unicode(len(self.unitsList[iUnit][2])) + u")"
                if self.isSelectedUnitType(self.unitsList[iUnit][1], False):
                    szDescription = u"      <u>" + szDescription + u"</u>"
                else:
                    szDescription = u"      " + szDescription
                if self.isSelectedUnitType(self.unitsList[iUnit][1], True):
                    szDescription = localText.changeTextColor(
                        szDescription, gc.getInfoTypeForString("COLOR_YELLOW"))
                if bReload:
                    screen.appendListBoxString(
                        self.UNIT_LIST_ID, szDescription,
                        WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                        self.unitsList[iUnit][1], CvUtil.FONT_LEFT_JUSTIFY)
                else:
                    screen.setListBoxStringGFC(
                        self.UNIT_LIST_ID, iItem, szDescription,
                        WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT, 1,
                        self.unitsList[iUnit][1], CvUtil.FONT_LEFT_JUSTIFY)
                iItem += 1

                for loopUnit in self.unitsList[iUnit][2]:

                    if self.bUnitDetails:
                        szDescription = CyGameTextMgr().getSpecificUnitHelp(
                            loopUnit, True, False)

                        listMatches = re.findall("<.*?color.*?>",
                                                 szDescription)
                        for szMatch in listMatches:
                            szDescription = szDescription.replace(szMatch, u"")

                        if loopUnit.isWaiting():
                            szDescription = '*' + szDescription

                        if self.isSelectedUnit(loopUnit.getOwner(),
                                               loopUnit.getID(), False):
                            szDescription = u"         <u>" + szDescription + u"</u>"
                        else:
                            szDescription = u"         " + szDescription

                        if self.isSelectedUnit(loopUnit.getOwner(),
                                               loopUnit.getID(), True):
                            szDescription = localText.changeTextColor(
                                szDescription,
                                gc.getInfoTypeForString("COLOR_YELLOW"))

                        if bReload:
                            screen.appendListBoxString(
                                self.UNIT_LIST_ID, szDescription,
                                WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT,
                                -loopUnit.getOwner(), loopUnit.getID(),
                                CvUtil.FONT_LEFT_JUSTIFY)
                        else:
                            screen.setListBoxStringGFC(
                                self.UNIT_LIST_ID, iItem, szDescription,
                                WidgetTypes.WIDGET_MINIMAP_HIGHLIGHT,
                                -loopUnit.getOwner(), loopUnit.getID(),
                                CvUtil.FONT_LEFT_JUSTIFY)
                        iItem += 1

                    iPlayer = loopUnit.getVisualOwner()
                    player = PyPlayer(iPlayer)
                    iColor = gc.getPlayerColorInfo(
                        gc.getPlayer(
                            iPlayer).getPlayerColor()).getColorTypePrimary()
                    screen.setMinimapColor(
                        MinimapModeTypes.MINIMAPMODE_MILITARY, loopUnit.getX(),
                        loopUnit.getY(), iColor, 0.6)
                    if self.isSelectedUnit(
                            loopUnit.getOwner(), loopUnit.getID(),
                            True) and iPlayer in self.selectedPlayerList:

                        if player.getTeam().isAtWar(
                                gc.getPlayer(self.iActivePlayer).getTeam()):
                            iColor = gc.getInfoTypeForString("COLOR_RED")
                        elif gc.getPlayer(iPlayer).getTeam() != gc.getPlayer(
                                self.iActivePlayer).getTeam():
                            iColor = gc.getInfoTypeForString("COLOR_YELLOW")
                        else:
                            iColor = gc.getInfoTypeForString("COLOR_WHITE")
                        screen.minimapFlashPlot(loopUnit.getX(),
                                                loopUnit.getY(), iColor, -1)
    def drawCityInfo(self, iReligion):

        if not self.bScreenUp:
            return

        screen = self.getScreen()

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

        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 xrange(gc.getNumReligionInfos()):
            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
        # Loop through the cities
        szLeftCities = u""
        szRightCities = u""
        for i in xrange(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 xrange(len(lHolyCity)):
                        szCityName += u"%c" %(gc.getReligionInfo(lHolyCity[iI]).getHolyCityChar())

                lReligions = pLoopCity.getReligions()
                if lReligions:
                    for iI in xrange(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 xrange(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 #21
0
    def showEvents(self, iTurn, bSilent):

        self.iTurn = iTurn
        screen = self.getScreen()

        if (iTurn < self.replayInfo.getInitialTurn()):
            self.iTurn = self.replayInfo.getInitialTurn()
            self.iLastTurnShown = -1
            return
        elif iTurn > self.replayInfo.getFinalTurn():
            self.iTurn = self.replayInfo.getInitialTurn()
            self.iLastTurnShown = -1
            self.resetData()
            self.showEvents(self.iTurn, False)
            return

        szTurnDate = CyGameTextMgr().getDateStr(self.iTurn, False,
                                                self.replayInfo.getCalendar(),
                                                self.replayInfo.getStartYear(),
                                                self.replayInfo.getGameSpeed())
        screen.deleteWidget(self.szHeader)
        # advc.106m: x was X_SCREEN; that doesn't work anymore.
        screen.setLabel(self.szHeader, "Background",
                        u"<font=4b>" + szTurnDate + u"<font>",
                        CvUtil.FONT_CENTER_JUSTIFY, self.X_TITLE, self.Y_TITLE,
                        self.Z_CONTROLS, FontTypes.TITLE_FONT,
                        WidgetTypes.WIDGET_GENERAL, -1, -1)

        events = []
        bFound = False
        bDone = False
        i = 0
        while (i < self.replayInfo.getNumReplayMessages() and not bDone):
            if (self.replayInfo.getReplayMessageTurn(i) <= iTurn
                    and self.replayInfo.getReplayMessageTurn(i) >
                    self.iLastTurnShown):
                events.append(i)
                bFound = True
            else:
                if (bFound):
                    bDone = True
            i += 1

        for iLoopEvent in events:

            szEventDate = CyGameTextMgr().getDateStr(
                self.replayInfo.getReplayMessageTurn(iLoopEvent), False,
                self.replayInfo.getCalendar(), self.replayInfo.getStartYear(),
                self.replayInfo.getGameSpeed())

            szText = self.replayInfo.getReplayMessageText(iLoopEvent)
            iX = self.replayInfo.getReplayMessagePlotX(iLoopEvent)
            iY = self.replayInfo.getReplayMessagePlotY(iLoopEvent)
            eMessageType = self.replayInfo.getReplayMessageType(iLoopEvent)
            eColor = self.replayInfo.getReplayMessageColor(iLoopEvent)

            if (szText != "" and not bSilent):
                szTextNoColor = re.sub("<color=.*?>", "", szText)
                szText = re.sub("</color>", "", szTextNoColor)

                szText = u"<font=2>" + szEventDate + u": " + szText + u"</font>"
                szText = localText.changeTextColor(szText, eColor)
                screen.prependListBoxString(self.szAreaId, szText,
                                            WidgetTypes.WIDGET_GENERAL, -1, -1,
                                            CvUtil.FONT_LEFT_JUSTIFY)

            if (eMessageType ==
                    ReplayMessageTypes.REPLAY_MESSAGE_PLOT_OWNER_CHANGE):
                iPlayer = self.replayInfo.getReplayMessagePlayer(iLoopEvent)
                if iPlayer != -1:
                    screen.setMinimapColor(MinimapModeTypes.MINIMAPMODE_REPLAY,
                                           iX, iY,
                                           self.replayInfo.getColor(iPlayer),
                                           0.6)
                else:
                    screen.setMinimapColor(
                        MinimapModeTypes.MINIMAPMODE_REPLAY, iX, iY,
                        gc.getInfoTypeForString("COLOR_CLEAR"), 0.6)
            else:
                if (iX > -1 and iY > -1 and not bSilent):
                    screen.minimapFlashPlot(
                        iX, iY, gc.getInfoTypeForString("COLOR_WHITE"), 10)
        if (self.yMessage > self.H_TEXT):
            screen.scrollableAreaScrollToBottom(self.szAreaId)

        # Power Graph
        iLoopTurn = self.iLastTurnShown
        while (iLoopTurn <= self.iTurn):
            iTotalScore = 0
            for iLoopPlayer in xrange(self.replayInfo.getNumPlayers()):
                iTotalScore += self.replayInfo.getPlayerScore(
                    iLoopPlayer, iLoopTurn)
            if (iTotalScore > 0):
                iScore = iTotalScore
                for iLoopPlayer in xrange(self.replayInfo.getNumPlayers()):
                    screen.addGraphData(self.szGraph, iLoopTurn,
                                        (1.0 * iScore) / iTotalScore,
                                        iLoopPlayer)
                    iScore -= self.replayInfo.getPlayerScore(
                        iLoopPlayer, iLoopTurn)
            iLoopTurn += 1

        self.iLastTurnShown = iTurn
def getAttitudeString(nPlayer, nTarget):
    """Returns the full hover text with attitude modifiers nPlayer has toward nTarget."""
    if hasAttitude(nPlayer, nTarget):
        return CyGameTextMgr().getAttitudeString(nPlayer, nTarget)
    return None
class Attitude:
    """ Holds summary of attitude that this player has toward target player.

    If the two IDs are the same or the two players have not met, the
    class will be filled with generic default values. We also check to see
    that the active player has met both players, and the accessor functions
    will react differently depending on if this is the case.
    """

    def __init__(self, iThisPlayer, iTargetPlayer):
        pActiveTeam = gc.getTeam(gc.getActivePlayer().getTeam())
        iThisTeam = gc.getPlayer(iThisPlayer).getTeam()
        pThisTeam = gc.getTeam(iThisTeam)
        iTargetTeam = gc.getPlayer(iTargetPlayer).getTeam()
        self.iThisPlayer = iThisPlayer
        self.iTargetPlayer = iTargetPlayer
        self.iAttitudeSum = 0
        self.iAttitudeModifiers = {}
        self.bHasActiveMetBoth = CyGame().isDebugMode() or (pActiveTeam.isHasMet(iThisTeam) and pActiveTeam.isHasMet(iTargetTeam))
        self.eAttitudeType = AttitudeTypes.NO_ATTITUDE
        # This might be better off being something descriptive such as
        # "players have not met" or "players are the same"
        self.sAttitudeString = ""
        # keldath fix attitude call on selfs - already checked
        if iThisPlayer != iTargetPlayer and pThisTeam.isHasMet(iTargetTeam):
            self.eAttitudeType = gc.getPlayer(iThisPlayer).AI_getAttitude(iTargetPlayer)
            self.sAttitudeString = CyGameTextMgr().getAttitudeString(iThisPlayer, iTargetPlayer)
            for sLine in self.sAttitudeString.split("\n"):
                #BugUtil.debug(u"LINE: %s" % (sLine))
                pMatch = re.match("^.*>([-\+]\d+)\s?:\s+(\".+\")<.*$", sLine, re.UNICODE)
                if (pMatch):
                    #BugUtil.debug(u"MATCH: (%s) (%s)" %(pMatch.group(1), pMatch.group(2)))
                    iValue = int(pMatch.group(1))
                    sString = unicode(pMatch.group(2))
                    self.iAttitudeSum += iValue
                    if sString in MODIFIER_STRING_TO_KEY:
                        self.iAttitudeModifiers[MODIFIER_STRING_TO_KEY[sString]] = iValue
                        #BugUtil.debug(u"Attitude::init() - Added to dict: %s" % (sString))
                    else:
                        BugUtil.debug(u"Attitude::init() - Attitude string contains unknown modifier text: %s" % (sString))
        #BugUtil.debug(u"Attitude::init() complete.")
        BugUtil.debug(u"%s" % (self))

    def __str__(self):
        """ String representation of class instance. """
        return (u"Attitude { 'iThisPlayer': %d, 'iTargetPlayer': %d, 'iAttitudeSum': %d, 'eAttitudeType': %d, 'bHasActiveMetBoth': %s,\n 'iAttitudeModifiers': %s,\n 'sAttitudeString': %s }"
                % (self.iThisPlayer, self.iTargetPlayer, self.iAttitudeSum, self.eAttitudeType,
                   self.bHasActiveMetBoth, str(self.iAttitudeModifiers), self.sAttitudeString))

    def hasModifier(self, sKey):
        """ Does the attitude contain given modifier? """
        if self.bHasActiveMetBoth:
            return (sKey in self.iAttitudeModifiers)
        return False

    def getModifier(self, sKey):
        """ Returns integer value of given attitude modifer. """
        if self.bHasActiveMetBoth:
            if sKey in self.iAttitudeModifiers:
                return self.iAttitudeModifiers[sKey]
        return 0

    def hasAttitude(self):
        """ Does this player have any attitude toward the target? """
        if self.bHasActiveMetBoth:
            return (not self.eAttitudeType == AttitudeTypes.NO_ATTITUDE)
        return False

    def getCount(self):
        """ Returns total (visible) count of attitude modifiers. """
        if self.bHasActiveMetBoth:
            return self.iAttitudeSum
        return 0

    def getCategory(self):
        """ Returns attitude category as an AttitudeTypes enum. """
        if self.bHasActiveMetBoth:
            return self.eAttitudeType
        return AttitudeTypes.NO_ATTITUDE

    def getString(self):
        """ Returns full diplomacy text string. """
        if self.bHasActiveMetBoth:
            return self.sAttitudeString
        return ""

    def getIcon(self):
        """ Returns smilie icon string based on attitude type. """
        if self.bHasActiveMetBoth:
            eCategory = self.getCategory()
            if eCategory != AttitudeTypes.NO_ATTITUDE:
                return ATTITUDE_ICONS[int(eCategory)]
        return ""

    def getColor(self):
        """ Returns the color of the attitude this player has toward target. """
        if self.bHasActiveMetBoth:
            eCategory = self.getCategory()
            if eCategory != AttitudeTypes.NO_ATTITUDE:
                return ATTITUDE_COLORS[int(eCategory)]
        return -1

    def getText(self, bNumber, bSmily, bWorstEnemy, bWarPeace):
        """ Returns a string describing the attitude this player has toward target. """
        if self.bHasActiveMetBoth:
            nAttitude = self.getCount()

            if bNumber:
                szText = str(nAttitude)
                if nAttitude > 0:
                    szText = "+" + szText
                if bSmily:
                    szText = "[" + szText + "] "
                else:
                    szText = "<font=3>   " + szText + "</font> "
            else:
                szText = ""

            iColor = self.getColor()
            szText = BugUtil.colorText(szText, iColor)
            if bSmily:
                szText = self.getIcon() + " " + szText

            pThisPlayer = gc.getPlayer(self.iThisPlayer)
            pTargetPlayer = gc.getPlayer(self.iTargetPlayer)
            if bWorstEnemy and isWorstEnemy(pThisPlayer, pTargetPlayer):
                szText += u"%c" % (CyGame().getSymbolID(FontSymbols.ANGRY_POP_CHAR))

            if bWarPeace:
                iThisTeam = pThisPlayer.getTeam()
                pThisTeam = gc.getTeam(iThisTeam)
                iTargetTeam = pTargetPlayer.getTeam()
                pTargetTeam = gc.getTeam(iTargetTeam)
                if pThisTeam.isAtWar(iTargetTeam):
                    szText += u"%c" % (gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar() + 25)
                elif gc.getGame().getActiveTeam() in (iThisTeam, iTargetTeam):
                    bPeace = False
                    if pThisTeam.isForcePeace(iTargetTeam):
                        bPeace = True
                    elif pTargetTeam.isAVassal():
                        for iOwnerTeam in xrange(gc.getMAX_TEAMS()):
                            if pTargetTeam.isVassal(iOwnerTeam) and pThisTeam.isForcePeace(iOwnerTeam):
                                bPeace = True
                                break
                    if bPeace:
                        szText += u"%c" % (gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar() + 26)

            return szText
        return ""
    def updateAnarchy(self):

        screen = self.getScreen()

        activePlayer = gc.getPlayer(self.iActivePlayer)

        bChange = False
        i = 0
        while (i < gc.getNumCivicOptionInfos() and not bChange):
            if (self.m_paeCurrentCivics[i] != self.m_paeOriginalCivics[i]):
                bChange = True
            i += 1

        # Make the revolution button
        screen.deleteWidget(self.EXIT_NAME)
        if (activePlayer.canRevolution(0) and bChange):
            screen.setText(
                self.EXIT_NAME, "Background",
                u"<font=4>" + localText.getText("TXT_KEY_CONCEPT_REVOLUTION",
                                                ()).upper() + u"</font>",
                CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT,
                self.Z_TEXT, FontTypes.TITLE_FONT,
                WidgetTypes.WIDGET_REVOLUTION, 1, 0)
            screen.show(self.CANCEL_NAME)
        else:
            screen.setText(
                self.EXIT_NAME, "Background",
                u"<font=4>" + localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT",
                                                ()).upper() + u"</font>",
                CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT,
                self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL,
                1, -1)
            screen.hide(self.CANCEL_NAME)

        # Anarchy
        iTurns = activePlayer.getCivicAnarchyLength(self.m_paeDisplayCivics)

        if (activePlayer.canRevolution(0)):
            szText = localText.getText("TXT_KEY_ANARCHY_TURNS", (iTurns, ))
        else:
            szText = CyGameTextMgr().setRevolutionHelp(self.iActivePlayer)

        screen.setLabel("CivicsRevText", "Background",
                        u"<font=3>" + szText + u"</font>",
                        CvUtil.FONT_CENTER_JUSTIFY, self.X_SCREEN,
                        self.BOTTOM_LINE_TOP + self.TEXT_MARGIN // 2, 0,
                        FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1,
                        -1)

        # Maintenance
        #szText = localText.getText("TXT_KEY_CIVIC_SCREEN_UPKEEP", (activePlayer.getCivicUpkeep(self.m_paeDisplayCivics, True), ))
        szText = localText.getText(
            "TXT_KEY_CIVIC_SCREEN_UPKEEP",
            (activePlayer.getCivicUpkeep(self.m_paeDisplayCivics, True) *
             (100 + activePlayer.getInflationRate()) / 100, ))  # K-Mod
        screen.setLabel(
            "CivicsUpkeepText", "Background",
            u"<font=3>" + szText + u"</font>", CvUtil.FONT_CENTER_JUSTIFY,
            self.X_SCREEN, self.BOTTOM_LINE_TOP + self.BOTTOM_LINE_HEIGHT -
            2 * self.TEXT_MARGIN, 0, FontTypes.GAME_FONT,
            WidgetTypes.WIDGET_GENERAL, -1, -1)
def sdGetTimeInt( turn ):
	TurnTable = CyGameTextMgr().getTimeStr(turn, False).split(' ')
	TurnInt   = int(TurnTable[0])
	if (TurnTable[1] == 'BC'):
		TurnInt = 0 - TurnInt
	return TurnInt
    def drawCityInfo(self, iCorporation):

        if not self.bScreenUp: return

        screen = self.getScreen()

        if iCorporation == gc.getNumCorporationInfos():
            iLinkCorporation = -1
        else:
            iLinkCorporation = iCorporation

        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)

        for i in xrange(gc.getNumCorporationInfos()):
            if (self.iCorporationSelected == i):
                screen.setState(self.getCorporationButtonName(i), True)
            else:
                screen.setState(self.getCorporationButtonName(i), False)

        iPlayer = PyPlayer(self.iActivePlayer)

        cityList = iPlayer.getCityList()

        # Loop through the cities
        szLeftCities = u""
        szRightCities = u""
        for i in xrange(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)

            lHeadquarters = pLoopCity.getHeadquarters()
            if lHeadquarters:
                for iI in xrange(len(lHeadquarters)):
                    szCityName += u"%c" % (gc.getCorporationInfo(
                        lHeadquarters[iI]).getHeadquarterChar())

            lCorporations = pLoopCity.getCorporations()
            if lCorporations:
                for iI in xrange(len(lCorporations)):
                    if lCorporations[iI] not in lHeadquarters:
                        szCityName += u"%c " % (gc.getCorporationInfo(
                            lCorporations[iI]).getChar())

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

            if (iLinkCorporation == -1):

                # Original
                #bFirst = True
                #for iI in xrange(len(lCorporations)):
                #  szTempBuffer = CyGameTextMgr().getCorporationHelpCity(lCorporations[iI], pLoopCity.GetCy(), False, False)
                #  if (szTempBuffer):
                #    if (not bFirst):
                #      szCityName += u", "
                #    szCityName += szTempBuffer
                #    bFirst = False

                # PAE
                lCorpBonus1 = [0, 0, 0]
                lCorpBonus2 = [0, 0, 0]
                for iJ in xrange(3):
                    lCorpBonus1[iJ] += pLoopCity.GetCy().getCorporationYield(
                        iJ)
                for iJ in xrange(3):
                    lCorpBonus2[iJ] += pLoopCity.GetCy(
                    ).getCorporationCommerce(iJ)

                bFirst = True
                # Yield
                for iJ in xrange(3):
                    if lCorpBonus1[iJ]:
                        if not bFirst: szCityName += u", "
                        szCityName += u"+%d%c" % (
                            lCorpBonus1[iJ], gc.getYieldInfo(iJ).getChar())
                        bFirst = False
                # Commerce
                for iJ in xrange(3):
                    if lCorpBonus2[iJ]:
                        if not bFirst: szCityName += u", "
                        szCityName += u"+%d%c" % (
                            lCorpBonus2[iJ], gc.getCommerceInfo(iJ).getChar())
                        bFirst = False
                # Costs
                if not bFirst:
                    szCityName += u", -%d%c" % (
                        pLoopCity.GetCy().calculateCorporationMaintenance(),
                        gc.getCommerceInfo(0).getChar())
                # ----

            else:
                szCityName += CyGameTextMgr().getCorporationHelpCity(
                    iLinkCorporation, pLoopCity.GetCy(), False, True)

            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)

        # Header...
        if self.iCorporationExamined != -1:
            screen.setLabel(
                self.HEADER_NAME, "Background",
                u"<font=4b>" + gc.getCorporationInfo(
                    self.iCorporationExamined).getDescription().upper() +
                u"</font>", CvUtil.FONT_CENTER_JUSTIFY, self.X_SCREEN,
                self.Y_TITLE, self.Z_TEXT, FontTypes.TITLE_FONT,
                WidgetTypes.WIDGET_GENERAL, -1, -1)
        else:
            screen.setLabel(
                self.HEADER_NAME, "Background", u"<font=4b>" +
                localText.getText("TXT_KEY_CORPORATION_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)

        screen.setText(self.EXIT_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)