def LoadContent(self):
     self.lazyLoadThread = None
     if self.objectID is None or self.objectID not in uicore.mapObjectDataByID:
         return
     if not self.display or not self.parent:
         return
     if self.subMap is None:
         from eve.client.script.ui.shared.mapView.hexagonal.hexMap import HexMap
         self.subMap = HexMap(parent=self, parentMap=self.hexGrid, align=uiconst.CENTER, setMapSize=self.mapsize)
         self.subMap.opacity = 0
         self.subMap.LoadMapData(self.objectID)
         self.subMap.state = uiconst.UI_DISABLED
         self.state = uiconst.UI_DISABLED
         width, height = hexUtil.hex_slot_size(self.isFlatTop, self.hexSize * 1000.0)
         self.subMap.localScaling = height / float(self.subMap.sizeUnscaled[1]) / 1000.0
         self.subMap.width = self.subMap.sizeUnscaled[0] * self.globalScaling * self.subMap.localScaling
         self.subMap.height = self.subMap.sizeUnscaled[1] * self.globalScaling * self.subMap.localScaling
         vX, vY, vW, vH = self._latestViewportData
         left = (self.parent.width - self.width) / 2 + self.left
         top = (self.parent.height - self.height) / 2 + self.top
         self.subMap.TraverseHexMap((vX + left,
          vY + top,
          vW,
          vH), scaling=self.globalScaling * self.localScaling)
         uicore.animations.FadeTo(self.subMap, startVal=0.0, endVal=1.0)
     self.subMap.display = True
Exemple #2
0
 def LoadContent(self):
     self.lazyLoadThread = None
     if self.objectID is None or self.objectID not in uicore.mapObjectDataByID:
         return
     if not self.display or not self.parent:
         return
     if self.subMap is None:
         from eve.client.script.ui.shared.mapView.hexagonal.hexMap import HexMap
         self.subMap = HexMap(parent=self,
                              parentMap=self.hexGrid,
                              align=uiconst.CENTER,
                              setMapSize=self.mapsize)
         self.subMap.opacity = 0
         self.subMap.LoadMapData(self.objectID)
         self.subMap.state = uiconst.UI_DISABLED
         self.state = uiconst.UI_DISABLED
         width, height = hexUtil.hex_slot_size(self.isFlatTop,
                                               self.hexSize * 1000.0)
         self.subMap.localScaling = height / float(
             self.subMap.sizeUnscaled[1]) / 1000.0
         self.subMap.width = self.subMap.sizeUnscaled[
             0] * self.globalScaling * self.subMap.localScaling
         self.subMap.height = self.subMap.sizeUnscaled[
             1] * self.globalScaling * self.subMap.localScaling
         vX, vY, vW, vH = self._latestViewportData
         left = (self.parent.width - self.width) / 2 + self.left
         top = (self.parent.height - self.height) / 2 + self.top
         self.subMap.TraverseHexMap(
             (vX + left, vY + top, vW, vH),
             scaling=self.globalScaling * self.localScaling)
         uicore.animations.FadeTo(self.subMap, startVal=0.0, endVal=1.0)
     self.subMap.display = True
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.editMode = attributes.editMode
     self.hexGrid = attributes.hexGrid
     self.hexSize = attributes.hexSize or self.hexSize
     self.hexGridSize = attributes.hexGridSize or self.hexGridSize
     self.isFlatTop = attributes.isFlatTop or self.isFlatTop
     self.sizeUnscaled = hexUtil.hex_slot_size(self.isFlatTop, self.hexSize)
     self.width, self.height = self.sizeUnscaled
     if settings.user.ui.Get('mapDebugShowIDs', 0):
         self.positionLabel = EveLabelSmall(parent=self, align=uiconst.CENTERTOP)
     self.backgroundSprite = Sprite(bgParent=self, texturePath='res:/UI/Texture/classes/HexMap/baseHexUnderlaySmall.png', color=self.hexGrid.mainColor)
     if self.editMode:
         self.state = uiconst.UI_NORMAL
Exemple #4
0
 def TraverseHexCell(self, viewportRect, scaling):
     self.globalScaling = scaling
     self._latestViewportData = viewportRect
     w, h = self.sizeUnscaled
     self.width = w * self.globalScaling * self.localScaling
     self.height = h * self.globalScaling * self.localScaling
     if self.gridPosition:
         self.MoveToCR(*self.gridPosition)
     vX, vY, vW, vH = viewportRect
     l = vX + self.left - self.width / 2 + self.parent.width / 2
     r = l + self.width
     t = vY + self.top - self.height / 2 + self.parent.height / 2
     b = t + self.height
     if self.width < 50:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlaySmall.png'
     elif self.width < 100:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlayMedium.png'
     else:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlay.png'
     if (r >= 0 and l <= vW or r >= vW
             and l <= 0) and (b >= 0 and t <= vH or b >= vH and t <= 0):
         self.display = True
         if self.height < self.hexSize / 2:
             if self.positionLabel:
                 self.positionLabel.display = False
         elif self.positionLabel:
             self.positionLabel.display = True
         if self.height >= 96:
             if not self.editMode and not self.lazyLoadThread and not self.subMap:
                 self.lazyLoadThread = AutoTimer(
                     50 + random.randint(1, 500), self.LoadContent)
             if self.subMap:
                 width, height = hexUtil.hex_slot_size(
                     self.isFlatTop, self.hexSize * 1000.0)
                 self.subMap.localScaling = height / float(
                     self.subMap.sizeUnscaled[1]) / 1000.0
                 self.subMap.width = self.subMap.sizeUnscaled[
                     0] * self.globalScaling * self.subMap.localScaling
                 self.subMap.height = self.subMap.sizeUnscaled[
                     1] * self.globalScaling * self.subMap.localScaling
                 left = (self.parent.width - self.width) / 2 + self.left
                 top = (self.parent.height - self.height) / 2 + self.top
                 self.subMap.TraverseHexMap(
                     (vX + left, vY + top, vW, vH),
                     scaling=self.globalScaling * self.localScaling)
         else:
             self.UnloadContent()
     else:
         self.display = False
         self.UnloadContent()
Exemple #5
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.editMode = attributes.editMode
     self.hexGrid = attributes.hexGrid
     self.hexSize = attributes.hexSize or self.hexSize
     self.hexGridSize = attributes.hexGridSize or self.hexGridSize
     self.isFlatTop = attributes.isFlatTop or self.isFlatTop
     self.sizeUnscaled = hexUtil.hex_slot_size(self.isFlatTop, self.hexSize)
     self.width, self.height = self.sizeUnscaled
     if settings.user.ui.Get('mapDebugShowIDs', 0):
         self.positionLabel = EveLabelSmall(parent=self, align=uiconst.CENTERTOP)
     self.backgroundSprite = Sprite(bgParent=self, texturePath='res:/UI/Texture/classes/HexMap/baseHexUnderlaySmall.png', color=self.hexGrid.mainColor)
     if self.editMode:
         self.state = uiconst.UI_NORMAL
 def TraverseHexCell(self, viewportRect, scaling):
     self.globalScaling = scaling
     self._latestViewportData = viewportRect
     w, h = self.sizeUnscaled
     self.width = w * self.globalScaling * self.localScaling
     self.height = h * self.globalScaling * self.localScaling
     if self.gridPosition:
         self.MoveToCR(*self.gridPosition)
     vX, vY, vW, vH = viewportRect
     l = vX + self.left - self.width / 2 + self.parent.width / 2
     r = l + self.width
     t = vY + self.top - self.height / 2 + self.parent.height / 2
     b = t + self.height
     if self.width < 50:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlaySmall.png'
     elif self.width < 100:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlayMedium.png'
     else:
         self.backgroundSprite.texturePath = 'res:/UI/Texture/classes/HexMap/baseHexUnderlay.png'
     if (r >= 0 and l <= vW or r >= vW and l <= 0) and (b >= 0 and t <= vH or b >= vH and t <= 0):
         self.display = True
         if self.height < self.hexSize / 2:
             if self.positionLabel:
                 self.positionLabel.display = False
         elif self.positionLabel:
             self.positionLabel.display = True
         if self.height >= 96:
             if not self.editMode and not self.lazyLoadThread and not self.subMap:
                 self.lazyLoadThread = AutoTimer(50 + random.randint(1, 500), self.LoadContent)
             if self.subMap:
                 width, height = hexUtil.hex_slot_size(self.isFlatTop, self.hexSize * 1000.0)
                 self.subMap.localScaling = height / float(self.subMap.sizeUnscaled[1]) / 1000.0
                 self.subMap.width = self.subMap.sizeUnscaled[0] * self.globalScaling * self.subMap.localScaling
                 self.subMap.height = self.subMap.sizeUnscaled[1] * self.globalScaling * self.subMap.localScaling
                 left = (self.parent.width - self.width) / 2 + self.left
                 top = (self.parent.height - self.height) / 2 + self.top
                 self.subMap.TraverseHexMap((vX + left,
                  vY + top,
                  vW,
                  vH), scaling=self.globalScaling * self.localScaling)
         else:
             self.UnloadContent()
     else:
         self.display = False
         self.UnloadContent()