Ejemplo n.º 1
0
 def drawBox(self, x, y, width, height, color='guiblue1', lineWidth=0.15, glow=1):
     """Draw a box"""
     #LEFT
     myLine = line.Line(self.guiMediaPath,(x,y),(x,y+height), 'square_grey', lineWidth, glow)
     myLine.sim.setColor(globals.colors[color])
     self.gui.append(myLine)
     #TOP
     myLine = line.Line(self.guiMediaPath,(x,y+height),(x+width,y+height), 'square_grey', lineWidth, glow)
     myLine.sim.setColor(globals.colors[color])
     self.gui.append(myLine)
     #RIGHT
     myLine = line.Line(self.guiMediaPath,(x+width,y+height),(x+width,y), 'square_grey', lineWidth, glow)
     myLine.sim.setColor(globals.colors[color])
     self.gui.append(myLine)
     #BOTTOM
     myLine = line.Line(self.guiMediaPath,(x+width,y),(x,y), 'square_grey', lineWidth, glow)
     myLine.sim.setColor(globals.colors[color])
     self.gui.append(myLine)
Ejemplo n.º 2
0
 def updateTargetLine(self):
     if self.myShip.currentTarget == None:
         self.removeTargetLine()
     else:
         if self.myTargetLine == None:
             self.myTargetLine = line.Line(self.path, (self.x, self.z), 
                                          (self.myShip.currentTarget.shipsim.x, self.myShip.currentTarget.shipsim.z),
                                           texture='square_grey', width=0.05, glow=0)
             self.myTargetLine.setColor(globals.colors[self.color1])
         else:
             self.myTargetLine.updateMyPosition(self.x, self.z, self.myShip.currentTarget.shipsim.x, self.myShip.currentTarget.shipsim.z)
Ejemplo n.º 3
0
 def plotVolumeData(self):
     """Plot the Volume Data"""
     for res in ['AL', 'EC', 'IA']:
         round = 0
         x1 = 0.0
         y1 = 0.0
         for vol in self.volume[res]:
             y2 = self.getY(vol / 1000.0, self.maxVolume, self.yVolMin,
                            self.yVolTot)
             x2 = self.getX(round, len(self.xAxis)) + self.xVolOffset
             if (x1, y1) != (0, 0):
                 myLine = line.Line(self.guiMediaPath, (x1, y1), (x2, y2),
                                    texture='square_grey')
                 myLine.setColor(
                     globals.colors[globals.resourceColors[res]])
                 self.gui.append(myLine)
             x1 = x2
             y1 = y2
             round += 1
Ejemplo n.º 4
0
 def plotPriceData(self):
     """Plot the Price Data"""
     for res in ['AL', 'EC', 'IA']:
         round = 0
         x1 = 0.0
         y1 = 0.0
         for price in self.prices[res]:
             y2 = self.getY(price, self.maxPrice, self.yPriceMin,
                            self.yPriceTot)
             x2 = self.getX(round, len(self.xAxis)) + self.xPriceOffset
             if (x1, y1) != (0, 0):
                 myLine = line.Line(self.guiMediaPath, (x1, y1), (x2, y2),
                                    texture='square_grey')
                 myLine.setColor(
                     globals.colors[globals.resourceColors[res]])
                 self.gui.append(myLine)
             x1 = x2
             y1 = y2
             round += 1
Ejemplo n.º 5
0
    def createLaserLine(self, rollGot, rollNeeded, lineWidth, sound, fade):
        """Fire a laser (direct or AMS), move its position based on if its hit chance"""
        if globals.serverMode == 0:
            from anw.gui import line
            if rollGot < rollNeeded:
                offSet = 0
                hit = 1
            else:
                offSet = self.currentTarget.radius * 2
                hit = 0

            (x, y) = self.getMyXY()
            xTar = self.currentTarget.posX + offSet
            yTar = self.currentTarget.posY + offSet
            myLine = line.Line(self.myShip.myGalaxy.guiMediaPath, (x, y),
                               (xTar, yTar),
                               texture='square_grey',
                               width=lineWidth,
                               hit=hit)
            myLine.setColor(globals.colors[self.myShip.myGalaxy.empires[
                self.myShip.empireID].color1])
            myLine.startFade(fade, self, self.currentTarget)
            self.myShip.myGalaxy.playSound(sound)