找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2306|回复: 22

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

[复制链接]
发表于 2023-7-9 12:56:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
本帖最后由 blackpineapple 于 2023-7-15 00:13 编辑

2023年暑假界面班通知

https://www.renpy.cn/forum.php?mod=viewthread&tid=1389&extra=page%3D1


第一周

界面美术文件请见暑假班通知,或者群下载。

主界面

jqBFeO.jpg

确认界面
s_Ggul.jpg
(只做确认界面,不做确认界面下面的部分)

请大家于本周(07/09 - 07/15)写作业并且在下面交作业。请使用论坛添加代码的功能。不懂的问题可以在群里询问。
周末我会编辑主贴发布答案。

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

screen main_menu():

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

    add "gui/main_menu/HomeScreenBackground.jpg"

    ## 文字阴影
    text "Dating Sim!":
        size 100
        color "#d19dbc90"
        font "fonts/theboldfont.ttf"
        xalign 0.5
        ypos 445
        xoffset 10
        anchor (0.5, 0.5)

    text "Dating Sim!":
        size 100
        color "#ebabd4"
        font "fonts/theboldfont.ttf"
        outlines [(9, "#fff", 0, 0)]
        xalign 0.5
        ypos 426
        anchor (0.5, 0.5)

    ## 文字阴影
    text _("UI PACK"):
        size 66
        color "#d19dbc90"
        font "fonts/theboldfont.ttf"
        pos (1095, 530)
        anchor (0.5, 0.5)

    text _("UI PACK"):
        size 66
        color "#76acd7"
        font "fonts/theboldfont.ttf"
        outlines [(6, "#fff", 0, 0)]
        pos (1085, 517)
        anchor (0.5, 0.5)

    vbox:
        ## 原美术素材带的透明部分实在太多,正常应该裁剪好
        spacing -18
        xalign 0.5
        ypos 615
        style_prefix "main_menu"
        
        button:
            text _("START NEW GAME"):
                style "main_menu_button_text"
            action Start()

        button:
            text _("CHECK MESSAGES"):
                style "main_menu_button_text"
            action NullAction()

        button:
            text _("CHARACTERS"):
                style "main_menu_button_text"
            action NullAction()

    button:
        background "gui/main_menu/GreenBtn.png"
        hover_background "gui/main_menu/GreenBtnPressed.png"
        pos (1767, 1008)
        anchor (0.5, 0.5)
        xysize (286, 161)
        add "gui/main_menu/Settings.png":
            xysize (64, 64)
            align (0.5, 0.5)
        action NullAction()

style main_menu_button:
    background "gui/main_menu/Button.png"
    hover_background "gui/main_menu/ButtonPressed.png"
    
    xysize (589, 124)

style main_menu_button_text:
    size 40
    color "#44527d"
    font "fonts/theboldfont.ttf"
    xalign 0.5
    yoffset 8


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

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

    zorder 200

    add "gui/overlay/confirm.png"

    frame:
        xalign .5
        yalign .5
        xysize (913, 488)
        background "gui/confirm/TextContainer.png"
       
        vbox:
            xalign .5
            yalign .5
            spacing 45

            text _(message):                
                size 47
                color "#44527d"
                xalign 0.5
                ## 应设定字体但是下面字体没有中文
                ## 会导致中文显示不出来
                #font "fonts/theboldfont.ttf"

            hbox:
                spacing 50

                button:
                    background "gui/confirm/BlueBtn.png"
                    hover_background "gui/confirm/BlueBtnPressed.png"
                    xysize (286, 161)
                    text _("确定"):
                        align (0.5, 0.5)

                    action yes_action

                button:
                    background "gui/confirm/RedBtn.png"
                    hover_background "gui/confirm/RedBtnPressed.png"
                    xysize (286, 161)
                    text _("取消"):
                        align (0.5, 0.5)

                    action no_action

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





Screenshot 2023-07-14 at 9.10.27 AM.png Screenshot 2023-07-14 at 9.10.14 AM.png


发表于 2023-7-10 16:03:53 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
###主界面
screen main_menu():

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

    add gui.main_menu_background at truecenter

    imagebutton xalign 1.0 yalign 1.0:
        idle "gui/button/settings.png"
        hover "gui/button/SettingsPressed.png"
    vbox xalign 0.5 yalign 0.84:
        spacing -40
        imagebutton :
            idle "gui/button/newgame.png"
            action Start()

        imagebutton:
            idle "gui/button/message.png"

        imagebutton:
            idle "gui/button/character.png"
            action Quit(confirm=not main_menu)

###确认界面
screen confirm(message, yes_action, no_action):

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

    zorder 200

    style_prefix "confirm"

    add "gui/overlay/confirm.png"
    image "gui/overlay/PopUpContainer.png" at truecenter
    vbox:
        xalign .5
        yalign .5
        spacing 45

        label _(message):
            style "confirm_prompt"
            xalign 0.5
        hbox:
                xalign 0.5
                spacing 150
                imagebutton:
                    idle "gui/button/yes.png"
                    hover "gui/button/YesPressed.png"
                    action yes_action
                imagebutton:
                    idle "gui/button/no.png"
                    hover "gui/button/NoPressed.png"
                    action no_action



                               
登录/注册后可看大图

差不多就是这样吧?
confirm.png

字体随便找了一个相像的

字体随便找了一个相像的
回复 支持 抱歉

使用道具 举报

发表于 2023-7-10 21:43:07 | 显示全部楼层
本帖最后由 若见的我 于 2023-7-13 23:20 编辑

尝试一下最大化的代码还原实现
1、重复的属性写在样式里,多次复用,删除了用不到的样式
2、不知道为啥用imagebutton时zoom不生效,最后全都换成button了

[RenPy] 纯文本查看 复制代码
screen main_menu():

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

    add "gui_new/main_menu/HomeScreenBackground.jpg" at truecenter
   
    style_prefix "main_menu"

    vbox:

        align   (0.5,0.7)
        vbox:
            spacing -20
            add Text("dating sim!", size = 110, color = "#ECABD3", style = "main_menu_title" )
            add Text("UI PACK",  size = 70, color = "#76AFDB", style = "main_menu_title" ) at right
        spacing 80
        vbox:
            spacing 50
            button :
                idle_background   Image("gui_new/main_menu/Button.png", style = "main_menu_image")  
                hover_background  Image("gui_new/main_menu/ButtonPressed.png", style = "main_menu_image")
                text("START NEW GAME")
                action Start()
            button :
                idle_background   Image("gui_new/main_menu/Button.png", style = "main_menu_image")  
                hover_background  Image("gui_new/main_menu/ButtonPressed.png", style = "main_menu_image")
                text("CHECK MESSAGES")
                action ()
            button :
                xalign   0.5  # 不居中会左偏,不知原因
                idle_background   Image("gui_new/main_menu/Button.png", style = "main_menu_image")  
                hover_background  Image("gui_new/main_menu/ButtonPressed.png", style = "main_menu_image")
                text("CHARACTERS")
                action ()
    button:
        align(1.0, 1.0)
        xysize(286,161)
        idle_background "gui_new/main_menu/GreenBtn.png"
        hover_background "gui_new/main_menu/GreenBtnPressed.png"
        add Image("gui_new/main_menu/Settings.png", style = "main_menu_image") zoom 0.5 
        action ()



style main_menu_vbox is vbox
style main_menu_text is gui_text

style main_menu_vbox:
    align   (0.5,0.5)
    xmaximum 1200

style main_menu_text:
    properties gui.text_properties("main_menu", accent=True)
    align   (0.5,0.5)
    font    "gui_new/main_menu/theboldfont.ttf"
    size    40
    color   "#58597C"

style main_menu_title:
    align   (0.5,0.5)
    font    "gui_new/main_menu/theboldfont.ttf"
    outlines [ (6, "#fff", 0, 0) ]

style main_menu_image:
    align   (0.5,0.5)







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

    ## 显示此屏幕时,确保其他屏幕无法输入。
    modal True

    zorder 200

    frame style "confirm_frame":
        vbox:
            align(0.5,0.2)
            text(message)  style "confirm_prompt_text" 
        hbox:
            align(0.5,0.7)
            spacing 100

            button:
                xsize 200
                ysize 150
                idle_background   Image("gui_new/confirm/BlueBtn.png", style = "confirm_button_image" )  
                hover_background  Image("gui_new/confirm/BlueBtnPressed.png", style = "confirm_button_image" )
                text _("YES") style "confirm_button_text"
                action yes_action
            button:
                xsize 200
                ysize 150
                idle_background   Image("gui_new/confirm/RedBtn.png", style = "confirm_button_image" )  
                hover_background  Image("gui_new/confirm/RedBtnPressed.png", style = "confirm_button_image" )
                text _("NO")  style "confirm_button_text"
                action no_action
    
    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action



style confirm_frame is gui_frame
style confirm_prompt_text is gui_prompt_text
style confirm_button_text is gui_medium_button_text

style confirm_frame:
    background Frame(["gui_new/confirm/TextContainer.png"], gui.confirm_frame_borders, tile=gui.frame_tile)
    padding gui.confirm_frame_borders.padding
    align(0.5,0.5)
    xysize(825,440)

style confirm_prompt_text:
    # font "gui_new/main_menu/theboldfont.ttf" # 无中文字体
    color "#44517F"
    size 38
    bold True
    layout "subtitle"

style confirm_button_text:
    properties gui.button_text_properties("confirm_button")
    align(0.5,0.5)
    font "gui_new/main_menu/theboldfont.ttf"
    color "#fff"

style confirm_button_image:
    align(0.5,0.5)






main_menu

main_menu

confirm

confirm
回复 支持 抱歉

使用道具 举报

发表于 2023-7-11 23:10:06 | 显示全部楼层
本帖最后由 zxc 于 2023-7-11 23:19 编辑

浅浅发表一下作业吧,代码如下,效果图更帖:
[RenPy] 纯文本查看 复制代码
screen main_menu():
    tag menu
    add "background"
    vbox:
        spacing -40
        style_prefix "main_style"
        align(0.5,0.8)
        button:
            idle_background "button"
            hover_background "buttonpressed"
            text "START NEW GAME"
            action Start()
        button:
            idle_background "button"
            hover_background "buttonpressed"
            text "CHECK MESSAGES"
            action Show("CheckMessages")
        button:
            text "CHAEACTERS"
            idle_background "button"
            hover_background "buttonpressed"
            action Show("ChaeActers")
    button:
        align(1.0,1.0)
        xysize(286,161)
        add "settings" xalign 0.5 yalign 0.5 zoom 0.5
        idle_background "greenbtn"
        hover_background "greenbtnpressed"
        action Show("preferences")
    frame:
        align(0.5,0.4)
        background None
        xysize(584,200)
        vbox:
            spacing -20
            style_prefix "main_style"
            text "DATINGSIM!" size 86 color "#c774c0"
            text "UIPACK" size 54 color "#4cadd3" xalign 1.0
style main_style_text:
    outlines [(5, "#FFF", 0, 0)]
    xalign 0.5
    yalign 0.5
    color "#000"
    bold True
style main_style_button:
    xysize(584,133)
    align(0.5,0.5)


screen confirm(message, yes_action, no_action):
    modal True
    zorder 200
    frame:
        align(0.5,0.5)
        xysize(894,507)
        background "popupcontainer"
        vbox:
            align(0.5,0.5)
            spacing 50
            style_prefix "confirm"
            text message size 54
            hbox:
                spacing 100
                style_prefix "confirm"
                imagebutton:
                    idle "bluebtn"
                    hover "bluebtnpressed"
                    foreground Text("{b}YES",xalign=0.5,yalign=0.5)
                    action yes_action
                imagebutton:
                    idle "redbtn"
                    hover "redbtnpressed"
                    foreground Text("{b}NO",xalign=0.5,yalign=0.5)
                    action no_action
style confirm_text:
    color "#000"
    outlines[(2,"#FFF",0,0)]
    align(0.5,0.5)
    bold True








main.jpg
confirm.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-12 15:39:46 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
screen title_button():
    
    vbox:
        xalign 0.5
        yalign 0.45
        first_spacing  -15
        text "DATING SIM!":
            size 110 
            color"#fdcad8ff"
            outlines [ (absolute(0), "#00000019", absolute(0), absolute(15)),(absolute(8), "#ffffff", absolute(0), absolute(0)) ]
            font "../THEBOLDFONT.ttf"
        text "UI PACK":
            xalign 1.0
            size 70 
            color"#45a0c2ff"
            font "../THEBOLDFONT.ttf"
            outlines [(absolute(0), "#00000019", absolute(0), absolute(15)), (absolute(9), "#ffffff", absolute(0), absolute(0)) ]
   
    vbox:
        xalign 0.5
        yalign 0.8
        spacing  -30
        button:
            xysize (584, 133)
            background "gui/Button.png"
            hover_background "gui/ButtonPressed.png"
            text "START NEW GAME":
                size 50
                xalign 0.5
                yalign 0.6
                color"#05668aff"
                font "../Roboto-Bold.ttf"
            action Start()
        button:
            xysize (584, 133)
            background "gui/Button.png"
            hover_background "gui/ButtonPressed.png"
            text "CHECK MESSAGES":
                size 50
                xalign 0.5
                yalign 0.6
                font "../Roboto-Bold.ttf"
                color"#05668aff"
            action Start()
        button:
            xysize (584, 133)
            background "gui/Button.png"
            hover_background "gui/ButtonPressed.png"
            text "CHARACTERS":
                size 50
                xalign 0.5
                yalign 0.6
                font "../Roboto-Bold.ttf"
                color"#05668aff"
            action Quit(True)
    button:
            xalign 1.0
            yalign 1.0
            xysize (286,161)
            background "green"
            hover_background "greenp"
            action ShowMenu('preferences')

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 40

            label _(message):
                style "confirm_prompt"
                xalign 0.5

            hbox:
                xalign 0.5
                spacing 100
                button:
                    xpos -0.5
                    xysize (200, 100)
                    background "gui/BlueBtn.png"
                    hover_background "gui/BlueBtnPressed.png"
                    text "YES":
                        size 40
                        xalign 0.9
                        yalign 1.2
                        color"#ffffffff"
                        font "../Roboto-Bold.ttf"
                    action yes_action
                button:
                    xysize (200, 100)
                    background "gui/RedBtn.png" 
                    hover_background "gui/RedBtnPressed.png"
                    text "NO":
                        size 40
                        xalign 0.9
                        yalign 1.2
                        color"#ffffffff"
                        font "../Roboto-Bold.ttf"
                    action no_action



还是感觉越看越不对劲


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

使用道具 举报

发表于 2023-7-13 00:15:05 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
    add "gui/HomeScreenB.jpg"
    text _("暑假作业") align (0.5, 0.35) size 200 color "#ebabd4" outlines [ (absolute(4), "#fff", absolute(0), absolute(0)) ]
    vbox:
        xalign 0.5
        yalign 0.9
        imagebutton idle "images/main/Button.png" hover "images/main/ButtonPressed.png" action Start() pos(0,-10) hover_sound "audio/hover.ogg" activate_sound "audio/activate.ogg"
        imagebutton idle "images/main/load_Button.png" hover "images/main/load_ButtonPressed.png" action ShowMenu("load") pos(0,-41)  hover_sound "audio/hover.ogg" activate_sound "audio/activate.ogg"
        imagebutton idle "images/main/out_Button.png" hover "images/main/out_ButtonPressed.png" action Quit(confirm=not main_menu) pos(0,-68) hover_sound "audio/hover.ogg" activate_sound "audio/activate.ogg"
    imagebutton idle "images/main/set.png" hover "images/main/set2.png" action ShowMenu("preferences") pos (1623, 929) hover_sound "audio/hover.ogg" activate_sound "audio/activate.ogg"


简单做了一下,感觉代码写的很勉强
2.png
1_压缩后.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-13 12:21:31 | 显示全部楼层
本帖最后由 arik 于 2023-7-14 10:48 编辑

大体上实现了(也许)…
[RenPy] 纯文本查看 复制代码
## 标题菜单屏幕 ######################################################################
##
## 用于在 Ren'Py 启动时显示标题菜单。
##
## [url=https://doc.renpy.cn/zh-CN/screen_special.html#main-menu]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 "gui/DatingGameUI/theboldfont.ttf"
style HomeScreen_title_text:
    align (0.5,0.5)
    size 110
    color "#ebacd5"
    font "gui/DatingGameUI/theboldfont.ttf"
    outlines[(10, "#ffffff", 0, 0)]
    
style HomeScreen_title_text_bottom:
    align (0.5,0.5)
    size 80
    color "#ebacd5"
    font "gui/DatingGameUI/theboldfont.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("gui/DatingGameUI/Exports/Icons/Settings.png",zoom = 0.45,xpos = 115,ypos = 51)

screen main_menu():
    
    tag menu
    add "gui/DatingGameUI/Exports/HomeScreen/HomeScreenBackground.jpg"
    vbox:
        xalign 0.5
        yalign 0.42
        imagebutton:
            idle"gui/DatingGameUI/Exports/HomeScreen/touming.png"
            foreground "title"
        text "UI PACK" style "HomeScreen_title_text_bottom" pos(0.70,0.37) 
    vbox:
        xalign 0.5
        yalign 0.82
        spacing -30
        imagebutton:
            idle"gui/DatingGameUI/Exports/HomeScreen/Button.png"
            hover"gui/DatingGameUI/Exports/HomeScreen/ButtonPressed.png"
            foreground "start_new_game_button_text"
            action Start()
        imagebutton:
            idle"gui/DatingGameUI/Exports/HomeScreen/Button.png"
            hover"gui/DatingGameUI/Exports/HomeScreen/ButtonPressed.png"
            foreground "check_messages"
            action ShowMenu("load")
        imagebutton:
            idle"gui/DatingGameUI/Exports/HomeScreen/Button.png"
            hover"gui/DatingGameUI/Exports/HomeScreen/ButtonPressed.png"
            foreground "characters"
            action ShowMenu("preferences")
    vbox:
        align(1.0, 1.0)
        imagebutton:
            idle "gui/DatingGameUI/Exports/GreenBtn.png"
            foreground "setting_icon"
            hover"gui/DatingGameUI/Exports/GreenBtnPressed.png"
            action Quit(confirm = True)



[RenPy] 纯文本查看 复制代码
## 确认屏幕 ########################################################################
##
## 当 Ren'Py 需要询问用户有关确定或取消的问题时,会调用确认屏幕。
##
## [url=https://doc.renpy.cn/zh-CN/screen_special.html#confirm]https://doc.renpy.cn/zh-CN/screen_special.html#confirm[/url]
style myConfirm:
    font "gui/DatingGameUI/theboldfont.ttf"
    size 40
    align (0.5, 0.5)
    color "#66507f"
style exit_text:
    font "gui/DatingGameUI/theboldfont.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 0.75
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.5,1.0)
            text "WANT TO QUIT?" style "myConfirm" pos(0.5,0.1)

            hbox:
                spacing 45
                imagebutton:
                    idle"gui/DatingGameUI/Exports/ExitPopup/BlueBtn.png"
                    hover"gui/DatingGameUI/Exports/ExitPopup/BlueBtnPressed.png"
                    foreground "YES_text" 
                    at exit_trans
                    action yes_action
                imagebutton:
                    idle"gui/DatingGameUI/Exports/ExitPopup/redBtn.png"
                    hover"gui/DatingGameUI/Exports/ExitPopup/redBtnPressed.png"
                    foreground "NO_text" 
                    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", "gui/DatingGameUI/Exports/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:
    textalign 0.5
    layout "subtitle"

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

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



DH5QQ9YUFI6U}6C{0V2D3(M.png D0BQ%UD70RI5)LH`}T)0A5V.png


回复 支持 抱歉

使用道具 举报

发表于 2023-7-13 15:29:30 | 显示全部楼层
非常勉强地写出来了……!另外为了出错的时候好回顾,我很少删除掉rpy自带的代码

[RenPy] 纯文本查看 复制代码
screen main_menu():
    ## 此语句可确保替换掉任何其他菜单界面。
    tag menu

    #add gui.main_menu_background
    add "gui/HomeScreenBackground.jpg"
    
    frame:
        background None
        align(0.57, 0.4)
        xysize(800,180)

        vbox:
            spacing -45

            text "DATING SIM!":
                kerning -4
                size 100 
                color "#eeaad1" 
                bold True 
                outlines [(0, "#00000020", 0, 18), (10, "#ffffff",0, 0)]

            text "UI PACK": 
                xalign 1.0
                kerning -4
                size 70 
                color "#72aed2" 
                bold True 
                outlines [(0, "#00000020", 0, 18), (10, "#ffffff",0, 0)]

    ## 此空框可使标题菜单变暗。
    ##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"
    
    vbox:
        xalign 0.5
        yalign 0.83
        spacing -50

        button:
            align (0.5, 0.5)
            
            text "START NEW GAME" style "miki_title_button"
            idle_background "gui/button/Button.png"
            hover_background "gui/button/ButtonPressed.png"
            xpadding 90
            ypadding 50

            action Start()

        #textbutton _("START NEW GAME") action Start()

        button:
            align (0.5, 0.5)
            
            text "CHECK MESSAGE" style "miki_title_button"
            idle_background "gui/button/Button.png"
            hover_background "gui/button/ButtonPressed.png"
            xpadding 100
            ypadding 50

            action Start()

        #textbutton _("CHECK MESSAGE") action None

        button:
            align (0.5, 0.5)   

            text "CHARACTERS" style "miki_title_button"
            background "gui/button/Button.png"
            hover_background "gui/button/ButtonPressed.png"
            xpadding 140
            ypadding 50

            action Start()

        #textbutton _("CHARACTERS") action None

    button:
        xalign 0.985
        yalign 1.0

        add "gui/Settings.png" zoom 0.5
        idle_background "gui/button/GreenBtn.png"
        hover_background "gui/button/GreenBtnPressed.png"
        xpadding 100
        ypadding 50

        action ShowMenu("preferences")

       #textbutton _("开始游戏") action ShowMenu("preferences")
        

style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text

style main_menu_frame:
    xsize 420
    yfill True

    background " "

style main_menu_vbox:
    xalign 1.0
    xoffset -30
    xmaximum 1200
    yalign 1.0
    yoffset -30

style main_menu_text:
    properties gui.text_properties("main_menu", accent=True)

style main_menu_title:
    properties gui.text_properties("title")

style main_menu_version:
    properties gui.text_properties("version")

style miki_title_button:
    align(0.5, 0.5)
    font "theboldfont.ttf"
    size 50
    color "#3d537c"


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

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

    zorder 200

    style_prefix "confirm"

    frame:
        vbox:
            xalign 0.5
            yalign 0.15

            text "ARE YOU SURE YOU" style "miki_title_button"
            text "WANT TO QUIT?" style "miki_title_button"

        background "gui/overlay/PopUpContainer.png"
        align (0.5, 0.5)
        xysize (894, 507)

        vbox:
            xalign .5
            yalign 0.9
            spacing 45

            label _(message):
                style "confirm_prompt"
                xalign 0.5

            hbox:
                xalign 0.5
                yalign 0.8
                spacing 150

                #textbutton _("确定") action yes_action
                #textbutton _("取消") action no_action

                button:
                    
                    text "YES" style "miki_confirm_button"
                    idle_background "gui/button/BlueBtn.png"
                    hover_background "gui/button/BlueBtnPressed.png"
                    xpadding 100
                    ypadding 60

                    action yes_action

                button:
                    
                    text "NO" style "miki_confirm_button"
                    idle_background "gui/button/RedBtn.png"
                    hover_background "gui/button/RedBtnPressed.png"
                    xpadding 100
                    ypadding 60

                    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", "gui/frame.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")

style miki_confirm_button:
    align(0.5, 0.5)
    font "theboldfont.ttf"
    size 50
    color "#ffffff"    


1.jpg
回复 支持 抱歉

使用道具 举报

发表于 2023-7-14 14:51:23 来自手机 | 显示全部楼层
本帖最后由 blackpineapple 于 2023-7-14 23:59 编辑


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

screen main_menu():

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



    ##替换标题界面
    add "gui/game_menu_bg.png"

    ##增加按钮
    vbox:
        align(0.5,0.9)

        imagebutton:
            idle 'gui/button/start_button.png'
            hover 'gui/button/button_pressed.png'
            action Start()

        imagebutton:
            idle 'gui/button/start_button.png'
            hover 'gui/button/button_pressed.png'
            action ShowMenu("load")


        imagebutton:
            idle 'gui/button/start_button.png'
            hover 'gui/button/button_pressed.png'
            action ShowMenu("about")

    vbox:
        spacing 75
        align(0.5,0.85)
        textbutton _("START NEW GAME")
        textbutton _("CHECK MESSAGES")
        textbutton _("CHARACTERS")


    vbox:
        align(0.99,0.99)
        imagebutton:
            idle 'gui/button/green_btn.png'
            hover 'gui/button/green_btn_pressed.png'
            action ShowMenu("preferences")

    vbox:
        align(0.94,0.95)
        imagebutton:
            idle 'gui/button/settings.png'



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

screen confirm(message, yes_action, no_action):

    ## 显示此屏幕时,确保其他屏幕无法输入。
    modal True

    zorder 200

    add "gui/overlay/confirm.png"

    frame:
        background "gui/overlay/popupcontainer.png"
        xalign .5
        yalign .5
        xysize (550,400)

        vbox:
            xalign .5
            yalign .5
            spacing 100

            text _("ARE YOU SURE YOU WANT TO QUIT?"):
                layout "subtitle"
                color "#000066"
                size 40
                xalign 1.8
                yalign 4.6

            hbox:
                xalign 4.3
                yalign 3.2
                spacing 180
                yoffset 10

                button:
                    background "gui/button/blue_btn.png"
                    hover_background "gui/button/blue_btn_pressed.png"
                    xysize (150,70)
                    text _("YES"):
                        align (1.2,2.7)
                        color "#ffffff"
                    action yes_action

                button:
                    background "gui/button/red_btn.png"
                    hover_background "gui/button/red_btn_pressed.png"
                    xysize (150,70)
                    text _("NO"):
                        align (1.2,2.7)
                        color "#ffffff"
                    action no_action

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

点评

我帮你编辑了下你的帖子,增加了插入代码,这样就可以有代码高亮显示了。  发表于 2023-7-14 23:59
回复 支持 抱歉

使用道具 举报

发表于 2023-7-14 15:54:23 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
label main_menu:
    return


label start:
    show screen background
    pause
    jump start
    return

screen background():
    add "gui/Background.png"

    button:
        idle_background "gui/button/button1.png"
        hover_background "gui/button/button1Pressed.png"
        action [None]

        focus_mask True

    button:
        idle_background "gui/button/button2.png"
        hover_background "gui/button/button2Pressed.png"
        action [None]

        focus_mask True

    button:
        idle_background "gui/button/button3.png"
        hover_background "gui/button/button3Pressed.png"
        action [None]

        focus_mask True

    button:
        idle_background "gui/button/settingbutton.png"
        hover_background "gui/button/settingbuttonPressed.png"
        action [None]

        focus_mask True

screen confirm(message, yes_action, no_action):
 
    ## 显示此界面时,确保其他界面无法输入。
    modal True
 
    zorder 200
 
    style_prefix "confirm"
 
    add "gui/overlay/confirm.png"
    frame:
 
            label _(message):
                style "confirm_prompt"

            hbox:
              
                button:
                
                
                    background "gui/button/bluebutton.png"
                    hover_background "gui/button/bluebuttonPressed.png"
                    text "YES":
                        size 40
                    action yes_action
                button:
                
                    background "gui/button/redbutton.png"
                    hover_background "gui/button/redbuttonPressed.png"
                    text "NO":
                        size 40
                    action no_action[mw_shl_code=renpy,true]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 "你确定要离开吗?" pos(0.35,1.0)

            hbox:
                spacing 45
                imagebutton:
                    idle"gui/button/bluebutton.png"
                    hover"gui/button/bluebuttonPressed.png"
                    action yes_action
                    focus_mask True

                imagebutton:
                    idle"gui/button/redbutton.png"
                    hover"gui/button/redbuttonPressed.png"
                    action no_action
                    focus_mask True

    ## 右键点击退出并答复 no(取消)。
    key "game_menu" action no_action
[/mw_shl_code]
回复 支持 抱歉

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-24 13:50 , Processed in 0.135809 second(s), 29 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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