def ShowBackgroundGrid(self): self.gridBackground = Container(parent=self, align=uiconst.TOPLEFT, pos=(0, 0, 10000, 10000)) for hexColumn in xrange(20): for hexRow in xrange(10): centerX, centerY = hex_slot_center_position( hexColumn, hexRow, self.hexGridSize * self.localScale * 0.5) slotSize = SLOT_SIZE * self.localScale hexSlot = Sprite( parent=self.gridBackground, left=centerX - slotSize / 2, top=centerY - slotSize / 2, width=slotSize, height=slotSize, texturePath= 'res:/UI/Texture/classes/Achievements/hexBack.png', opacity=0.05) hexSlot.hexGridPosition = (hexColumn, hexRow)
def ShowBackgroundGrid(self): if not self.width or not self.height: return self.gridBackground.Flush() hexRow = 0 i = 0 while True: hexColumn = 0 while True: centerX, centerY = hex_slot_center_position(hexColumn, hexRow, BACKGROUND_SLOT_SIZE * self.localScale * 0.5) slotSize = BACKGROUND_SLOT_SIZE * self.localScale left = centerX - slotSize / 2 top = centerY - slotSize / 2 if left > self.width: break hexSlot = Sprite(parent=self.gridBackground, left=left, top=top, width=slotSize, height=slotSize, texturePath='res:/UI/Texture/classes/Achievements/hexBack.png', opacity=0.04, state=uiconst.UI_DISABLED) hexSlot.hexGridPosition = (hexColumn, hexRow) hexColumn += 1 hexRow += 1 if top > self.height: break