Пример #1
0
 def DrawFrame(self, alignToTop):
     if alignToTop:
         pointList = ((0, 0), ((self.width - DOCK_POINTER_LENGTH * 2) * 0.5,
                               0), (self.width * 0.5, -DOCK_POINTER_LENGTH),
                      ((self.width + DOCK_POINTER_LENGTH * 2) * 0.5,
                       0), (self.width, 0), (self.width,
                                             self.height), (0, self.height))
     else:
         pointList = ((0, 0), (self.width, 0), (self.width, self.height),
                      ((self.width + DOCK_POINTER_LENGTH * 2) * 0.5,
                       self.height), (self.width * 0.5,
                                      self.height + DOCK_POINTER_LENGTH),
                      ((self.width - DOCK_POINTER_LENGTH * 2) * 0.5,
                       self.height), (0, self.height))
     if self.lineTrace is not None:
         self.lineTrace.Close()
     self.lineTrace = uiprimitives.VectorLineTrace(
         parent=self, lineWidth=1.0, spriteEffect=trinity.TR2_SFX_FILL)
     self.lineTrace.isLoop = True
     for point in pointList:
         x, y = point
         x, y = uicore.ScaleDpi(x), uicore.ScaleDpi(y)
         color = sm.GetService('uiColor').GetUIColor(
             uiconst.COLORTYPE_UIHILIGHT)
         color = color[:3] + (0.25, )
         self.lineTrace.AddPoint((x, y), color)
 def CreateHairlines(self, moduleID, bracket, target):
     self.trace = uiprimitives.VectorLineTrace(parent=uicore.layer.shipui,
                                               lineWidth=2.5,
                                               idx=-1,
                                               name='vectorlineTrace')
     self.trace.SetRGB(0.5, 0.7, 0.6, 0.5)
     self.line = uiprimitives.VectorLineTrace(parent=uicore.layer.shipui,
                                              lineWidth=0.1,
                                              idx=-1,
                                              name='vectorline')
     linePoints = self.GetHairlinePoints(moduleID, bracket, target)
     if linePoints is None:
         return
     startPoint, midPoint, endPoint = linePoints
     self.line.AddPoint(startPoint)
     self.line.AddPoint(midPoint)
     self.line.AddPoint(endPoint)
     self.trace.AddPoint(startPoint)
     self.trace.AddPoint(midPoint)
     self.trace.AddPoint(endPoint)
     return (self.trace, self.line)
Пример #3
0
    def ResizeAndAddFrame(self):
        self.height = max(self.height, self.pointerLabel.textheight + 2 * const.defaultPadding)
        upDownLeft = UIPOINTER_WIDTH / 2 - UIPOINTER_ARROW_WIDTH / 2 + self.arrowPositionModifier
        leftRightTop = UIPOINTER_HEIGHT / 2 - UIPOINTER_ARROW_HEIGHT / 2 + self.arrowPositionModifier
        arrowSprite = self.arrowSprite
        pointUp, pointDown, pointLeft = self.pointDirections
        if pointUp or pointDown:
            arrowSprite.width = UIPOINTER_ARROW_HEIGHT
            arrowSprite.height = UIPOINTER_ARROW_WIDTH
            arrowSprite.left = upDownLeft
            if pointUp:
                arrowSprite.texturePath = 'res:/UI/Texture/classes/UIPointer/pointUp.png'
                arrowSprite.top = 0
                self.innerCont.padTop = arrowSprite.height
            elif pointDown:
                arrowSprite.texturePath = 'res:/UI/Texture/classes/UIPointer/pointDown.png'
                arrowSprite.top = self.height - arrowSprite.height
                self.innerCont.padBottom = arrowSprite.height
        else:
            arrowSprite.width = UIPOINTER_ARROW_WIDTH
            arrowSprite.height = UIPOINTER_ARROW_HEIGHT
            arrowSprite.top = leftRightTop
            if pointLeft:
                arrowSprite.texturePath = 'res:/UI/Texture/classes/UIPointer/pointLeft.png'
                arrowSprite.left = 0
                self.innerCont.padLeft = arrowSprite.width
            else:
                arrowSprite.texturePath = 'res:/UI/Texture/classes/UIPointer/pointRight.png'
                arrowSprite.left = UIPOINTER_WIDTH - arrowSprite.width
                self.innerCont.padRight = arrowSprite.width
        vectorLine = uiprimitives.VectorLineTrace(parent=self.innerCont)
        vectorLine.isLoop = True
        leftMost = 0
        rightMost = self.width - self.innerCont.padLeft - self.innerCont.padRight
        top = 0
        bottom = self.height - self.innerCont.padTop - self.innerCont.padBottom
        extraVertices = []
        if pointUp:
            extraVertices = [(1, (arrowSprite.left, top)), (2, (arrowSprite.left + arrowSprite.width / 2.0, top - arrowSprite.height)), (3, (arrowSprite.left + arrowSprite.width, top))]
        elif pointDown:
            extraVertices = [(3, (arrowSprite.left + arrowSprite.width, bottom)), (4, (arrowSprite.left + arrowSprite.width / 2.0, bottom + arrowSprite.height)), (5, (arrowSprite.left, bottom))]
        elif pointLeft:
            extraVertices = [(4, (leftMost, arrowSprite.top + arrowSprite.height)), (5, (leftMost - arrowSprite.width, arrowSprite.top + arrowSprite.height / 2.0)), (6, (leftMost, arrowSprite.top))]
        else:
            extraVertices = [(2, (rightMost, arrowSprite.top)), (3, (rightMost + arrowSprite.width, arrowSprite.top + arrowSprite.height / 2.0)), (4, (rightMost, arrowSprite.top + arrowSprite.height))]
        vectorLine.AddPoint((leftMost, top), color=TutorialColor.HINT_FRAME)
        vectorLine.AddPoint((rightMost, top), color=TutorialColor.HINT_FRAME)
        vectorLine.AddPoint((rightMost, bottom), color=TutorialColor.HINT_FRAME)
        vectorLine.AddPoint((leftMost, bottom), color=TutorialColor.HINT_FRAME)
        for idx, pos in extraVertices:
            vectorLine.AddPoint(pos, idx=idx, color=TutorialColor.HINT_FRAME)

        uicore.animations.SpSwoopBlink(self.blinkSprite, rotation=math.pi - 0.5, duration=3.0, loops=TutorialConstants.NUM_BLINKS)