~vbkaisetsu/+junk/renpy-vertical-text

« back to all changes in this revision

Viewing changes to extras/dse/old_day_planner.rpy

  • Committer: tom
  • Date: 2006-10-01 14:09:56 UTC
  • Revision ID: svn-v3-trunk1:a20cb6e2-ff0c-0410-a951-e6c088e16c52:renpy%2Ftrunk:148

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This file contains the old day planner, the one used in the
2
 
# Ren'Py demo.
3
 
 
4
 
# Used in the old day planner to show the date.
5
 
init:
6
 
 
7
 
    $ dp_date = "No Date Set"
8
 
 
9
 
 
10
 
# This is the old day planner, as found in the demo code,
11
 
# reimplemented to be compatible with the new day planner.
12
 
#
13
 
# This isn't as well tested as the real one, given above.
14
 
label old_day_planner:
15
 
 
16
 
    # This is None to indicate that nothing is being edited, or
17
 
    # a name, var tuple to give the period that is being edited.
18
 
    $ dp_editing = None
19
 
    
20
 
label old_day_planner_cycle:
21
 
 
22
 
    call dp_callback from _call_dp_callback_2
23
 
    
24
 
    python hide:
25
 
 
26
 
        renpy.choice_for_skipping()
27
 
 
28
 
        # Period Selection Window.
29
 
        ui.window(xpos=0,
30
 
                  ypos=200,
31
 
                  xanchor='left',
32
 
                  yanchor='top',
33
 
                  xfill=False,
34
 
                  xminimum=300
35
 
                  )
36
 
 
37
 
        ui.vbox(xpos=0.5, xanchor='center')
38
 
        ui.text(dp_date, xpos=0.5, xanchor='center', textalign=0.5)
39
 
        ui.null(height=20)
40
 
 
41
 
        cannot_continue = False
42
 
        
43
 
        for name, var in zip(dp_period_names, dp_period_vars):
44
 
 
45
 
            def period_clicked(name=name, var=var):
46
 
                store.dp_editing = (name, var)
47
 
                return True
48
 
 
49
 
            value = getattr(store, var)
50
 
            valname = ""
51
 
                        
52
 
            for n, v in dp_period_acts[name]:
53
 
                if v == value:
54
 
                    valname = n
55
 
 
56
 
 
57
 
            if not valname:
58
 
                cannot_continue = True
59
 
                    
60
 
            face = name + ": " + valname
61
 
 
62
 
 
63
 
            
64
 
 
65
 
            _button_factory(face, "dp",
66
 
                            selected = dp_editing == (name, var),
67
 
                            clicked = period_clicked)
68
 
                            
69
 
 
70
 
        ui.null(height=20)
71
 
 
72
 
        if cannot_continue:            
73
 
            _button_factory("Continue", "dp")
74
 
        else:
75
 
            _button_factory("Continue", "dp", clicked=ui.returns(False))
76
 
 
77
 
        ui.null(height=20)
78
 
        ui.close()
79
 
 
80
 
 
81
 
        # Choice window.
82
 
        if dp_editing:
83
 
 
84
 
            name, var = dp_editing
85
 
            
86
 
            ui.window(xpos=300,
87
 
                      ypos=200,
88
 
                      xanchor='left',
89
 
                      yanchor='top',
90
 
                      xfill=False,
91
 
                      xminimum=500
92
 
                      )
93
 
 
94
 
            ui.vbox()
95
 
 
96
 
            _label_factory("What will you do in the %s?" %
97
 
                           name.lower(), "dp")
98
 
            ui.null(height=20)
99
 
 
100
 
            for label, value in dp_period_acts[name]:
101
 
 
102
 
                def clicked(var=var, value=value):
103
 
                    setattr(store, var, value)
104
 
                    store.dp_editing = None
105
 
                    return True
106
 
                    
107
 
                
108
 
 
109
 
                _button_factory(label, "dp",
110
 
                                selected = getattr(store, var) == value, 
111
 
                                clicked = clicked)
112
 
 
113
 
            ui.close()
114
 
 
115
 
 
116
 
    if ui.interact():
117
 
        jump old_day_planner_cycle
118
 
 
119
 
    return