Ren'Py memo

Ren'Pyの個人的なメモ

過去作の一部コード晒し

やめども
choice(選択肢)
main_menu(タイトル画面)
navigation(コンフィグメニュー)
gui.rpy



## Choice(選択)スクリーン #############################################################

screen choice(items):
    style_prefix "choice"

    vbox:
        xalign 0.5
        if whereis == "syudan":
            yalign 0.3
        else:
            yalign 0.15
        for i in items:
            $ chosen = i.kwargs.get("chosen", False)
            if not chosen:
                textbutton i.caption idle_background "ch_idle" hover_background "ch_hover" action i.action at one_trans
            if chosen:
                textbutton i.caption idle_background "ch_grey" hover_background "ch_grey2" text_color gui.color1 text_hover_color gui.color4 action i.action at one_trans
            null height 28

define config.narrator_menu = True

style choice_box is hbox
style choice_button is button
style choice_button_text is button_text

style choice_box:
    yalign 0.0
    xalign 0.5
    spacing 35

style choice_button is default:
    xsize 400
    ysize 80
    activate_sound gui.sound1

style choice_button_text is default:
    xalign 0.5
    yalign 0.5
    size 30
    color gui.color4
    hover_color gui.color4


main_menu(タイトル画面)

screen main_menu():

    tag menu
    style_prefix "main_menu"
    add "main_menu"

    if (persistent.cheat == True) or (persistent.sueA and persistent.sueB and persistent.saneA and persistent.saneB and persistent.mutsuA and persistent.mutsuB):
        add "main_menu_moji2"
        add "leaves_blowing"
    else:
        add "main_menu_moji"

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

    if persistent.clear == True or persistent.cheat == True:
        vbox:
            xpos 1020
            yalign 0.29
            textbutton _("▶▶"):
                action [SetVariable("endjump",True), Start()]
                text_size 40
                tooltip "最初の選択肢から始める"

    vbox:
        xpos 1000
        yalign 0.4
        spacing 45
        textbutton _("Continue") action FileLoad("quitsave", slot=True)
        textbutton _("Start") action [SetVariable("endjump",False), Start()]
        textbutton _("Load") action ShowMenu("load")
        textbutton _("Option") action ShowMenu("preferences")
        textbutton _("Extra"):
            if persistent.clear == True or persistent.cheat == True:
                action ShowMenu("extras")
    vbox:
        xalign 0.99
        yalign 1.0
        text _("{noalt}Ver.{/noalt}{alt}やめどもれんぼはれんぼたる、バージョン{/alt}[config.version]{alt}、矢印キーで移動、エンターで決定{/alt}"):
            style "main_menu_version"

    $ tooltip = GetTooltip()

    if tooltip:
        nearrect:
            focus "tooltip"

            frame:
                xoffset -10
                yoffset 13
                text tooltip color gui.color1 outlines [ (absolute(2), gui.color4, absolute(0), absolute(0)) ] size 24

style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text
style main_menu_button is button
style main_menu_button_text is button_text

style main_menu_vbox:
    xalign 1.0
    yalign 1.0
    xmaximum 800

style main_menu_version:
    color gui.color5
    size 27

style main_menu_button_text:
    size 60
    bold True
    color gui.color1
    hover_color gui.color2
    insensitive_color gui.color3
    outlines [ (absolute(1), gui.color4, absolute(0), absolute(0)) ]


navigation(コンフィグ)

screen navigation():

    hbox:
        style_prefix "navigation"
        xalign 0.5
        spacing 5

        if not main_menu:
            textbutton _("バックログ") action ShowMenu("history")
            textbutton _("セーブ") action ShowMenu("save")

        textbutton _("ロード") action ShowMenu("load")
        textbutton _("オプション") action ShowMenu("preferences")

        textbutton _("リードミー") action ShowMenu("help")

        if not main_menu:
            textbutton _("タイトル") action MainMenu(confirm=persistent.ask_title)
        else:
            if persistent.clear == True or persistent.cheat == True:
                textbutton _("エクストラ") action ShowMenu("extras")
            textbutton _("戻る") action Return()

style navigation_button is gui_button
style navigation_button_text is gui_button_text

style navigation_button:
    idle_background "color1a"
    hover_background "color4a"
    selected_background "color2a"
    activate_sound gui.sound1
    xsize 170
    ysize 80

style navigation_button_text:
    idle_color gui.color4
    hover_color gui.color1
    selected_color gui.color4
    xalign 0.5
    yalign 0.55
    size 24
    kerning 1


gui.rpy

################################################################################
## Initialization
################################################################################

init offset = -2

init python:
    gui.init(1060, 600)

## Colors ######################################################################

define gui.sound1 = "audio/se/switchblade2.mp3"

define gui.color1 = "#404057"
define gui.color2 = "#A472A9"
define gui.color3 = "#B7B5C6"
define gui.color4 = "#F0F0EC"
define gui.color5 = "#FBFBFB"

define gui.color1a = "#404057CC"
define gui.color5a = "#FBFBFBCC"

define gui.font_name_en = 'JF-Dot-Kappa20-0213'
define gui.font_name = 'JF-Dot-Kappa20-0213'

## Fonts and Font Sizes ########################################################

define gui.text_font = gui.preference("font", "JF-Dot-Kappa20-0213.ttf")
define gui.name_text_font = gui.preference("font", "JF-Dot-Kappa20-0213.ttf")
define gui.interface_text_font = gui.preference("font", "JF-Dot-Kappa20-0213.ttf")

define gui.text_size = gui.preference("size", 28)

## Localization ################################################################

define gui.language = "japanese-strict"

## Styles ################################################################

style default:
    font gui.text_font
    size gui.text_size
    language gui.language

style input:
    adjust_spacing False

style hyperlink_text:
    underline True
    color gui.color1
    hover_color gui.color2

style gui_text:
    color gui.color1
    size gui.text_size
    font gui.interface_text_font

style button:
    xysize (None, None)
    padding (4, 4)
    activate_sound gui.sound1

style button_text is gui_text

style label_text is gui_text

style prompt_text is gui_text

style bar:
    ysize 75
    left_bar Frame("gui/left.png", 4, 4, 4, 4, tile=False)
    right_bar Frame("gui/right.png", 4, 4, 4, 4, tile=False)

style vbar:
    xsize 75
    top_bar Frame("tbar1", 4, 4, 4, 4, tile=False)
    bottom_bar Frame("bbar1", 4, 4, 4, 4, tile=False)

style scrollbar:
    ysize 35
    base_bar Frame("horizontal_[prefix_]bar", 4, 4, 4, 4, tile=False)
    thumb Frame("horizontal_[prefix_]thumb", 4, 4, 4, 4, tile=False)

style vscrollbar:
    xsize 35
    base_bar Frame("vertical_[prefix_]bar", 4, 4, 4, 4, tile=False)
    thumb Frame("vertical_[prefix_]thumb", 4, 4, 4, 4, tile=False)

style slider:
    ysize 45
    base_bar Frame("horizontal_[prefix_]bar", 4, 4, 4, 4, tile=False)
    thumb "horizontal_[prefix_]thumb"

style vslider:
    xsize 45
    base_bar Frame("vertical_[prefix_]bar", 4, 4, 4, 4, tile=False)
    thumb "vertical_[prefix_]thumb"

style frame:
    padding (4, 4, 4, 4)