home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 January / Gamestar_80_2006-01_dvd.iso / Dema / Civilization4 / data1.cab / Civ4DemoComponent / Assets / Python / EntryPoints / CvScreensInterface.py < prev    next >
Encoding:
Python Source  |  2005-11-09  |  23.2 KB  |  781 lines

  1. ## Sid Meier's Civilization 4
  2. ## Copyright Firaxis Games 2005
  3. import CvMainInterface
  4. import CvDomesticAdvisor
  5. import CvTechChooser
  6. import CvForeignAdvisor
  7. import CvMilitaryAdvisor
  8. import CvFinanceAdvisor
  9. import CvReligionScreen
  10. import CvCivicsScreen
  11. import CvVictoryScreen
  12.  
  13. import CvOptionsScreen
  14. import CvReplayScreen
  15. import CvHallOfFameScreen
  16. import CvDanQuayle
  17. import CvUnVictoryScreen
  18.  
  19. import CvDawnOfMan
  20. import CvTechSplashScreen
  21. import CvTopCivs
  22. import CvInfoScreen
  23.  
  24. import CvIntroMovieScreen
  25. import CvVictoryMovieScreen
  26. import CvWonderMovieScreen
  27. import CvEraMovieScreen
  28.  
  29. import CvPediaMain
  30. import CvPediaHistory
  31.  
  32. import CvWorldBuilderScreen
  33. import CvWorldBuilderDiplomacyScreen
  34.  
  35. import CvDebugTools
  36. import CvDebugInfoScreen
  37.  
  38. import CvDemoVictoryScreen
  39.  
  40. import CvUtil
  41. import CvEventInterface
  42. import CvPopupInterface
  43. import CvScreenUtilsInterface
  44. import ScreenInput as PyScreenInput
  45. from CvScreenEnums import *
  46. from CvPythonExtensions import *
  47.  
  48. g_bIsScreenActive = -1
  49.  
  50. def toggleSetNoScreens():
  51.     global g_bIsScreenActive
  52.     print "SCREEN OFF"
  53.     g_bIsScreenActive = -1
  54.  
  55. def toggleSetScreenOn(argsList):
  56.     global g_bIsScreenActive
  57.     print "%s SCREEN TURNED ON" %(argsList[0],)
  58.     g_bIsScreenActive = argsList[0]
  59.  
  60. demoVictoryScreen = CvDemoVictoryScreen.CvDemoVictoryScreen()
  61. def showDemoVictoryScreen():
  62.     demoVictoryScreen.interfaceScreen()
  63.     
  64. mainInterface = CvMainInterface.CvMainInterface()
  65. def showMainInterface():
  66.     mainInterface.interfaceScreen()
  67.  
  68. techChooser = CvTechChooser.CvTechChooser()
  69. def showTechChooser():
  70.     techChooser.interfaceScreen()
  71.  
  72. hallOfFameScreen = CvHallOfFameScreen.CvHallOfFameScreen(HALL_OF_FAME)
  73. def showHallOfFame(argsList):
  74.     hallOfFameScreen.interfaceScreen(argsList[0])
  75.  
  76. civicScreen = CvCivicsScreen.CvCivicsScreen()
  77. def showCivicsScreen():
  78.     civicScreen.interfaceScreen()
  79.  
  80. religionScreen = CvReligionScreen.CvReligionScreen()
  81. def showReligionScreen():
  82.     religionScreen.interfaceScreen()
  83.  
  84. optionsScreen = CvOptionsScreen.CvOptionsScreen()
  85. def showOptionsScreen():
  86.     optionsScreen.interfaceScreen()
  87.  
  88. foreignAdvisor = CvForeignAdvisor.CvForeignAdvisor()
  89. def showForeignAdvisorScreen(argsList):
  90.     foreignAdvisor.interfaceScreen(argsList[0])
  91.  
  92. financeAdvisor = CvFinanceAdvisor.CvFinanceAdvisor()
  93. def showFinanceAdvisor():
  94.     financeAdvisor.interfaceScreen()
  95.  
  96. domesticAdvisor = CvDomesticAdvisor.CvDomesticAdvisor()
  97. def showDomesticAdvisor():
  98.     domesticAdvisor.interfaceScreen()
  99.  
  100. militaryAdvisor = CvMilitaryAdvisor.CvMilitaryAdvisor(MILITARY_ADVISOR)
  101. def showMilitaryAdvisor():
  102.     militaryAdvisor.interfaceScreen()
  103.  
  104. dawnOfMan = CvDawnOfMan.CvDawnOfMan(DAWN_OF_MAN)
  105. def showDawnOfMan(argsList):
  106.     dawnOfMan.interfaceScreen()
  107.  
  108. introMovie = CvIntroMovieScreen.CvIntroMovieScreen()
  109. def showIntroMovie(argsList):
  110.     introMovie.interfaceScreen()
  111.     
  112. victoryMovie = CvVictoryMovieScreen.CvVictoryMovieScreen()
  113. def showVictoryMovie(argsList):
  114.     return
  115.     victoryMovie.interfaceScreen(argsList[0])
  116.     
  117. wonderMovie = CvWonderMovieScreen.CvWonderMovieScreen()
  118. def showWonderMovie(argsList):
  119.     wonderMovie.interfaceScreen(argsList[0], argsList[1], argsList[2])
  120.  
  121. eraMovie = CvEraMovieScreen.CvEraMovieScreen()
  122. def showEraMovie(argsList):
  123.     eraMovie.interfaceScreen(argsList[0])
  124.     
  125. replayScreen = CvReplayScreen.CvReplayScreen(REPLAY_SCREEN)
  126. def showReplay(argsList):
  127.     return
  128.     replayScreen.showScreen(argsList[4])
  129.  
  130. danQuayleScreen = CvDanQuayle.CvDanQuayle()
  131. def showDanQuayleScreen(argsList):
  132.     return
  133.     danQuayleScreen.interfaceScreen()
  134.  
  135. unVictoryScreen = CvUnVictoryScreen.CvUnVictoryScreen()
  136. def showUnVictoryScreen(argsList):
  137.     return
  138.     unVictoryScreen.interfaceScreen()
  139.  
  140. topCivs = CvTopCivs.CvTopCivs()
  141. def showTopCivs():
  142.     return
  143.     topCivs.showScreen()
  144.  
  145. infoScreen = CvInfoScreen.CvInfoScreen(INFO_SCREEN)
  146. def showInfoScreen(argsList):
  147.     return
  148.     iTabID = argsList[0]
  149.     infoScreen.showScreen(-1, iTabID)
  150.  
  151. debugInfoScreen = CvDebugInfoScreen.CvDebugInfoScreen()
  152. def showDebugInfoScreen():
  153.     return
  154.     debugInfoScreen.interfaceScreen()
  155.  
  156. techSplashScreen = CvTechSplashScreen.CvTechSplashScreen(TECH_SPLASH)
  157. def showTechSplash(argsList):
  158.     techSplashScreen.interfaceScreen(argsList[0])
  159.  
  160. victoryScreen = CvVictoryScreen.CvVictoryScreen(VICTORY_SCREEN)
  161. def showVictoryScreen():
  162.     return
  163.     victoryScreen.interfaceScreen()
  164.  
  165. #################################################
  166. ## Civilopedia
  167. #################################################
  168. pediaMainScreen = CvPediaMain.CvPediaMain()
  169. def linkToPedia(argsList):
  170.     pediaMainScreen.link(argsList[0])
  171.         
  172. def pediaShow():
  173.     return pediaMainScreen.pediaShow()
  174.     
  175. def pediaBack():
  176.     return pediaMainScreen.back()
  177.         
  178. def pediaForward():
  179.     pediaMainScreen.forward()
  180.         
  181. def pediaMain(argsList):
  182.     pediaMainScreen.pediaJump(PEDIA_MAIN, argsList[0], True)
  183.         
  184. def pediaJumpToTech(argsList):
  185.     pediaMainScreen.pediaJump(PEDIA_TECH, argsList[0], True)
  186.  
  187. def pediaJumpToUnit(argsList):
  188.     pediaMainScreen.pediaJump(PEDIA_UNIT, argsList[0], True)
  189.  
  190. def pediaJumpToBuilding(argsList):
  191.     pediaMainScreen.pediaJump(PEDIA_BUILDING, argsList[0], True)
  192.     
  193. def pediaJumpToProject(argsList):
  194.     return
  195.     pediaMainScreen.pediaJump(PEDIA_PROJECT, argsList[0], True)
  196.     
  197. def pediaJumpToReligion(argsList):
  198.     return
  199.     pediaMainScreen.pediaJump(PEDIA_RELIGION, argsList[0], True)
  200.     
  201. def pediaJumpToPromotion(argsList):
  202.     return
  203.     pediaMainScreen.pediaJump(PEDIA_PROMOTION, argsList[0], True)
  204.     
  205. def pediaJumpToUnitChart(argsList):
  206.     return
  207.     pediaMainScreen.pediaJump(PEDIA_UNIT_CHART, argsList[0], True)
  208.  
  209. def pediaJumpToBonus(argsList):
  210.     return
  211.     pediaMainScreen.pediaJump(PEDIA_BONUS, argsList[0], True)
  212.     
  213. def pediaJumpToTerrain(argsList):
  214.     return
  215.     pediaMainScreen.pediaJump(PEDIA_TERRAIN, argsList[0], True)
  216.     
  217. def pediaJumpToFeature(argsList):
  218.     return
  219.     pediaMainScreen.pediaJump(PEDIA_FEATURE, argsList[0], True)
  220.     
  221. def pediaJumpToImprovement(argsList):
  222.     return
  223.     pediaMainScreen.pediaJump(PEDIA_IMPROVEMENT, argsList[0], True)
  224.  
  225. def pediaJumpToCivic(argsList):
  226.     return
  227.     pediaMainScreen.pediaJump(PEDIA_CIVIC, argsList[0], True)
  228.  
  229. def pediaJumpToCiv(argsList):
  230.     pediaMainScreen.pediaJump(PEDIA_CIVILIZATION, argsList[0], True)
  231.  
  232. def pediaJumpToLeader(argsList):
  233.     pediaMainScreen.pediaJump(PEDIA_LEADER, argsList[0], True)
  234.  
  235. def pediaJumpToSpecialist(argsList):
  236.     return
  237.     pediaMainScreen.pediaJump(PEDIA_SPECIALIST, argsList[0], True)
  238.     
  239. def pediaShowHistorical(argsList):
  240.     return
  241.     iEntryId = pediaMainScreen.pediaHistorical.getIdFromEntryInfo(argsList[0], argsList[1])
  242.     pediaMainScreen.pediaJump(PEDIA_HISTORY, iEntryId, True)
  243.     return
  244.  
  245. #################################################
  246. ## Worldbuilder
  247. #################################################
  248. worldBuilderScreen = CvWorldBuilderScreen.CvWorldBuilderScreen()
  249. def getWorldBuilderScreen():
  250.     return worldBuilderScreen
  251.  
  252. def showWorldBuilderScreen():
  253.     return
  254.     worldBuilderScreen.interfaceScreen()
  255.  
  256. def hideWorldBuilderScreen():
  257.     worldBuilderScreen.killScreen()
  258.  
  259. def WorldBuilderToggleUnitEditCB():
  260.     worldBuilderScreen.toggleUnitEditCB()
  261.  
  262. def WorldBuilderAllPlotsCB():
  263.     CvEventInterface.beginEvent(CvUtil.EventWBAllPlotsPopup)
  264.  
  265. def WorldBuilderEraseCB():
  266.     worldBuilderScreen.eraseCB()
  267.  
  268. def WorldBuilderLandmarkCB():
  269.     worldBuilderScreen.landmarkModeCB()
  270.  
  271. def WorldBuilderExitCB():
  272.     worldBuilderScreen.Exit()
  273.  
  274. def WorldBuilderToggleCityEditCB():
  275.     worldBuilderScreen.toggleCityEditCB()
  276.  
  277. def WorldBuilderNormalPlayerTabModeCB():
  278.     worldBuilderScreen.normalPlayerTabModeCB()
  279.  
  280. def WorldBuilderNormalMapTabModeCB():
  281.     worldBuilderScreen.normalMapTabModeCB()
  282.  
  283. def WorldBuilderRevealTabModeCB():
  284.     worldBuilderScreen.revealTabModeCB()
  285.  
  286. def WorldBuilderDiplomacyModeCB():
  287.     worldBuilderScreen.diplomacyModeCB()
  288.  
  289. def WorldBuilderRevealAllCB():
  290.     worldBuilderScreen.revealAll(True)
  291.  
  292. def WorldBuilderUnRevealAllCB():
  293.     worldBuilderScreen.revealAll(False)
  294.  
  295. def WorldBuilderHandleUnitCB( argsList ):
  296.     worldBuilderScreen.handleUnitCB(argsList)
  297.  
  298. def WorldBuilderHandleTerrainCB( argsList ):
  299.     worldBuilderScreen.handleTerrainCB(argsList)
  300.  
  301. def WorldBuilderHandleFeatureCB(argsList):
  302.     worldBuilderScreen.handleFeatureCB(argsList)
  303.  
  304. def WorldBuilderHandleBonusCB( argsList ):
  305.     worldBuilderScreen.handleBonusCB(argsList)
  306.  
  307. def WorldBuilderHandleImprovementCB(argsList):
  308.     worldBuilderScreen.handleImprovementCB(argsList)
  309.  
  310. def WorldBuilderHandlePlotTypeCB( argsList ):
  311.     worldBuilderScreen.handlePlotTypeCB(argsList)
  312.  
  313. def WorldBuilderHandleAllPlotsCB( argsList ):
  314.     worldBuilderScreen.handleAllPlotsCB(argsList)
  315.  
  316. def WorldBuilderHandleUnitEditExperienceCB( argsList ):
  317.     worldBuilderScreen.handleUnitEditExperienceCB(argsList)
  318.     
  319. def WorldBuilderHandleUnitEditLevelCB( argsList ):
  320.     worldBuilderScreen.handleUnitEditLevelCB(argsList)
  321.     
  322. def WorldBuilderHandleUnitEditNameCB( argsList ):
  323.     worldBuilderScreen.handleUnitEditNameCB(argsList)
  324.     
  325. def WorldBuilderHandleCityEditPopulationCB( argsList ):
  326.     worldBuilderScreen.handleCityEditPopulationCB(argsList)
  327.  
  328. def WorldBuilderHandleCityEditCultureCB( argsList ):
  329.     worldBuilderScreen.handleCityEditCultureCB(argsList)
  330.  
  331. def WorldBuilderHandleCityEditGoldCB( argsList ):
  332.     worldBuilderScreen.handleCityEditGoldCB(argsList)
  333.  
  334. def WorldBuilderHandleCityEditAddScriptCB( argsList ):
  335.     worldBuilderScreen.getCityScript()
  336.  
  337. def WorldBuilderHandleUnitEditAddScriptCB( argsList ):
  338.     print("TEST")
  339.     worldBuilderScreen.getUnitScript()
  340.  
  341. def WorldBuilderHandleCityEditNameCB( argsList ):
  342.     worldBuilderScreen.handleCityEditNameCB(argsList)
  343.  
  344. def WorldBuilderHandleLandmarkTextCB( argsList ):
  345.     worldBuilderScreen.handleLandmarkTextCB(argsList)
  346.  
  347. def WorldBuilderHandleUnitEditPullDownCB( argsList ):
  348.     worldBuilderScreen.handleUnitEditPullDownCB(argsList)
  349.  
  350. def WorldBuilderHandleUnitAITypeEditPullDownCB( argsList ):
  351.     worldBuilderScreen.handleUnitAITypeEditPullDownCB(argsList)
  352.  
  353. def WorldBuilderHandlePlayerEditPullDownCB( argsList ):
  354.     worldBuilderScreen.handlePlayerEditPullDownCB(argsList)
  355.  
  356. def WorldBuilderHandlePlayerUnitPullDownCB( argsList ):
  357.     worldBuilderScreen.handlePlayerUnitPullDownCB(argsList)
  358.  
  359. def WorldBuilderHandleSelectTeamPullDownCB( argsList ):
  360.     worldBuilderScreen.handleSelectTeamPullDownCB(argsList)
  361.  
  362. def WorldBuilderHandlePromotionCB( argsList ):
  363.     worldBuilderScreen.handlePromotionCB(argsList)
  364.  
  365. def WorldBuilderHandleBuildingCB( argsList ):
  366.     worldBuilderScreen.handleBuildingCB(argsList)
  367.  
  368. def WorldBuilderHandleTechCB( argsList ):
  369.     worldBuilderScreen.handleTechCB(argsList)
  370.  
  371. def WorldBuilderHandleRouteCB( argsList ):
  372.     worldBuilderScreen.handleRouteCB(argsList)
  373.  
  374. def WorldBuilderHandleEditCityBuildingCB( argsList ):
  375.     worldBuilderScreen.handleEditCityBuildingCB(argsList)
  376.  
  377. def WorldBuilderHandleBrushWidthCB( argsList ):
  378.     worldBuilderScreen.handleBrushWidthCB(argsList)
  379.  
  380. def WorldBuilderHandleBrushHeightCB( argsList ):
  381.     worldBuilderScreen.handleBrushHeightCB(argsList)
  382.  
  383. def WorldBuilderHandleLandmarkCB( argsList ):
  384.     worldBuilderScreen.handleLandmarkCB(argsList)
  385.  
  386. def WorldBuilderHandleFlyoutMenuCB( argsList ):
  387.     worldBuilderScreen.handleFlyoutMenuCB(argsList)
  388.  
  389. def WorldBuilderGetHighlightPlot(argsList):
  390.     return worldBuilderScreen.getHighlightPlot(argsList)
  391.  
  392. def WorldBuilderOnNormalPlayerBrushSelected(argsList):
  393.     iList,iIndex,iTab = argsList;
  394.     print("WB brush selected, iList=%d, iIndex=%d, type=%d" %(iList,iIndex,iTab))    
  395.     if (worldBuilderScreen.setCurrentNormalPlayerIndex(iIndex)):
  396.         return 1
  397.     return 0
  398.  
  399. def WorldBuilderOnNormalMapBrushSelected(argsList):
  400.     iList,iIndex,iTab = argsList;
  401.     print("WB brush selected, iList=%d, iIndex=%d, type=%d" %(iList,iIndex,iTab))    
  402.     if (worldBuilderScreen.setCurrentNormalMapIndex(iIndex)):
  403.         if (worldBuilderScreen.setCurrentNormalMapList(iList)):
  404.             return 1
  405.     return 0
  406.  
  407. def WorldBuilderOnWBEditBrushSelected(argsList):
  408.     iList,iIndex,iTab = argsList;
  409.     if (worldBuilderScreen.setEditButtonClicked(iIndex)):
  410.         return 1
  411.     return 0
  412.  
  413. def WorldBuilderOnWBEditReligionSelected(argsList):
  414.     iList,iIndex,iTab = argsList;
  415.     if (worldBuilderScreen.setEditReligionSelected(iIndex)):
  416.         return 1
  417.     return 0
  418.  
  419. def WorldBuilderOnWBEditHolyCitySelected(argsList):
  420.     iList,iIndex,iTab = argsList;
  421.     if (worldBuilderScreen.setEditHolyCitySelected(iIndex)):
  422.         return 1
  423.     return 0
  424.  
  425. def WorldBuilderOnAllPlotsBrushSelected(argsList):
  426.     if (worldBuilderScreen.handleAllPlotsCB(argsList)):
  427.         return 1
  428.     return 0
  429.  
  430. def WorldBuilderGetUnitTabID():
  431.     return worldBuilderScreen.getUnitTabID()
  432.  
  433. def WorldBuilderGetBuildingTabID():
  434.     return worldBuilderScreen.getBuildingTabID()
  435.  
  436. def WorldBuilderGetTechnologyTabID():
  437.     return worldBuilderScreen.getTechnologyTabID()
  438.  
  439. def WorldBuilderGetImprovementTabID():
  440.     return worldBuilderScreen.getImprovementTabID()
  441.  
  442. def WorldBuilderGetBonusTabID():
  443.     return worldBuilderScreen.getBonusTabID()
  444.  
  445. def WorldBuilderGetImprovementListID():
  446.     return worldBuilderScreen.getImprovementListID()
  447.  
  448. def WorldBuilderGetBonusListID():
  449.     return worldBuilderScreen.getBonusListID()
  450.  
  451. def WorldBuilderGetTerrainTabID():
  452.     return worldBuilderScreen.getTerrainTabID()
  453.  
  454. def WorldBuilderGetTerrainListID():
  455.     return worldBuilderScreen.getTerrainListID()
  456.  
  457. def WorldBuilderGetFeatureListID():
  458.     return worldBuilderScreen.getFeatureListID()
  459.  
  460. def WorldBuilderGetPlotTypeListID():
  461.     return worldBuilderScreen.getPlotTypeListID()
  462.  
  463. def WorldBuilderGetRouteListID():
  464.     return worldBuilderScreen.getRouteListID()
  465.  
  466. def WorldBuilderHasTech(argsList):
  467.     iTech = argsList[0]
  468.     return worldBuilderScreen.hasTech(iTech)
  469.  
  470. def WorldBuilderHasPromotion(argsList):
  471.     iPromotion = argsList[0]
  472.     return worldBuilderScreen.hasPromotion(iPromotion)
  473.  
  474. def WorldBuilderHasBuilding(argsList):
  475.     iBuilding = argsList[0]
  476.     return worldBuilderScreen.hasBuilding(iBuilding)
  477.  
  478. def WorldBuilderHasReligion(argsList):
  479.     iReligion = argsList[0]
  480.     return worldBuilderScreen.hasReligion(iReligion)
  481.  
  482. def WorldBuilderHasHolyCity(argsList):
  483.     iReligion = argsList[0]
  484.     return worldBuilderScreen.hasHolyCity(iReligion)
  485.  
  486. ##### WORLDBUILDER DIPLOMACY SCREEN #####
  487.  
  488. worldBuilderDiplomacyScreen = CvWorldBuilderDiplomacyScreen.CvWorldBuilderDiplomacyScreen()
  489. def showWorldBuilderDiplomacyScreen():
  490.     worldBuilderDiplomacyScreen.interfaceScreen()
  491.  
  492. def hideWorldBuilderDiplomacyScreen():
  493.     worldBuilderDiplomacyScreen.killScreen()
  494.  
  495.  
  496. #################################################
  497. ## Utility Functions (can be overridden by CvScreenUtilsInterface
  498. #################################################
  499.  
  500. def movieDone(argsList):
  501.     # allows overides for mods
  502.     if (CvScreenUtilsInterface.getScreenUtils().movieDone(argsList)):
  503.         return
  504.     
  505.     if (argsList[0] == INTRO_MOVIE_SCREEN):
  506.         introMovie.hideScreen()
  507.  
  508.     if (argsList[0] == VICTORY_MOVIE_SCREEN):
  509.         victoryMovie.hideScreen()
  510.  
  511. def leftMouseDown (argsList):
  512.     # allows overides for mods
  513.     if (CvScreenUtilsInterface.getScreenUtils().leftMouseDown(argsList)):
  514.         return
  515.     
  516.     if ( argsList[0] == WORLDBUILDER_SCREEN ):
  517.         worldBuilderScreen.leftMouseDown(argsList[1:])
  518.         return 1
  519.     return 0
  520.         
  521. def rightMouseDown (argsList):
  522.     # allows overides for mods
  523.     if (CvScreenUtilsInterface.getScreenUtils().rightMouseDown(argsList)):
  524.         return
  525.     
  526.     if ( argsList[0] == WORLDBUILDER_SCREEN ):
  527.         worldBuilderScreen.rightMouseDown(argsList)
  528.         return 1
  529.     return 0
  530.  
  531. def mouseOverPlot (argsList):
  532.     # allows overides for mods
  533.     if (CvScreenUtilsInterface.getScreenUtils().mouseOverPlot(argsList)):
  534.         return
  535.     
  536.     if (WORLDBUILDER_SCREEN == argsList[0]):
  537.         worldBuilderScreen.mouseOverPlot(argsList)
  538.  
  539. def handleInput (argsList):
  540.     ' handle input is called when a screen is up '
  541.     inputClass = PyScreenInput.ScreenInput(argsList)
  542.     
  543.     # allows overides for mods
  544.     ret = CvScreenUtilsInterface.getScreenUtils().handleInput( (inputClass.getPythonFile(),inputClass) )
  545.  
  546.     # get the screen that is active from the HandleInputMap Dictionary
  547.     screen = HandleInputMap.get( inputClass.getPythonFile() )
  548.     
  549.     # call handle input on that screen
  550.     if ( screen and not ret):
  551.         return screen.handleInput(inputClass)
  552.     return 0
  553.  
  554. def update (argsList):
  555.     # allows overides for mods
  556.     if (CvScreenUtilsInterface.getScreenUtils().update(argsList)):
  557.         return
  558.     
  559.     if (HandleInputMap.has_key(argsList[0])):
  560.         screen = HandleInputMap.get(argsList[0])
  561.         screen.update(argsList[1])
  562.  
  563. # Forced screen update
  564. def forceScreenUpdate (argsList):
  565.     # allows overides for mods
  566.     if (CvScreenUtilsInterface.getScreenUtils().forceScreenUpdate(argsList)):
  567.         return
  568.         
  569.     # Tech chooser update (forced from net message)
  570.     if ( argsList[0] == TECH_CHOOSER ):
  571.         #CvTechChooser.CvTechChooser().updateTechRecords()
  572.         techChooser.updateTechRecords()
  573.     # Main interface Screen
  574.     elif ( argsList[0] == MAIN_INTERFACE ):
  575.         #CvMainInterface.CvMainInterface().updateScreen()
  576.         mainInterface.updateScreen()
  577.     # world builder Screen
  578.     elif ( argsList[0] == WORLDBUILDER_SCREEN ):
  579.         worldBuilderScreen.updateScreen()
  580.     # world builder diplomacy Screen
  581.     elif ( argsList[0] == WORLDBUILDER_DIPLOMACY_SCREEN ):
  582.         worldBuilderDiplomacyScreen.updateScreen()
  583.     elif ( argsList[0] == DOMESTIC_ADVISOR ):
  584.         domesticAdvisor.updateScreen()
  585.  
  586. # Forced redraw
  587. def forceScreenRedraw (argsList):
  588.     # allows overides for mods
  589.     if (CvScreenUtilsInterface.getScreenUtils().forceScreenRedraw(argsList)):
  590.         return
  591.     
  592.     # Main Interface Screen
  593.     if ( argsList[0] == MAIN_INTERFACE ):
  594.         #CvMainInterface.CvMainInterface().redraw()
  595.         mainInterface.redraw()
  596.     elif ( argsList[0] == WORLDBUILDER_SCREEN ):
  597.         worldBuilderScreen.redraw()
  598.     elif ( argsList[0] == WORLDBUILDER_DIPLOMACY_SCREEN ):
  599.         worldBuilderDiplomacyScreen.redraw()
  600.  
  601. def minimapClicked (argsList):
  602.     # allows overides for mods
  603.     if (CvScreenUtilsInterface.getScreenUtils().minimapClicked(argsList)):
  604.         return
  605.     
  606.     if (MILITARY_ADVISOR == argsList[0]):
  607.         militaryAdvisor.minimapClicked()
  608.     return
  609.  
  610. ############################################################################
  611. ## Misc Functions
  612. ############################################################################
  613.  
  614. def handleBack(screens):
  615.     for iScreen in screens:
  616.         if (HandleNavigationMap.has_key(iScreen)):
  617.             print iScreen
  618.             screen = HandleNavigationMap.get( iScreen )
  619.             print screen
  620.             screen.back()
  621.     print "Mouse BACK"
  622.     return 0
  623.  
  624. def handleForward(screens):
  625.     for iScreen in screens:
  626.         if (HandleNavigationMap.has_key(iScreen)):
  627.             print iScreen
  628.             screen = HandleNavigationMap.get( iScreen )
  629.             print screen
  630.             screen.forward()
  631.     print "Mouse FWD"
  632.     return 0
  633.  
  634. def refreshMilitaryAdvisor (argsList):
  635.     if (0 == argsList[0]):
  636.         militaryAdvisor.refreshSelected(argsList[1])
  637.     elif (1 == argsList[0]):
  638.         militaryAdvisor.refreshSelectedLeader(argsList[1])
  639.     
  640. def updateMusicPath (argsList):
  641.     szPathName = argsList[0]
  642.     optionsScreen.updateMusicPath(szPathName)
  643.  
  644. def refreshOptionsScreen():
  645.     optionsScreen.refreshScreen()
  646.  
  647. def cityWarningOnClickedCallback(argsList):
  648.     iButtonId = argsList[0]
  649.     iData1 = argsList[1]
  650.     iData2 = argsList[2]
  651.     iData3 = argsList[3]
  652.     iData4 = argsList[4]
  653.     szText = argsList[5]
  654.     bOption1 = argsList[6]
  655.     bOption2 = argsList[7]
  656.     city = CyGlobalContext().getPlayer(CyGlobalContext().getGame().getActivePlayer()).getCity(iData1)
  657.     if (not city.isNone()):
  658.         if (iButtonId == 0):
  659.             if (city.isProductionProcess()):
  660.                 CyMessageControl().sendPushOrder(iData1, iData2, iData3, False, False, False)
  661.             else:
  662.                 CyMessageControl().sendPushOrder(iData1, iData2, iData3, False, True, False)
  663.         elif (iButtonId == 2):
  664.             CyInterface().selectCity(city, False)
  665.  
  666. def cityWarningOnFocusCallback(argsList):
  667.     CyInterface().playGeneralSound("AS2D_ADVISOR_SUGGEST")
  668.     CyInterface().lookAtCityOffset(argsList[0])
  669.     return 0
  670.  
  671. def featAccomplishedOnClickedCallback(argsList):
  672.     iButtonId = argsList[0]
  673.     iData1 = argsList[1]
  674.     iData2 = argsList[2]
  675.     iData3 = argsList[3]
  676.     iData4 = argsList[4]
  677.     szText = argsList[5]
  678.     bOption1 = argsList[6]
  679.     bOption2 = argsList[7]
  680.     
  681.     if (iButtonId == 1):
  682.         if (iData1 == FeatTypes.FEAT_TRADE_ROUTE):
  683.             showDomesticAdvisor()
  684.         elif ((iData1 >= FeatTypes.FEAT_UNITCOMBAT_ARCHER) and (iData1 <= FeatTypes.FEAT_UNITCOMBAT_NAVAL)):
  685.             showMilitaryAdvisor()
  686.         elif ((iData1 >= FeatTypes.FEAT_COPPER_CONNECTED) and (iData1 <= FeatTypes.FEAT_FOOD_CONNECTED)):
  687.             showForeignAdvisorScreen([0])
  688.         elif ((iData1 == FeatTypes.FEAT_NATIONAL_WONDER) or
  689.               ((iData1 >= FeatTypes.FEAT_POPULATION_HALF_MILLION) and (iData1 <= FeatTypes.FEAT_POPULATION_5_BILLION))):
  690.           # 1 is for the wonder tab...
  691.             showInfoScreen([1])
  692.  
  693. def featAccomplishedOnFocusCallback(argsList):
  694.     iData1 = argsList[0]
  695.     iData2 = argsList[1]
  696.     iData3 = argsList[2]
  697.     iData4 = argsList[3]
  698.     szText = argsList[4]
  699.     bOption1 = argsList[5]
  700.     bOption2 = argsList[6]
  701.     
  702.     CyInterface().playGeneralSound("AS2D_FEAT_ACCOMPLISHED")
  703.     if ((iData1 >= FeatTypes.FEAT_UNITCOMBAT_ARCHER) and (iData1 <= FeatTypes.FEAT_FOOD_CONNECTED)):
  704.         CyInterface().lookAtCityOffset(iData2)
  705.         
  706.     return 0
  707.  
  708.  
  709. #######################################################################################
  710. ## Handle Input Map
  711. #######################################################################################
  712. HandleInputMap = {  MAIN_INTERFACE : mainInterface,
  713.                     DOMESTIC_ADVISOR : domesticAdvisor,
  714.                     RELIGION_SCREEN : religionScreen,
  715.                     CIVICS_SCREEN : civicScreen,
  716.                     TECH_CHOOSER : techChooser,
  717.                     FOREIGN_ADVISOR : foreignAdvisor,
  718.                     FINANCE_ADVISOR : financeAdvisor,
  719.                     MILITARY_ADVISOR : militaryAdvisor,
  720.                     DAWN_OF_MAN : dawnOfMan,
  721.                     WONDER_MOVIE_SCREEN : wonderMovie,
  722.                     ERA_MOVIE_SCREEN : eraMovie,
  723.                     INTRO_MOVIE_SCREEN : introMovie,
  724.                     OPTIONS_SCREEN : optionsScreen,
  725.                     INFO_SCREEN : infoScreen,
  726.                     TECH_SPLASH : techSplashScreen,
  727.                     REPLAY_SCREEN : replayScreen,
  728.                     VICTORY_SCREEN : victoryScreen,
  729.                     TOP_CIVS : topCivs,
  730.                     HALL_OF_FAME : hallOfFameScreen,
  731.                     VICTORY_MOVIE_SCREEN : victoryMovie,
  732.                     
  733.                     PEDIA_MAIN : pediaMainScreen,
  734.                     PEDIA_TECH : pediaMainScreen,
  735.                     PEDIA_UNIT : pediaMainScreen,
  736.                     PEDIA_BUILDING : pediaMainScreen,
  737.                     PEDIA_PROMOTION : pediaMainScreen,
  738.                     PEDIA_PROJECT : pediaMainScreen,
  739.                     PEDIA_UNIT_CHART : pediaMainScreen,
  740.                     PEDIA_BONUS : pediaMainScreen,
  741.                     PEDIA_IMPROVEMENT : pediaMainScreen,
  742.                     PEDIA_TERRAIN : pediaMainScreen,
  743.                     PEDIA_FEATURE : pediaMainScreen,
  744.                     PEDIA_CIVIC : pediaMainScreen,
  745.                     PEDIA_CIVILIZATION : pediaMainScreen,
  746.                     PEDIA_LEADER : pediaMainScreen,
  747.                     PEDIA_RELIGION : pediaMainScreen,
  748.                     PEDIA_HISTORY : pediaMainScreen,
  749.                     WORLDBUILDER_SCREEN : worldBuilderScreen,
  750.                     WORLDBUILDER_DIPLOMACY_SCREEN : worldBuilderDiplomacyScreen,
  751.                     
  752.                     DEBUG_INFO_SCREEN : debugInfoScreen,
  753.                     DEMO_VICTORY_SCREEN : demoVictoryScreen,
  754.                 
  755.                 # add new screens here
  756.                 }
  757.  
  758. #######################################################################################
  759. ## Handle Navigation Map
  760. #######################################################################################
  761. HandleNavigationMap = {
  762.                     PEDIA_MAIN : pediaMainScreen,
  763.                     PEDIA_TECH : pediaMainScreen,
  764.                     PEDIA_UNIT : pediaMainScreen,
  765.                     PEDIA_BUILDING : pediaMainScreen,
  766.                     PEDIA_PROMOTION : pediaMainScreen,
  767.                     PEDIA_PROJECT : pediaMainScreen,
  768.                     PEDIA_UNIT_CHART : pediaMainScreen,
  769.                     PEDIA_BONUS : pediaMainScreen,
  770.                     PEDIA_IMPROVEMENT : pediaMainScreen,
  771.                     PEDIA_TERRAIN : pediaMainScreen,
  772.                     PEDIA_FEATURE : pediaMainScreen,
  773.                     PEDIA_CIVIC : pediaMainScreen,
  774.                     PEDIA_CIVILIZATION : pediaMainScreen,
  775.                     PEDIA_LEADER : pediaMainScreen,
  776.                     PEDIA_HISTORY : pediaMainScreen,
  777.                     PEDIA_RELIGION : pediaMainScreen
  778.                 
  779.                 # add new screens here
  780.                 }
  781.