如果没有楼主和楼上们的珠玉在前我这个任务真完不成(当然现在也没有完成全部效果就是了)
以下代码没有修改任何图片素材。
[RenPy] 纯文本查看 复制代码 screen main_menu():
## 此语句可确保替换掉任何其他菜单屏幕。
tag menu
# add gui.main_menu_background
# ## 此空框可使标题菜单变暗。
# frame:
# style "main_menu_frame"
# ## use 语句将其他的屏幕包含进此屏幕。标题屏幕的实际内容在导航屏幕中。
# use navigation
# if gui.show_name:
# vbox:
# style "main_menu_vbox"
# text "[config.name!t]":
# style "main_menu_title"
# text "[config.version]":
# style "main_menu_version"
# 换成我们自己的背景图
add "DatingGameUI/Exports/HomeScreen/HomeScreenBackground.jpg"
# 增加按钮(从 screen navigation copy过来)
vbox: # 纵向排列
spacing -30 # 间距(由于图片素材自带空白区域, 因此出现负间距的奇怪情况, 可通过修改素材避免)
align (0.5, 0.8) #起始位置(横向比例, 纵向比例)
button:
style "main_menu_button" # 使用自定义的格式
text "START NEW GAME":
style "main_menu_button_text"
action Start()
button:
style "main_menu_button"
text "CHECK MESSAGES":
style "main_menu_button_text"
action NullAction() # 无行为
button:
style "main_menu_button"
text "CHARACTERS":
style "main_menu_button_text"
action NullAction()
vbox:
align(0.999, 0.999)
button:
xysize (286, 161) #(横向大小,纵向大小)
align (0.5, 0.5)
background "DatingGameUI/Exports/GreenBtn.png"
hover_background "DatingGameUI/Exports/GreenBtnPressed.png"
image "DatingGameUI/Exports/Icons/Settings.png":
align (0.5, 0.5)
xysize(64, 64) #原始图像是(128, 128)
action ShowMenu("preferences")
vbox:
spacing -15
align (0.5, 0.4)
add Text("DATING SIM!", size=100, color="#ebabd4", align=(0.5, 0.5), font="theboldfont.ttf", outlines=[(9, "#fff", 0, 0)])
add Text("UI PACK", size=66, color="#76acd7", align=(0.5, 0.5), font="theboldfont.ttf", outlines=[(6, "#fff", 0, 0)]) at right
style main_menu_button: # 自定义可复用的格式
xysize (584, 133)
background "DatingGameUI/Exports/HomeScreen/button.png"
hover_background "DatingGameUI/Exports/HomeScreen/buttonPressed.png"
style main_menu_button_text:
align (0.5, 0.5)
color "#44527d"
font "theboldfont.ttf"
size 40
[RenPy] 纯文本查看 复制代码 screen confirm(message, yes_action, no_action):
## 显示此屏幕时,确保其他屏幕无法输入。
modal True
zorder 200
# style_prefix "confirm"
add "gui/overlay/confirm.png"
frame:
xysize (913, 488)
background "DatingGameUI/Exports/VictoryOrDefeat/TextContainer.png"
align (0.5, 0.5)
vbox:
xalign 0.5
yalign 0.5
spacing 45
text "ARE YOU SURE YOU\n WANT TO QUIT?":
xalign 0.5
size 47
color "#44527d"
font "theboldfont.ttf"
hbox:
xalign 0.5
spacing 150
button:
xysize (286, 161)
background "DatingGameUI/Exports/VictoryOrDefeat/BlueBtn.png"
hover_background "DatingGameUI/Exports/VictoryOrDefeat/BlueBtnPressed.png"
text "{b}YES{/b}":
size 47
align (0.5, 0.5)
color "#ffffff"
font "theboldfont.ttf"
action yes_action
button:
xysize (286, 161)
background "DatingGameUI/Exports/VictoryOrDefeat/RedBtn.png"
hover_background "DatingGameUI/Exports/VictoryOrDefeat/RedBtnPressed.png"
text "{b}NO{/b}":
size 47
align (0.5, 0.5)
color "#ffffff"
font "theboldfont.ttf"
action no_action
## 右键点击退出并答复 no(取消)。
key "game_menu" action no_action
总结一下学到的东西:
1. vbox,hbox,button,text的排列组合嵌套实现效果
2. 设置各种常见格式(基础的)比如ispacing,dle/hover,xysize,align,font,size,color
3. 用style管理复用格式组合
已知有这个玩意但还没搞明白的:
1. outlines是什么?
2. Text()和 text:有什么区别
3. add XXX和vbox/button这些有什么区别和关系?
不知道怎么实现的:
1. 标题的立体阴影效果? |