Exemplo n.º 1
0
 def __init__(self, shipInfo, *args, **kwargs):
     name = shipInfo[1]
     Item.__init__(self, name, *args, **kwargs)
     self.setTag('shipName', name)
     self.shipModel = ShipMeter(shipInfo[0], shipInfo[2], shipInfo[3])
     self.shipModel.reparentTo(self)
     self.shipModel.setScale(0.13)
     self.shipModel.setTwoSided(1)
     formattedName = 'smallCapsslant' + name.replace(' ', '\n') + ''
     self.text = Text(name + '-text',
                      NodePath(),
                      0.0,
                      formattedName,
                      0,
                      scale=0.017000000000000001)
     self.text.reparentTo(self)
     if self.shipModel.getBounds().isEmpty():
         r = 10
     else:
         r = self.shipModel.getBounds().getRadius()
     self.text.setPos(0, -r * 0.75, 0.001)
     self.setBin('fixed', 300)
     self.text.setBin('fixed', 301)
     self.shipNode = NodePath('Ship')
     self.shipNode.reparentTo(self)
     self.shipNode.setBillboardPointEye()
     self.shipNode.setPos(0, -0.0050000000000000001, 0)
     self.shipNode.setHpr(0, 30, 0)
     self.shipModel.reparentTo(self.shipNode)
Exemplo n.º 2
0
    def createGui(self):
        self.shipDisplay = self.attachNewNode('shipDisplay')
        self.shipDisplay.setPos(self['shipPos'])
        self.shipDisplay.setHpr(self['shipHpr'])
        self.shipDisplay.setScale(self['shipScale'])
        self.shipDisplay.setColorScale(self['shipColorScale'])
        self.shipMeter = ShipMeter(self['shipId'],
                                   self['shipClass'],
                                   self['mastInfo'],
                                   siegeTeam=self['siegeTeam'])
        if not ShipFrame.logos:
            ShipFrame.logos = loader.loadModel('models/textureCards/sailLogo')

        if ShipFrame.logos:
            image = None
            if self['siegeTeam'] == PVPGlobals.FrenchTeam:
                image = ShipFrame.logos.find('**/logo_french_flag')
            elif self['siegeTeam'] == PVPGlobals.SpanishTeam:
                image = ShipFrame.logos.find('**/logo_spanish_flag')

            if image:
                self.flag = DirectLabel(parent=self,
                                        image=image,
                                        image_scale=0.080000000000000002,
                                        image_pos=(0.089999999999999997, 0,
                                                   0.089999999999999997))

        self.shipMeter.reparentTo(self.shipDisplay)
        self.shipMeter.setDepthTest(1)
        self.shipMeter.setDepthWrite(1)
Exemplo n.º 3
0
class ShipFrame(DirectFrame):
    __module__ = __name__
    logos = None

    def __init__(self, parent, **kw):
        optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (0.0, 1, 0.0, 0.5), None), ('relief', DGG.FLAT, None), ('shipId', 0, None), ('shipName', '', None), ('shipClass', 0, None), ('shipPos', Point3(0, 0, 0), None), ('shipHpr', VBase3(-90, 0, 0), None), ('shipScale', VBase3(1), None), ('shipColorScale', VBase4(1), self.setShipColorScale), ('siegeTeam', 0, None), ('mastInfo', [], None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.__init__(self, parent, **kw)
        self.initialiseoptions(ShipFrame)
        self.shipDisplay = None
        self.shipMeter = None
        self.createGui()
        return

    def destroy(self):
        self.shipDisplay = None
        if self.shipMeter:
            self.shipMeter.destroy()
            self.shipMeter = None
        DirectFrame.destroy(self)
        return

    def createGui(self):
        self.shipDisplay = self.attachNewNode('shipDisplay')
        self.shipDisplay.setPos(self['shipPos'])
        self.shipDisplay.setHpr(self['shipHpr'])
        self.shipDisplay.setScale(self['shipScale'])
        self.shipDisplay.setColorScale(self['shipColorScale'])
        self.shipMeter = ShipMeter(self['shipId'], self['shipClass'], self['mastInfo'], siegeTeam=self['siegeTeam'])
        if not ShipFrame.logos:
            ShipFrame.logos = loader.loadModel('models/textureCards/sailLogo')
        if ShipFrame.logos:
            image = None
            if self['siegeTeam'] == PVPGlobals.FrenchTeam:
                image = ShipFrame.logos.find('**/logo_french_flag')
            else:
                if self['siegeTeam'] == PVPGlobals.SpanishTeam:
                    image = ShipFrame.logos.find('**/logo_spanish_flag')
            if image:
                self.flag = DirectLabel(parent=self, image=image, image_scale=0.08, image_pos=(0.09,
                                                                                               0,
                                                                                               0.09))
        self.shipMeter.reparentTo(self.shipDisplay)
        self.shipMeter.setDepthTest(1)
        self.shipMeter.setDepthWrite(1)
        return

    def setCustomization(self, customHull, customRigging, customPattern, customLogo):
        self.shipMeter.setCustomization(customHull, customRigging, customPattern, customLogo)

    def setShipColorScale(self):
        if self.shipDisplay:
            self.shipDisplay.setColorScale(self['shipColorScale'])
class ShipFrame(DirectFrame):
    logos = None

    def __init__(self, parent, **kw):
        optiondefs = (('state', DGG.DISABLED, None), ('frameSize', (0.0, 1, 0.0, 0.5), None), ('relief', DGG.FLAT, None), ('shipId', 0, None), ('shipName', '', None), ('shipClass', 0, None), ('shipPos', Point3(0, 0, 0), None), ('shipHpr', VBase3(-90, 0, 0), None), ('shipScale', VBase3(1), None), ('shipColorScale', VBase4(1), self.setShipColorScale), ('siegeTeam', 0, None), ('mastInfo', [], None))
        self.defineoptions(kw, optiondefs)
        DirectFrame.__init__(self, parent)
        self.initialiseoptions(ShipFrame)
        self.shipDisplay = None
        self.shipMeter = None
        self.createGui()


    def destroy(self):
        self.shipDisplay = None
        if self.shipMeter:
            self.shipMeter.destroy()
            self.shipMeter = None

        DirectFrame.destroy(self)


    def createGui(self):
        self.shipDisplay = self.attachNewNode('shipDisplay')
        self.shipDisplay.setPos(self['shipPos'])
        self.shipDisplay.setHpr(self['shipHpr'])
        self.shipDisplay.setScale(self['shipScale'])
        self.shipDisplay.setColorScale(self['shipColorScale'])
        self.shipMeter = ShipMeter(self['shipId'], self['shipClass'], self['mastInfo'], siegeTeam = self['siegeTeam'])
        if not ShipFrame.logos:
            ShipFrame.logos = loader.loadModel('models/textureCards/sailLogo')

        if ShipFrame.logos:
            image = None
            if self['siegeTeam'] == PVPGlobals.FrenchTeam:
                image = ShipFrame.logos.find('**/logo_french_flag')
            elif self['siegeTeam'] == PVPGlobals.SpanishTeam:
                image = ShipFrame.logos.find('**/logo_spanish_flag')

            if image:
                self.flag = DirectLabel(parent = self, image = image, image_scale = 0.080000000000000002, image_pos = (0.089999999999999997, 0, 0.089999999999999997))


        self.shipMeter.reparentTo(self.shipDisplay)
        self.shipMeter.setDepthTest(1)
        self.shipMeter.setDepthWrite(1)


    def setShipColorScale(self):
        if self.shipDisplay:
            self.shipDisplay.setColorScale(self['shipColorScale'])
    def createGui(self):
        self.shipDisplay = self.attachNewNode('shipDisplay')
        self.shipDisplay.setPos(self['shipPos'])
        self.shipDisplay.setHpr(self['shipHpr'])
        self.shipDisplay.setScale(self['shipScale'])
        self.shipDisplay.setColorScale(self['shipColorScale'])
        self.shipMeter = ShipMeter(self['shipId'], self['shipClass'], self['mastInfo'], siegeTeam = self['siegeTeam'])
        if not ShipFrame.logos:
            ShipFrame.logos = loader.loadModel('models/textureCards/sailLogo')

        if ShipFrame.logos:
            image = None
            if self['siegeTeam'] == PVPGlobals.FrenchTeam:
                image = ShipFrame.logos.find('**/logo_french_flag')
            elif self['siegeTeam'] == PVPGlobals.SpanishTeam:
                image = ShipFrame.logos.find('**/logo_spanish_flag')

            if image:
                self.flag = DirectLabel(parent = self, image = image, image_scale = 0.080000000000000002, image_pos = (0.089999999999999997, 0, 0.089999999999999997))


        self.shipMeter.reparentTo(self.shipDisplay)
        self.shipMeter.setDepthTest(1)
        self.shipMeter.setDepthWrite(1)
Exemplo n.º 6
0
 def __init__(self, shipInfo, *args, **kwargs):
     name = shipInfo[1]
     Item.__init__(self, name, *args, **kwargs)
     self.setTag('shipName', name)
     self.shipModel = ShipMeter(shipInfo[0], shipInfo[2], shipInfo[3])
     self.shipModel.reparentTo(self)
     self.shipModel.setScale(0.13)
     self.shipModel.setTwoSided(1)
     formattedName = 'smallCapsslant' + name.replace(' ', '\n') + ''
     self.text = Text(name + '-text', NodePath(), 0.0, formattedName, 0, scale = 0.017000000000000001)
     self.text.reparentTo(self)
     if self.shipModel.getBounds().isEmpty():
         r = 10
     else:
         r = self.shipModel.getBounds().getRadius()
     self.text.setPos(0, -r * 0.75, 0.001)
     self.setBin('fixed', 300)
     self.text.setBin('fixed', 301)
     self.shipNode = NodePath('Ship')
     self.shipNode.reparentTo(self)
     self.shipNode.setBillboardPointEye()
     self.shipNode.setPos(0, -0.0050000000000000001, 0)
     self.shipNode.setHpr(0, 30, 0)
     self.shipModel.reparentTo(self.shipNode)
Exemplo n.º 7
0
class Ship(Item):

    def __init__(self, shipInfo, *args, **kwargs):
        name = shipInfo[1]
        Item.__init__(self, name, *args, **kwargs)
        self.setTag('shipName', name)
        self.shipModel = ShipMeter(shipInfo[0], shipInfo[2], shipInfo[3])
        self.shipModel.reparentTo(self)
        self.shipModel.setScale(0.13)
        self.shipModel.setTwoSided(1)
        formattedName = '\x01smallCaps\x01\x01slant\x01' + name.replace(' ', '\n') + '\x02\x02'
        self.text = Text(name + '-text', NodePath(), 0.0, formattedName, 0, scale=0.017)
        self.text.reparentTo(self)
        if self.shipModel.getBounds().isEmpty():
            r = 10
        else:
            r = self.shipModel.getBounds().getRadius()
        self.text.setPos(0, -r * 0.75, 0.001)
        self.setBin('fixed', 300)
        self.text.setBin('fixed', 301)
        self.shipNode = NodePath('Ship')
        self.shipNode.reparentTo(self)
        self.shipNode.setBillboardPointEye()
        self.shipNode.setPos(0, -0.005, 0)
        self.shipNode.setHpr(0, 30, 0)
        self.shipModel.reparentTo(self.shipNode)

    def setRotation(self, worldNorth, rotation):
        self.shipModel.setH(rotation)

    def updateZoom(self, zoom):
        self.text.setScale(1 - zoom / 1.5)

    def destroy(self):
        if self.shipModel:
            self.shipModel.destroy()
            self.shipModel = None
        return