def __init__(self, parent, avId, xPos, yPos, isBoss):
     name = 'MinimapInvasionObject-%s' % avId
     self.worldNode = parent.attachNewNode(name)
     self.worldNode.setPos(xPos, yPos, 0)
     if isBoss and not (MinimapInvasionObject.BOSS_ICON):
         gui = loader.loadModel('models/effects/effectCards')
         MinimapInvasionObject.BOSS_ICON = gui.find('**/effectJolly')
         MinimapInvasionObject.BOSS_ICON.clearTransform()
         MinimapInvasionObject.BOSS_ICON.setHpr(180, 90, 0)
         MinimapInvasionObject.BOSS_ICON.setScale(100)
         MinimapInvasionObject.BOSS_ICON.flattenStrong()
     elif not MinimapInvasionObject.ICON:
         gui = loader.loadModel('models/gui/compass_main')
         MinimapInvasionObject.ICON = gui.find('**/icon_sphere')
         MinimapInvasionObject.ICON.clearTransform()
         MinimapInvasionObject.ICON.setHpr(90, 90, 0)
         MinimapInvasionObject.ICON.setScale(200)
         MinimapInvasionObject.ICON.setColor(1, 0, 0, 1)
         MinimapInvasionObject.ICON.flattenStrong()
     
     if isBoss:
         self.minimapObj = GridMinimapObject(name, self.worldNode, MinimapInvasionObject.BOSS_ICON)
         self.minimapObj.mapGeom.setBin('gui-fixed', 1)
     else:
         self.minimapObj = GridMinimapObject(name, self.worldNode, MinimapInvasionObject.ICON)
     self.accept('transferMinimapObjects', self.transferMinimapObject)
     parent.minimap.addObject(self.minimapObj)
     self.moveIval = None
Ejemplo n.º 2
0
 def __init__(self, parent, avId, xPos, yPos, isBoss):
     name = 'MinimapInvasionObject-%s' % avId
     self.worldNode = parent.attachNewNode(name)
     self.worldNode.setPos(xPos, yPos, 0)
     if isBoss:
         if not MinimapInvasionObject.BOSS_ICON:
             gui = loader.loadModel('models/effects/effectCards')
             MinimapInvasionObject.BOSS_ICON = gui.find('**/effectJolly')
             MinimapInvasionObject.BOSS_ICON.clearTransform()
             MinimapInvasionObject.BOSS_ICON.setHpr(180, 90, 0)
             MinimapInvasionObject.BOSS_ICON.setScale(100)
             MinimapInvasionObject.BOSS_ICON.flattenStrong()
         else:
             if not MinimapInvasionObject.ICON:
                 gui = loader.loadModel('models/gui/compass_main')
                 MinimapInvasionObject.ICON = gui.find('**/icon_sphere')
                 MinimapInvasionObject.ICON.clearTransform()
                 MinimapInvasionObject.ICON.setHpr(90, 90, 0)
                 MinimapInvasionObject.ICON.setScale(200)
                 MinimapInvasionObject.ICON.setColor(1, 0, 0, 1)
                 MinimapInvasionObject.ICON.flattenStrong()
         self.minimapObj = isBoss and GridMinimapObject(
             name, self.worldNode, MinimapInvasionObject.BOSS_ICON)
         self.minimapObj.mapGeom.setBin('gui-fixed', 1)
     else:
         self.minimapObj = GridMinimapObject(name, self.worldNode,
                                             MinimapInvasionObject.ICON)
     self.accept('transferMinimapObjects', self.transferMinimapObject)
     parent.minimap.addObject(self.minimapObj)
     self.moveIval = None
     return
    def __init__(self, formation, iconParent, modelPath, cardName):
        if not MinimapFormation.ICON:
            card = loader.loadModel(modelPath)
            MinimapFormation.ICON = card.find(cardName)
            MinimapFormation.ICON.clearTransform()
            MinimapFormation.ICON.setHpr(0, -90, 0)
            MinimapFormation.ICON.setScale(250 * formation.miniMapiconScale)
            MinimapFormation.ICON.flattenStrong()
            gui = loader.loadModel('models/gui/gui_main')
            MinimapFormation.ICON_TRACKED = gui.find('**/icon_objective_grey')
            MinimapFormation.ICON_TRACKED.setScale(1.25 *
                                                   formation.miniMapiconScale)
            MinimapFormation.ICON_TRACKED.setColorScale(Vec4(1, 1, 0, 1), 1)
            MinimapFormation.ICON_TRACKED.flattenStrong()

        GridMinimapObject.__init__(self, formation.getName(), iconParent,
                                   MinimapFormation.ICON)
        self.trackedNode = NodePath(formation.getName())
        self.trackedIcon = MinimapFormation.ICON_TRACKED.copyTo(
            self.trackedNode)
        self.trackedIcon.reparentTo(self.mapGeom, sort=-1)
        self.trackedIcon.hide()
        self.isTracked = False
        self.siegeTeam = 0
        self.refreshIconColor()
class MinimapInvasionObject(DirectObject):
    ICON = None
    BOSS_ICON = None
    BOSS_SORT = 5

    def __init__(self, parent, avId, xPos, yPos, isBoss):
        name = 'MinimapInvasionObject-%s' % avId
        self.worldNode = parent.attachNewNode(name)
        self.worldNode.setPos(xPos, yPos, 0)
        if isBoss and not MinimapInvasionObject.BOSS_ICON:
            gui = loader.loadModel('models/effects/effectCards')
            MinimapInvasionObject.BOSS_ICON = gui.find('**/effectJolly')
            MinimapInvasionObject.BOSS_ICON.clearTransform()
            MinimapInvasionObject.BOSS_ICON.setHpr(180, 90, 0)
            MinimapInvasionObject.BOSS_ICON.setScale(100)
            MinimapInvasionObject.BOSS_ICON.flattenStrong()
        elif not MinimapInvasionObject.ICON:
            gui = loader.loadModel('models/gui/compass_main')
            MinimapInvasionObject.ICON = gui.find('**/icon_sphere')
            MinimapInvasionObject.ICON.clearTransform()
            MinimapInvasionObject.ICON.setHpr(90, 90, 0)
            MinimapInvasionObject.ICON.setScale(200)
            MinimapInvasionObject.ICON.setColor(1, 0, 0, 1)
            MinimapInvasionObject.ICON.flattenStrong()
        if isBoss:
            self.minimapObj = GridMinimapObject(
                name, self.worldNode, MinimapInvasionObject.BOSS_ICON)
            self.minimapObj.mapGeom.setBin('gui-fixed', 1)
        else:
            self.minimapObj = GridMinimapObject(name, self.worldNode,
                                                MinimapInvasionObject.ICON)
        self.accept('transferMinimapObjects', self.transferMinimapObject)
        parent.minimap.addObject(self.minimapObj)
        self.moveIval = None
        return

    def transferMinimapObject(self, guiMgr):
        guiMgr.transferMinimapObject(self.minimapObj)

    def destroy(self):
        self.ignore('transferMinimapObjects')
        if self.minimapObj:
            self.minimapObj.removeFromMap()
        self.minimapObj = None
        if self.worldNode:
            self.worldNode.removeNode()
        self.worldNode = None
        if self.moveIval:
            self.moveIval.finish()
        self.moveIval = None
        return

    def updatePos(self, xPos, yPos):
        if self.moveIval:
            self.moveIval.finish()
            self.moveIval = None
        self.moveIval = LerpPosInterval(self.worldNode, 1.5,
                                        Point3(xPos, yPos, 0))
        self.moveIval.start()
        return
 def __init__(self, formation, iconParent, modelPath, cardName):
     if not MinimapFormation.ICON:
         card = loader.loadModel(modelPath)
         MinimapFormation.ICON = card.find(cardName)
         MinimapFormation.ICON.clearTransform()
         MinimapFormation.ICON.setHpr(0, -90, 0)
         MinimapFormation.ICON.setScale(250 * formation.miniMapiconScale)
         MinimapFormation.ICON.flattenStrong()
         gui = loader.loadModel('models/gui/gui_main')
         MinimapFormation.ICON_TRACKED = gui.find('**/icon_objective_grey')
         MinimapFormation.ICON_TRACKED.setScale(1.25 * formation.miniMapiconScale)
         MinimapFormation.ICON_TRACKED.setColorScale(Vec4(1, 1, 0, 1), 1)
         MinimapFormation.ICON_TRACKED.flattenStrong()
     
     GridMinimapObject.__init__(self, formation.getName(), iconParent, MinimapFormation.ICON)
     self.trackedNode = NodePath(formation.getName())
     self.trackedIcon = MinimapFormation.ICON_TRACKED.copyTo(self.trackedNode)
     self.trackedIcon.reparentTo(self.mapGeom, sort = -1)
     self.trackedIcon.hide()
     self.isTracked = False
     self.siegeTeam = 0
     self.refreshIconColor()
class MinimapInvasionObject(DirectObject):
    ICON = None
    BOSS_ICON = None
    BOSS_SORT = 5
    
    def __init__(self, parent, avId, xPos, yPos, isBoss):
        name = 'MinimapInvasionObject-%s' % avId
        self.worldNode = parent.attachNewNode(name)
        self.worldNode.setPos(xPos, yPos, 0)
        if isBoss and not (MinimapInvasionObject.BOSS_ICON):
            gui = loader.loadModel('models/effects/effectCards')
            MinimapInvasionObject.BOSS_ICON = gui.find('**/effectJolly')
            MinimapInvasionObject.BOSS_ICON.clearTransform()
            MinimapInvasionObject.BOSS_ICON.setHpr(180, 90, 0)
            MinimapInvasionObject.BOSS_ICON.setScale(100)
            MinimapInvasionObject.BOSS_ICON.flattenStrong()
        elif not MinimapInvasionObject.ICON:
            gui = loader.loadModel('models/gui/compass_main')
            MinimapInvasionObject.ICON = gui.find('**/icon_sphere')
            MinimapInvasionObject.ICON.clearTransform()
            MinimapInvasionObject.ICON.setHpr(90, 90, 0)
            MinimapInvasionObject.ICON.setScale(200)
            MinimapInvasionObject.ICON.setColor(1, 0, 0, 1)
            MinimapInvasionObject.ICON.flattenStrong()
        
        if isBoss:
            self.minimapObj = GridMinimapObject(name, self.worldNode, MinimapInvasionObject.BOSS_ICON)
            self.minimapObj.mapGeom.setBin('gui-fixed', 1)
        else:
            self.minimapObj = GridMinimapObject(name, self.worldNode, MinimapInvasionObject.ICON)
        self.accept('transferMinimapObjects', self.transferMinimapObject)
        parent.minimap.addObject(self.minimapObj)
        self.moveIval = None

    
    def transferMinimapObject(self, guiMgr):
        guiMgr.transferMinimapObject(self.minimapObj)

    
    def destroy(self):
        self.ignore('transferMinimapObjects')
        if self.minimapObj:
            self.minimapObj.removeFromMap()
        
        self.minimapObj = None
        if self.worldNode:
            self.worldNode.removeNode()
        
        self.worldNode = None
        if self.moveIval:
            self.moveIval.finish()
        
        self.moveIval = None

    
    def updatePos(self, xPos, yPos):
        if self.moveIval:
            self.moveIval.finish()
            self.moveIval = None
        
        self.moveIval = LerpPosInterval(self.worldNode, 1.5, Point3(xPos, yPos, 0))
        self.moveIval.start()