Ren'Py memo

Ren'Pyの個人的なメモ

おまけ画面・NVL画面のコード

おまけ画面

やめども
NVL形式の掌編が本編クリア後に表示される
おまけ画面、NVL画面のコード



おまけ画面の用意
screens.rpy

screen extra():
    style_prefix "omake"

    hbox:
        text _("ボタンをクリックすると攻略対象視点の掌編が読めます。"):
            xpos 230
            ypos 45
            color gcolor1

    hbox:
        xpos 190
        ypos 80
        vbox:

            if persistent.sue1 == True or persistent.cheat:
                textbutton _("掌編1 スーくん"):
                    if persistent.sueA == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'sue_afterA')

            null height 30

            if persistent.sane1 == True or persistent.cheat:
                textbutton _("掌編3 サネちゃん"):
                    if persistent.saneA == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'sane_afterA')

            null height 30

            if persistent.mutsu1 == True or persistent.cheat:
                textbutton _("掌編5 ムツ"):
                    if persistent.mutsuA == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'mutsu_afterA')

        null width 45

        vbox:

            if persistent.sue2 == True or persistent.cheat:
                textbutton _("掌編2 スーくん"):
                    if persistent.sueB == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'sue_afterB')

            null height 30

            if persistent.sane2 == True or persistent.cheat:
                textbutton _("掌編4 サネちゃん"):
                    if persistent.saneB == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'sane_afterB')

            null height 30

            if persistent.mutsu2 == True or persistent.cheat:
                textbutton _("掌編6 ムツ"):
                    if persistent.mutsuB == True:
                        idle_background "color1"
                    else:
                        idle_background "color2"
                    action Start(label=u'mutsu_afterB')


NVL画面

NVL画面の用意
screens_nvl.rpy

define config.nvl_list_length = 3

screen nvl(dialogue, items=None):

    window:
        style "nvl_window"
        background Transform(style.window.background, alpha=persistent.window_alpha)

        has vbox:
            spacing 0 #かたまり同士の行間
            use nvl_dialogue(dialogue)

    use quick_menu

screen nvl_dialogue(dialogue):

    for d in dialogue:

        window:
            id d.window_id

            fixed:
                yfit True

                if d.who is not None:

                    text d.who:
                        id d.who_id

                text d.what:
                    id d.what_id
                    if preferences.language == "en_us":
                        line_leading 9
                        kerning 1
                    else:
                        line_leading 11
                        kerning 1
                    color gcolor4


style nvl_window is default
style nvl_entry is default

style nvl_label is say_label
style nvl_dialogue is default
style nvl_thought is nvl_dialogue

style nvl_button is button
style nvl_button_text is button_text

style nvl_window:
    xpos 252
    ypos 0
    background "gcolor1"
    xsize 800
    ysize 720
    padding (0, 0, 0, 0)

style nvl_entry:
    xsize 620
    ysize None

style nvl_dialogue:
    xpos 96
    ypos 20
    xanchor 0.0
    xsize 1080
    text_align 0.0
    size 27
    layout ("tex")

style nvl_button:
    xfill False
    xpos 450
    xanchor 0.0

style nvl_button_text:
    xfill False

NVLテキストボックスの用意
images.rpy

    image game_menu3 = Solid("#B7B5C699", xsize=1280, ysize=720)

NVLからreturnでタイトルに戻った時、おまけ画面に自動で遷移する
screen.rpy

screen main_menu():
    if persistent.nvl_return == True:
        on "show" action [ShowMenu("extras"),SetVariable("persistent.nvl_return", "false")]

おまけ掌編ラベル例
1sue.rpy

label sue_afterA:

    python:
        quick_menu = True
        nvl_on = True #quick_menu不要パーツのオンオフ用
        persistent.nvl_return = True

    scene bc0
    show game_menu3
    with dissolve
    $ play_music(sue,fadein=0.5)

    v"\n おれと[persistent.name_keep]がお付き合いを初めて一週間が経った。ちょっと扇動っぽいズルをしたとはいえれっきとした同意ある交際だ。たまにコアリクイみたいな威嚇のポーズされたりしているけど。"
    nvl clear #ページ切り替え
    v"\n\n\nEXTRA STORY1 思えば思わるる"
    nvl clear

    $ persistent.sueA = True
    return