Changeset 285:71f15f6e9274


Ignore:
Timestamp:
04/08/11 18:52:47 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Hook up auto_next dialogue events.

Location:
skaapsteker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/dialogue.py

    r251 r285  
    5050        self.event(DsmEvent(choice=i))
    5151
     52    def auto_next(self):
     53        self.event(DsmEvent(auto_next=True))
     54
    5255
    5356class AttrDict(dict):
     
    6164class DsmEvent(object):
    6265
    63     def __init__(self, choice=None):
     66    def __init__(self, choice=None, auto_next=False):
    6467        self.items = {
    6568            "choice": choice,
     69            "auto_next": auto_next,
    6670        }
    6771
     
    9397
    9498        auto_next = state_src.get("auto_next", None)
     99        self.auto_next = False
    95100        if auto_next is not None:
     101            self.auto_next = True
     102            assert not self.choices, "%s: auto_next and choices are not compatible" % ":".join(base_path)
    96103            pseudo_path = base_path + ["auto_next"]
    97             self.triggers.append(Trigger("""True""", auto_next, pseudo_path))
     104            self.triggers.append(Trigger("""auto_next""", auto_next, pseudo_path))
    98105
    99106        on_entry = state_src.get("on_entry", None)
  • skaapsteker/widgets/bubble.py

    r259 r285  
    2727            self._text = None
    2828        options = [(text, i) for (i, text) in state.choices]
    29         options.append(("Leave", "L"))
     29        if state.auto_next:
     30            options.append(("Next", "N"))
     31        else:
     32            options.append(("Leave", "L"))
    3033        pos = pos.move(0, 0) # copy
    3134        self._text_choice = TextChoice(options, pos, wrap=True)
     
    3538        if data == "L":
    3639            CloseDialog.post(self.npc)
     40        elif data == "N":
     41            self.dsm.auto_next()
     42            self._state_update()
    3743        else:
    3844            self.dsm.choice(i)
Note: See TracChangeset for help on using the changeset viewer.