找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 79|回复: 2

[求助] 如何让玩家自由选择是否启用对话框头像?

[复制链接]
发表于 6 天前 | 显示全部楼层 |阅读模式

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

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

×
萌新第一次用RenPy,想写一个按钮,效果是按下后用户可以自由启用/禁用对话框左侧的头像。

目前已经做出来按钮界面并能加入头像,卡在启用/禁用功能上了……
望大佬们不吝赐教

看章鱼老师的教程做出来的设置界面

看章鱼老师的教程做出来的设置界面
 楼主| 发表于 6 天前 | 显示全部楼层
本帖最后由 Ray 于 2025-2-17 21:38 编辑

[RenPy] 纯文本查看 复制代码
#script.rpy部分
init:
    if not hasattr(persistent, "show_side_image"):
        $ persistent.show == True

define ray = Character("ray",color="#6495ED",window_background="gui/ray_textbox.png",
    image="ray",
    show_side_image=ConditionSwitch(
        "persistent.show", "rayside",
        "not persistent.show", Null()
        )
)
[RenPy] 纯文本查看 复制代码
#screen.rpy部分
text "启用对话框头像":
                        style "system_text_style"

                    imagebutton:
                        align (0.5, 0.5)
                        idle "gui/button/radio_idle.png" at button_fadeinout1
                        selected_hover "gui/button/radio_selectedhover.png"
                        selected_idle "gui/button/radio_selectedidle.png"
                        hover "gui/button/radio_hover.png"
                        activate_sound "audio/click.mp3"
                        hover_sound "audio/remain.mp3"
                        action ToggleVariable("persistent.show")


回复 支持 抱歉

使用道具 举报

 楼主| 发表于 6 天前 | 显示全部楼层
[RenPy] 纯文本查看 复制代码
#选项部分
imagebutton:
                        align (0.5, 0.5)
                        idle "gui/button/radio_idle.png" at button_fadeinout1
                        selected_hover "gui/button/radio_selectedhover.png"
                        selected_idle "gui/button/radio_selectedidle.png"
                        hover "gui/button/radio_hover.png"
                        activate_sound "audio/click.mp3"
                        hover_sound "audio/remain.mp3"
                        action SetVariable("show_side_portrait", True)
                    imagebutton:
                        align (0.5, 0.5)
                        idle "gui/button/radio_idle.png" at button_fadeinout1
                        selected_hover "gui/button/radio_selectedhover.png"
                        selected_idle "gui/button/radio_selectedidle.png"
                        hover "gui/button/radio_hover.png"
                        activate_sound "audio/click.mp3"
                        hover_sound "audio/remain.mp3"
                        action SetVariable("show_side_portrait", False)[mw_shl_code=renpy,true]#say界面
screen say(who, what):
    style_prefix "say"

    window:
        id "window"

        if who is not None:

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

        if show_side_portrait == True and who in character_images:
            add character_images[who] xalign 0.0 yalign 1.0

        text what id "what"[mw_shl_code=renpy,true]#在script最开始写上:
init python:

    character_images = {
        "ray": "images/ray/rayside.png"
    }
[/mw_shl_code][/mw_shl_code]
用这个笨方法可以达到效果,但是代码太冗杂了……
回复 支持 抱歉

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-23 20:18 , Processed in 0.185287 second(s), 28 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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