Esempio n. 1
0
    def __init__(self):
        self.lifeBar1 = DirectWaitBar(text="Player1",
                                      text_fg=(1, 1, 1, 1),
                                      text_pos=(-1.2, -0.18, 0),
                                      text_align=TextNode.ALeft,
                                      value=100,
                                      barColor=(0, 1, 0.25, 1),
                                      barRelief=DGG.RAISED,
                                      barBorderWidth=(0.03, 0.03),
                                      borderWidth=(0.01, 0.01),
                                      relief=DGG.RIDGE,
                                      frameColor=(0.8, 0.05, 0.10, 1),
                                      frameSize=(-1.2, 0, 0, -0.1),
                                      pos=(-0.2, 0, base.a2dTop - 0.15))
        self.lifeBar1.setTransparency(1)

        self.lifeBar2 = DirectWaitBar(text="Player2",
                                      text_fg=(1, 1, 1, 1),
                                      text_pos=(1.2, -0.18, 0),
                                      text_align=TextNode.ARight,
                                      value=100,
                                      barColor=(0, 1, 0.25, 1),
                                      barRelief=DGG.RAISED,
                                      barBorderWidth=(0.03, 0.03),
                                      borderWidth=(0.01, 0.01),
                                      relief=DGG.RIDGE,
                                      frameColor=(0.8, 0.05, 0.10, 1),
                                      frameSize=(0, 1.2, 0, -0.1),
                                      pos=(0.2, 0, base.a2dTop - 0.15))
        self.lifeBar2.setTransparency(1)

        self.accept("hud_setLifeBarValue", self.setLifeBarValue)
        self.hide()
Esempio n. 2
0
    def start(self):
        self.fullyChargedSound = base.loadSfx('phase_4/audio/sfx/ring_get.ogg')
        self.rechargeSound = base.loadSfx(
            'phase_4/audio/sfx/MG_sfx_travel_game_blue_arrow.ogg')
        self.batteryFrame = DirectFrame(parent=base.a2dBottomRight,
                                        pos=(-0.2, 0, 0.1),
                                        scale=(0.8, 0, 1))
        self.batteryBg = OnscreenImage(
            image='phase_4/maps/battery_charge_frame.png',
            parent=self.batteryFrame)
        self.batteryBg.setTransparency(1)
        self.batteryBg.setX(0.03)
        self.batteryBg.setScale(0.17, 0, 0.05)
        self.batteryBg.setColorScale(0, 0, 0, 1)
        self.batteryBar = DirectWaitBar(value=0,
                                        range=5,
                                        barColor=(1, 1, 1, 1),
                                        relief=None,
                                        scale=(0.12, 0.0, 0.3),
                                        parent=self.batteryFrame)

        self.viewfinder = Viewfinder(1.0)

        base.localAvatar.walkControls.setWalkSpeed(CIGlobals.ToonForwardSpeed,
                                                   0.0,
                                                   CIGlobals.ToonReverseSpeed,
                                                   CIGlobals.ToonRotateSpeed)
        FirstPerson.start(self)
Esempio n. 3
0
 def __init__(self):
     NodePath.__init__(self, 'wave-gui')
     self.reparentTo(base.a2dBottomCenter)
     self.setBin('fixed', 60)
     self.setTransparency(True, 1)
     self.setAlphaScale(0.75, 1)
     self.setZ(0.1)
     self.frame = DirectFrame(image='materials/ui/wave_ui_base.png',
                              parent=self,
                              relief=None,
                              image_scale=(.373, 1, .094))
     self.waveText = OnscreenText(text="Wave 4",
                                  pos=(0, 0.0175, 0),
                                  scale=0.06,
                                  parent=self.frame)
     self.progress = DirectWaitBar(scale=(.324, 1, .3),
                                   relief=None,
                                   barColor=(1, 0.75, 0, 1),
                                   parent=self.frame,
                                   pos=(0, 0, -0.0293))
     self.progress.setBin('fixed', 61)
     self.progress['range'] = 50
     self.progress['value'] = 35
     self.progressText = OnscreenText(text=str(self.progress['value']) +
                                      " / " + str(self.progress['range']),
                                      scale=0.04,
                                      parent=self.frame,
                                      pos=(0, -0.04, 0))
     self.progressText.setBin('fixed', 62)
     self.hide()
Esempio n. 4
0
 def makeGui(self):
     self.destroyGui()
     self.guiFrame = DirectFrame(parent = base.a2dBottomRight, pos=(-0.55, 0, 0.15))
     self.guiBg = OnscreenImage(image = "phase_4/maps/turret_gui_bg.png", scale = (0.15, 0, 0.075), parent = self.guiFrame)
     self.guiBg.setTransparency(True)
     self.guiLabel = DirectLabel(text = "Turret", text_fg = (1, 0, 0, 1), relief = None, text_scale = 0.05, text_font = loader.loadFont("phase_3/models/fonts/ImpressBT.ttf"), pos = (0, 0, 0.025), parent = self.guiFrame)
     self.guiBar = DirectWaitBar(range = self.myTurret.getMaxHealth(), value = self.myTurret.getHealth(), scale = 0.125, parent = self.guiFrame, pos = (0, 0, -0.01))
Esempio n. 5
0
 def _initPiePowerMeter(self):
     h = PartyGlobals.CogActivityPowerMeterHeight / 2.0
     w = PartyGlobals.CogActivityPowerMeterWidth / 2.0
 
     self._piePowerMeter = DirectWaitBar(
         frameSize = (-h, h, -w, w),
         relief = DGG.GROOVE,
         frameColor = (0.9, 0.9, 0.9, 1.0),
         borderWidth = (0.01, 0.01),
         barColor = PartyGlobals.CogActivityColors[0],
         pos = PartyGlobals.CogActivityPowerMeterPos,
         hpr = (0.0, 0.0, -90.0),
         )
     
     self._piePowerMeter.setBin("fixed", 0)
     
     self._piePowerTitle = OnscreenText(
         text=TTLocalizer.PartyCogGuiPowerLabel,
         pos=PartyGlobals.CogActivityPowerMeterTextPos,
         scale=0.05,
         fg=(1.0, 1.0, 1.0, 1.0),
         align=TextNode.ACenter,
         )
         
     self._piePowerTitle.setBin("fixed", 0)
     
     self._piePowerMeter.hide()
     self._piePowerTitle.hide()  
Esempio n. 6
0
    def __init__(self):
        # a fill panel so the player doesn't see how everything
        # gets loaded in the background
        self.frameMain = DirectFrame(
            # size of the frame
            frameSize = (base.a2dLeft, base.a2dRight,
                         base.a2dTop, base.a2dBottom),
			image = "Logo.png",
			image_scale = (0.612/2.0, 1, 0.495/2.0),
			image_pos = (0, 0, 0.7),
            # tramsparent bg color
            frameColor = (0, 0, 0, 1))
        self.frameMain.setTransparency(1)

        # the text Loading... on top
        self.lblLoading = DirectLabel(
            scale = 0.25,
            pos = (0, 0, 0),
            frameColor = (0, 0, 0, 0),
            text = _("Loading..."),
            text_align = TextNode.ACenter,
            text_fg = (1,1,1,1))
        self.lblLoading.reparentTo(self.frameMain)

        # the waitbar on the bottom
        self.wbLoading = DirectWaitBar(
            text = "0%",
            text_fg = (1,1,1,1),
            value = 0,
            pos = (0, 0, -0.5),
            barColor = (0.5, 0.4, 0.1, 1),
            frameColor = (0.1, 0.1, 0.1, 1))
        self.wbLoading.reparentTo(self.frameMain)
 def enterFrozen(self):
     self.loadIceCube()
     base.playSfx(self.iceFormSfx)
     base.cr.playGame.getPlace().fsm.request('stop', [0])
     base.localAvatar.stop()
     base.playSfx(choice(self.frozenSfxArray))
     self.iccsIval = LerpColorScaleInterval(
         self.iceCube,
         duration=0.5,
         colorScale=VBase4(0.76, 0.76, 1.0, 1.0),
         startColorScale=self.iceCube.getColorScale(),
         blendType='easeInOut')
     self.iccsIval.start()
     props = WindowProperties()
     props.setCursorHidden(True)
     base.win.requestProperties(props)
     self.frame = DirectFrame(pos=(0, 0, 0.7))
     self.powerBar = DirectWaitBar(frameColor=(1, 1, 1, 1),
                                   range=100,
                                   value=0,
                                   scale=(0.4, 0.5, 0.25),
                                   parent=self.frame,
                                   barColor=(0.55, 0.7, 1.0, 1.0))
     self.label = OnscreenText(text="SHAKE MOUSE",
                               shadow=(0, 0, 0, 1),
                               fg=(0.55, 0.7, 1.0, 1.0),
                               pos=(0, -0.1, 0),
                               parent=self.frame)
     taskMgr.add(self.__watchMouseMovement, 'BRWater-watchMouseMovement')
     taskMgr.add(self.__lowerPowerBar, 'BRWater-lowerPowerBar')
     mw = base.mouseWatcherNode
     if mw.hasMouse():
         self.lastMouseX = mw.getMouseX()
Esempio n. 8
0
File: hud.py Progetto: iPazu/Slimy
    def __init__(self):
        self.lifeBar = DirectWaitBar(value=100,
                                     barColor=(0, 1, 0.20, 1),
                                     barRelief=DGG.RAISED,
                                     relief=DGG.RIDGE,
                                     frameColor=(0.8, 0.05, 0.10, 1),
                                     frameSize=(-1.2, 0, 0, -0.1),
                                     pos=(-0.2, 0, base.a2dTop))
        self.lifeBar.setTransparency(1)

        self.font = loader.loadFont(
            str(MAINDIR) + '/assets/fonts/allerdisplay.ttf')

        self.score_text = OnscreenText(text="Score:",
                                       pos=(-1.6, 0.93),
                                       scale=0.05,
                                       fg=(1, 1, 1, 1),
                                       align=TextNode.ACenter,
                                       font=self.font,
                                       mayChange=False)
        self.score = OnscreenText(text="0",
                                  pos=(-1.6, 0.83),
                                  scale=0.07,
                                  fg=(1, 1, 1, 1),
                                  align=TextNode.ACenter,
                                  font=self.font,
                                  mayChange=True)

        self.accept("hud_setLifeBarValue", self.setLifeBarValue)
        self.hide()
 def initFishStaminaBar(self):
     self.legendaryGui = loader.loadModel('models/minigames/pir_m_gam_fsh_legendaryGui')
     self.iconBaseFrame = DirectFrame(relief=None, state=DGG.DISABLED, pos=(0, 0,
                                                                            0), sortOrder=30, image=self.legendaryGui.find('**/pir_t_gui_fsh_fishPortraitFrame'), image_scale=0.18, image_pos=(0,
                                                                                                                                                                                               0,
                                                                                                                                                                                               0))
     self.iconBaseFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.fishUINodePath = NodePath(self.iconBaseFrame)
     self.fishUINodePath.setPos(-0.3, 0.0, 0.83)
     self.fishUINodePath.reparentTo(hidden)
     self.iconCard = loader.loadModel('models/gui/treasure_gui')
     self.iconBaseFrame.iconImage = OnscreenImage(parent=self.iconBaseFrame, image=self.iconCard.find('**/%s*' % CollectionMap.Assets[self.myData['id']]), scale=0.35, hpr=(0,
                                                                                                                                                                            0,
                                                                                                                                                                            0), pos=(0.0,
                                                                                                                                                                                     0,
                                                                                                                                                                                     0.0))
     self.fishNameLabel = TextNode('fishNameLabel')
     name = self.getName().split('_')
     self.fishNameLabel.setText(name[0])
     self.fishNameLabel.setTextColor(1.0, 1.0, 1.0, 1.0)
     self.fishNameLabelNodePath = NodePath(self.fishNameLabel)
     self.fishNameLabelNodePath.setPos(0.3, 0, 0.04)
     self.fishNameLabelNodePath.setScale(0.045)
     self.fishNameLabelNodePath.reparentTo(self.iconBaseFrame)
     self.fishStaminaBar = DirectWaitBar(parent=self.iconBaseFrame, relief=DGG.FLAT, state=DGG.DISABLED, range=100, value=0, sortOrder=20, frameColor=(0,
                                                                                                                                                       0,
                                                                                                                                                       0,
                                                                                                                                                       1.0), pos=(0.07, 0.0, -0.015), hpr=(0,
                                                                                                                                                                                           0,
                                                                                                                                                                                           0), frameSize=(0,
                                                                                                                                                                                                          0.72,
                                                                                                                                                                                                          0,
                                                                                                                                                                                                          0.028))
     self.fishStaminaBar['value'] = self.staminaValue
     self.fishStaminaBar['barColor'] = FishingGlobals.fishingStaminaBarColor[int(self.staminaValue / 100.0 * (len(FishingGlobals.fishingStaminaBarColor) - 1))]
     self.fishStaminaValueLabel = TextNode('fishStaminaValueLabel')
     self.fishStaminaValueLabel.setText(str(self.staminaValue) + '//' + str(self.staminaValue))
     self.fishStaminaValueLabel.setTextColor(1.0, 1.0, 1.0, 1.0)
     self.fishStaminaValueLabelNodePath = NodePath(self.fishStaminaValueLabel)
     self.fishStaminaValueLabelNodePath.setPos(0.66, 0, -0.06)
     self.fishStaminaValueLabelNodePath.setScale(0.045)
     self.fishStaminaValueLabelNodePath.reparentTo(self.iconBaseFrame)
     self.fishStaminaBarFrame = DirectLabel(parent=self.iconBaseFrame, relief=None, state=DGG.DISABLED, frameColor=(1,
                                                                                                                    1,
                                                                                                                    1,
                                                                                                                    0.1), pos=(0.44,
                                                                                                                               0.0,
                                                                                                                               0.0), hpr=(0,
                                                                                                                                          0,
                                                                                                                                          0), sortOrder=25, image=self.legendaryGui.find('**/pir_t_gui_fsh_staminaBarForeground'), image_scale=(1.0,
                                                                                                                                                                                                                                                0.0,
                                                                                                                                                                                                                                                0.05), image_pos=(0.0,
                                                                                                                                                                                                                                                                  0.0,
                                                                                                                                                                                                                                                                  0.0), image_hpr=(0.0,
                                                                                                                                                                                                                                                                                   0.0,
                                                                                                                                                                                                                                                                                   0.0))
     self.fishStaminaBarFrame.setTransparency(TransparencyAttrib.MAlpha)
     self.fishStaminaBarFrame.setDepthTest(True)
     self.fishStaminaBarFrame.setDepthWrite(True)
     return
    def __init__(self, description, needed, icon):
        NodePath.__init__(self, 'objective-%s' % id(self))

        self.needed = needed
        self.visible = False

        self.fadeInTrack = None
        self.fadeOutTrack = None

        gui = loader.loadModel(
            'phase_5/models/cogdominium/tt_m_gui_csa_flyThru')
        self.background = gui.find('**/*background').copyTo(self)
        self.background.setScale(2.5)
        gui.removeNode()

        self.icon = icon.copyTo(self.background)
        self.icon.setScale(0.08)
        self.icon.setPos(-0.167, 0, -0.002)

        text = TextNode('challenge')
        text.setText('Challenge')
        text.setFont(ToontownGlobals.getSignFont())
        text.setTextColor(0.95, 0.95, 0, 1)
        self.objText = self.background.attachNewNode(text)
        self.objText.setScale(0.03)
        self.objText.setPos(-0.04, 0.0, 0.02)

        text = TextNode('description')
        text.setText(description)
        text.setFont(ToontownGlobals.getSignFont())
        text.setTextColor(0.95, 0.95, 0, 1)
        text.setAlign(TextNode.ACenter)
        self.objText = self.background.attachNewNode(text)
        self.objText.setScale(0.015)
        self.objText.setPos(0.048, 0.0, -0.009)

        self.progressBar = DirectWaitBar(guiId='ChallengeProgressBar',
                                         parent=self.background,
                                         frameSize=(-0.11, 0.11, -0.007,
                                                    0.007),
                                         pos=(0.048, 0, -0.0338),
                                         text='')
        self.progressBar['range'] = needed

        self.progressText = DirectLabel(
            guiId='ChallengeProgressText',
            parent=self.progressBar,
            relief=None,
            pos=(0, 0, -0.0048),
            text='',
            textMayChange=1,
            text_scale=0.014,
            text_fg=(0.03, 0.83, 0, 1),
            text_align=TextNode.ACenter,
            text_font=ToontownGlobals.getSignFont())

        self.updateProgress(0)

        self.reparentTo(base.a2dBottomLeft)
        self.stash()
Esempio n. 11
0
 def _draw (self, parent, numPos):
     # Draw the main frame:
     sizeY = parent.getHeight() / (MAX_PLAYERS-1)
     sizeX = parent.getWidth()
     cX = 0 # Relative to parent
     cY = -sizeY * numPos
     self._root = DirectFrame(parent=parent, pos=(cX, 0, cY),
                              frameSize=(-sizeX/2, sizeX/2, -sizeY, 0))
     # Draw player name:
     nameSizeY = sizeY * PARTY_LIST_NAME_PARTITION
     nameColor = (0.5,0.5,0.5,0.25)
     self._nameText = DirectLabel(parent=self._root, pos=(0, 0, 0),
                        frameSize=(-sizeX/2, sizeX/2, -nameSizeY, 0),
                        frameColor=nameColor,
                        text="",
                        text_font=self._font,
                        text_scale=PARTY_NAME_FONT_SIZE,
                        text_pos=PARTY_NAME_FONT_OFFSET,
                        text_align=TextNode.ACenter,
                        suppressMouse=0)
     # Draw Icon:
     iconY = -nameSizeY
     iconSizeY = sizeY * PARTY_LIST_ICON_PARTITION
     self._icon = DirectFrame(parent=self._root, pos=(0, 0, iconY),
                              frameSize=(-sizeX/2, sizeX/2, -iconSizeY, 0),
                              suppressMouse=0)
     # Draw HP Bar:
     healthY = -nameSizeY-iconSizeY
     healthSizeY = sizeY * PARTY_LIST_HEALTH_PARTITION
     self._healthBar = DirectWaitBar(parent=self._root, pos=(0, 0, healthY),
                          frameSize=(-sizeX/2, sizeX/2, -healthSizeY, 0),
                          frameColor=PARTY_LIST_HEALTH_BG_COLOR,
                          barColor=PARTY_LIST_HEALTH_FG_COLOR,
                          range=1, value=0, suppressMouse=0)
Esempio n. 12
0
 def __init__(self, barColor=(255, 0, 0, 1), pos=(1.0, 0, 0.9)):
     self.bar = DirectWaitBar(pos=pos,
                              barColor=barColor,
                              text="",
                              value=0,
                              range=30,
                              frameSize=(-0.3, 0.3, 0, 0.03),
                              frameColor=(0, 0, 255, 1))
Esempio n. 13
0
 def setupHealthBar(self):
     self.hpBar = DirectWaitBar(text="",
                                value=100.0,
                                pos=(0, 0, 1.5),
                                scale=0.3,
                                barColor=Vec4(1, 0, 0, 1))
     self.hpBar.setBillboardPointEye()
     self.hpBar.reparentTo(self.eNode)
 def setupPowerBar(self):
     self.powerBar = DirectWaitBar(pos=(0.0, 0, -0.94), relief=DGG.SUNKEN, frameSize=(-2.0,
      2.0,
      -0.2,
      0.2), borderWidth=(0.02, 0.02), scale=0.25, range=1, sortOrder=50, frameColor=(0.5, 0.5, 0.5, 0.5), barColor=(0.75, 0.75, 1.0, 0.8), text='', text_scale=0.26, text_fg=(1, 1, 1, 1), text_align=TextNode.ACenter, text_pos=(0, -0.05))
     self.power = 0
     self.powerBar['value'] = self.power
     self.powerBar.hide()
Esempio n. 15
0
    def onstage(self):
        self.notify.debug('onstage')
        DistributedMinigame.onstage(self)
        self.maze.onstage()
        self.randomNumGen.shuffle(self.startPosHTable)
        lt = base.localAvatar
        lt.reparentTo(render)
        lt.hideName()
        self.__placeToon(self.localAvId)
        lt.setAnimState('Happy', 1.0)
        lt.setSpeed(0, 0)
        self.camParent = render.attachNewNode('mazeGameCamParent')
        self.camParent.reparentTo(base.localAvatar)
        self.camParent.setPos(0, 0, 0)
        self.camParent.setHpr(render, 0, 0, 0)
        camera.reparentTo(self.camParent)
        camera.setPos(self.camOffset)
        self.__spawnCameraTask()
        self.toonRNGs = []
        for i in xrange(self.numPlayers):
            self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen))

        self.treasures = []
        for i in xrange(self.maze.numTreasures):
            self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId))

        self.__loadSuits()
        for suit in self.suits:
            suit.onstage()

        self.sndTable = {'hitBySuit': [None] * self.numPlayers, 'falling': [
                     None] * self.numPlayers}
        for i in xrange(self.numPlayers):
            self.sndTable['hitBySuit'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_Tag_C.ogg')
            self.sndTable['falling'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.ogg')

        self.grabSounds = []
        for i in xrange(5):
            self.grabSounds.append(base.loader.loadSfx('phase_4/audio/sfx/MG_maze_pickup.ogg'))

        self.grabSoundIndex = 0
        for avId in self.avIdList:
            self.toonHitTracks[avId] = Wait(0.1)

        self.scores = [0] * self.numPlayers
        self.goalBar = DirectWaitBar(parent=render2d, relief=DGG.SUNKEN, frameSize=(-0.35,
                                                                                    0.35,
                                                                                    -0.15,
                                                                                    0.15), borderWidth=(0.02,
                                                                                                        0.02), scale=0.42, pos=(0.84, 0, 0.5 - 0.28 * self.numPlayers + 0.05), barColor=(0,
                                                                                                                                                                                         0.7,
                                                                                                                                                                                         0,
                                                                                                                                                                                         1))
        self.goalBar.setBin('unsorted', 0)
        self.goalBar.hide()
        self.introTrack = self.getIntroTrack()
        self.introTrack.start()
        return
    def __init__(self):
        self.defaultLogoScale = 1
        self.defaultLogoZ = 0.65
        self.bgm = loader.loadModel(
            "phase_3/models/gui/progress-background.bam")
        self.bgm.find('**/logo').stash()
        self.barShadow = OnscreenImage(image=self.bgm.find("**/bar_shadow"),
                                       parent=hidden)
        self.bgm.find("**/bar_shadow").removeNode()
        self.bg = self.bgm.find('**/bg')
        self.defaultBgTexture = self.bg.findTexture('*')

        self.logoNode, self.logoImg = CIGlobals.getLogoImage(
            hidden, self.defaultLogoScale, (0, 0, self.defaultLogoZ))

        self.bg_img = OnscreenImage(image=self.bg, parent=hidden)
        self.bg_img.setSx(1.35)
        self.bg_img.hide()
        self.progress_bar = DirectWaitBar(value=0,
                                          pos=(0, 0, -0.85),
                                          parent=hidden,
                                          text_pos=(0, 0, 0.2))
        self.progress_bar.setSx(1.064)
        self.progress_bar.setSz(0.38)
        toontipgui = loader.loadModel(
            'phase_3.5/models/gui/stickerbook_gui.bam')
        poster = toontipgui.find('**/questCard')
        self.toontipFrame = DirectFrame(image=poster,
                                        image_scale=(1.4, 1, 1),
                                        parent=hidden,
                                        relief=None,
                                        pos=(0, 0, -0.1),
                                        scale=0.85)
        self.toontipLbl = OnscreenText(text="",
                                       parent=self.toontipFrame,
                                       fg=(89.0 / 255, 95.0 / 255, 98.0 / 255,
                                           1),
                                       font=CIGlobals.getToonFont(),
                                       wordwrap=13,
                                       pos=(-0.59, 0.25),
                                       align=TextNode.ALeft,
                                       scale=0.08)
        self.loading_lbl = DirectLabel(text="",
                                       relief=None,
                                       scale=0.08,
                                       pos=(-1.0725, 0, -0.79),
                                       text_align=TextNode.ALeft,
                                       sortOrder=100,
                                       text_fg=(1, 1, 1, 1),
                                       text_font=CIGlobals.getMinnieLogoFont(),
                                       parent=hidden,
                                       text_shadow=(0, 0, 0, 0))

        # This is useful when the user has chosen to hide aspect2d before the loading screen.
        # However, we want to show the loading screen all the time, so we need to restore the
        # previous state after the loading screen ends.
        self.mustRestoreHiddenAspect2d = False
Esempio n. 17
0
 def __init__(self, aspect, unit_id, panel_pos, unit_type, default_hp, hp, default_ap, ap):
     self.unit_id = unit_id
     self.frameWidth = 0.30
     self.frameHeight = 0.06
     self.frame = DirectFrame(  # relief = DGG.FLAT
                                scale = 1
                               , frameSize = (0, self.frameWidth, 0, -self.frameHeight)
                               , frameColor = (0.2, 0.2, 0.2, 0.8)
                               , parent = base.a2dTopLeft )#@UndefinedVariable
     
     self.pos = Point3(0, 0, -GUI_TOP_OFFSET-0.05 - (0.069*panel_pos))        
     self.frame.setPos(self.pos)
     
     self.ap_bar = DirectWaitBar(parent = self.frame
                               , text = ""
                               , range = default_ap
                               , value = ap
                               , pos = (0.2,0,-0.045)
                               , barColor = (0,0,1,1)
                               , frameColor = (0,0,0.5,0.2)
                               , scale = (0.1,0.5,0.1))
     
     self.hp_bar = DirectWaitBar(parent = self.frame
                               , text = ""
                               , range = default_hp
                               , value = hp
                               , pos = (0.2,0,-0.015)
                               , barColor = (0,1,0,1)
                               , frameColor = (1,0,0,0.9)
                               , scale = (0.1,0.5,0.08))
     
     self.insignia = OnscreenImage(parent = self.frame
                                         ,image = "unit_" + unit_type + "_big_transparent_32.png"
                                         ,pos = (0.035,0,-0.03)
                                         ,scale = 0.025)
     self.insignia.setTransparency(TransparencyAttrib.MAlpha)
     
     self.all_icons = {}
     self.visible_icons = {}
     self.addIcon("overwatch")
     self.addIcon("set_up")
     
     self.getBounds(aspect)
 def __init__(self, mg, cr, avId):
     RemoteAvatar.__init__(self, mg, cr, avId)
     self.health = 100
     self.retrieveAvatar()
     if game.process == 'client':
         self.healthBar = DirectWaitBar(value=100)
         self.healthBar.setBillboardAxis()
         self.healthBar.reparentTo(self.avatar)
         self.healthBar.setZ(self.avatar.nametag3d.getZ(self.avatar) + 1)
         print "generated health bar"
 def load(self):
     if self.isToon:
         self.barGeom = loader.loadModel('phase_3.5/models/gui/exp_bar')
         self.color = self.style.getHeadColor()
         self.bgBar = DirectFrame(parent=base.a2dBottomLeft,
                                  relief=None,
                                  geom=self.barGeom,
                                  pos=(.6, 0, .3),
                                  geom_scale=(0.3, 0.25, 0.1),
                                  geom_color=self.color)
         self.expBar = DirectWaitBar(parent=self.bgBar,
                                     guiId='expBar',
                                     pos=(0.0, 0, 0),
                                     relief=DGG.SUNKEN,
                                     frameSize=(-2.0, 2.0, -0.1, 0.1),
                                     borderWidth=(0.01, 0.01),
                                     scale=0.25,
                                     range=self.maxExp,
                                     sortOrder=50,
                                     frameColor=(0.5, 0.5, 0.5, 0.5),
                                     barColor=(0.0, 1.0, 0.0, 0.5),
                                     text=str(self.exp) + '/' +
                                     str(self.maxExp),
                                     text_scale=0.2,
                                     text_fg=(1, 1, 1, 1),
                                     text_align=TextNode.ACenter,
                                     text_pos=(0, -0.05))
         self.expBar['value'] = self.exp
         if self.level == ToontownGlobals.MaxToonLevel:
             self.expBar['range'] = 1
             self.expBar['value'] = 1
             self.expBar['text'] = 'MAX'
         self.levelLabel = OnscreenText(
             parent=self.bgBar,
             text=TTLocalizer.ExpBarLevel + str(self.level + 1),
             pos=(0.0, 0.05),
             scale=0.05,
             font=ToontownGlobals.getBuildingNametagFont(),
             fg=(1, 1, 1, 1))
         self.levelLabel.hide()
         gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
         arrowImage = (gui.find('**/tt_t_gui_mat_shuffleArrowUp'),
                       gui.find('**/tt_t_gui_mat_shuffleArrowDown'),
                       gui.find('**/tt_t_gui_mat_shuffleArrowUp'),
                       gui.find('**/tt_t_gui_mat_shuffleArrowDisabled'))
         self.visToggle = DirectButton(parent=self.bgBar,
                                       relief=None,
                                       geom=arrowImage,
                                       hpr=(0, 0, 0),
                                       pos=(.53, 0, 0),
                                       scale=(0.4, 0.4, 0.4),
                                       command=self.toggleVis)
         if not settings.get('experienceBarMode'):
             self.hide()
 def __init__(self):
     NodePath.__init__(self, 'pbar')
     self.bar = DirectWaitBar(range = 150, frameColor = (1, 1, 1, 1), barColor = (0.286, 0.901, 1, 1), relief = DGG.RAISED,
                            borderWidth = (0.04, 0.04), pos = (0, 0, 0.85), scale = 0.2, hpr = (0, 0, 0),
                            parent = self, frameSize = (-0.85, 0.85, -0.12, 0.12))
     self.hide()
     self.reparentTo(aspect2d)
     self.speed = 0.2
     self.exponent = 0.75
     self.startTime = 0.0
     self.task = None
 def initHealthBar(self):
     self.healthBar = DirectWaitBar(frameSize=(-0.35, 0.35, -0.04, 0.04),
                                    relief=DGG.FLAT,
                                    frameColor=(0.0, 0.0, 0.0, 0.0),
                                    borderWidth=(0.0, 0.0),
                                    barColor=(0.0, 1.0, 0.0, 1.0),
                                    scale=100)
     self.healthBar.setBillboardPointEye()
     self.healthBar['value'] = 100
     self.healthBar.hide(OTPRender.ReflectionCameraBitmask)
     self.healthBar.setLightOff()
 def createInterface(self):
     self.cogProgressBar = DirectWaitBar(pos=(0, 0, -0.9),
                                         relief=DGG.RAISED,
                                         scale=0.6,
                                         frameColor=(1, 0.5, 0.3, 0.75),
                                         barColor=(1, 0.25, 0.25, 0.5),
                                         value=0,
                                         range=self.getTotalCogs(),
                                         text="",
                                         text_scale=0.08)
     self.__updateProgressBar()
Esempio n. 23
0
 def __init__(self):
     self.defaultLogoScale = 1
     self.defaultLogoZ = 0.65
     self.bgm = loader.loadModel(
         "phase_3/models/gui/progress-background.bam")
     self.bgm.find('**/logo').stash()
     self.bg = self.bgm.find('**/bg')
     self.logo = loader.loadTexture("phase_3/maps/CogInvasion_Logo.png")
     self.logoNode = hidden.attachNewNode('logoNode')
     self.logoNode.setScale(self.defaultLogoScale)
     self.logoNode.setPos(0, self.defaultLogoZ, 0)
     self.logoImg = OnscreenImage(image=self.logo,
                                  scale=(0.685, 0, 0.325),
                                  parent=self.logoNode)
     self.logoImg.setTransparency(True)
     self.bg_img = OnscreenImage(image=self.bg, parent=hidden)
     self.bg_img.setSx(1.35)
     self.bg_img.hide()
     self.progress_bar = DirectWaitBar(value=0,
                                       pos=(0, 0, -0.85),
                                       parent=hidden,
                                       text_pos=(0, 0, 0.2))
     self.progress_bar.setSx(1.064)
     self.progress_bar.setSz(0.38)
     toontipgui = loader.loadModel(
         'phase_3.5/models/gui/stickerbook_gui.bam')
     poster = toontipgui.find('**/questCard')
     self.toontipFrame = DirectFrame(image=poster,
                                     image_scale=(1.4, 1, 1),
                                     parent=hidden,
                                     relief=None,
                                     pos=(0, 0, -0.1),
                                     scale=0.85)
     self.toontipLbl = OnscreenText(text="",
                                    parent=self.toontipFrame,
                                    fg=(89.0 / 255, 95.0 / 255, 98.0 / 255,
                                        1),
                                    font=CIGlobals.getToonFont(),
                                    wordwrap=14.5,
                                    pos=(-0.59, 0.25),
                                    align=TextNode.ALeft,
                                    scale=0.08)
     self.loading_lbl = DirectLabel(text="",
                                    relief=None,
                                    scale=0.08,
                                    pos=(-1.0725, 0, -0.79),
                                    text_align=TextNode.ALeft,
                                    sortOrder=100,
                                    text_fg=(89.0 / 255, 95.0 / 255,
                                             98.0 / 255, 1.0),
                                    text_font=CIGlobals.getMinnieFont(),
                                    parent=hidden,
                                    text_shadow=(0, 0, 0, 1))
Esempio n. 24
0
    def __init__(self, framework):
        super(Hud, self).__init__()
        self.f = framework

        self.player = DirectWaitBar(
            text="Player",
            text_fg=(1, 1, 1, 1),
            text_pos=(-1.2, -0.15, 0),
            text_align=TextNode.ALeft,
            text_scale=0.075,
            value=100,
            barColor=(0, 1, 0.25, 1),
            barRelief=DGG.FLAT,
            barBorderWidth=(0.03, 0.03),
            borderWidth=(0.01, 0.01),
            relief=DGG.FLAT,
            frameColor=(0.8, 0.05, 0.10, 1),
            frameSize=(-1.2, 0, 0, -0.05),
            pos=(-0.2, 0, self.f.a2dTop - 0.10))
        self.player.set_transparency(1)

        self.bot = DirectWaitBar(
            text="Enemy",
            text_fg=(1, 1, 1, 1),
            text_pos=(1.2, -0.15, 0),
            text_align=TextNode.ARight,
            text_scale=0.075,
            value=100,
            barColor=(0, 1, 0.25, 1),
            barRelief=DGG.FLAT,
            barBorderWidth=(0.03, 0.03),
            borderWidth=(0.01, 0.01),
            relief=DGG.FLAT,
            frameColor=(0.8, 0.05, 0.10, 1),
            frameSize=(0, 1.2, 0, -0.05),
            pos=(0.2, 0, self.f.a2dTop - 0.10))
        self.bot.set_transparency(1)

        self.accept("hud_set_hp", self.set_hp)
        self.hide()
Esempio n. 25
0
 def __init__(self, parent):
     super().__init__()
     self.node = parent.attach_new_node("cooldown bar")
     self.wait_bar = DirectWaitBar(
         value=0,
         scale=1,
         parent=self.node,
         frameColor=(0, 0, 0, 0.3),
         barColor=(1, 1, 0, 0.6),
     )
     self.width = 0.026
     self.height = 0.005
     self.accept("aspectRatioChanged", self.aspect_ratio_change_update)
Esempio n. 26
0
    def mostrarInfo(self):

        self.marcador = TextNode("Marcador")
        self.marcador.setText("Puntos: " + str(self.ship.puntos))
        self.marcador.setCardColor(0, 0, 0, 1)
        self.marcador.setCardDecal(True)
        self.marcador.setCardAsMargin(0.4, 0.4, 0.4, 0.4)
        self.marcadorNP = aspect2d.attachNewNode(self.marcador)
        self.marcadorNP.reparentTo(base.a2dTopLeft)
        self.marcadorNP.setPos(0.02, 0, -0.05)
        self.marcadorNP.setScale(0.07)

        self.barraEnergia = DirectWaitBar(text = "Energia", value = 5, 
            range = 5, scale = 0.3, pos = (0, 0, 0.95))
Esempio n. 27
0
 def setAvatar(self, avatar):
     Gag.setAvatar(self, avatar)
     if self.isLocal():
         self.powerBar = DirectWaitBar(range=150,
                                       frameColor=(1, 1, 1, 1),
                                       barColor=(0.286, 0.901, 1, 1),
                                       relief=DGG.RAISED,
                                       borderWidth=(0.04, 0.04),
                                       pos=(0, 0, 0.85),
                                       scale=0.2,
                                       hpr=(0, 0, 0),
                                       parent=aspect2d,
                                       frameSize=(-0.85, 0.85, -0.12, 0.12))
         self.powerBar.hide()
Esempio n. 28
0
    def __init__(self, unit):
        self.unit = unit
        self.node = unit.base_node.attach_new_node("floating bar node")
        self.node.set_pos(0, 0, unit.actor.HEIGHT)

        self.health_bar = DirectWaitBar(
            value=unit.health,
            parent=self.node,
            frameColor=(1, 0, 0, 0.3),
            barColor=(0, 1, 0, 1),
        )
        self.health_bar.reparent_to(self.node)
        self.health_bar.set_scale(0.13)
        self.health_bar.set_compass(core.instance.camera)

        self.mana_bar = DirectWaitBar(value=unit.mana,
                                      pos=(0, 0, -0.03),
                                      parent=self.node,
                                      frameColor=(0, 0, 0, 0.3),
                                      barColor=(0, 0, 1, 1),
                                      frameSize=(-1, 1, 0.05, 0.15))
        self.mana_bar.reparent_to(self.node)
        self.mana_bar.set_scale(0.13)
        self.mana_bar.set_compass(core.instance.camera)

        font = MainFont()
        self.name_label = DirectLabel(
            text=unit.name,
            pos=(0, 0, 0.03),
            scale=0.04,
            parent=self.node,
            text_bg=(0, 0, 0, 0),
            text_fg=(1, 1, 1, 1),
            frameColor=(0, 0, 0, 0),
            text_font=font,
        )
        self.name_label.set_compass(core.instance.camera)
Esempio n. 29
0
 def __init__(self, path, scale=0.5, extraText='', decimal=0, showOverValues=1):
     rootsim.RootSim.__init__(self, path, scale=scale)
     self.extraText = extraText
     self.currentValue = 0.0
     self.maxValue = 0.0
     self.barValue = 0.0
     self.scale = scale
     self.decimal = decimal
     self.showOverValues = showOverValues
     self.myText = ''
     self.textOverValue = None
     self.myBar = DirectWaitBar(text = '0 / 0', scale = scale, 
                                frameColor = globals.colors['guiblue2'],
                                borderWidth = (0.01, 0.01))
     self.barColor = globals.colors['guiblue1']
Esempio n. 30
0
 def load(self):
     if self.isToon:
         self.barGeom = loader.loadModel('phase_3.5/models/gui/exp_bar')
         self.color = self.style.getHeadColor()
         self.bgBar = DirectFrame(relief=None, geom=self.barGeom, pos=(0.0, 0, -.95), geom_scale=(0.3, 0.25, 0.1), geom_color=self.color)
         self.expBar = DirectWaitBar(parent=self.bgBar, guiId='expBar', pos=(0.0, 0, 0), relief=DGG.SUNKEN, frameSize=(-2.0, 2.0, -0.1, 0.1), borderWidth=(0.01, 0.01), scale=0.25, range=self.maxExp, sortOrder=50, frameColor=(0.5, 0.5, 0.5, 0.5), barColor=(0.0, 1.0, 0.0, 0.5), text=str(self.exp)+'/'+str(self.maxExp), text_scale=0.2, text_fg=(1, 1, 1, 1), text_align=TextNode.ACenter, text_pos=(0, -0.05))
         self.expBar['value'] = self.exp
         if self.level == ToontownGlobals.MaxToonLevel:
             self.expBar['range'] = 1
             self.expBar['value'] = 1
             self.expBar['text'] = 'MAX'
         self.levelLabel = OnscreenText(parent = self.bgBar, text = TTLocalizer.ExpBarLevel + str(self.level+1), pos = (0.0, 0.05), scale = 0.05, font=ToontownGlobals.getBuildingNametagFont(), fg = (1, 1, 1, 1))
         self.levelLabel.hide()
         gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
         if not settings.get('experienceBarMode'):
             self.hide()