找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1412|回复: 12

[课堂] 【2023暑假界面】第二周 (对话框)

[复制链接]
发表于 2023-7-17 10:39:04 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 blackpineapple 于 2023-7-29 12:47 编辑

2023年暑假界面班通知

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



第二周


Screenshot 2023-07-16 at 7.36.13 PM.png


本周作业答案。我没有做上面那个蓝色的按钮,因为感觉不明所以,制作请参考那个绿色的按钮。我也没做绿色的按钮,按钮请参考第一周作业。


script 文件写法
[RenPy] 纯文本查看 复制代码
define e = Character("Bob")

label start:

    scene bg 

    show bob at right

    menu:
        e "Hey! I didn’t know you were going to be here today!"
        "Me Either!":
            pass
        "I wasn't supposed to be":
            pass


    return



say界面
[RenPy] 纯文本查看 复制代码
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who":
                    color "#ebabd4"
                    font "fonts/theboldfont.ttf"
                    size 72
                    yoffset -80
                    xoffset -300

        frame:
            background Solid("#0ff0")
            xysize (1760, 200)
            pos (80, 10)
            text what id "what":
                color "#44527d"
                font "fonts/theboldfont.ttf"
                align (0, 0)


    ## If there's a side image, display it above the text. Do not display on the
    ## phone variant - there's no room.
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0


## Make the namebox available for styling through the Character object.
init python:
    config.character_id_prefixes.append('namebox')

style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label


style window:
    xalign 0.5
    xfill True
    yoffset 550
    ysize gui.textbox_height

    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos gui.name_xpos
    xanchor gui.name_xalign
    xsize gui.namebox_width
    ypos gui.name_ypos
    ysize gui.namebox_height

    background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    padding gui.namebox_borders.padding

style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos

    adjust_spacing False



choice 界面
[RenPy] 纯文本查看 复制代码
screen choice(items):
    vbox:
        pos (50, 780)
        spacing -50
        for i in items:
            button:
                xysize (594, 148)
                background "gui/choice_bg.png"
                hover_background "gui/choice_bg_hover.png"
                text i.caption:
                    color "#44527d"
                    size 40
                    align (0.5, 0.5)
                    font "fonts/theboldfont.ttf"
                action i.action


Screenshot 2023-07-28 at 9.40.20 PM.png





发表于 2023-7-21 09:40:52 | 显示全部楼层
arik 发表于 2023-7-20 20:53
看上去完成了...
下面是screens.rpy的内容:

有些小问题:

gui.interface_text_font建议用默认字体,避免中文字符不显示的问题。或者用字体组(font group)。

选项按钮由于底图的问题,导致按钮可点击部分互相覆盖,具体表现为“点第一个选项的下半部分会变成选择第二个选项”。可以用focus_mask特性再放个图或函数来控制按钮的实际可交互区域。
[RenPy] 纯文本查看 复制代码
init python:
    def choice_button_area(xoffset, yoffset):
        return (xoffset >= 24 and xoffset <= 569) and (yoffset >= 36 and yoffset <= 113)

screen choice(items):
 
    vbox:
        spacing 35
        for i in items:
            button:
                xysize (950, 60)
                pos (0.05, 800)
                background "gui/DatingGameUI/Exports/Dialogue/ReplyBtn.png"
                hover_background "gui/DatingGameUI/Exports/Dialogue/ReplyBtnPressed.png"
                focus_mask choice_button_area
                hbox:
                    ypos 55
                    xalign 0.2
                    text i.caption
                action i.action



回复 支持 1 抱歉 0

使用道具 举报

发表于 2023-7-20 20:53:06 | 显示全部楼层
看上去完成了...
下面是screens.rpy的内容:

[RenPy] 纯文本查看 复制代码
## 对话屏幕 ########################################################################
##
## 对话屏幕用于向用户显示对话。它需要两个参数,who 和 what,分别是叙述角色的名字
## 和所叙述的文本。(如果没有名字,参数 who 可以是 None。)
##
## 此屏幕必须创建一个 id 为 what 的文本可视控件,因为 Ren'Py 使用它来管理文本显
## 示。它还可以创建 id 为 who 和 id 为 window 的可视控件来应用样式属性。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#say[/url]

screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"
            
        imagebutton:
            pos(0.835,410)
            idle "gui/DatingGameUI/Exports/GreenBtn.png"
            foreground "setting_icon"
            hover"gui/DatingGameUI/Exports/GreenBtnPressed.png"
            action ShowMenu("preferences")
        button:
            background "gui/DatingGameUI/Exports/ExitPopup/BlueBtn.png"
            hover_background "gui/DatingGameUI/Exports/ExitPopup/BlueBtnPressed.png"
            pos (0,-540)
            xysize (286,161)
            add "gui/DatingGameUI/Exports/Icons/BackArrow.png":
                xysize (64, 64)
                align (0.5, 0.5)
            action NullAction()
    ## 如果有对话框头像,会将其显示在文本之上。请不要在手机界面下显示这个,因为
    ## 没有空间。
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0

screen ctc():
    add "texticon" align(0.96,0.73)

image texticon:
    "gui/DatingGameUI/Exports/NextBtn.png"
    pause 0.5
    "gui/DatingGameUI/Exports/NextBtnPressed.png"
    pause 0.5
    repeat



## 通过 Character 对象使名称框可用于样式化。
init python:
    config.character_id_prefixes.append('namebox')

style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label


style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/DatingGameUI/Exports/Dialogue/DialogueContainer.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos gui.name_xpos
    xanchor gui.name_xalign
    xsize gui.namebox_width
    ypos gui.name_ypos
    ysize gui.namebox_height

    background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    padding gui.namebox_borders.padding

style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos

    adjust_spacing False


[RenPy] 纯文本查看 复制代码
## 选择屏幕 ########################################################################
##
## 此屏幕用于显示由 menu 语句生成的游戏内选项。参数 items 是一个对象列表,每个对
## 象都有字幕和动作字段。
##
## [url]https://doc.renpy.cn/zh-CN/screen_special.html#choice[/url]

screen choice(items):

    vbox:
        spacing 35
        for i in items:
            button:
                xysize (950, 60)
                pos (0.05, 800)
                background "gui/DatingGameUI/Exports/Dialogue/ReplyBtn.png"
                hover_background "gui/DatingGameUI/Exports/Dialogue/ReplyBtnPressed.png"
                hbox:
                    ypos 55
                    xalign 0.2
                    text i.caption
                action i.action
           


style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xalign 0.5
    ypos 405
    yanchor 0.5

    spacing gui.choice_spacing

style choice_button is default:
    properties gui.button_properties("choice_button")

style choice_button_text is default:
    properties gui.button_text_properties("choice_button")



gui.rpy瞎改了一些东西:
[RenPy] 纯文本查看 复制代码
################################################################################
## GUI 配置变量
################################################################################


## 颜色 ##########################################################################
##
## 界面中文本的颜色。

## 整个界面中使用的强调色,用于标记和突出显示文本。
define gui.accent_color = '#e2aed2'

## 当文本按钮既未被选中也未被悬停时使用的颜色。
define gui.idle_color = '#888888'

## 小的颜色用于小的文本,需要更亮/更暗才能达到同样的效果。
define gui.idle_small_color = '#aaaaaa'

## 当按钮和滑条被悬停时使用的颜色。
define gui.hover_color = '#66c1e0'

## 当文本按钮被选中但非焦点时使用的颜色。当一个按钮为当前屏幕或设置选项值时,会
## 处于选中状态。
define gui.selected_color = '#ffffff'

## 当文本按钮无法被选择时使用的颜色。
define gui.insensitive_color = '#8888887f'

## 滑条未填充的部分使用的颜色。这些颜色不直接使用,但在重新生成条形图像文件时使
## 用。
define gui.muted_color = '#003d51'
define gui.hover_muted_color = '#005b7a'

## 对话和菜单选择文本使用的颜色。
define gui.text_color = '#283563'
define gui.interface_text_color = '#ffffff'


## 字体和字体大小 #####################################################################

## 游戏内文本使用的字体。
define gui.text_font = "gui/DatingGameUI/theboldfont.ttf"

## 角色名称使用的字体。
define gui.name_text_font = "gui/DatingGameUI/theboldfont.ttf"

## 游戏外文本使用的字体。
define gui.interface_text_font = "gui/DatingGameUI/theboldfont.ttf"

## 普通对话文本的大小。
define gui.text_size = 35

## 角色名称的大小。
define gui.name_text_size = 55

## 游戏用户界面中文本的大小。
define gui.interface_text_size = 33

## 游戏用户界面中标签的大小。
define gui.label_text_size = 36

## 通知屏幕上文本的大小。
define gui.notify_text_size = 24

## 游戏标题的大小。
define gui.title_text_size = 75


## 标题和游戏菜单 #####################################################################

## 标题菜单和游戏菜单使用的图像。
define gui.main_menu_background = "gui/main_menu.png"
define gui.game_menu_background = "gui/game_menu.png"


## 对话 ##########################################################################
##
## 这些变量控制对话如何在屏幕上逐行显示。

## 包含对话的文本框的高度。
define gui.textbox_height = 330

## 文本框在屏幕上的垂直位置。0.0 是顶部,0.5 是居中,1.0 是底部。
define gui.textbox_yalign = 0.7


## 叙述角色名字相对于文本框的位置。可以是从左侧或顶部起的整数像素,或设为 0.5 来
## 居中。
define gui.name_xpos = 70
define gui.name_ypos = -25

## 角色名字的水平对齐方式。0.0 为左侧对齐,0.5 为居中显示,而 1.0 为右侧对齐。
define gui.name_xalign = 0.0

## 包含角色名字的方框的宽度、高度和边框尺寸,或设为 None 来自动确定其大小。
define gui.namebox_width = None
define gui.namebox_height = None

## 包含角色名字的方框的边界尺寸,以左、上、右、下顺序排列。
define gui.namebox_borders = Borders(5, 5, 5, 5)

## 若为 True,则名字框的背景将平铺;若为 False,则名字框的背景将缩放。
define gui.namebox_tile = False


## 对话相对于文本框的位置。可以是相对于文本框从左侧或顶部起的整数像素,或设为
## 0.5 来居中。
define gui.dialogue_xpos = 100
define gui.dialogue_ypos = 75

## 对话文本的最大宽度,以像素为单位。
define gui.dialogue_width = 1116

## 对话文本的水平对齐方式。0.0 为左侧对齐,0.5 为居中显示,而 1.0 为右侧对齐。
define gui.dialogue_text_xalign = 0.0


[RenPy] 纯文本查看 复制代码
## 选项按钮 ########################################################################
##
## 游戏内菜单使用的选项按钮。

define gui.choice_button_width = 1185
define gui.choice_button_height = None
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(150, 8, 150, 8)
define gui.choice_button_text_font = gui.text_font
define gui.choice_button_text_size = gui.text_size
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_idle_color = '#2a3a63'
define gui.choice_button_text_hover_color = "#ffffff"
define gui.choice_button_text_insensitive_color = '#2c3c67'


以下是script.rpy里的内容:

[RenPy] 纯文本查看 复制代码
define e = Character("ROSALINE")

transform chara_pos:
    pos(0.6,160)

label start:
    scene background
    show chara at chara_pos with dissolve
    $ e("HEY! I DIDN'T KONW YOU WERE GOING TO BE HERE TODAY! ",interact=False)
    menu:
        "ME EITHER!":
            jump test_001
        "I WASN'T SUPPOSED TO BE":
            jump test_002

label test_001:
    e "WHAT A COINCIDENCE"
    jump next_001

label test_002:
    e "..."
    jump next_001

label next_001:
    e "BYE"
    "ME" "BYE"
    return


[1UHKJSVL{GD($DRHW59VKJ.png R7@~JG3XC}44}8HA{IL6@49.png

点评

好快啊~  发表于 2023-7-21 08:35
回复 支持 抱歉

使用道具 举报

发表于 2023-7-21 08:59:39 | 显示全部楼层


在screen.rpy里面(话说放到script下面也可以跑呀)

[RenPy] 纯文本查看 复制代码
##定制的datesim选择对话
screen datesim(items):
    # text _(location):
    #     size 80
    #     color "#000000"
    vbox:
        align (0.05, 0.74)
        spacing 1
        for i in items:
            ##按钮
            button:
                xysize(550,100)
                ##背景图选择
                background Frame("gui/button/ReplyBtn.png")
                ##悬浮时的背景图
                #hover_background Frame()
                ##需要判断这个参数是不是在参数列表里
                ##因为不是所有都设置了这个参数
                # if "sale" in i.kwargs and i.kwargs["sale"]:
                #     text "sale":
                #         color "#000"
                #         size 30
                action i.action
                hbox:
                    spacing 1
                    align(0.1,0.5)
                    text i.caption:
                        color "#000"
                        align (0.0, 0.0)
                    
                    #text str(i.args[0])



[RenPy] 纯文本查看 复制代码
## 快捷菜单界面 ######################################################################
##
## 快捷菜单显示于游戏内,以便于访问游戏外的菜单。

screen quick_menu():

    ## 确保该菜单出现在其他界面之上,
    zorder 100

    if quick_menu:
        imagebutton xalign 0.0 yalign 0.0:
            idle  "gui/button/btn4  copy.png"
            action Rollback()
        imagebutton xalign 1.0 yalign 1.0:
            idle "gui/button/settings.png"
            hover "gui/button/SettingsPressed.png"
            action ShowMenu('preferences')
        # hbox:
        #     style_prefix "quick"

        #     xalign 1.0
        #     yalign 1.0

            # textbutton _("回退") action Rollback()
            # textbutton _("历史") action ShowMenu('history')
            # textbutton _("快进") action Skip() alternate Skip(fast=True, confirm=True)
            # textbutton _("自动") action Preference("auto-forward", "toggle")
            # textbutton _("保存") action ShowMenu('save')
            # textbutton _("快存") action QuickSave()
            # textbutton _("快读") action QuickLoad()



###################################

###对话文字的位置修改
[RenPy] 纯文本查看 复制代码
#    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    xpos 70
    yalign 0.1
#    ypos gui.dialogue_ypos




                               
登录/注册后可看大图



下面是script里,关于ctc方面的
[RenPy] 纯文本查看 复制代码
image ctc_blink:
    "images/NextBtn.png"
    align (1.0, 1.0)
    linear 0.5 alpha 1.0
    linear 0.5 alpha 0.0
    repeat
define r=Character("rosaline",who_color = "#f191e3ff",image = "r",
                    what_color="#000000",
                    what_size = 40,who_size = 70,ctc="ctc_blink",ctc_position = "nestled")
image background = "gui/HomeScreenBackground.jpg"
image touchui = "images/touchui.png"
image side r n = "images/i wrongside.png"
label start:
    scene background
    show touchui at right
    r n "test and test and testes"
    menu (screen="datesim"):
        r "zbcdefg"
        "yeeeeees"( ): 
            jump yeeeeees
        "noooooooooo"( ):
            jump noooooooooo

    label yeeeeees:
        r "is yes!"  

    label noooooooooo:
        r  "is not no!"
            
    return






                               
登录/注册后可看大图

还有gui的部分
[RenPy] 纯文本查看 复制代码
## 文本框在屏幕上的垂直位置。0.0 是顶部,0.5 是居中,1.0 是底部。
define gui.textbox_yalign = 0.5

## 字体和字体大小 #####################################################################

## 游戏内文本使用的字体。
define gui.text_font = "theboldfont.ttf"

## 角色名称使用的字体。
define gui.name_text_font = "theboldfont.ttf"







                               
登录/注册后可看大图



那么问题来了!

1.ctc的位置问题。是相对于文本的却不是文本框
如果不修改图片,不去定制界面的话该怎么办?
而且出现了选择界面后,ctc就没了,这是怎么回事呢?
2.头像的问题
可以看到我上面的代码是加了头像的,但这个位置显示的明显不是理想中在对话的左边,是太大了?被文字挤下来了?还是说我只是修改了文字的位置,而没有改头像框的位置(可惜我没找到在哪儿改,那么在哪儿改呢?望指教)

choice

choice
ctc.jpg

点评

啧啧啧,这种算明目张胆地夹带私货~  发表于 2023-7-21 09:49
回复 支持 抱歉

使用道具 举报

发表于 2023-7-21 15:40:52 | 显示全部楼层
虽然但是搞出来就行了(

这是screen里的对话界面
[RenPy] 纯文本查看 复制代码
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

    button:
        xalign 0.99999
        yalign 1.0

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

        action ShowMenu("preferences")

    button:
        xpos -20
        ypos -20

        add "gui/BackArrow.png" zoom 0.5
        background "gui/button/BlueBtn.png"
        hover_background "gui/button/BlueBtnPressed.png"
        xpadding 100
        ypadding 50

        action None

    ## 如果有对话框头像,会将其显示在文本之上。请不要在手机界面下显示这个,因为
    ## 没有空间。
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0


[RenPy] 纯文本查看 复制代码
style window:
    #xalign 0.5
    #xfill True
    xpos 30
    yalign 0.71#gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/DialogueContainer.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos 71#gui.name_xpos
    xanchor gui.name_xalign
    xsize gui.namebox_width
    ypos -88#gui.name_ypos
    ysize gui.namebox_height

    #background Frame(" ", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    padding gui.namebox_borders.padding

style say_label:
    #properties gui.text_properties("name", accent=True)
    font "theboldfont.ttf"
    size 78
    color "#ebabd4"

    xalign gui.name_xalign
    yalign 0.5

style say_dialogue:
    #properties gui.text_properties("dialogue")
    font "theboldfont.ttf"
    size 35
    #spacing 10
    color "#44527d"

    xpos 130#gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos 20#gui.dialogue_ypos

    adjust_spacing False


这是screen里的选择
[RenPy] 纯文本查看 复制代码
screen choice(items):
    #style_prefix "choice"

    vbox:
        xalign 0.06
        yalign 0.94   
        spacing -30

        for i in items:

            #textbutton i.caption action i.action
            button:
                background "gui/button/Button.png"
                hover_background "gui/button/ButtonPressed.png"
                xysize (584,133)

                hbox:
                    text i.caption:
                        font "theboldfont.ttf"
                        size 35
                        color "#44527d"
                    xalign 0.5
                    yalign 0.5

                action i.action


新写了一个characters的rpy文件
[RenPy] 纯文本查看 复制代码
#角色定义
define r = Character("ROSALINE",ctc = "ctc",ctc_position="fixed")

#ctc
image ctc:
    xalign 0.975
    yalign 0.72
    "gui/NextBtn_.png"

#立绘位置
transform right_r:
    xalign 0.85
    ypos 170

#立绘
image r 1 = "images/fg/ExampleCharacterOultine.png"

#场景
image bg background = "images/bg/Background.jpg"


这是script里的
[RenPy] 纯文本查看 复制代码
label start:

    scene bg background

    show r 1 at right_r

    r "HEY! DIDN'T KNOW YOU WERE GOING TO BE HERE TODAY!"

    menu:

        "ME EITHER!":
           pass

        "I WASN'T SUPPOSED TO BE":
           pass


F[P@H7W7J1GSH%DR{F`4$F8.jpg
回复 支持 抱歉

使用道具 举报

发表于 2023-7-23 22:23:23 | 显示全部楼层
Snipaste_2023-07-23_22-18-28_压缩后.png




对话界面

[RenPy] 纯文本查看 复制代码
define e = Character("艾琳",who_color="#e1aed2",)
image bg = "gui/Background.jpg"

label start:
    scene bg
    show screen nv_gui
    show eileen
    e "您已创建一个新的 Ren'Py 游戏。"
    menu:
        e "当您完善了故事、图片和音乐之后,您就可以向全世界发布了!"
        "那真是太好了!":
            return
        "好的!":
            return
    return
screen nv_gui():
    imagebutton auto "images/VictoryOrDefeat/Blue_%s.png" action MainMenu()
    imagebutton auto "images/main/set_%s.png" action ShowMenu("preferences") pos (1623, 929) hover_sound "audio/hover.ogg" activate_sound "audio/activate.ogg"
    add "images/Icons/BackArrow.png" pos (90, 30) size (100, 100)


菜单部分修改
[RenPy] 纯文本查看 复制代码
style choice_vbox:
    spacing 0
    pos (90, 800)

style choice_button is default:
    background Frame("images/HomeScreen/Button_idle.png",xsize=600,)
    hover_background "images/HomeScreen/Button_hover.png"
    xysize (600,120)
    # properties gui.button_properties("choice_button")

style choice_button_text is default:
    color "#4e577e"
    align (0.5, 0.5)
    # properties gui.button_text_properties("choice_button")



回复 支持 抱歉

使用道具 举报

发表于 2023-7-25 12:04:13 | 显示全部楼层
对话框:
[RenPy] 纯文本查看 复制代码
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

    imagebutton:
        foreground Image("gui/Settings.png", xalign=0.5, yalign=0.5)
        idle "gui/GreenBtn.png"
        hover "gui/GreenBtnPressed.png"
        action ShowMenu('preferences')
        xalign 1.0
        yalign 1.0

    imagebutton:
        foreground Image("gui/BackArrow.png", xalign=0.5, yalign=0.5)
        idle "gui/ExitPopup/BlueBtn.png"
        hover "gui/ExitPopup/BlueBtnPressed.png"
        action MainMenu()
        xalign 0
        yalign 0

    imagebutton:
        idle "gui/NextBtn.png"
        hover "gui/NextBtnPressed.png"
        action NullAction()
        xalign 0.95
        yalign 0.66


选项:
[RenPy] 纯文本查看 复制代码
screen choice(items):
    style_prefix "choice"

    vbox:
        xalign 0.05
        yalign 0.92
        spacing -30
        for i in items:
            textbutton i.caption action i.action


script:
[RenPy] 纯文本查看 复制代码
define r = Character("ROSALINE",color="#D29CB2")
transform right:
    xalign 0.9 yalign 1.0



label start:

    scene background
    show r at right
    $ r ("HEY! I DIDN'T KNOW YOU WERE GOING TO BE HERE TODAY!",interact=False)
    # interact=False使得选项按钮出现时台词不会消失。
    menu:
        "ME EITHER!":
            pass
        "I WASN'T SUPPOSED TO BE":
            pass

    return


gui:(按钮部分只会简单粗暴地替换gui参数和图片orz)
[RenPy] 纯文本查看 复制代码
define gui.choice_button_width = 594
define gui.choice_button_height = 148
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(150, 8, 150, 8)
define gui.choice_button_text_font = gui.text_font
define gui.choice_button_text_size = 27
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_yalign = 0.5
define gui.choice_button_text_idle_color = "#081451"
define gui.choice_button_text_hover_color = "#ffffff"
define gui.choice_button_text_insensitive_color = "#444444"


QQ截图20230725115947.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-25 21:39:40 | 显示全部楼层
screens.rpy
[RenPy] 纯文本查看 复制代码
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who":
                    color "#f191e3ff"
                    outlines [(1, "#f191e3ff")]

        text what id "what"

    button:
        xysize (286, 161)
        align (1.0,1.0)
        background "gui/GreenBtn.png"
        hover_background "gui/GreenBtnPressed.png"
        add "gui/Icons/Settings.png":
            align (0.5,0.5)
            xysize(64, 64)
        action NullAction()

    button:
        xysize (286, 161)
        align (0.0,0.0)
        background "gui/VictoryOrDefeat/BlueBtn.png"
        hover_background "gui/VictoryOrDefeat/BlueBtnPressed.png"
        add "gui/Icons/BackArrow.png":
            align (0.5,0.5)
            xysize(64, 64)
        action NullAction()

[RenPy] 纯文本查看 复制代码
screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption action i.action
              
            



style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xalign 0
    ypos 830
    xpos 50
    yanchor 0

style choice_button is default:
    properties gui.button_properties("choice_button")
    background "gui/HomeScreen/Button.png"
    hover_background "gui/HomeScreen/ButtonPressed.png"
    xysize (589, 100)
    

style choice_button_text is default:
    properties gui.button_text_properties("choice_button")
    size 30
    color "#031446"
    xalign 0.5
    yoffset 1

script.rpy
[RenPy] 纯文本查看 复制代码
# 游戏的脚本可置于此文件中。

transform right:
    xalign 0.8
    yalign 1.0

# 声明此游戏使用的角色。颜色参数可使角色姓名着色。

define e = Character("ROSALINE", ctc="ctc_blink" ,ctc_position="fixed")

image bg room = "gui/Background.jpg"

image ctc_blink:
    offset (1750,750)
    "gui/NextBtn.png"
    linear 0.5 alpha 1.0
    "gui/NextBtnPressed.png"
    linear 0.5 alpha 1.0
    repeat

# 游戏在此开始。

label start:

    # 显示一个背景。此处默认显示占位图,但您也可以在图片目录添加一个文件
    # (命名为 bg room.png 或 bg room.jpg)来显示。

    scene bg room

    # 显示角色立绘。此处使用了占位图,但您也可以在图片目录添加命名为
    # eileen happy.png 的文件来将其替换掉。

    show eileen happy at right

    # 此处显示各行对话。

    e "您已创建一个新的 Ren'Py 游戏。"

    e "当您完善了故事、图片和音乐之后,您就可以向全世界发布了!"


    menu:
        e "HEY!I DIDN`T KNOW YOU WERE GOING TO BE HERE TODAY!"
        "ME EITHER!":
            jump me

        "I WASN`T SUPPOSED TO BE":
            jump i
label me:

    e "您已创建一个新的 Ren'Py 游戏。"

label i:

    e "当您完善了故事、图片和音乐之后,您就可以向全世界发布了!"

    # 此处为游戏结尾。

    return
QQ图片20230725212843.png
回复 支持 抱歉

使用道具 举报

发表于 2023-7-26 00:20:17 | 显示全部楼层
对话框.png
[RenPy] 纯文本查看 复制代码
## 对话屏幕 ########################################################################

screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who":
                    color "#ff99ff"
                    outlines [(2, "#ff99ff")]

        frame:
            background Solid("#0000")
            xysize (1600,200)
            pos (120,-230)
            text what id "what":
                color "#003366"
                outlines [(1, "#003366")]

    vbox:
        align (0.87,0.89)
        button:
            idle_background 'gui/button/green_btn.png'
            hover_background 'gui/button/green_btn_pressed.png'
            xysize (40,20)
            action ShowMenu("preferences")

    button:
        align (0.95,0.99)
        add 'gui/button/settings.png'
        action ShowMenu("preferences")


    vbox:
        align (-1,0.01)
        button:
            idle_background 'gui/button/back_btn.png'
            xysize (40,20)
            action Quit(confirm=not main_menu)




    ## 如果有对话框头像,会将其显示在文本之上。请不要在手机界面下显示这个,因为
    ## 没有空间。
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0


## 通过 Character 对象使名称框可用于样式化。
init python:
    config.character_id_prefixes.append('namebox')

style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label


style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/textbox.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos 100
    ypos -320


style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5



# 游戏在此开始。

label start:
    
    scene background

    show rosaline

    menu:
        r "HEY!I DIDN'T KNOW YOU WERE GOING TO BE HERE TODAY!"
        "ME EITHER!":
            jump choice_1

        "I WASN'T SUPPOSED TO BE":
            jump choice_2

label choice_1:
    "ME EITHER!"
    return

label choice_2:
    "I WASN'T SUPPOSED TO BE"
    return

回复 支持 抱歉

使用道具 举报

发表于 2023-7-29 22:37:14 | 显示全部楼层
本帖最后由 hypnos200 于 2023-7-30 07:49 编辑

[RenPy] 纯文本查看 复制代码
screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            button:
                xysize (594, 148)
                background "gui/ReplyBtn.png"
                hover_background "gui/ReplyBtnPressed.png"
                text i.caption:
                    yalign 0.5
                    xalign 0.5
                action i.action


style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text

style choice_vbox:
    xpos 42
    ypos 930
    yanchor 0.5

    spacing gui.choice_spacing

[RenPy] 纯文本查看 复制代码
screen say(who, what):
    style_prefix "say"

    button:
            xalign 1.0
            yalign 1.0
            xysize (286,161)
            background "green"
            hover_background "greenp"
            action ShowMenu('preferences')

    button:
            xalign 0.0
            yalign 0.0
            xysize (286,161)
            background "backn"
            hover_background "backnp"
            action MainMenu()

    window:
        id "window"

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"



    ## 如果有对话框头像,会将其显示在文本之上。请不要在手机界面下显示这个,因为
    ## 没有空间。
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0


## 通过 Character 对象使名称框可用于样式化。
init python:
    config.character_id_prefixes.append('namebox')

style window is default
style say_label is default
style say_dialogue is default
style say_thought is say_dialogue

style namebox is default
style namebox_label is say_label


style window:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height

    background Image("gui/DialogueContainer.png", xalign=0.5, yalign=1.0)

style namebox:
    xpos gui.name_xpos
    xanchor gui.name_xalign
    xsize gui.namebox_width
    ypos gui.name_ypos
    ysize gui.namebox_height

    background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
    padding gui.namebox_borders.padding

style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos

    adjust_spacing False

[RenPy] 纯文本查看 复制代码
define e = Character("Rosaline",who_color = "#e2aed2",ctc = "ctc1",ctc_position="fixed")


# 游戏在此开始。

label start:

    # 显示一个背景。此处默认显示占位图,但您也可以在图片目录添加一个文件
    # (命名为 bg room.png 或 bg room.jpg)来显示。

    scene background

    # 显示角色立绘。此处使用了占位图,但您也可以在图片目录添加命名为
    # eileen happy.png 的文件来将其替换掉。

    show jy at rightn

    # 此处显示各行对话。

   
    menu:
        e "Authorize!Progrise!The rider kick increases the power by adding to brightness!"
        "Shining":
            pass
        "Hopper":
            pass

    e "When I shine, darkness fades."

    # 此处为游戏结尾。

    return
screenshot0003.png
screenshot0004.png
回复 支持 抱歉

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-13 20:05 , Processed in 0.092482 second(s), 30 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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