Hallo,
ich brauche mal wieder etwas Hilfe bei einem Python-Problem.
Ich würde gerne die "Migrating GP" - Modifikation von den civfanatics in mein Projekt einbinden (ermöglicht es, GP's aus einer Stadt gegen eine Gebühr zu entlassen um sie z.B. in einer anderen Stadt anzusiedeln).
Soweit klappt auch alles, allerdings fehlt mir in der Stadtanzeige noch der entsprechende Text, der eigentlich bei der niedergelassenen GP angezeigt wird,
z.B. "Stadt Verlassen. Kosten: x Gold". Den Text kann man in der XML selber definieren.
Das wäre in der CvMainInterface.py die folgende Modifikation:
Code:
# Will handle the input for this screen...
def handleInput (self, inputClass):
## Migrating GP ##
if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName().find("FreeSpecialist") == 0:
pCity = CyInterface().getHeadSelectedCity()
CyMessageControl().sendModNetMessage(9413, inputClass.getData1(), pCity.getOwner(), pCity.getID(), -1)
## Migrating GP ##
return 0
def update(self, fDelta):
return
Normalerweise kann ich den Code problemlos in die CvMainInterface.py einbinden, jetzt benutze ich aber die BUG-Mod als "Grundlage" für mein eigenes Projekt.
Und da hat man an der entsprechenden Stelle schon reichlich modifiziert.
Jetzt weiß ich nicht, wo bzw. an welcher Stelle ich den GP-Code einbinden soll oder ob ich die vorhandenen Modifikationen der BUG-Mod abändern muss.
Da sieht es so aus:
Code:
# Will handle the input for this screen...
def handleInput (self, inputClass):
# BugUtil.debugInput(inputClass)
# BUG - PLE - start
if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON) or \
(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF) or \
(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
if (self.MainInterfaceInputMap.has_key(inputClass.getFunctionName())):
return self.MainInterfaceInputMap.get(inputClass.getFunctionName())(inputClass)
if (self.MainInterfaceInputMap.has_key(inputClass.getFunctionName() + "1")):
return self.MainInterfaceInputMap.get(inputClass.getFunctionName() + "1")(inputClass)
# BUG - PLE - end
# BUG - BUG Option Button - Start
if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED:
if inputClass.getFunctionName() == "BUGOptionsScreenWidget":
BugOptionsScreen.showOptionsScreen()
return 1
# BUG - BUG Option Button - End
# BUG - Raw Yields - start
if (inputClass.getFunctionName().startswith("RawYields")):
return self.handleRawYieldsButtons(inputClass)
# BUG - Raw Yields - end
return 0
# BUG - Great Person Bar - start
if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName().startswith("GreatPersonBar")):
# Zoom to next GP city
iCity = inputClass.getData1()
if (iCity == -1):
pCity, _ = GPUtil.findNextCity()
else:
pCity = gc.getActivePlayer().getCity(iCity)
if pCity and not pCity.isNone():
CyInterface().selectCity(pCity, False)
return 1
# BUG - Great Person Bar - end
# BUG - field of view slider - start
if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_SLIDER_NEWSTOP):
if (inputClass.getFunctionName() == self.szSliderId):
screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
self.iField_View = inputClass.getData() + 1
self.setFieldofView(screen, False)
self.setFieldofView_Text(screen)
MainOpt.setFieldOfView(self.iField_View)
# BUG - field of view slider - end
return 0
# BUG - Raw Yields - start
def handleRawYieldsButtons(self, inputClass):
iButton = inputClass.getID()
if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON):
self.PLE.displayHelpHover(RAW_YIELD_HELP[iButton])
elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF):
self.PLE.hideInfoPane()
elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
global g_bYieldView
global g_iYieldType
global g_iYieldTiles
if iButton == 0:
g_bYieldView = False
elif iButton in (1, 2, 3):
g_bYieldView = True
g_iYieldType = RawYields.YIELDS[iButton - 1]
elif iButton in (4, 5, 6):
g_bYieldView = True
g_iYieldTiles = RawYields.TILES[iButton - 4]
else:
return 0
CyInterface().setDirty(InterfaceDirtyBits.CityScreen_DIRTY_BIT, True)
return 1
return 0
# BUG - Raw Yields - end
def update(self, fDelta):
return
Kann mir da jemand weiterhelfen?