Changeset 288 for trunk


Ignore:
Timestamp:
09/24/09 04:58:09 (10 years ago)
Author:
orlandov
Message:

Ticket 101: Load NPC avatar image filename from the YAML dialogue file. fixes[s:trac, t:101]

Location:
trunk/game
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/dialogue/sample.yaml

    r287 r288  
    1515 
    1616--- 
    17 NPC: Guard 
    18 AVATAR: Guard1.png 
     17NPC: Friendly NPC 
     18AVATAR: gui/icons/npc.png 
    1919START: main_dialog 
    2020 
  • trunk/game/gui/dialogue.xml

    r287 r288  
    22    <HBox> 
    33        <VBox> 
    4             <Icon image="gui/icons/npc.png" size="200,200" /> 
     4            <Icon name="npc_avatar" size="200,200" /> 
    55            <Label name="stats_label" /> 
    66        </VBox> 
  • trunk/game/scripts/dialogue.py

    r287 r288  
    6161        start_section = self.tree['START'] 
    6262        self.section_stack = [] 
     63 
     64        self.callbacks['npc_avatar'](self.tree['AVATAR']) 
    6365 
    6466        try: 
  • trunk/game/scripts/dialoguegui.py

    r287 r288  
    5050            'start_quest': self.startQuest, 
    5151            'complete_quest': self.completeQuest, 
     52            'npc_avatar': self.handleAvatarImage, 
    5253            'end': self.handleEnd 
    5354        } 
     
    120121        self.npc.behaviour.idle() 
    121122 
     123    def handleAvatarImage(self, image): 
     124        """Callback to handle when the dialogue engine wants to set the NPC image 
     125           @type image: str 
     126           @param image: filename of avatar image""" 
     127        avatar_image = self.dialogue_gui.findChild(name='npc_avatar') 
     128        avatar_image.image = image 
     129 
    122130    def handleResponses(self, *args): 
    123131        """Callback to handle when the dialogue engine wants to display a new 
Note: See TracChangeset for help on using the changeset viewer.