找回密码
 立即注册

QQ登录

只需一步,快速开始

楼主: blackpineapple

[课堂] 【2023暑假界面】第一周 (主界面,确定界面)

[复制链接]
发表于 2023-7-14 21:18:07 | 显示全部楼层
本帖最后由 tan笑分生 于 2023-7-14 21:20 编辑

[RenPy] 纯文本查看 复制代码
## 确认界面 ########################################################################
##
## 当 Ren'Py 需要询问用户有关确定或取消的问题时,会调用确认界面。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#confirm[/url]

style myConfirm:
    font "theboldfont-1.ttf"
    size 50
    align (0.6, 0.5)
    color "#66507f"
style exit_text:
    font "theboldfont-1.ttf"
    size 50
    align(0.5, 0.5)
image YES_text:
    Text("YES",style = "exit_text")
image NO_text:
    Text("NO",style = "exit_text")
transform exit_trans:
    zoom 1.0
screen confirm(message, yes_action, no_action):
 
    ## 显示此屏幕时,确保其他屏幕无法输入。
    modal True
 
    zorder 200
 
    style_prefix "confirm"
 
    add "gui/overlay/confirm.png"
 
    frame:
 
        vbox:
            xalign .5
            yalign .5
            spacing 45
            text "ARE YOU SURE YOU" style "myConfirm" pos(0.45,0.5)
            text "WANT TO QUIT?" style "myConfirm" pos(0.45,-15)
 
            hbox:
                spacing 45
                imagebutton:
                    idle"ExitPopup/BlueBtn.png"
                    hover"ExitPopup/BlueBtnPressed.png"
                    foreground "YES_text"
                    pos(-80,-28)
                    at exit_trans
                    action yes_action
                imagebutton:
                    idle"ExitPopup/redBtn.png"
                    hover"ExitPopup/redBtnPressed.png"
                    foreground "NO_text"
                    pos(-80,-28)
                    at exit_trans
                    action no_action
 
    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action
 
 
style confirm_frame is gui_frame
style confirm_prompt is gui_prompt
style confirm_prompt_text is gui_prompt_text
style confirm_button is gui_medium_button
style confirm_button_text is gui_medium_button_text
 
style confirm_frame:
    background Frame([ "gui/confirm_frame.png", "ExitPopup/PopUpContainer.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
    padding gui.confirm_frame_borders.padding
    xalign .5
    yalign .5

style confirm_prompt_text:
    text_align 0.5
    layout "subtitle"

style confirm_button:
    properties gui.button_properties("confirm_button")

style confirm_button_text:
    properties gui.button_text_properties("confirm_button")

[RenPy] 纯文本查看 复制代码
## 标题菜单界面 ######################################################################
##
## 用于在 Ren'Py 启动时显示标题菜单。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#main-menu[/url]

style HomeScreen_button_text:
    align (0.5,0.5)
    size 40
    color "#3f527f"
    font "theboldfont-1.ttf"
style HomeScreen_title_text:
    align (0.7,0.45)
    size 110
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
style HomeScreen_title_text2:
    align (0.5,0.5)
    size 80
    color "#68a3ca"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
     
style HomeScreen_title_text_bottom:
    align (0.5,0.5)
    size 80
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
 
image start_new_game_button_text:
    contains:
        Text("START NEW GAME",style = "HomeScreen_button_text")
image check_messages:
    contains:
        Text("CHECK MESSAGES",style = "HomeScreen_button_text")
image characters:
    contains:
        Text("CHARACTERS",style = "HomeScreen_button_text")
image title:
    contains:
        Text("DATING SIM!",style = "HomeScreen_title_text")
image setting_icon = Transform("Exports/Icons/Settings.png",zoom = 0.45,xpos = 115,ypos = 51)
 
screen main_menu():
     
    tag menu
    add "HomeScreen/HomeScreenBackground.jpg"
    vbox:
        xalign 0.5
        yalign 0.42
        imagebutton:
            idle"HomeScreen/touming.png"
            foreground "title"
        text "UI PACK" style "HomeScreen_title_text2" pos(0.60,-280)
    vbox:
        xalign 0.5
        yalign 0.82
        spacing -30
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "start_new_game_button_text"
            action Start()
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "check_messages"
            action ShowMenu("load")
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "characters"
            action ShowMenu("preferences")
    vbox:
        align(1.0, 1.0)
        imagebutton:
            idle "GreenBtn.png"
            foreground "setting_icon"
            hover"GreenBtnPressed.png"
            action Quit(confirm = True)


{829FC89C-C126-4e19-9FDF-973E08E209B4}.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-14 21:25:18 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
## 标题菜单界面 ######################################################################
##
## 用于在 Ren'Py 启动时显示标题菜单。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#main-menu[/url]

style HomeScreen_button_text:
    align (0.5,0.5)
    size 40
    color "#3f527f"
    font "theboldfont-1.ttf"
style HomeScreen_title_text:
    align (0.7,0.45)
    size 110
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
style HomeScreen_title_text2:
    align (0.5,0.5)
    size 80
    color "#68a3ca"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
     
style HomeScreen_title_text_bottom:
    align (0.5,0.5)
    size 80
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
 
image start_new_game_button_text:
    contains:
        Text("START NEW GAME",style = "HomeScreen_button_text")
image check_messages:
    contains:
        Text("CHECK MESSAGES",style = "HomeScreen_button_text")
image characters:
    contains:
        Text("CHARACTERS",style = "HomeScreen_button_text")
image title:
    contains:
        Text("DATING SIM!",style = "HomeScreen_title_text")
image setting_icon = Transform("Exports/Icons/Settings.png",zoom = 0.45,xpos = 115,ypos = 51)
 
screen main_menu():
     
    tag menu
    add "HomeScreen/HomeScreenBackground.jpg"
    vbox:
        xalign 0.5
        yalign 0.42
        imagebutton:
            idle"HomeScreen/touming.png"
            foreground "title"
        text "UI PACK" style "HomeScreen_title_text2" pos(0.60,-280)
    vbox:
        xalign 0.5
        yalign 0.82
        spacing -30
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "start_new_game_button_text"
            action Start()
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "check_messages"
            action ShowMenu("load")
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "characters"
            action ShowMenu("preferences")
    vbox:
        align(1.0, 1.0)
        imagebutton:
            idle "GreenBtn.png"
            foreground "setting_icon"
            hover"GreenBtnPressed.png"
            action Quit(confirm = True)

## 确认界面 ########################################################################
##
## 当 Ren'Py 需要询问用户有关确定或取消的问题时,会调用确认界面。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#confirm[/url]

style myConfirm:
    font "theboldfont-1.ttf"
    size 50
    align (0.6, 0.5)
    color "#66507f"
style exit_text:
    font "theboldfont-1.ttf"
    size 50
    align(0.5, 0.5)
image YES_text:
    Text("YES",style = "exit_text")
image NO_text:
    Text("NO",style = "exit_text")
transform exit_trans:
    zoom 1.0
screen confirm(message, yes_action, no_action):
 
    ## 显示此屏幕时,确保其他屏幕无法输入。
    modal True
 
    zorder 200
 
    style_prefix "confirm"
 
    add "gui/overlay/confirm.png"
 
    frame:
 
        vbox:
            xalign .5
            yalign .5
            spacing 45
            text "ARE YOU SURE YOU" style "myConfirm" pos(0.45,0.5)
            text "WANT TO QUIT?" style "myConfirm" pos(0.45,-15)
 
            hbox:
                spacing 45
                imagebutton:
                    idle"ExitPopup/BlueBtn.png"
                    hover"ExitPopup/BlueBtnPressed.png"
                    foreground "YES_text"
                    pos(-80,-28)
                    at exit_trans
                    action yes_action
                imagebutton:
                    idle"ExitPopup/redBtn.png"
                    hover"ExitPopup/redBtnPressed.png"
                    foreground "NO_text"
                    pos(-80,-28)
                    at exit_trans
                    action no_action
 
    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action
 
 
style confirm_frame is gui_frame
style confirm_prompt is gui_prompt
style confirm_prompt_text is gui_prompt_text
style confirm_button is gui_medium_button
style confirm_button_text is gui_medium_button_text
 
style confirm_frame:
    background Frame([ "gui/confirm_frame.png", "ExitPopup/PopUpContainer.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
    padding gui.confirm_frame_borders.padding
    xalign .5
    yalign .5

style confirm_prompt_text:
    text_align 0.5
    layout "subtitle"

style confirm_button:
    properties gui.button_properties("confirm_button")

style confirm_button_text:
    properties gui.button_text_properties("confirm_button")
{829FC89C-C126-4e19-9FDF-973E08E209B4}.png
{4F2C5EDC-3367-46de-834D-62E992187331}.jpg
回复 支持 抱歉

使用道具 举报

发表于 2023-7-15 15:53:32 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
## 标题菜单界面 ######################################################################
##
## 用于在 Ren'Py 启动时显示标题菜单。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#main-menu[/url]

style HomeScreen_button_text:
    align (0.5,0.5)
    size 40
    color "#3f527f"
    font "theboldfont-1.ttf"
style HomeScreen_title_text:
    align (0.7,0.45)
    size 110
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
style HomeScreen_title_text2:
    align (0.5,0.5)
    size 80
    color "#68a3ca"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
     
style HomeScreen_title_text_bottom:
    align (0.5,0.5)
    size 80
    color "#ebacd5"
    font "theboldfont-1.ttf"
    outlines[(10, "#ffffff", 0, 0)]
 
image start_new_game_button_text:
    contains:
        Text("START NEW GAME",style = "HomeScreen_button_text")
image check_messages:
    contains:
        Text("CHECK MESSAGES",style = "HomeScreen_button_text")
image characters:
    contains:
        Text("CHARACTERS",style = "HomeScreen_button_text")
image title:
    contains:
        Text("DATING SIM!",style = "HomeScreen_title_text")
image setting_icon = Transform("Exports/Icons/Settings.png",zoom = 0.45,xpos = 115,ypos = 51)
 
screen main_menu():
     
    tag menu
    add "HomeScreen/HomeScreenBackground.jpg"
    vbox:
        xalign 0.5
        yalign 0.42
        imagebutton:
            idle"HomeScreen/touming.png"
            foreground "title"
        text "UI PACK" style "HomeScreen_title_text2" pos(0.60,-280)
    vbox:
        xalign 0.5
        yalign 0.82
        spacing -30
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "start_new_game_button_text"
            action Start()
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "check_messages"
            action ShowMenu("load")
        imagebutton:
            idle"HomeScreen/Button.png"
            hover"HomeScreen/ButtonPressed.png"
            foreground "characters"
            action ShowMenu("preferences")
    vbox:
        align(1.0, 1.0)
        imagebutton:
            idle "GreenBtn.png"
            foreground "setting_icon"
            hover"GreenBtnPressed.png"
            action Quit(confirm = True)
## 确认界面 ########################################################################
##
## 当 Ren'Py 需要询问用户有关确定或取消的问题时,会调用确认界面。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#confirm[/url]

style myConfirm:
    font "theboldfont-1.ttf"
    size 50
    align (0.6, 0.5)
    color "#66507f"
style exit_text:
    font "theboldfont-1.ttf"
    size 50
    align(0.5, 0.5)
image YES_text:
    Text("YES",style = "exit_text")
image NO_text:
    Text("NO",style = "exit_text")
transform exit_trans:
    zoom 1.0
screen confirm(message, yes_action, no_action):
 
    ## 显示此屏幕时,确保其他屏幕无法输入。
    modal True
 
    zorder 200
 
    style_prefix "confirm"
 
    add "gui/overlay/confirm.png"
 
    frame:
 
        vbox:
            xalign .5
            yalign .5
            spacing 45
            text "ARE YOU SURE YOU" style "myConfirm" pos(0.45,0.5)
            text "WANT TO QUIT?" style "myConfirm" pos(0.45,-15)
 
            hbox:
                spacing 45
                imagebutton:
                    idle"ExitPopup/BlueBtn.png"
                    hover"ExitPopup/BlueBtnPressed.png"
                    foreground "YES_text"
                    pos(-80,-28)
                    at exit_trans
                    action yes_action
                imagebutton:
                    idle"ExitPopup/redBtn.png"
                    hover"ExitPopup/redBtnPressed.png"
                    foreground "NO_text"
                    pos(-80,-28)
                    at exit_trans
                    action no_action
 
    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action
 
 
style confirm_frame is gui_frame
style confirm_prompt is gui_prompt
style confirm_prompt_text is gui_prompt_text
style confirm_button is gui_medium_button
style confirm_button_text is gui_medium_button_text
 
style confirm_frame:
    background Frame([ "gui/confirm_frame.png", "ExitPopup/PopUpContainer.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
    padding gui.confirm_frame_borders.padding
    xalign .5
    yalign .5

style confirm_prompt_text:
    text_align 0.5
    layout "subtitle"

style confirm_button:
    properties gui.button_properties("confirm_button")

style confirm_button_text:
    properties gui.button_text_properties("confirm_button")

捕获.jpg
捕获2.jpg
回复 支持 抱歉

使用道具 举报

发表于 2023-7-15 22:01:51 | 显示全部楼层
如果没有楼主和楼上们的珠玉在前我这个任务真完不成(当然现在也没有完成全部效果就是了)
以下代码没有修改任何图片素材。


[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


Snipaste_2023-07-15_21-54-27.jpg

[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


confirm.png


总结一下学到的东西:
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. 标题的立体阴影效果?

点评

第二种做法:outlines [(9, "#d19dbc90", 13, 13), (9, "#fff", 0, 0), ]  发表于 2023-7-16 00:59
文字阴影有两种做法,一种是我的答案里的。用另外一个颜色的字,垫在下面,有少许位移。  发表于 2023-7-16 00:59
1. outline是描边,可以去看看文档,有讲。 2. 这两个其实说起来没有区别。可能是用在不同地方。 3. add是增加一个图片,也可以增加背景图。  发表于 2023-7-16 00:52
回复 支持 抱歉

使用道具 举报

发表于 2023-7-24 22:53:05 | 显示全部楼层
怎么有人第三周还在交第一周的作业啊(悲)
主界面:
[RenPy] 纯文本查看 复制代码
screen main_menu():

    tag menu ## 此语句可确保替换掉任何其他菜单界面。

    add gui.main_menu_background #背景图

    text "DATING SIM!":
        size 100
        color "#D29CB2"
        font "GILLUBCD.TTF"
        xalign 0.5
        yalign 0.4
        outlines [(0, "#00000030", 0, 20), (8, "#FFFFFF",0, 0)] #阴影&描边(宽度,色号与透明度,横轴偏移,纵轴偏移)

    text "UIPACK":
        size 70
        color "#83C3FA"
        font "GILLUBCD.TTF"
        xalign 0.58
        yalign 0.51
        outlines [(0, "#00000030", 0, 20), (8, "#FFFFFF",0, 0)]

    button:
        text "START NEW GAME":
            xalign 0.5
            yalign 0.5
        xysize(594,148) #不规定xysize的话底图就会向右偏移,原因不明x
        xalign 0.5
        yalign 0.64
        background "gui/ReplyBtn.png"
        hover_background "gui/ReplyBtnPressed.png"
        action Start()

    button:
        text "CHECK MESSAGES":
            xalign 0.5
            yalign 0.5
        xysize(594,148)
        xalign 0.5
        yalign 0.74
        background "gui/ReplyBtn.png"
        hover_background "gui/ReplyBtnPressed.png" #没有做action,所以hover不生效

    button:
        text "CHARACTERS":
            xalign 0.5
            yalign 0.5
        xysize(594,148)
        xalign 0.5
        yalign 0.84
        background "gui/ReplyBtn.png"
        hover_background "gui/ReplyBtnPressed.png"

    imagebutton:
        foreground Image("gui/Settings.png", xalign=0.5, yalign=0.5)
        idle "gui/GreenBtn.png"
        hover "gui/GreenBtnPressed.png"
        xalign 1.0
        yalign 1.0
        action ShowMenu('preferences')
        #完全不清楚button和imagebutton之间有什么不同总之两种都试试看……


确认界面:
[RenPy] 纯文本查看 复制代码
screen confirm(message, yes_action, no_action):

    ## 显示此界面时,确保其他界面无法输入。
    modal True
    zorder 200

    add "gui/overlay/confirm.png"

    frame:
        xalign .5
        yalign .5
        xysize(894,507)
        background "gui/ExitPopup/PopUpContainer.png"

        vbox:
            xalign .5
            yalign .5
            spacing 60

            text _("ARE YOU SURE TO QUIT?"):    #弹出框内文本属性
                size 40
                color "#081451"
                xalign 0.5
                font "COOPBL.ttf"

            hbox:
                xalign 0.5
                spacing 150

                button: #确定按钮
                    background "gui/ExitPopup/BlueBtn.png"
                    hover_background "gui/ExitPopup/BlueBtnPressed.png"
                    xysize(286,161)
                    text _("YES"):
                        align (0.5,0.5)
                        font "COOPBL.ttf"
                        color "#FFFFFF"
                    action yes_action

                button: #取消按钮
                    background "gui/ExitPopup/RedBtn.png"
                    hover_background "gui/ExitPopup/RedBtnPressed.png"
                    xysize(286,161)
                    text _("NO"):
                        align (0.5,0.5)
                        font "COOPBL.ttf"
                        color "#FFFFFF"
                    action no_action

    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action


1.png
2.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-24 23:00:07 | 显示全部楼层
编程好难qwq 发表于 2023-7-24 22:53
怎么有人第三周还在交第一周的作业啊(悲)
主界面:

一丢丢疑问:
(1)不知道为什么如果不规定button的大小,那么button中使用的background图片及时规定了xalign 0.5也不能够正确居中,而是会往右下偏移一些。
(2)button和imagebutton有哪些差异呢(似乎button下只能用background与hover_background,但是imagebutton下对应的是idle和hover??)?在制作按钮的时候应该怎样判断选用哪一种更好?
回复 支持 抱歉

使用道具 举报

 楼主| 发表于 2023-7-25 04:50:08 | 显示全部楼层
编程好难qwq 发表于 2023-7-24 23:00
一丢丢疑问:
(1)不知道为什么如果不规定button的大小,那么button中使用的background图片及时规定了xa ...

(1)button的大小一定要规定,要不然整体做界面可能有各种问题。
(2)button非常好,可以制作各种复杂按钮,
回复 支持 抱歉

使用道具 举报

发表于 2023-7-25 11:26:48 | 显示全部楼层
blackpineapple 发表于 2023-7-25 04:50
(1)button的大小一定要规定,要不然整体做界面可能有各种问题。
(2)button非常好,可以制作各种复杂 ...

明白了,感谢
回复 支持 抱歉

使用道具 举报

发表于 2023-7-30 10:25:33 | 显示全部楼层
本帖最后由 墨曲缘 于 2023-7-30 10:28 编辑

[mw_shl_code=renpy,true]## 标题菜单屏幕 ######################################################################
##
## 用于在 Ren'Py 启动时显示标题菜单。
##
## https://doc.renpy.cn/zh-CN/screen_special.html#main-menu

screen main_menu():

    ## 此语句可确保替换掉任何其他菜单屏幕。
    tag menu


    add "ai"


    vbox:
        align(0.5, 0.63)
        imagebutton:
            idle_foreground Text("START NEW GAME", xalign = 0.5, yalign = 0.5 )
            hover_foreground Text("START NEW GAME", xalign = 0.5, yalign = 0.5)
            idle "button"
            hover "button"
            action Start()

    vbox:
        align(0.5, 0.74)
        imagebutton:
            idle_foreground Text("CHECK MESSAGES", xalign = 0.5, yalign = 0.5)
            hover_foreground Text("CHECK MESSAGES", xalign = 0.5, yalign = 0.5)
            idle "button"
            hover "button"
            action ShowMenu("load")

    vbox:
        align(0.5, 0.86)
        imagebutton:
            idle_foreground Text("CHARACTERS", xalign = 0.5, yalign = 0.5)
            hover_foreground Text("CHARACTERS", xalign = 0.5, yalign = 0.5)
            idle "button"
            hover "button"
            action Quit(confirm=not main_menu)

    button:
        align(1.0,1.0)
        xysize(286,161)
        add "2" xalign 0.5 yalign 0.5 zoom 0.5
        idle_background "0"
        hover_background "0"
        action Show("preference")
    frame:
        align(0.5,0.4)
        background None
        xysize(584,200)
        vbox:
                spacing -20
                text "DATING SIM!" size 100
        vbox:
                at right
                text "UIPACK" size 80

screen confirm(message, yes_action, no_action):

    modal True
    zorder 200

    frame:

        align(0.5,0.5)
        xysize(894,507)
        background "k"

    vbox:
            align(0.5,0.5)
            spacing 50
            style_prefix "4"
            imagebutton:
                idle "4"
                hover "4"
                foreground Text("YES",xalign=0.5,yalign=0.5)
                action yes_action
            imagebutton:
                idle "4"
                hover "4"
                foreground Text("NO",xalign=0.5,yalign=0.5)
                action NO_action


回复 支持 抱歉

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|RenPy中文空间 ( 苏ICP备17067825号|苏公网安备 32092302000068号 )

GMT+8, 2024-12-21 23:42 , Processed in 0.108704 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表