# Rise of Mankind 2.9 - resource bar
def updateResourceStrings( self ):
screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
xResolution = screen.getXResolution()
yResolution = screen.getYResolution()
pPlayer = gc.getPlayer(gc.getGame().getActivePlayer())
# global bshowResourceBar
if (RoMOpt.isResourceBarTypesAll()):
for szBonus in bonusTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
for szBonus in bonusTypes2:
szName = "ResourceText" + szBonus
screen.hide( szName )
for szBonus in bonusTypes3:
szName = "ResourceText" + szBonus
screen.hide( szName )
for szBonus in bonusTypes4:
szName = "ResourceText" + szBonus
screen.hide( szName )
for szBonus in bonusAllTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
elif (RoMOpt.isResourceBarTypesRush()):
for szBonus in bonusRushTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
elif (RoMOpt.isResourceBarTypesStrategic()):
for szBonus in bonusStrategicTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
elif (RoMOpt.isResourceBarTypesManufactured()):
for szBonus in bonusManufacturedTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
elif (RoMOpt.isResourceBarTypesFood()):
for szBonus in bonusFoodTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
elif (RoMOpt.isResourceBarTypesLuxury()):
for szBonus in bonusLuxuryTypes:
szName = "ResourceText" + szBonus
screen.hide( szName )
screen.hide( "ResourceBackground" )
iWidth = 0
iCount = 0
iBtnHeight = 18
yCoord = 85
if (RoMOpt.isShowResourceBar()):
if (RoMOpt.isResourceBarTypesAll()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
# if (pPlayer.getBonusImport(iBonus) == 1):
# szTempBuffer += u"%c: <color=255,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
iCount = 0
for szBonus in bonusTypes2:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 80, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
iCount = 0
for szBonus in bonusTypes3:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 120, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
iCount = 0
for szBonus in bonusTypes4:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 160, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
iCount = 0
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, (iWidth * 4) + 22, (iBtnHeight * 19) + 12 )
screen.show( "ResourceBackground" )
elif (RoMOpt.isResourceBarTypesRush()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusRushTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, iWidth + 12, (iBtnHeight * iCount) + 12 )
iCount = 0
screen.show( "ResourceBackground" )
elif (RoMOpt.isResourceBarTypesStrategic()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusStrategicTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, iWidth + 12, (iBtnHeight * iCount) + 12 )
iCount = 0
screen.show( "ResourceBackground" )
elif (RoMOpt.isResourceBarTypesManufactured()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusManufacturedTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, iWidth + 12, (iBtnHeight * iCount) + 12 )
iCount = 0
screen.show( "ResourceBackground" )
elif (RoMOpt.isResourceBarTypesFood()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusFoodTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, iWidth + 12, (iBtnHeight * iCount) + 12 )
iCount = 0
screen.show( "ResourceBackground" )
elif (RoMOpt.isResourceBarTypesLuxury()):
if (not CyInterface().isCityScreenUp() and CyInterface().isScoresVisible() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == False):
for szBonus in bonusLuxuryTypes:
iBonus = gc.getInfoTypeForString(szBonus)
szBuffer = u"<font=2>"
szTempBuffer = ""
if (pPlayer.getNumAvailableBonuses(iBonus) < 10):
szTempBuffer += " "
if(pPlayer.getNumAvailableBonuses(iBonus) == 0):
szTempBuffer += u"%c: <color=255,0,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
elif(pPlayer.getNumAvailableBonuses(iBonus) == 1):
szTempBuffer += u"%c: <color=255,255,255>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
else:
szTempBuffer += u"%c: <color=0,255,0>%d</color>" %(gc.getBonusInfo(iBonus).getChar(), pPlayer.getNumAvailableBonuses(iBonus))
szBuffer = szBuffer + szTempBuffer
szBuffer = szBuffer + "</font>"
if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
iWidth = CyInterface().determineWidth( szBuffer )
szName = "ResourceText" + szBonus
screen.setText( szName, "ResourceBackground", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 40, yCoord + (iCount * iBtnHeight) + 24, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, iBonus, -1 )
screen.show( szName )
iCount = iCount + 1
screen.setPanelSize( "ResourceBackground", 6, yCoord + 18, iWidth + 12, (iBtnHeight * iCount) + 12 )
iCount = 0
screen.show( "ResourceBackground" )
yCoord = 85
iCount = 0
# Rise of Mankind 2.9 - resource bar