Example #1
0
    def __init__(self, world):

        UIBase.__init__(self, world)

        #add frame border (temp!!!!!)
        self.border = DirectFrame(image=("./LEGameAssets/Textures/border.png"),
                                  frameColor=(0, 0, 0, 0),
                                  image_scale=(1, 1, 1),
                                  image_pos=(0, 0, 0),
                                  frameSize=(-1, 1, -1, 1),
                                  pos=(0, 0, 0))
        self.border.setTransparency(1)
        self.border.reparentTo(render2d)

        self.journalUI = JournalUI(world)
        self.conversationUI = ConversationUI(world)

        self.lifebarUI = LifebarUI(world)
        self.offensiveSpellUI = OffensiveSpellUI(world)
        self.modifierSporeUI = ModifierSporeUI(world)
        self.defensiveSpellUI = DefensiveSpellUI(world)
        taskMgr.add(self.update, "updateUI")

        # change the conversationUI position
        self.world.accept('u', self.conversationUI.repositionUp)
        self.world.accept('j', self.conversationUI.repositionDown)

        # health bars
        self.healthBars = {}
Example #2
0
 def __init__(self,world):
     
     UIBase.__init__(self,world)
     
     #add frame border (temp!!!!!)
     self.border = DirectFrame(image = ("./LEGameAssets/Textures/border.png"), frameColor=(0, 0, 0, 0),
                           image_scale = (1,1,1),image_pos = (0, 0, 0),frameSize=(-1,1,-1,1),pos=(0,0,0))
     self.border.setTransparency(1)
     self.border.reparentTo(render2d)
     
     self.journalUI = JournalUI(world)
     self.conversationUI = ConversationUI(world)
     
     self.lifebarUI = LifebarUI(world)
     self.offensiveSpellUI = OffensiveSpellUI(world)
     self.modifierSporeUI = ModifierSporeUI(world)
     self.defensiveSpellUI = DefensiveSpellUI(world)
     taskMgr.add(self.update, "updateUI")
     
     # change the conversationUI position
     self.world.accept('u', self.conversationUI.repositionUp)
     self.world.accept('j', self.conversationUI.repositionDown)
     
     
     # health bars
     self.healthBars = {}
Example #3
0
class GameplayUI(UIBase):
    def __init__(self, world):

        UIBase.__init__(self, world)

        #add frame border (temp!!!!!)
        self.border = DirectFrame(image=("./LEGameAssets/Textures/border.png"),
                                  frameColor=(0, 0, 0, 0),
                                  image_scale=(1, 1, 1),
                                  image_pos=(0, 0, 0),
                                  frameSize=(-1, 1, -1, 1),
                                  pos=(0, 0, 0))
        self.border.setTransparency(1)
        self.border.reparentTo(render2d)

        self.journalUI = JournalUI(world)
        self.conversationUI = ConversationUI(world)

        self.lifebarUI = LifebarUI(world)
        self.offensiveSpellUI = OffensiveSpellUI(world)
        self.modifierSporeUI = ModifierSporeUI(world)
        self.defensiveSpellUI = DefensiveSpellUI(world)
        taskMgr.add(self.update, "updateUI")

        # change the conversationUI position
        self.world.accept('u', self.conversationUI.repositionUp)
        self.world.accept('j', self.conversationUI.repositionDown)

        # health bars
        self.healthBars = {}

    def removeAllHealthBars(self):
        for name, healthbar in self.healthBars.iteritems():
            healthbar.removeNode()
        self.healthBars = {}

    def showHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].show()
        else:
            healthBar = HealthBar(gameObj)
            healthBar.setLight(self.world.overlayAmbientLightNP)
            self.healthBars[gameObj.getName()] = healthBar

    def hideHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].hide()

    def removeHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].removeNode()
            del self.healthBars[gameObj.getName()]

    def update(self, task):
        self.journalUI.update()
        self.conversationUI.update()
        #self.inventoryUI.update()
        self.lifebarUI.update()
        self.offensiveSpellUI.update()
        self.modifierSporeUI.update()
        self.defensiveSpellUI.update()
        for gameObjName, healthBar in self.healthBars.iteritems():
            healthBar.refresh()

        return task.cont

    def hideAll(self):
        self.border.hide()
#        self.journalUI.hide()
#        self.conversationUI.hide()
#        self.lifebarUI.hide()
#        self.offensiveSpellUI.hide()
#        self.modifierSporeUI.hide()
#        self.defensiveSpellUI.hide()

    def showAll(self):
        self.border.show()
#        self.journalUI.show()
#        self.conversationUI.show()
#        self.lifebarUI.show()
#        self.offensiveSpellUI.show()
#        self.modifierSporeUI.show()
#        self.defensiveSpellUI.show()

    def stop(self):
        taskMgr.remove("updateUI")

    def start(self):
        taskMgr.add(self.update, "updateUI")
Example #4
0
class GameplayUI(UIBase):
    
    def __init__(self,world):
        
        UIBase.__init__(self,world)
        
        #add frame border (temp!!!!!)
        self.border = DirectFrame(image = ("./LEGameAssets/Textures/border.png"), frameColor=(0, 0, 0, 0),
                              image_scale = (1,1,1),image_pos = (0, 0, 0),frameSize=(-1,1,-1,1),pos=(0,0,0))
        self.border.setTransparency(1)
        self.border.reparentTo(render2d)
        
        self.journalUI = JournalUI(world)
        self.conversationUI = ConversationUI(world)
        
        self.lifebarUI = LifebarUI(world)
        self.offensiveSpellUI = OffensiveSpellUI(world)
        self.modifierSporeUI = ModifierSporeUI(world)
        self.defensiveSpellUI = DefensiveSpellUI(world)
        taskMgr.add(self.update, "updateUI")
        
        # change the conversationUI position
        self.world.accept('u', self.conversationUI.repositionUp)
        self.world.accept('j', self.conversationUI.repositionDown)
        
        
        # health bars
        self.healthBars = {}
        
    def removeAllHealthBars(self):
        for name, healthbar in self.healthBars.iteritems():
            healthbar.removeNode()
        self.healthBars = {}
    
    def showHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].show()
        else:
            healthBar = HealthBar(gameObj)
            healthBar.setLight(self.world.overlayAmbientLightNP)
            self.healthBars[gameObj.getName()] = healthBar
    
    def hideHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].hide()
    
    def removeHealthBar(self, gameObj):
        if gameObj.getName() in self.healthBars:
            self.healthBars[gameObj.getName()].removeNode()
            del self.healthBars[gameObj.getName()]
    
    def update(self, task):
        self.journalUI.update()
        self.conversationUI.update()
        #self.inventoryUI.update()
        self.lifebarUI.update()
        self.offensiveSpellUI.update()
        self.modifierSporeUI.update()
        self.defensiveSpellUI.update()
        for gameObjName, healthBar in self.healthBars.iteritems():
            healthBar.refresh()
        
        return task.cont
    def hideAll(self):
        self.border.hide()
#        self.journalUI.hide()
#        self.conversationUI.hide()
#        self.lifebarUI.hide()
#        self.offensiveSpellUI.hide()
#        self.modifierSporeUI.hide()
#        self.defensiveSpellUI.hide()
        
    def showAll(self):
        self.border.show()
#        self.journalUI.show()
#        self.conversationUI.show()
#        self.lifebarUI.show()
#        self.offensiveSpellUI.show()
#        self.modifierSporeUI.show()
#        self.defensiveSpellUI.show()
        
    
    def stop(self):
        taskMgr.remove("updateUI")
    
    def start(self):
        taskMgr.add(self.update, "updateUI")