RenPy中文空间

标题: 在Renpy中实现历史记录跳跃效果 [打印本页]

作者: 丛雨    时间: 2018-10-21 11:27
标题: 在Renpy中实现历史记录跳跃效果
本帖最后由 丛雨 于 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组件,点击历史记录中的对话,确认,即可跳转到目标对话。

作者: 龙氏    时间: 2018-10-21 17:20
默认在 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.")



作者: 水上由岐    时间: 2018-10-21 19:23
现代GAL里非常实用的一个功能,感谢分享
作者: 乐西白    时间: 2020-8-11 08:28
感谢分享!
作者: 不是心教    时间: 2021-3-13 11:23
感谢老哥,十分好用
作者: 天使的遗族    时间: 2021-7-1 17:47
这个跟跳到上一个选项比那个更常用?




欢迎光临 RenPy中文空间 (https://www.renpy.cn/) Powered by Discuz! X3.5