~klnavarro98/klnovels/la_prison

« back to all changes in this revision

Viewing changes to game/screens.rpy

  • Committer: mickey
  • Date: 2016-07-04 17:48:10 UTC
  • Revision ID: mickey@klnavarro.fr-20160704174810-qovsuwipnunn7o5m
Project 'La Prison' added to Bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This file is in the public domain. Feel free to modify it as a basis
 
2
# for your own screens.
 
3
 
 
4
##############################################################################
 
5
# Say
 
6
#
 
7
# Screen that's used to display adv-mode dialogue.
 
8
# http://www.renpy.org/doc/html/screen_special.html#say
 
9
screen say:
 
10
 
 
11
    # Defaults for side_image and two_window
 
12
    default side_image = None
 
13
    default two_window = False
 
14
 
 
15
    # Decide if we want to use the one-window or two-window varaint.
 
16
    if not two_window:
 
17
 
 
18
        # The one window variant.        
 
19
        window:
 
20
            id "window"
 
21
 
 
22
            has vbox:
 
23
                style "say_vbox"
 
24
 
 
25
            if who:
 
26
                text who id "who"
 
27
 
 
28
            text what id "what"
 
29
 
 
30
    else:
 
31
 
 
32
        # The two window variant.
 
33
        vbox:
 
34
            style "say_two_window_vbox"
 
35
 
 
36
            if who:            
 
37
                window:
 
38
                    style "say_who_window"
 
39
 
 
40
                    text who:
 
41
                        id "who"
 
42
                        
 
43
            window:
 
44
                id "window"
 
45
 
 
46
                has vbox:
 
47
                    style "say_vbox"
 
48
 
 
49
                text what id "what"
 
50
              
 
51
    # If there's a side image, display it above the text.
 
52
    if side_image:
 
53
        add side_image
 
54
    else:
 
55
        add SideImage() xalign 0.0 yalign 1.0
 
56
 
 
57
    # Use the quick menu.
 
58
    use quick_menu
 
59
 
 
60
 
 
61
##############################################################################
 
62
# Choice
 
63
#
 
64
# Screen that's used to display in-game menus.
 
65
# http://www.renpy.org/doc/html/screen_special.html#choice
 
66
 
 
67
screen choice:
 
68
 
 
69
    window: 
 
70
        style "menu_window"        
 
71
        xalign 0.5
 
72
        yalign 0.5
 
73
        
 
74
        vbox:
 
75
            style "menu"
 
76
            spacing 2
 
77
            
 
78
            for caption, action, chosen in items:
 
79
                
 
80
                if action:  
 
81
                    
 
82
                    button:
 
83
                        action action
 
84
                        style "menu_choice_button"                        
 
85
 
 
86
                        text caption style "menu_choice"
 
87
                    
 
88
                else:
 
89
                    text caption style "menu_caption"
 
90
 
 
91
init -2 python:
 
92
    config.narrator_menu = True
 
93
    
 
94
    style.menu_window.set_parent(style.default)
 
95
    style.menu_choice.set_parent(style.button_text)
 
96
    style.menu_choice.clear()
 
97
    style.menu_choice_button.set_parent(style.button)
 
98
    style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
 
99
    style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)
 
100
 
 
101
 
 
102
##############################################################################
 
103
# Input
 
104
#
 
105
# Screen that's used to display renpy.input()
 
106
# http://www.renpy.org/doc/html/screen_special.html#input
 
107
 
 
108
screen input:
 
109
 
 
110
    window style "input_window":
 
111
        has vbox
 
112
 
 
113
        text prompt style "input_prompt"
 
114
        input id "input" style "input_text"
 
115
 
 
116
    use quick_menu
 
117
        
 
118
##############################################################################
 
119
# Nvl
 
120
#
 
121
# Screen used for nvl-mode dialogue and menus.
 
122
# http://www.renpy.org/doc/html/screen_special.html#nvl
 
123
 
 
124
screen nvl:
 
125
 
 
126
    window:
 
127
        style "nvl_window"
 
128
 
 
129
        has vbox:
 
130
            style "nvl_vbox"
 
131
 
 
132
        # Display dialogue.
 
133
        for who, what, who_id, what_id, window_id in dialogue:
 
134
            window:
 
135
                id window_id
 
136
 
 
137
                has hbox:
 
138
                    spacing 10
 
139
 
 
140
                if who is not None:
 
141
                    text who id who_id
 
142
 
 
143
                text what id what_id
 
144
 
 
145
        # Display a menu, if given.
 
146
        if items:
 
147
 
 
148
            vbox:
 
149
                id "menu"
 
150
 
 
151
                for caption, action, chosen in items:
 
152
 
 
153
                    if action:
 
154
 
 
155
                        button:
 
156
                            style "nvl_menu_choice_button"
 
157
                            action action
 
158
 
 
159
                            text caption style "nvl_menu_choice"
 
160
 
 
161
                    else:
 
162
 
 
163
                        text caption style "nvl_dialogue"
 
164
 
 
165
    add SideImage() xalign 0.0 yalign 1.0
 
166
    
 
167
    use quick_menu
 
168
        
 
169
##############################################################################
 
170
# Main Menu 
 
171
#
 
172
# Screen that's used to display the main menu, when Ren'Py first starts
 
173
# http://www.renpy.org/doc/html/screen_special.html#main-menu
 
174
 
 
175
screen main_menu:
 
176
 
 
177
    # This ensures that any other menu screen is replaced.
 
178
    tag menu
 
179
 
 
180
    # The background of the main menu.
 
181
    window:
 
182
        style "mm_root"
 
183
 
 
184
    # The main menu buttons.
 
185
    frame:
 
186
        style_group "mm"
 
187
        xalign .98
 
188
        yalign .98
 
189
 
 
190
        has vbox
 
191
 
 
192
        textbutton _("Start Game") action Start()
 
193
        textbutton _("Load Game") action ShowMenu("load")
 
194
        textbutton _("Preferences") action ShowMenu("preferences")
 
195
        textbutton _("Help") action Help()
 
196
        textbutton _("Quit") action Quit(confirm=False)
 
197
 
 
198
init -2 python:
 
199
 
 
200
    # Make all the main menu buttons be the same size.
 
201
    style.mm_button.size_group = "mm"
 
202
 
 
203
 
 
204
##############################################################################
 
205
# Navigation
 
206
#
 
207
# Screen that's included in other screens to display the game menu
 
208
# navigation and background.
 
209
# http://www.renpy.org/doc/html/screen_special.html#navigation
 
210
screen navigation:
 
211
 
 
212
    # The background of the game menu.
 
213
    window:
 
214
        style "gm_root"
 
215
 
 
216
    # The various buttons.
 
217
    frame:
 
218
        style_group "gm_nav"
 
219
        xalign .98
 
220
        yalign .98
 
221
        
 
222
        has vbox
 
223
 
 
224
        textbutton _("Return") action Return()
 
225
        textbutton _("Preferences") action ShowMenu("preferences")
 
226
        textbutton _("Save Game") action ShowMenu("save")
 
227
        textbutton _("Load Game") action ShowMenu("load")
 
228
        textbutton _("Main Menu") action MainMenu()
 
229
        textbutton _("Help") action Help()
 
230
        textbutton _("Quit") action Quit()
 
231
 
 
232
init -2 python:
 
233
    style.gm_nav_button.size_group = "gm_nav"
 
234
    
 
235
 
 
236
##############################################################################
 
237
# Save, Load
 
238
#
 
239
# Screens that allow the user to save and load the game.
 
240
# http://www.renpy.org/doc/html/screen_special.html#save
 
241
# http://www.renpy.org/doc/html/screen_special.html#load
 
242
 
 
243
# Since saving and loading are so similar, we combine them into
 
244
# a single screen, file_picker. We then use the file_picker screen
 
245
# from simple load and save screens.
 
246
    
 
247
screen file_picker:
 
248
 
 
249
    frame:
 
250
        style "file_picker_frame"
 
251
 
 
252
        has vbox
 
253
 
 
254
        # The buttons at the top allow the user to pick a
 
255
        # page of files.
 
256
        hbox:
 
257
            style_group "file_picker_nav"
 
258
            
 
259
            textbutton _("Previous"):
 
260
                action FilePagePrevious()
 
261
 
 
262
            textbutton _("Auto"):
 
263
                action FilePage("auto")
 
264
 
 
265
            textbutton _("Quick"):
 
266
                action FilePage("quick")
 
267
 
 
268
            for i in range(1, 9):
 
269
                textbutton str(i):
 
270
                    action FilePage(i)
 
271
                    
 
272
            textbutton _("Next"):
 
273
                action FilePageNext()
 
274
 
 
275
        $ columns = 2
 
276
        $ rows = 5
 
277
                
 
278
        # Display a grid of file slots.
 
279
        grid columns rows:
 
280
            transpose True
 
281
            xfill True
 
282
            style_group "file_picker"
 
283
            
 
284
            # Display ten file slots, numbered 1 - 10.
 
285
            for i in range(1, columns * rows + 1):
 
286
 
 
287
                # Each file slot is a button.
 
288
                button:
 
289
                    action FileAction(i)
 
290
                    xfill True
 
291
 
 
292
                    has hbox
 
293
 
 
294
                    # Add the screenshot.
 
295
                    add FileScreenshot(i)
 
296
                    
 
297
                    $ file_name = FileSlotName(i, columns * rows)
 
298
                    $ file_time = FileTime(i, empty=_("Empty Slot."))
 
299
                    $ save_name = FileSaveName(i)
 
300
 
 
301
                    text "[file_name]. [file_time!t]\n[save_name!t]"
 
302
 
 
303
                    key "save_delete" action FileDelete(i)
 
304
                    
 
305
                    
 
306
screen save:
 
307
 
 
308
    # This ensures that any other menu screen is replaced.
 
309
    tag menu
 
310
 
 
311
    use navigation
 
312
    use file_picker
 
313
 
 
314
screen load:
 
315
 
 
316
    # This ensures that any other menu screen is replaced.
 
317
    tag menu
 
318
 
 
319
    use navigation
 
320
    use file_picker
 
321
 
 
322
init -2 python:
 
323
    style.file_picker_frame = Style(style.menu_frame)
 
324
 
 
325
    style.file_picker_nav_button = Style(style.small_button)
 
326
    style.file_picker_nav_button_text = Style(style.small_button_text)
 
327
 
 
328
    style.file_picker_button = Style(style.large_button)
 
329
    style.file_picker_text = Style(style.large_button_text)
 
330
 
 
331
    
 
332
 
 
333
##############################################################################
 
334
# Preferences
 
335
#
 
336
# Screen that allows the user to change the preferences.
 
337
# http://www.renpy.org/doc/html/screen_special.html#prefereces
 
338
    
 
339
screen preferences:
 
340
 
 
341
    tag menu
 
342
 
 
343
    # Include the navigation.
 
344
    use navigation
 
345
 
 
346
    # Put the navigation columns in a three-wide grid.
 
347
    grid 3 1:
 
348
        style_group "prefs"
 
349
        xfill True
 
350
 
 
351
        # The left column.
 
352
        vbox:
 
353
            frame:
 
354
                style_group "pref"
 
355
                has vbox
 
356
 
 
357
                label _("Display")
 
358
                textbutton _("Window") action Preference("display", "window")
 
359
                textbutton _("Fullscreen") action Preference("display", "fullscreen")
 
360
 
 
361
            frame:
 
362
                style_group "pref"
 
363
                has vbox
 
364
 
 
365
                label _("Transitions")
 
366
                textbutton _("All") action Preference("transitions", "all")
 
367
                textbutton _("None") action Preference("transitions", "none")
 
368
 
 
369
            frame:
 
370
                style_group "pref"
 
371
                has vbox
 
372
 
 
373
                label _("Text Speed")
 
374
                bar value Preference("text speed")
 
375
 
 
376
            frame:
 
377
                style_group "pref"
 
378
                has vbox
 
379
 
 
380
                textbutton _("Joystick...") action Preference("joystick")
 
381
 
 
382
 
 
383
        vbox:
 
384
            frame:
 
385
                style_group "pref"
 
386
                has vbox
 
387
 
 
388
                label _("Skip")
 
389
                textbutton _("Seen Messages") action Preference("skip", "seen")
 
390
                textbutton _("All Messages") action Preference("skip", "all")
 
391
 
 
392
            frame:
 
393
                style_group "pref"
 
394
                has vbox
 
395
 
 
396
                textbutton _("Begin Skipping") action Skip()
 
397
 
 
398
            frame:
 
399
                style_group "pref"
 
400
                has vbox
 
401
 
 
402
                label _("After Choices")
 
403
                textbutton _("Stop Skipping") action Preference("after choices", "stop")
 
404
                textbutton _("Keep Skipping") action Preference("after choices", "skip")
 
405
 
 
406
            frame:
 
407
                style_group "pref"
 
408
                has vbox
 
409
 
 
410
                label _("Auto-Forward Time")
 
411
                bar value Preference("auto-forward time")
 
412
 
 
413
        vbox:
 
414
            frame:
 
415
                style_group "pref"
 
416
                has vbox
 
417
 
 
418
                label _("Music Volume")
 
419
                bar value Preference("music volume")
 
420
 
 
421
            frame:
 
422
                style_group "pref"
 
423
                has vbox
 
424
 
 
425
                label _("Sound Volume")
 
426
                bar value Preference("sound volume")
 
427
 
 
428
                if config.sample_sound:
 
429
                    textbutton _("Test"):
 
430
                        action Play("sound", config.sample_sound)
 
431
                        style "soundtest_button"
 
432
 
 
433
            frame:
 
434
                style_group "pref"
 
435
                has vbox
 
436
 
 
437
                label _("Voice Volume")
 
438
                bar value Preference("voice volume")
 
439
 
 
440
                if config.sample_voice:
 
441
                    textbutton "Test":
 
442
                        action Play("voice", config.sample_voice)
 
443
                        style "soundtest_button"
 
444
 
 
445
init -2 python:
 
446
    style.pref_frame.xfill = True
 
447
    style.pref_frame.xmargin = 5
 
448
    style.pref_frame.top_margin = 5
 
449
 
 
450
    style.pref_vbox.xfill = True
 
451
 
 
452
    style.pref_button.size_group = "pref"
 
453
    style.pref_button.xalign = 1.0
 
454
 
 
455
    style.pref_slider.xmaximum = 192
 
456
    style.pref_slider.xalign = 1.0
 
457
 
 
458
    style.soundtest_button.xalign = 1.0
 
459
 
 
460
 
 
461
##############################################################################
 
462
# Yes/No Prompt
 
463
#
 
464
# Screen that asks the user a yes or no question.
 
465
# http://www.renpy.org/doc/html/screen_special.html#yesno-prompt
 
466
    
 
467
screen yesno_prompt:
 
468
 
 
469
    modal True
 
470
 
 
471
    window:
 
472
        style "gm_root"
 
473
 
 
474
    frame:
 
475
        style_group "yesno"
 
476
 
 
477
        xfill True
 
478
        xmargin .05
 
479
        ypos .1
 
480
        yanchor 0
 
481
        ypadding .05
 
482
        
 
483
        has vbox:
 
484
            xalign .5
 
485
            yalign .5
 
486
            spacing 30
 
487
            
 
488
        label _(message):
 
489
            xalign 0.5
 
490
 
 
491
        hbox:
 
492
            xalign 0.5
 
493
            spacing 100
 
494
            
 
495
            textbutton _("Yes") action yes_action
 
496
            textbutton _("No") action no_action
 
497
 
 
498
 
 
499
init -2 python:    
 
500
    style.yesno_button.size_group = "yesno"
 
501
    style.yesno_label_text.text_align = 0.5
 
502
 
 
503
 
 
504
##############################################################################
 
505
# Quick Menu
 
506
#
 
507
# A screen that's included by the default say screen, and adds quick access to
 
508
# several useful functions.
 
509
screen quick_menu:
 
510
 
 
511
    # Add an in-game quick menu.
 
512
    hbox:
 
513
        style_group "quick"
 
514
    
 
515
        xalign 1.0
 
516
        yalign 1.0
 
517
 
 
518
        textbutton _("Q.Save") action QuickSave()
 
519
        textbutton _("Q.Load") action QuickLoad()
 
520
        textbutton _("Save") action ShowMenu('save')
 
521
        textbutton _("Skip") action Skip()
 
522
        textbutton _("Auto") action Preference("auto-forward", "toggle")
 
523
        textbutton _("Prefs") action ShowMenu('preferences')
 
524
        
 
525
init -2 python:
 
526
    style.quick_button.set_parent('default')
 
527
    style.quick_button.background = None
 
528
    style.quick_button.xpadding = 5
 
529
 
 
530
    style.quick_button_text.set_parent('default')
 
531
    style.quick_button_text.size = 12
 
532
    style.quick_button_text.idle_color = "#8888"
 
533
    style.quick_button_text.hover_color = "#ccc"
 
534
    style.quick_button_text.selected_idle_color = "#cc08"
 
535
    style.quick_button_text.selected_hover_color = "#cc0"
 
536
    style.quick_button_text.insensitive_color = "#4448"
 
537
    
 
538
    # Set a default value for the auto-forward time, and note that AFM is
 
539
    # turned off by default.
 
540
    config.default_afm_time = 10
 
541
    config.default_afm_enable = False
 
542
    
 
543