screens.rpy 14 KB

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