Exemple #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 = {}
 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.pauseUI = PauseUI(world)
     #self.shroomUI = ShroomUI(world)
     self.conversationUI = ConversationUI(world)
     self.timerUI = TimerUI(world);
     self.timerUI.killTimer();
     
     #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 = {}
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.pauseUI = PauseUI(world)
        #self.shroomUI = ShroomUI(world)
        self.conversationUI = ConversationUI(world)
        self.timerUI = TimerUI(world);
        self.timerUI.killTimer();
        
        #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.pauseUI.update()
        self.timerUI.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.shroomUI.hideAll()
        self.pauseUI.hideAll()
        self.journalUI.hideAll()
        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.pauseUI.showAll()
        #self.shroomUI.showAll();
        self.journalUI.showAll()
        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")
Exemple #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")