Beispiel #1
0
    def __init__(self, dialog, myGameManager):
        self._myGameManager = myGameManager
        self._dialog = dialog
        data = myLangManager.getDialog(dialog)
        self._renderedDialogs = []
        self._dialogTexts = data['dialogs']
        self._dialogActions = data['actions']
        self._dialogResources = data['resources']
        self._currentSubDialog = 0
        self._currentDialog = 0
        self._lastDialog = -1
        self._maxDialog = len(self._dialogTexts) - 1
        self._background = pygame.Surface(myDisplayManager.getSize())

        self._width = 0.8 * myDisplayManager.getSize()[0]
        self._height = 0.6 * myDisplayManager.getSize()[1]

        self._padding = 20
        self._dialogBackground = pygame.Surface(
            (self._width + (2 * self._padding), self._height +
             (2 * self._padding)), pygame.SRCALPHA)
        self._dialogBackground.fill((117, 117, 117, 180))

        self._position = myDisplayManager.getCenterPosition(
            self._dialogBackground.get_size())

        self._isFading = True
        self._currentFading = 0
        self._fadeDirection = 1
        self._fadeSpeed = 15

        self._resources = {}
        self.loadResources()
        self.renderDialogs()
Beispiel #2
0
 def refresh(self):
     mapSize = self._mapObject.getPixelMapSize()
     screenW, screenH = myDisplayManager.getSize()
     self._maxOffsetX, self._maxOffsetY = mapSize[0] - screenW, mapSize[1] - screenH
     self._width = 0.5 * screenW
     self._height = 0.5 * screenH
     self._position = myDisplayManager.getCenterPosition((self._width, self._height))
     self._background = pygame.Surface((screenW, screenH), pygame.SRCALPHA)
Beispiel #3
0
 def render(self, deltaTime):
     titlePosition = (myDisplayManager.getCenterPosition(
         self._titleSurface.get_size())[0], self._margin)
     myDisplayManager.display(self._titleSurface, titlePosition)
     index = 0
     for button in self._buttons:
         button.setShaking(self._selectedButton == index)
         button.renderButton(deltaTime)
         index += 1
Beispiel #4
0
 def __init__(self, mapObject):
     self._mapObject = mapObject
     self._offsetX = 0
     self._offsetY = 0
     self._debug = False
     mapSize = self._mapObject.getPixelMapSize()
     screenW, screenH = myDisplayManager.getSize()
     self._maxOffsetX, self._maxOffsetY = mapSize[0] - screenW, mapSize[1] - screenH
     self._width = 0.5 * screenW
     self._height = 0.5 * screenH
     self._position = myDisplayManager.getCenterPosition((self._width, self._height))
     self._background = pygame.Surface((screenW, screenH), pygame.SRCALPHA)
Beispiel #5
0
 def refresh(self):
     self._width = 0.8 * myDisplayManager.getSize()[0]
     self._height = 0.6 * myDisplayManager.getSize()[1]
     self._dialogBackground = pygame.Surface(
         (self._width + (2 * self._padding), self._height +
          (2 * self._padding)), pygame.SRCALPHA)
     self._dialogBackground.fill((117, 117, 117, 180))
     self._position = myDisplayManager.getCenterPosition(
         self._dialogBackground.get_size())
     self._currentSubDialog = 0
     self._currentDialog = 0
     self._lastDialog = -1
     self.renderDialogs()
Beispiel #6
0
 def createButtons(self):
     self._buttons.clear()
     screenW, screenH = myDisplayManager.getSize()
     positionT = 0.15 * screenW
     positionL = 0
     index = 0
     for label in self._buttonsLabels:
         if index > 0:
             positionT += self._buttons[index -
                                        1].getSizes()[1] + self._margin
         self._buttons.append(
             TextButton(self.createOptionsLabel(label), 'Allegro', 32,
                        colors.BLACK, (positionL, positionT),
                        self._selectedButton == index))
         if index == 0:
             # Button all same width
             positionL = myDisplayManager.getCenterPosition(
                 self._buttons[0].getSizes())[0]
             self._buttons[0].setPosition((positionL, positionT))
         index += 1