Changeset 572


Ignore:
Timestamp:
07/02/10 11:55:19 (9 years ago)
Author:
beliar
Message:

Patch by Beliar.

Location:
trunk/game
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/game/gui/hud.xml

    r364 r572  
    1616  <ScrollArea name="actionsScrollArea" vertical_scrollbar="1"  
    1717              horizontal_scrollbar="0" is_focusable="0"> 
    18     <ListBox name="actionsBox" is_focusable="0" /> 
     18    <VBox name="actionsBox" is_focusable="0" /> 
    1919  </ScrollArea> 
    2020 
  • trunk/game/scripts/gamescenecontroller.py

    r571 r572  
    2323import glob 
    2424import os 
    25 from objects.action import ChangeMapAction, ExamineBoxAction, OpenBoxAction, \ 
     25from objects.action import ChangeMapAction, ExamineAction, OpenBoxAction, \ 
    2626                           UnlockBoxAction, LockBoxAction, TalkAction 
    2727 
     
    234234                                self.model.game_state.PlayerCharacter.approach,  
    235235                                [obj.X, obj.Y], 
    236                                 ExamineBoxAction(self, obj.name, obj.text)]) 
     236                                ExamineAction(self, obj.name, obj.text)]) 
    237237                # is it a Door? 
    238238                if obj.trueAttr("door"): 
  • trunk/game/scripts/gui/hud.py

    r571 r572  
    6464         
    6565        self.actions_box = self.hud.findChild(name="actionsBox") 
    66         self.actions_text = [] 
     66        #self.actions_text = "" 
    6767        self.menu_displayed = False 
    6868        self.inventory_storage = None 
     
    102102        actions_width = screen_width - 470 - 2*gap 
    103103 
     104        self.actions_box.min_width = actions_width 
     105        self.actions_box.max_width = actions_width 
     106         
    104107        # and finally add an actions box 
    105         self.hud.findChild(name="actionsBox").min_size = (actions_width, 0) 
    106108        actions_scroll_area.min_size = (actions_width, 55) 
    107109        actions_scroll_area.max_size = (actions_width, 55) 
     
    113115           self.actions_text 
    114116           @return: None""" 
    115         self.actions_box.items = self.actions_text 
     117        self.actions_box.adaptLayout() 
     118        self.actions_box.parent.adaptLayout() 
    116119 
    117120    def addAction(self, action): 
     
    120123           @param action: The text that you want to display in the actions box 
    121124           @return: None""" 
    122         self.actions_text.insert(0, action) 
     125        action_label = pychan.widgets.Label(text = action, wrap_text = True) 
     126        action_label.max_width = self.actions_box.width 
     127        self.actions_box.insertChild(action_label, 0) 
    123128        self.refreshActionsBox() 
    124129 
  • trunk/game/scripts/objects/action.py

    r571 r572  
    144144 
    145145 
    146 class ExamineBoxAction(Action): 
    147     """Examine a box. Needs to be more generic, but will do for now.""" 
     146class ExamineAction(Action): 
     147    """Examine an object.""" 
    148148    def __init__(self, controller, examine_name, examine_desc, commands = None): 
    149149        """ 
     
    159159        @param examine_name: Description of the object to be examined. 
    160160        """ 
    161         super(ExamineBoxAction, self).__init__(controller, commands) 
     161        super(ExamineAction, self).__init__(controller, commands) 
    162162        self.view = controller.view 
    163163        self.examine_name = examine_name 
     
    166166    def execute(self): 
    167167        """Examine the box.""" 
    168         self.view.hud.createExamineBox(self.examine_name, \ 
    169                                               self.examine_desc) 
    170         super(ExamineBoxAction, self).execute() 
     168        action_text = unicode(self.examine_desc) 
     169        self.view.hud.addAction(action_text) 
     170        print action_text 
    171171 
    172172class ReadAction(Action): 
     
    192192    def execute(self): 
    193193        """Examine the box.""" 
    194         print "You read " + self.text_name 
    195         print self.text 
    196         #self.view.hud.createExamineBox(self.text_name, \ 
    197         #                                      self.text) 
     194        action_text = unicode('\n'.join(["You read " + self.text_name + ".",  
     195                                         self.text])) 
     196        self.view.hud.addAction(action_text) 
     197        print action_text 
    198198        super(ReadAction, self).execute() 
    199199 
     
    288288           "Unlock":UnlockBoxAction, 
    289289           "Lock":LockBoxAction, 
    290            "Examine":ExamineBoxAction, 
     290           "Examine":ExamineAction, 
    291291           "Read":ReadAction, 
    292292           "Talk":TalkAction, 
Note: See TracChangeset for help on using the changeset viewer.