找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9084|回复: 5

[经验] 在Renpy中实现历史记录跳跃效果

[复制链接]
发表于 2018-10-21 11:27:06 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 丛雨 于 2018-10-21 11:31 编辑

在许多Galgame中都有在历史记录点击历史对话跳跃的效果,让游玩者有更多操作自由。
通过修改screen history,可以实现此类效果。
[RenPy] 纯文本查看 复制代码
## 将screen history中 window 内容替换为以下代码
 window:

                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True

                if h.who:

                    label h.who:
                        style "history_name"
                        substitute False

                        ## Take the color of the who text from the Character, if
                        ## set.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]

                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                textbutton what:                    
                    substitute False
                    style "history_text"
                    action Confirm("Jump?", yes=RollbackToIdentifier(h.rollback_identifier), no=None, confirm_selected=False), 
 

将原来的text组件替换为textbitton组件,点击历史记录中的对话,确认,即可跳转到目标对话。

评分

参与人数 2干货 +6 收起 理由
BuErShen + 3 版区有你更精彩(*^_^*)
龙氏 + 3 感谢分享!

查看全部评分

发表于 2018-10-21 19:23:15 | 显示全部楼层
现代GAL里非常实用的一个功能,感谢分享
回复 支持 2 抱歉 0

使用道具 举报

发表于 2018-10-21 17:20:55 | 显示全部楼层
默认在 screens.rpy里搜索:screen history 进行修改。
完全替换 screen history(): 的脚本如下:
[RenPy] 纯文本查看 复制代码
screen history():

    tag menu

    ## Avoid predicting this screen, as it can be very large.
    predict False

    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0):

        style_prefix "history"

        for h in _history_list:

            window:
                ## This lays things out properly if history_height is None.
                has fixed:
                    yfit True

                if h.who:
                    label h.who:
                        style "history_name"
                        substitute False

                        ## Take the color of the who text from the Character, if set.
                        if "color" in h.who_args:
                            text_color h.who_args["color"]
                            
                $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                textbutton what:
                    substitute False
                    style "history_text"
                    action Confirm("跳转到此处?", yes=RollbackToIdentifier(h.rollback_identifier), no=None, confirm_selected=False),

        if not _history_list:
            label _("The dialogue history is empty.")


评分

参与人数 1活力 +180 收起 理由
BuErShen + 180 感谢分享!

查看全部评分

回复 支持 2 抱歉 0

使用道具 举报

发表于 2020-8-11 08:28:09 | 显示全部楼层
感谢分享!
回复

使用道具 举报

发表于 2021-3-13 11:23:12 | 显示全部楼层
感谢老哥,十分好用
回复 支持 抱歉

使用道具 举报

发表于 2021-7-1 17:47:11 | 显示全部楼层
这个跟跳到上一个选项比那个更常用?
回复 支持 抱歉

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-17 03:30 , Processed in 0.063197 second(s), 15 queries , File On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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