Aide pour ajouter langue a un jeu python

Fermé
frelon71 Messages postés 38 Date d'inscription samedi 23 juillet 2016 Statut Membre Dernière intervention 25 novembre 2023 - 2 août 2022 à 17:33
frelon71 Messages postés 38 Date d'inscription samedi 23 juillet 2016 Statut Membre Dernière intervention 25 novembre 2023 - 3 août 2022 à 15:14

Bonjour,

Je suis un traducteur de jeu renpy et j'aimerais savoir comment ajouter la langue Française en python merci


Windows / Opera 89.0.4447.71

A voir également:

3 réponses

yg_be Messages postés 23361 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 29 novembre 2024 Ambassadeur 1 556
2 août 2022 à 21:49

bonjour,

quel est le rapport entre la langue du jeu et le langage de programmation utilisé?

0
frelon71 Messages postés 38 Date d'inscription samedi 23 juillet 2016 Statut Membre Dernière intervention 25 novembre 2023
3 août 2022 à 14:47

Bonjour je crois que vous n'avez pas compris, le jeu est en anglais d'origine je veux le traduire en Français, donc il faut que j'ajoute la langue française au jeu, mais le fichier screen est écris en python alors que la plupart des jeu renpy ne le sont pas donc plus facile a ajouter les langues, merci

0
yg_be Messages postés 23361 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 29 novembre 2024 1 556
3 août 2022 à 14:55

Tu souhaites donc modifier du code Python?
Connais-tu ce langage de programmation?

0
frelon71 Messages postés 38 Date d'inscription samedi 23 juillet 2016 Statut Membre Dernière intervention 25 novembre 2023
Modifié le 8 août 2022 à 22:39

Pas trop; justement . C'est pour ça que je demande si c'est facile à faire.

0
yg_be Messages postés 23361 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 29 novembre 2024 1 556
3 août 2022 à 15:08

Je pense que le point de départ est de te former en Python pour comprendre le contenu du fichier que tu veux modifier.
Ce sera ensuite plus ou moins facile, suivant la complexité du fichier.

0
frelon71 Messages postés 38 Date d'inscription samedi 23 juillet 2016 Statut Membre Dernière intervention 25 novembre 2023 > yg_be Messages postés 23361 Date d'inscription lundi 9 juin 2008 Statut Contributeur Dernière intervention 29 novembre 2024
Modifié le 8 août 2022 à 22:38

Je sais deja quel fichier il faut modifier mais je ne sais pas comment l'ajouter. voila le screen, car sur les jeux renpy simple on ajoutais la vbox mais la c'est pas pareil vu que c'est du python, merci

vbox:
 

                    style_prefix "radio"
                    label _("Language")
                    textbutton _( "English" ) action Language(None)
                    textbutton _( "French" ) action Language("french")

Le script :

image wbag:
    "ui/w_bag.png"
    alpha 0.25

image wbag_h:
    "ui/w_bag.png"
    alpha 1.0

image tools:
    "ui/w_tools.png"
    alpha 0.25

image tools_h:
    "ui/w_tools.png"
    alpha 1.0

#Chapters & chapter animations variables
default caswitch=0
default choice_line=""
default alpha0=1
default alpha1=1
default alpha2=1
default pagechange=False
default datelog=""
default p_datelog=""
default datelogIndex=0
default show_variables=True
default memory_tracker=[]
default paths_enabled=False
default index_na=0
default time_na=0
default max_na=90
default splitafter=[":",",","."," ",";","!","?"]
default relativPos=(0.66,0.5)
default slotnumber=198
default slot_savename=""
default slot_extra_info=""
default slot_extra_info_maxlen=16
default esc_textToDisplay=""
default esc_labelToGo=""
#default slot_dict=dict([])

#default helpers=True
default help_disable_option=0
default dummy=0

# chapter dict  = chapter name for i18n,chapter subtitle for i18n,chapter images template name
default chapters=[]
default chapterNum=1
default langset=0
default voice_playing=False
default chapter5_anims=dict([("valpath",(100,200)),("nopath",(0,0))])
default phone2=""
default phone_notif=False
default is_phone_notified=False


# Skype and neo mc phone dynamic
image sy_skype=DynamicDisplayable(skype_voiced)
image sy_skype_desk="images/ev/chapter1/Sylvia at computer close up - Desk crop.png"
image sy_skype_desk_voiced="images/ev/chapter1/Sylvia at computer close up - Desk crop - Sylvia talking.png"

image mc_phone2lea=DynamicDisplayable(mcphone_lea_voiced)
image mc_phone2_lea="images/ev/chapter1/MC Phone Call Lea.png"
image mc_phone2_lea_voiced="images/ev/chapter1/MC Phone Call Lea Border.png"

image mc_phone2val=DynamicDisplayable(mcphone_val_voiced)
image mc_phone2_val="images/ev/chapter1/MC Phone Call Val.png"
image mc_phone2_val_voiced="images/ev/chapter1/MC Phone Call Val Border.png"

# neo mc phone static
image mc_phone2_glow open="images/ev/chapter1/MC Phone Glow On.png"
image mc_phone2_glow calling="images/ev/chapter1/MC Phone Glow Calling.png"
image mc_phone2_switch="images/ev/chapter1/MC Phone Call Switch.png"
image mc_phone2_end="images/ev/chapter1/MC Phone Call End.png"
image mc_phone2_off="images/ev/chapter1/MC Phone Off.png"
image mc_phone2_notif="images/ev/chapter1/MC Phone Call Notif.png"


# Functions
init python:
    from datetime import timedelta
    from datetime import datetime


    def set_phone_notif(thevalue):
        global phone_notif
        phone_notif=thevalue

    def mcphone_lea_voiced(st,at):
        if renpy.music.is_playing("voice"):
            return renpy.displayable("mc_phone2_lea_voiced"),0.2
        else:
            return renpy.displayable("mc_phone2_lea"),0.2


    def mcphone_val_voiced(st,at):
        if renpy.music.is_playing("voice"):
            return renpy.displayable("mc_phone2_val_voiced"),0.2
        else:
            return renpy.displayable("mc_phone2_val"),0.2

    def skype_voiced(st,at):
        if renpy.music.is_playing("voice"):
            return renpy.displayable("sy_skype_desk_voiced"),0.2
        else:
            return renpy.displayable("sy_skype_desk"),0.2


    def test_slot_dict(slotnumber):
        try:
            slot_savename=persistent.slot_dict["1-"+str(slotnumber)]
        except:
            slot_savename=""
        return (slot_savename)

    def rename_slot_func(newstring):
        slot_realname="1-"+str(slotnumber)
        if len(newstring)>slot_extra_info_maxlen:
            slot_extra_info=newstring[:slot_extra_info_maxlen]
        else:
            slot_extra_info=newstring
        persistent.slot_dict[slot_realname]=slot_extra_info

    def update_slot(newstring):
        try:
            persistent.slot_dict["1-"+str(slotnumber)]=newstring
        except:
            dummy=0


    def getCurrentTime():
        t=datetime.now()
        return(t)

    def deltaTime(t):
        dt=datetime.now()-t
        return(dt)

    def label_callback(name, abnormal):
        store.current_label = name

    config.label_callback = label_callback

    if persistent.help_screens is None:
        persistent.help_screens=True

    if persistent.display_pathV is None:
        persistent.display_pathV=True

# Images for composing menus
# image ui_background = "ui/ui_background.png"
init -2 python:

    style.quick_button.set_parent('default')
    style.quick_button.background = None
    style.quick_button.xpadding = 5

    style.quick_button_text.set_parent('default')
    style.quick_button_text.size = 20
    style.quick_button_text.idle_color = "#9999"
    style.quick_button_text.hover_color = "#ccc"
    style.quick_button_text.selected_idle_color = "#cc08"
    style.quick_button_text.selected_hover_color = "#cc0"
    style.quick_button_text.insensitive_color = "#4448"

    # Set a default value for the auto-forward time, and note that AFM is
    # turned off by default.
    config.default_afm_time = 10
    config.default_afm_enable = False

    config.thumbnail_width = 188
    config.thumbnail_height = 110
    file_page=1

    config.narrator_menu = True

    style.menu_window.set_parent(style.default)
    style.menu_choice.set_parent(style.button_text)
    style.menu_choice.clear()
    style.menu_choice_button.set_parent(style.button)
    #style.menu_choice_button.outlines=[(3, "#000", 0, 0)]
    style.menu_choice_button.xminimum = int(config.screen_width)
    style.menu_choice_button.xmaximum = int(config.screen_width)
    #style.menu_choice_button.xminimum = int(config.screen_width * 0.75)
    #style.menu_choice_button.xmaximum = int(config.screen_width * 0.75)

    style.mobile_menu_choice=Style(style.menu_choice)
    style.mobile_menu_choice.size = 27

    style.pref_slider.left_bar = "ui/slidebar.png" #full
    style.pref_slider.right_bar = "ui/slidebar_empty.png" #empty

    style.pref_slider.xmaximum = 213    # width of your left_bar image.
    style.pref_slider.ymaximum = 20    # height of your left_bar image.  Probably will be the height of the red part of the bar plus the slider's height.

    style.pref_slider.thumb = "ui/pixel.png"
    style.pref_slider.thumb_offset = 0.5    # Half of your thumb's width in pixels
    style.pref_slider.thumb_shadow = None
    isTitleScreen=0

    style.gm_nav_button.size_group = "gm_nav"

    #Style for maps
    style.map_button = Style(style.button_text)
    style.map_button.clear()
    #style.map_button.font="ui/minikstt.ttf"
    style.map_button.size=24
    style.map_button.color = "#FFF"
    style.map_button.hover_color = "#0F0"
    style.map_button.selected_color = "#FF0"
    style.map_button.outlines=[(3, "#777", 0, 0),(2, "#000", 0, 0)]
    #style.map_button.outlines=[(2, "#000", 0, 0)]
    style.map_button.background=None
    style.map_button.hover_background=None
    style.map_button.selected_background=None
    style.map_button.idle_background=None
    style.map_button.yminimum = 1
    style.map_button.xminimum = 1

    style.map_button_ss= Style(style.map_button)
    style.map_button_ss.size=60
    style.map_button_ss.hover_color = "#f17201"

    style.mobile_map_button = Style(style.map_button)
    #style.mobile_map_button.size=24
    style.mobile_map_button.outlines=[(2, "#777", 0, 0),(3, "#000", 0, 0)]


    style.mapyn_button = Style(style.map_button)
    style.mapyn_button.selected_color = "#FFF"
    #style.mapyn_button.font="ui/gorila.ttf"
    style.mapyn_button.size=32
    style.mapyn_button.color = "#FFF"
    style.mapyn_button.hover_color = "#f17201"

    #Style for signature
    style.sign_button = Style(style.map_button)
    style.sign_button.size=28
    style.sign_button.color="#9E9E9E"
    style.sign_button.outlines=[(1, "#9E9E9E", 0, 0)]
    style.sign_button.hover_color = "#f17201"

    #Style for chapters
    style.chapt = Style(style.map_button)
    style.chapt.clear()
    style.chapt.color="#f2e5b7"
    style.chapt.outlines=[(3, "#000", 0, 0)]
    style.chapt.font="ui/CALIST.ttf"

    #Style for WIP
    style.WIP = Style(style.map_button)
    style.WIP.clear()
    style.WIP.size=32
    style.WIP.color="#fff"
    style.WIP.outlines=[(1, "#666", 0, 0)]
    style.WIP.font="ui/CALIST.ttf"

    #Style for datelog
    style.complog = Style(style.map_button)
    style.complog.clear()
    style.complog.size=32
    style.complog.color="#fff"
    style.complog.outlines=[(3, "#000", 0, 0)]
    style.complog.font="ui/Courier Prime Code.ttf"


    #Style for datelog
    style.complog = Style(style.map_button)
    style.complog.clear()
    style.complog.size=32
    style.complog.color="#fff"
    style.complog.outlines=[(2, "#000", 0, 0)]
    style.complog.font="ui/segoeprb.ttf"


    #Styles for narration (dorn)
    # window style for narration
    style.dorn = Style(style.window)
    style.dorn.background = Frame("ui/null.png", 0, 0)
    style.dorn.left_padding = 30
    style.dorn.right_padding = 30


    # text style for narration
    style.dorn_text= Style(style.complog)
    style.dorn_text.size=28
    style.say_vbox.xfill=True


    #Style for navigatore
    style.navigatore_button = Style(style.button_text)
    style.navigatore_button.clear()
    style.navigatore_button.color = "#FFF"
    style.navigatore_button.hover_color = "#FFF"
    style.navigatore_button.selected_color = "#f17201"
    style.navigatore_button.outlines=[(1, "#000", 0, 0)]
    style.navigatore_button.size=18
    style.navigatore_button.font="ui/gorila.ttf"
    style.navigatore_button.background=None
    style.navigatore_button.hover_background=None
    style.navigatore_button.selected_background=None
    style.navigatore_button.idle_background=None
    style.navigatore_button.yminimum = 1
    style.navigatore_button.xminimum = 1


    #Style for preferences
    style.prefa_button = Style(style.button_text)
    style.prefa_button.clear()
    style.prefa_button.color = "#999"
    style.prefa_button.hover_color = "#f17201"
    style.prefa_button.selected_color = "#f17201"
    style.prefa_button.outlines=[(3, "#000", 0, 0),(2, "#fff", 0, 0)]
    style.prefa_button.size=20
    style.prefa_button.text_align=0.0
    style.prefa_button.font="ui/gorila.ttf"
    style.prefa_button.background=None
    style.prefa_button.hover_background=None
    style.prefa_button.selected_background=None
    style.prefa_button.idle_background=None
    style.prefa_button.yminimum = 1
    style.prefa_button.xminimum = 1

    #Style for language buttons
    style.lang_button = Style(style.button_text)
    style.lang_button.clear()
    #style.lang_button.font="ui/minikstt.ttf"
    style.lang_button.color = "#999"
    style.lang_button.hover_color = "#f17201"
    style.lang_button.selected_color = "#f17201"
    style.lang_button.outlines=[(2, "#333", 0, 0),(1, "#fff", 0, 0)]
    style.lang_button.size=21
    style.lang_button.text_align=0.0
    style.lang_button.background=None
    style.lang_button.hover_background=None
    style.lang_button.selected_background=None
    style.lang_button.idle_background=None
    style.lang_button.yminimum = 1
    style.lang_button.xminimum = 1

    #Styles for phone
    # Text
    style.phone=Style(style.button_text)
    style.phone.font="ui/DejaVuSans-Bold.ttf"
    style.phone.color="#fff"
    style.phone.size=22
    style.phone.outlines=[(0, "#ccc", 0, 0)]

    # Headers
    style.phone_h=Style(style.button_text)
    style.phone_h.font="ui/CatV_6x12_9.ttf"
    style.phone_h.color="#fff"
    style.phone_h.size=17
    style.phone_h.outlines=[(0, "#ccc", 0, 0)]

    # Styles for notebook
    style.notebook=Style(style.button_text)
    style.notebook.clear()
    style.notebook.text_align=0.0
    style.notebook.font="ui/Mali-ExtraLight.ttf"
    style.notebook.color="#72695a"
    style.notebook.size=20
    style.notebook.outlines=[(1, "#c3bdb3", 0, 0)]


#Some default values here (because nowhere else to pt them)
default helpmsg="Supposed to help"
default helpimg="ui/null.png"

#image ui_background = "ui/fog66.png"
image pixl="ui/pixl.png"


#Animation to add borders
image borderu:
    "images/border.png"
    xalign 0.0 ypos 0
    linear 1.0 ypos 50

image borderd:
    "images/border.png"
    xalign 0.0 ypos 820
    linear 1.0 ypos 770


#Animations for Title Screen

image one:
    "ui/Title_Sylvia.jpg"

image two:
    im.Crop("images/ev/chapter2/lea_sun.jpg", (150, 0, 1074, 720))
    alpha 0.0
    pause 5
    linear 1.0 alpha 1.0
    pause 4
    alpha 0.0
    pause 5
    repeat

image three:
    "ui/three.jpg"
    alpha 0.0
    pause 5
    pause 4
    linear 1.0 alpha 1.0
    pause 5
    linear 1.0 alpha 0.0
    repeat

#Heart animations fo title
image goodtitle:
    "images/char/icons/good.png"
    alpha 0.0
    pause 11.0
    zoom 0.2 xpos 0.4 ypos 0.5 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.35 ypos 0.1 alpha 0.5
    linear 1.0 alpha 0.0
    repeat

image badtitle:
    "images/char/icons/bad.png"
    alpha 0.0
    pause 8.0
    zoom 0.2 xpos 0.1 ypos 0.5 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.05 ypos 0.1 alpha 0.5
    linear 1.0 alpha 0.0
    repeat

image oktitle:
    "images/char/icons/ok.png"
    alpha 0.0
    pause 6.0
    zoom 0.2 xpos 0.25 ypos 0.5 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.2 ypos 0.1 alpha 0.5
    linear 1.0 alpha 0.0
    repeat

# Hear in prefs
image scoreheart:
    "images/char/icons/good.png"
    zoom 0.25 alpha 0.8 xalign 0.05 yalign 0.47

#Animation heart in game

image goodh:
    "images/char/icons/good.png"
    zoom 0.2 xpos 0.35 ypos 0.7 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.30 ypos 0.4 alpha 0.7
    linear 1.0 alpha 0.0

image okh:
    "images/char/icons/ok.png"
    zoom 0.2 xpos 0.35 ypos 0.7 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.30 ypos 0.4 alpha 0.7
    linear 1.0 alpha 0.0

image badh:
    "images/char/icons/bad.png"
    zoom 0.2 xpos 0.35 ypos 0.7 alpha 0.1
    linear 2.0 zoom 0.4 xpos 0.30 ypos 0.4 alpha 0.7
    linear 1.0 alpha 0.0

screen phone2(phone2display,thedate,t):
    add phone2display xpos 200

    # add the display
    if phone2display=="mc_phone2lea":
        $ thename="Léa GONTRAND"
    elif phone2display=="mc_phone2val":
        $ thename="Valérie"
    else:
        $ thename=""

    if thename!="":
        $ xcenta=0.665
        $ ycenta=0.66

        use phone2call_display(t,thedate,thename,xcenta,ycenta)

        timer 0.25 repeat True action [SetVariable("is_phone_notified",phone_notif)]

        if is_phone_notified==True:
            add "mc_phone2_notif":
                at transform:
                    xpos 200
                    alpha 0.0
                    pause 0.25
                    linear 0.5 alpha 1.0
                    pause 0.75
                    linear 0.25 alpha 0.0
                    repeat

            text ("Valérie calling...") style "phone" :
                at transform:
                    xcenter xcenta ycenter ycenta-0.402
                    alpha 0.0
                    pause 0.25
                    linear 0.5 alpha 1.0
                    pause 0.75
                    linear 0.25 alpha 0.0
                    repeat


        add "mc_phone2_glow open" xpos 200
        add "mc_phone2_glow open" xpos 200

screen audio_progress(audio_channel,interval,ShowMe,align_x,align_y,size_x,max_x):
    timer interval repeat True action [SetVariable("voice_playing",renpy.music.is_playing("voice"))]

    if renpy.music.is_playing("voice") and ShowMe==True:
        bar:
            value AudioPositionValue(channel=audio_channel, update_interval=interval)
            xalign align_x
            yalign align_y
            xsize size_x
            xmaximum max_x
            thumb None

#########################################################################
# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say(who, what):

    #CUSTOM: display variables (can be switched off on preferences)
    if writer>1 and persistent.display_pathV==True:
        $ infovoice=_get_voice_info()
        $ dialogId=infovoice.auto_filename[len('voice/'+persistent.voicelang+'/'):-4]

        use audio_progress("voice",0.2,True,0.5,0.01,400,400)

    # temporary variables
        $ tempo_traced="  Voice playing: "+str(voice_playing)+"\nVoice file: "+infovoice.auto_filename+"\ndialogId: "+dialogId+"\n{color=#b0b}Label: "+store.current_label+"{/color}\n{color=#b0b0b0}"
        for memory_traced in memory_tracker:
            $tempo_traced=tempo_traced+"\n"+str(memory_traced)+"="+str(checkMemory(memory_traced))
        $ tempo_traced=tempo_traced+"{/color}"

        if paths_enabled==True:
            $ bestpath_screen=comparePaths()
            text ("{color=#5eff6e}Last path choice="+str(player_choice)+"{/color}\n{color=#00a6ff}Léa status="+str(checkMemory("lea"))+"{/color}\nSylvia="+str(checkMemory("sypath"))+" Léa="+str(checkMemory("leapath"))+" Valérie="+str(checkMemory("valpath"))+"\nNo Paths="+str(checkMemory("nopath"))+" Rejected="+str(checkMemory("rejpath"))+"\n{color=#ffae00}Best Path(s)="+str(bestpath_screen))+"{/color}"+tempo_traced:
                xalign 0.01
                yalign 0.01
                size 18
        else:
            text ("\n{color=#00a6ff}Léa status="+str(checkMemory("lea")))+tempo_traced:
                xalign 0.01
                yalign 0.01
                size 18

    # Defaults for side_image and two_window
    default side_image = None
    default two_window = False

    # Decide if we want to use the one-window or two-window varaint.
    if not two_window:

        # The one window variant.
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0

    # Use the quick menu.
    use quick_menu


##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    if choice_line!="":
        text (choice_line) style "menu_choice_button" xcenter 0.5 ycenter 0.1

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        if renpy.mobile==False:
            vbox:
                style "menu"
                spacing 4

                for caption, action, chosen in items:
                    if action:
                        button:
                            action action
                            style "menu_choice_button"

                            text caption style "menu_choice"
                    else:
                        text caption style "menu_caption"
        else:
            vbox:
                style "menu"
                spacing 10

                for caption, action, chosen in items:
                    if action:
                        button:
                            action action
                            style "menu_choice_button"

                            text caption style "mobile_menu_choice"
                    else:
                        text caption style "menu_caption"

    use quick_menu

##############################################################################
# Input
#
# Screen that's used to display renpy.input()
# http://www.renpy.org/doc/html/screen_special.html#input

screen input:

    window style "input_window":
        has vbox

        text prompt style "input_prompt"
        input id "input" style "input_text"

    use quick_menu

##############################################################################
# Nvl
#
# Screen used for nvl-mode dialogue and menus.
# http://www.renpy.org/doc/html/screen_special.html#nvl

screen nvl:

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for who, what, who_id, what_id, window_id in dialogue:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id

        # Display a menu, if given.
        if items:

            vbox:
                id "menu"

                for caption, action, chosen in items:

                    if action:

                        button:
                            style "nvl_menu_choice_button"
                            action action

                            text caption style "nvl_menu_choice"

                    else:

                        text caption style "nvl_dialogue"

    add SideImage() xalign 0.0 yalign 1.0

    use quick_menu

##############################################################################
# Main Menu
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    $ MMX=-50
    $ MMXT=0.02
    $ MMXD=-30
    $ MMY=360

    $ MMY2=MMY+18
    $ MMY2b=MMY2+1
    $ MMYD=50
    $ MMSX=693
    $ MMSY=43
    $ MI=0


    if neoui==1:
        #timer MM_deltaXTick repeat True action (SetVariable("MM_test",MM_test+1))

        add "MM_bg"

        add "MM_LeftTree"

        add "MM_RightTree" xalign 1.0

        add "MM_Light"

        add "MM_pattern" xpos 424 ypos 0

        add "MM_overlay" xpos 0 ypos 0

        add "MM_girls" xpos 588 ypos 111

        # ManorStories Logo
        imagemap:
            idle "MM_logo"
            hover "MM_logo_hover"
            xcenter 0.95 ypos 0.9
            hotspot (0,0,120,65) action OpenURL("https://www.patreon.com/manorstories")


        if renpy.can_load("quitsave"):
            # Resume
            imagemap:
                idle "MM_button"
                hover "MM_button_hover"
                xpos MM_deltaX[MI]+MMX ypos MMY
                hotspot (0, 0, MMSX, MMSY) action FileLoad("quitsave", slot=True)

            textbutton _("Resume") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2
            $ MI+=1


        # New Game
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos MMY+(MMYD*MI)
            hotspot (0, 0, MMSX, MMSY) action Start()

        textbutton _("New Game") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2+(MMYD*MI)
        $ MI+=1


        # Load
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos MMY+(MMYD*MI)
            hotspot (0, 0, MMSX, MMSY) action [SetVariable("pagechange",False),ShowMenu("load")]

        textbutton _("Load") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2+(MMYD*MI)
        $ MI+=1

        # Settings
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos MMY+(MMYD*MI)
            hotspot (0, 0, MMSX, MMSY) action ShowMenu("preferences")

        textbutton _("Settings") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2+(MMYD*MI)
        $ MI+=1

        # Extra
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos MMY+(MMYD*MI)
            #hotspot (0, 0, MMSX, MMSY) action ShowMenu("gallery1")
            hotspot (0, 0, MMSX, MMSY) action Start("extras")

        textbutton _("Extras") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2+(MMYD*MI)
        $ MI+=1

        # Credits
        #imagemap:
        #    idle "MM_button"
        #    hover "MM_button_hover"
        #    xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos (MMY)+(MMYD*MI)
        #    hotspot (0, 0, MMSX, MMSY) action Start("concepts3D_7")

        #textbutton _("Credits") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2b+(MMYD*MI)
        #$ MI+=1

        # Exit
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos MMY+(MMYD*MI)
            hotspot (0, 0, MMSX, MMSY) action Quit(confirm=True)

        textbutton _("Quit") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2b+(MMYD*MI)
        $ MI+=1

        # Support us
        imagemap:
            idle "MM_button"
            hover "MM_button_hover"
            xpos MM_deltaX[MI]+MMX+(MMXD*MI) ypos (MMY)+(MMYD*MI)
            hotspot (0, 0, MMSX, MMSY) action [OpenURL("https://www.patreon.com/manorstories")]

        textbutton _("Support us") style "mm_button" text_style "mm_button" xalign MMXT ycenter MMY2+(MMYD*MI)

        add "MM_title" xpos 64 ypos 136

        # Versions & dedicated to
        if dedicatedTo!="":
            text _("{size=24}{font=ui/Daniel-Black.otf}[dedicatedTo]{/font}{/size}"):
                xcenter 0.86
                yalign 0.02
                color "#f17201"
                style "no_ol"

            text ("{color=#666}{size=20}{b}[config.version]{/b}{/color}"):
                    xcenter 0.86
                    yalign 0.04
                    style "no_ol"

        else:
            text ("{color=#666}{size=16}{b}[config.version]{/b}{/color}"):
                    xcenter 0.86
                    yalign 0.02
                    style "no_ol"

        # DEBUG
        #if MM_Frame>999:
        #    $ MM_Frame=0
        #timer MM_Tick repeat True action SetVariable("MM_Frame",MM_Frame+1)
        #text ("[MM_Frame]\n[MM_deltaX]") xpos 20 ypos 20


    else:
        add "White"

        add "one"

        add "two"

        add "three"

        add "goodtitle"

        add "badtitle"

        add "oktitle"

        if renpy.can_load("quitsave"):
            #textbutton _("Resume") action FileLoad("quitsave", slot=True)
            imagemap:
                ground "ui/title_idle_r.png"
                idle "ui/title_idle_r.png"
                hover "ui/title_hover_r.png"

                hotspot (1030,250,230,50) action FileLoad("quitsave", slot=True)
                hotspot (1030, 305, 230,50) action Start()
                hotspot (1030, 363, 230, 50) action [SetVariable("pagechange",False),ShowMenu("load")]
                hotspot (1030, 419, 230, 50) action ShowMenu("preferences")
                hotspot (1030, 475, 230, 50) action ShowMenu("gallery1")
                hotspot (1030, 534, 230, 50) action Start("concepts3D_7")
                hotspot (1030, 593, 230, 50) action Quit(confirm=True)
                hotspot (1040, 670, 230, 40) action OpenURL("https://www.patreon.com/manorstories")

            text _("{size=32}{font=ui/minikstt.ttf}Resume Game{/font}{/size}"):
                xcenter 0.903
                ycenter 275
                color "#fff"

            text _("{size=32}{font=ui/minikstt.ttf}Start Game{/font}{/size}"):
                xcenter 0.903
                ycenter 330
                color "#fff"
            text _("{size=32}{font=ui/minikstt.ttf}Load Game{/font}{/size}"):
                xcenter 0.903
                ycenter 387
                color "#fff"

            text _("{size=32}{font=ui/minikstt.ttf}Preferences{/font}{/size}"):
                xcenter 0.903
                ycenter 444
                color "#fff"
            text _("{size=32}{font=ui/minikstt.ttf}Gallery{/font}{/size}"):
                xcenter 0.903
                ycenter 501
                color "#fff"

            text _("{size=32}{font=ui/minikstt.ttf}Credits{/font}{/size}"):
                xcenter 0.903
                ycenter 559

            text _("{size=32}{font=ui/minikstt.ttf}Exit{/font}{/size}"):
                xcenter 0.903
                ycenter 618
                color "#fff"

        # Version with no quitslot
        else:
            imagemap:
                ground "ui/title_idle.png"
                idle "ui/title_idle.png"
                hover "ui/title_hover.png"

                hotspot (1030, 250, 230,50) action Start()
                hotspot (1030, 305, 230, 50) action [SetVariable("pagechange",False),ShowMenu("load")]
                hotspot (1030, 363, 230, 50) action ShowMenu("preferences")
                hotspot (1030, 419, 230, 50) action ShowMenu("gallery1")
                hotspot (1030, 475, 230, 50) action Start("concepts3D_7")
                hotspot (1030, 534, 230, 50) action Quit(confirm=True)
                hotspot (1040, 670, 230, 40) action OpenURL("https://www.patreon.com/manorstories")

        # Version with no quitslot
            text _("{size=32}{font=ui/minikstt.ttf}Start Game{/font}{/size}"):
                xcenter 0.903
                ycenter 275
                color "#fff"
            text _("{size=32}{font=ui/minikstt.ttf}Load Game{/font}{/size}"):
                xcenter 0.903
                ycenter 330
                color "#fff"

            text _("{size=32}{font=ui/minikstt.ttf}Preferences{/font}{/size}"):
                xcenter 0.903
                ycenter 387
                color "#fff"
            text _("{size=32}{font=ui/minikstt.ttf}Gallery{/font}{/size}"):
                xcenter 0.903
                ycenter 444
                color "#fff"

            text _("{size=32}{font=ui/minikstt.ttf}Credits{/font}{/size}"):
                xcenter 0.903
                ycenter 501

            text _("{size=32}{font=ui/minikstt.ttf}Exit{/font}{/size}"):
                xcenter 0.903
                ycenter 559
                color "#fff"

            # Link to Patreon action OpenURL("https://www.patreon.com/manorstories")
            add "ui/patreon.png" xcenter 1064 ycenter 0.96 zoom 1.2

            text ("{color=#999}{size=16}Support us on Patreon{/size}{/color}"):
                    xcenter 0.92
                    ycenter 0.96
                    style "no_ol"

            if dedicatedTo!="":
                text _("{size=20}{font=ui/Daniel-Black.otf}[dedicatedTo]{/font}{/size}"):
                    xcenter 0.903
                    yalign 0.3
                    color "#f17201"
                    style "no_ol"

                text ("{color=#444}{size=16}{b}[config.version]{/b}{/color}"):
                        xcenter 0.903
                        yalign 0.32
                        style "no_ol"

            else:
                text ("{color=#444}{size=16}{b}[config.version]{/b}{/color}"):
                        xcenter 0.903
                        yalign 0.31
                        style "no_ol"


##############################################################################
# Navigation
#
# Screen that's included in other screens to display the game menu
# navigation and background.
# http://www.renpy.org/doc/html/screen_special.html#navigation
screen navigation:

    # The background of the game menu.
    window:
        style "gm_root"

    # The various buttons.
    frame:
        style_group "gm_nav"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Return") action Return()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Save Game") action [SetVariable("pagechange",False),ShowMenu("save")]
        textbutton _("Load Game") action [SetVariable("pagechange",False),ShowMenu("load")]
        textbutton _("Main Menu") action MainMenu()
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit()


##############################################################################
# Save, Load
#
# Screens that allow the user to save and load the game.
# http://www.renpy.org/doc/html/screen_special.html#save
# http://www.renpy.org/doc/html/screen_special.html#load

# Since saving and loading are so similar, we combine them into
# a single screen, file_picker. We then use the file_picker screen
# from simple load and save screens.


# Renaming saves input
# rename_slot_funct (actually saving?) is defined L65

screen rename_slot():
    # test if we can load a save (mean can modify it)
    if renpy.can_load("1-"+str(slotnumber)):
        $ old_savename=test_slot_dict(slotnumber)

        if len(old_savename)==0:
            $ old_savename = "%s" % (FileTime(slotnumber, empty=_("No save")))
            $ old_savename = old_savename[14:]

        add "ui/helpbg.png":
            xcenter 0.5
            ycenter 0.5
            alpha 0.95
            xzoom 0.75 yzoom 0.6

        text _("{b}{size=30}Edit title for slot [slotnumber]"):
            xalign 0.5
            yalign 0.34
            color "#fff"

        button:
            id "rename_slot_input"
            action NullAction()
            xcenter 0.5
            #background None
            ycenter 0.45
            xmaximum 500
            ymaximum 42
            add Input(style="no_ol",color="#fff",size=32,default=old_savename,changed=rename_slot_func,lenght=slot_extra_info_maxlen,button=renpy.get_widget("rename_slot","rename_slot_input"))

        textbutton _("{font=ui/gorila.ttf}{size=24}OK{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xcenter 0.69 ycenter 0.61 action Hide("rename_slot")
        # when cancel is on the dict goes banana!!
        #textbutton _("{font=ui/gorila.ttf}{size=24}Cancel{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xcenter 0.61 ycenter 0.61 action [update_slot(bkp_savename),Hide("rename_slot")]
    else:
        timer 0.1 repeat False action [Hide('rename_slot')]

screen load_save_slot:
    # check in the dictionary
    $ TheSaveName=test_slot_dict(number)
    if len(TheSaveName)==0:
        $ file_text = "%2s. %s" % (
                                FileSlotName(number, 199),
                                FileTime(number, empty=_("No save")))
    else:
        $ file_text = "%2s. %s" % (FileSlotName(number, 199),TheSaveName)

    add FileScreenshot(number) xalign 0.47 yalign 0.35
    text "{size=16}{font=ui/danielbd.ttf}[file_text]{/font}{/size}" xalign 0.5 ypos 0.8 size 10 color "#000" style "no_ol"

screen file_picker:
    # Determine what was the last save slot and start from his page
    if pagechange==False:
        $ lastsaved=renpy.newest_slot('1-')
        if lastsaved!=None:
            $ file_page=int(math.ceil((int(lastsaved[2:]))/6.0))
        else:
            $ file_page=1


    if file_page<=0:
        $ file_page=1
    elif file_page>=26:
        $ file_page=25


    imagemap:
            xalign 0.2
            yalign 0.6
            ground "ui/loadsave_idle2.png"
            hover "ui/loadsave_hover2.png"
            selected_idle "ui/loadsave_selected.png"

            #rank+((file_page-1)*6)
            # (6, 3, 209, 202)
            hotspot (0, 0, 220, 215) clicked FileAction(1+((file_page-1)*6)):
                use load_save_slot(number=1+((file_page-1)*6))
            hotspot (260, 0, 220, 215) clicked FileAction(2+((file_page-1)*6)):
                use load_save_slot(number=2+((file_page-1)*6))
            hotspot (521, 0, 221, 215) clicked FileAction(3+((file_page-1)*6)):
                use load_save_slot(number=3+((file_page-1)*6))
            hotspot (0, 221, 220, 215) clicked FileAction(4+((file_page-1)*6)):
                use load_save_slot(number=4+((file_page-1)*6))
            hotspot (260, 221, 220, 215) clicked FileAction(5+((file_page-1)*6)):
                use load_save_slot(number=5+((file_page-1)*6))
            hotspot (521, 221, 221, 215) clicked FileAction(6+((file_page-1)*6)):
                use load_save_slot(number=6+((file_page-1)*6))

    if renpy.mobile==False:
        # for renaming function (desktop only)
        # lazy version of it TODO: make a button under loadable saves
        if rename_saves==1:
            imagemap:
                    xalign 0.2
                    yalign 0.6
                    ground "ui/loadsave_rename_idle.png"
                    hover "ui/loadsave_rename_hover.png"
                    selected_idle "ui/loadsave_rename_selected.png"

                    hotspot (181, 176, 40, 40) clicked [SetVariable('slotnumber',(1+((file_page-1)*6))),Show("rename_slot")]
                    hotspot (441, 176, 40, 40) clicked [SetVariable('slotnumber',(2+((file_page-1)*6))),Show("rename_slot")]
                    hotspot (701, 176, 40, 40) clicked [SetVariable('slotnumber',(3+((file_page-1)*6))),Show("rename_slot")]
                    hotspot (181, 397, 40, 40) clicked [SetVariable('slotnumber',(4+((file_page-1)*6))),Show("rename_slot")]
                    hotspot (441, 397, 40, 40) clicked [SetVariable('slotnumber',(5+((file_page-1)*6))),Show("rename_slot")]
                    hotspot (701, 397, 40, 40) clicked [SetVariable('slotnumber',(6+((file_page-1)*6))),Show("rename_slot")]

        imagemap:
            xpos 75
            ypos 0
            ground "ui/navi_page_idle.png"
            hover "ui/navi_page_hover.png"
            hotspot (988, 490, 75, 30) clicked ShowMenu(action_file,file_page=file_page-1,pagechange=True)
            hotspot (1072, 490, 75, 30) clicked ShowMenu(action_file,file_page=file_page+1,pagechange=True)

            text ("{size=18}{font=ui/gorila.ttf}Page -{/font}{/size}") xcenter 1025 ycenter 503
            text ("{size=18}{font=ui/gorila.ttf}Page +{/font}{/size}") xcenter 1110 ycenter 503

    else:
        imagemap:
            xcenter 0.9
            ycenter 0.8
            ground "ui/Mnavi_page_idle.png"
            hover "ui/Mnavi_page_hover.png"
            hotspot (0, 0, 92, 33) clicked ShowMenu(action_file,file_page=file_page-1,pagechange=True)
            hotspot (103, 0,92 , 33) clicked ShowMenu(action_file,file_page=file_page+1,pagechange=True)

            text ("{size=18}{font=ui/gorila.ttf}Page -{/font}{/size}") xcenter 45 ycenter 15
            text ("{size=18}{font=ui/gorila.ttf}Page +{/font}{/size}") xcenter 150 ycenter 15

    text ("{size=22}{font=ui/gorila.ttf}- Page [file_page] -{/font}{/size}") xalign 0.37 yalign 0.9 size 28

screen navigatore:

    if renpy.mobile==False:
        imagemap:
            xpos 75
            ypos 0
            ground "ui/navi_main_idle.png"
            idle "ui/navi_main_idle.png"
            selected_idle "ui/navi_main_selected.png"
            hover "ui/navi_main_hover.png"

            hotspot (988, 240, 75, 75) action MainMenu()
            hotspot (1072, 240, 75, 75) action ShowMenu("save")
            hotspot (988, 324, 75, 75) action ShowMenu("load")
            hotspot (1072,324, 75, 75) action ShowMenu("preferences")
            hotspot (988, 407, 160, 75) action Return()

            text _("Menu") style "navigatore_button" xcenter 1025 ycenter 275
            text _("Save") style "navigatore_button" xcenter 1110 ycenter 275
            text _("Load") style "navigatore_button" xcenter 1025 ycenter 360
            text _("Prefs.") style "navigatore_button" xcenter 1110 ycenter 360
            text _("Return") style "navigatore_button" xcenter 1067 ycenter 446 size 24
    else:
        imagemap:
            ground "ui/Mnavi_main_idle.png"
            idle "ui/Mnavi_main_idle.png"
            selected_idle "ui/Mnavi_main_selected.png"
            hover "ui/Mnavi_main_hover.png"
            xcenter 0.9
            ycenter 0.5

            hotspot (0, 0, 92, 93) action MainMenu()
            hotspot (104, 0, 92, 93) action ShowMenu("save")
            hotspot (0, 105, 92, 90) action ShowMenu("load")
            hotspot (104,105, 92, 90) action ShowMenu("preferences")
            hotspot (0,200, 195, 100) action Return()

            text _("Menu") style "navigatore_button" xcenter 45 ycenter 45 size 23
            text _("Save") style "navigatore_button" xcenter 150 ycenter 45 size 23
            text _("Load") style "navigatore_button" xcenter 45 ycenter 150 size 23
            text _("Prefs.") style "navigatore_button" xcenter 150 ycenter 150 size 23
            text _("Return") style "navigatore_button" xcenter 105 ycenter 255 size 27

screen save:
    # This ensures that any other menu screen is replaced.
    tag menu

    add "images/bg/myoffice_b.jpg"
    add "images/black.png" alpha 0.6
    add "ui/fog66.png":
        alpha 0.5


    add "ui/bgg.png"

    use file_picker(action_file="save")
    #add "ui/h_save.png"
    text _("{font=ui/gorila.ttf}Save game{/font}"):
        xalign 0.37
        yalign 0.0
        size 72
        color "#fff"
        style "b_ol"

    use navigatore


screen gallery_switch:

    $ gala="gallery"+str(gallery_page-1)
    $ galb="gallery"+str(gallery_page+1)
    if gallery_page==1:
        $ gala="gallery"+str(maxGallery)
    elif gallery_page==maxGallery:
        $ galb="gallery1"

    if renpy.mobile==False:
        imagemap:
            xpos 75
            ypos 0
            ground "ui/navi_page_idle.png"
            hover "ui/navi_page_hover.png"
            hotspot (988, 490, 75, 30) action ShowMenu(gala)
            hotspot (1072, 490, 75, 30) action ShowMenu(galb)

            text ("{size=18}{font=ui/gorila.ttf}Page -{/font}{/size}") xcenter 1025 ycenter 503
            text ("{size=18}{font=ui/gorila.ttf}Page +{/font}{/size}") xcenter 1110 ycenter 503
    else:
        imagemap:
            xcenter 0.9
            ycenter 0.8
            ground "ui/Mnavi_page_idle.png"
            hover "ui/Mnavi_page_hover.png"
            hotspot (0, 0, 92, 33) clicked ShowMenu(gala)
            hotspot (103, 0,92 , 33) clicked ShowMenu(galb)

            text ("{size=18}{font=ui/gorila.ttf}Page -{/font}{/size}") xcenter 45 ycenter 15
            text ("{size=18}{font=ui/gorila.ttf}Page +{/font}{/size}") xcenter 150 ycenter 15


screen load:
    # This ensures that any other menu screen is replaced.
    tag menu

    add "images/bg/room_b.jpg"
    add "images/black.png" alpha 0.6
    add "ui/fog66g.png":
        alpha 0.5

    add "ui/bgg.png"

    use file_picker(action_file="load")
    #add "ui/h_load.png"
    text _("{font=ui/gorila.ttf}Load game{/font}"):
        xalign 0.37
        yalign 0.0
        size 72
        color "#fff"
        style "b_ol"

    use navigatore

init -2 python:
    style.file_picker_frame = Style(style.menu_frame)

    style.file_picker_nav_button = Style(style.small_button)
    style.file_picker_nav_button_text = Style(style.small_button_text)

    style.file_picker_button = Style(style.large_button)
    style.file_picker_text = Style(style.large_button_text)

##############################################################################
# Preferences
#
# Screen that allows the user to change the preferences.
# http://www.renpy.org/doc/html/screen_special.html#prefereces


screen preferences:

    tag menu

    add "images/bg/office_night_p.jpg"
    add "images/black.png" alpha 0.6
    add "ui/fog66r.png":
        alpha 0.4

    add "ui/bgg.png"

    text _("{font=ui/gorila.ttf}Settings{/font}"):
        xalign 0.37
        yalign 0.0
        size 72
        color "#fff"
        style "b_ol"

    if writer>1:
        text ("{font=ui/gorila.ttf}Paths{/font}"):
            xcenter 0.13
            ypos 100
            size 28
            color "#000"
            style "w_ol"

        textbutton ("Show variables") style "prefa_button" text_style "prefa_button" xcenter 0.13 ypos 145 action SetVariable("persistent.display_pathV", True)
        textbutton ("Hide variables") style "prefa_button" text_style "prefa_button" xcenter 0.13 ypos 170 action SetVariable("persistent.display_pathV", False)


    imagemap:
        xalign 0.6
        yalign 0.6
        ground "ui/no_ground.png"
        bar pos (25, 80) value Preference("music volume") style "pref_slider"
        bar pos (25, 150) value Preference("voice volume") style "pref_slider"
        bar pos (25,220) value Preference("sfx volume") style "pref_slider"
        bar pos (306, 80) value Preference("text speed") style "pref_slider"

        text _("{font=ui/gorila.ttf}Audio{/font}"):
            xpos 16
            ypos 10
            size 28
            color "#000"
            style "w_ol"

        text _("{font=ui/gorila.ttf}Music Volume{/font}"):
            xpos 25
            ypos 52
            size 20
            color "#999"
            style "w_ol"


        text _("{font=ui/gorila.ttf}Voices Volume{/font}"):
            xpos 25
            ypos 122
            size 20
            color "#999"
            style "w_ol"


        text _("{font=ui/gorila.ttf}SFX Volume{/font}"):
            xpos 25
            ypos 192
            size 20
            color "#999"
            style "w_ol"

        text _("{font=ui/gorila.ttf}Texts{/font}"):
            xpos 298
            ypos 10
            size 28
            color "#000"
            style "w_ol"

        text _("{font=ui/gorila.ttf}Text speed{/font}"):
            xpos 306
            ypos 52
            size 20
            color "#999"
            style "w_ol"

        if writer>1:
            text _("{font=ui/gorila.ttf}Text skip{/font}"):
                xpos 298
                ypos 145
                size 28
                color "#000"
                style "w_ol"

            textbutton _("All text") style "prefa_button" text_style "prefa_button" xcenter 420 ypos 200 action Preference("skip", "all")
            textbutton _("Seen text only") style "prefa_button" text_style "prefa_button" xcenter 420 ypos 230 action Preference("skip", "seen")

        else:
            text _("{font=ui/gorila.ttf}Help screens{/font}"):
                xpos 298
                ypos 145
                size 28
                color "#000"
                style "w_ol"

            textbutton _("Enabled") style "prefa_button" text_style "prefa_button" xcenter 420 ypos 200 action SetVariable("persistent.help_screens", True)
            textbutton _("Disabled") style "prefa_button" text_style "prefa_button" xcenter 420 ypos 230 action SetVariable("persistent.help_screens", False)


        if renpy.mobile==False:
            text _("{font=ui/gorila.ttf}Advanced{/font}{size=16} *{/size}"):
                xpos 16
                ypos 275
                size 28
                color "#000"
                style "w_ol"

            textbutton _("Always start from menu") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 325 action Confirm("", [SetVariable("persistent.autoreload","no"),Jump('autoreload_proc')], ShowMenu('preferences'), confirm_selected=True)
            textbutton _("Resume game directly") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 360 action Confirm("",[SetVariable("persistent.autoreload","quitsave"),Jump('autoreload_proc')], ShowMenu('preferences'), confirm_selected=True)

            if english_only==0:
                textbutton _("Select language") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 375 action Jump('language_chooser_persistent')
            text _("* Game will restart to apply settings") xcenter 240 ypos 400 size 20

        elif renpy.mobile==False and english_only==0:
            text _("{font=ui/gorila.ttf}Advanced{/font}{size=16} *{/size}"):
                xpos 160
                ypos 275
                size 28
                color "#000"
                style "w_ol"

            #if config.auto_load=="quitsave":
            #    textbutton _("Start from menu") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 325 action Jump('unset_autoreload')
            #else:
            #    textbutton _("Resume game directly") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 325 action Jump('set_autoreload')

            textbutton _("Select language") style "prefa_button" text_style "prefa_button" xcenter 240 ypos 330 action Jump('language_chooser_persistent')
            text _("* Game will restart to apply settings") xcenter 420 ypos 400 size 20


#Score/Potential
    add "scoreheart" xcenter 0.15 ycenter 435 alpha 0.8
    text _("{b}Story completion [score] %"):
        xcenter 0.15
        ycenter 422
        text_align 0.5
        color "#f00"
        style "w_ol"

    if renpy.mobile==False:
        $ yposo=-72
        text _("{font=ui/gorila.ttf}Display{/font}"):
            xcenter 0.15
            ypos 275+yposo #275
            size 28
            color "#000"
            style "w_ol"

        textbutton _("Window") style "prefa_button" text_style "prefa_button" xcenter 0.15 ypos 325+yposo action Preference("display", "window") #325
        textbutton _("Fullscreen") style "prefa_button" text_style "prefa_button" xcenter 0.15 ypos 360+yposo action Preference("display", "fullscreen") #360

# Helpers
# Maybie a better way to do in renpy 7 is https://lemmasoft.renai.us/forums/viewtopic.php?p=498230#p498230
# Keep in mind this menu have been written in renpy 6!
    if writer>1:
        text _("{font=ui/gorila.ttf}Help screens{/font}"):
            xcenter 0.13
            ypos 469
            size 28
            color "#000"
            style "w_ol"

        textbutton _("Enabled") style "prefa_button" text_style "prefa_button" xcenter 0.13 yalign 0.73 action SetVariable("persistent.help_screens", True)
        textbutton _("Disabled") style "prefa_button" text_style "prefa_button" xcenter 0.13 ypos 554 action SetVariable("persistent.help_screens", False)


    use navigatore

##############################################################################
# Yes/No Prompt
#
# Screen that asks the user a yes or no question.
# http://www.renpy.org/doc/html/screen_special.html#yesno-prompt

screen yesno_prompt:

    #add "ui_background"
    imagemap:
        ground "ui/yesno.png"

        text _("{font=ui/gorila.ttf}{size=32}Are you sure you want to do this ?{/size}{/font}"):
            xalign 0.5
            yalign 0.42
            size 24
            color "#fff"
            #style "b_ol"

        textbutton _("{font=ui/gorila.ttf}{size=32}Yes{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xalign 0.43 yalign 0.56 action yes_action
        textbutton _("{font=ui/gorila.ttf}{size=32}No{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xalign 0.57 yalign 0.56 action no_action


##############################################################################
# Help screens (to replace what narrator is saying sometimes)
#
#
screen pleasewait():
    add "Black" alpha 0.5
    text _("Please wait ...") style "WIP" xcenter 0.5 yalign 0.66

    #timer time_wait repeat False action [Hide('pleasewait'),Return(value=None)]


screen base_prompt:
    #add "ui_background"
    add "ui/helpbg.png":
        xcenter 0.5
        ycenter 0.5
        alpha 0.90

    text _("{font=ui/gorila.ttf}{size=32}Info{/size}{/font}"):
        xalign 0.5
        yalign 0.24
        color "#fff"

    text ("{size=24}"+helpmsg+"{/size}"):
        xpos 260
        ypos 220
        color "#fff"

    add helpimg xcenter 0.7 ycenter 0.35 zoom 2.1

    if store.current_label!="splashscreen":
        use quick_menu

screen help_prompt:
    if persistent.help_screens:
        use base_prompt
        textbutton _("{font=ui/gorila.ttf}{size=24}OK{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xcenter 0.7 ycenter 0.7 action Return(value=None)
        if help_disable_option!=1:
            textbutton _("{font=ui/gorila.ttf}{size=24}Disable help messages{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xcenter 0.4 ycenter 0.7 action SetVariable("persistent.help_screens", False)
    else:
        timer 0.1 repeat False action [Hide('help_prompt'),Return(value=None)]


##############################################################################
# Quick Menu
#
# A screen that's included by the default say screen, and adds quick access to
# several useful functions.

screen quick_menu():
    $ no_quick_menu=0
    if renpy.get_screen("scene_selector_title") or renpy.get_screen("testers_title"):
        $ no_quick_menu=1
    else:
        $ qm_alpha=0.5

        if renpy.mobile==False:
            if 'bag' in inventory:
                imagemap:
                    ground "wbag"
                    hover "wbag_h"
                    xpos 950
                    ypos 678

                    hotspot (0, 0, 33, 32) action Show('inventory')

            imagemap:
                #ground "ui/w_tools.png"
                ground "tools"
                hover "tools_h"
                xpos 984
                ypos 678

                hotspot (0, 0, 31, 32) action Rollback()
                hotspot (32, 0, 31, 32) action ShowMenu('load')
                hotspot (64, 0, 31, 32) action ShowMenu('save')
                hotspot (96, 0, 31, 32) action Skip()
                hotspot (128, 0, 31, 32) action ShowMenu('preferences')
                hotspot (160, 0, 31, 32) action Quit()
        else:
            if 'bag' in inventory:
                imagemap:
                    ground "ui/Mw_bag.png"
                    hover "ui/Mo_bag.png"
                    xpos 770
                    ypos 666
                    hotspot (0, 0, 40, 40) action Show('inventory')

            imagemap:
                ground "ui/Mw_tools.png"
                hover "ui/Mo_tools.png"
                xpos 830
                ypos 670
                hotspot (0, 0, 40, 40) action Rollback()
                hotspot (60, 0, 40, 40) action ShowMenu('load')
                hotspot (120, 0, 40, 40) action ShowMenu('save')
                hotspot (180, 0, 40, 40) action Skip()
                hotspot (240, 0, 40, 40) action ShowMenu('preferences')
                hotspot (300, 0, 30, 40) action Quit()


############################################################################
# Patience bar (pourcentage)
#
# Une barre qui se rempli a mesure
#
# Pour monter/cacher ... ben un simple show screen patiencebar / hide screen paticencebar
#
# Animation du patiencebar
#$ setpatience =  patience+step2patience
# play sound ("sounds/patience.mp3")
# while patience < setpatience:
#    $ patience += 1
#    pause 0.01

screen patiencebar():

    add "ui/ui_bar2.png":
        #xpos 0
        xalign 0.5
        #ypos 522
        ypos 15

    #Call the class with patience value or do a simple crop
    add "ui/patiencebar2.png":
        xpos 780
        ypos 15

    add "ui/patiencebar2_empty.png":
        xpos 780
        ypos 15
        #crop (0,0,int(patience),24)
        crop (0,0,int(patience*2.2),24) #why this multiplication? does PatiencebarCCD have it (or should have it)?


    text ("{color=#fff}{size=20}([tries]/[maxtries]) {i}[instructions]{/i}{/size}{/color}"):
        xpos 280 ypos 15

    text ("{color=#fff}{size=20}"+str(int(patience))+" %{/size}{/color}"):
        xcenter 890 ypos 15

screen testers_title:

    add "extras_bg":
        alpha 0.4

    text _("New Game") style "mm_button" xcenter 0.5 ycenter 0.1 size 50

    imagemap:
        idle "mm_back"
        hover "mm_back_hover"
        xcenter 0.05
        ycenter 0.92
        hotspot(0,0,72,60) action MainMenu(confirm=False)

    use quick_menu

    #text _("{font=ui/gorila.ttf}{color=#f17201}{size=58}{u}Start Menu{/u}{/size}{/color}{/font}"):
    #    xalign 0.5
    #    yalign 0.1

    #text _("{font=ui/gorila.ttf}{color=#fff}{size=58}Start Menu{/size}{/color}{/font}"):
    #    xalign 0.5
    #    yalign 0.1

    #text _("{font=ui/gorila.ttf}{color=#fff}{size=32}Select an option{/size}{/color}{/font}"):
    #    xalign 0.5
    #    yalign 0.2

    #textbutton __("{b}Back to main menu{/b}") style "map_button" text_style "map_button" xalign 0.1 yalign 0.9 action MainMenu(confirm=False)

# COMPUTER WRITTING EFFECT (like type writter)
# use variable datelog,datelogIndex
screen datelog:

    $ timos_step=0.08
    #$ p_datelog=datelog[0:datelogIndex]

    timer timos_step repeat True action If( datelogIndex<len(datelog) , true=[SetVariable('datelogIndex', datelogIndex+1),SetVariable('p_datelog', datelog[0:datelogIndex]+"_"),Play ("sound","sounds/bipw2.mp3",False)],false=[SetVariable('p_datelog', datelog)])

    #index modulo 2>sound
    #if text[index] = space different sound
    text (p_datelog) style "complog" xalign 0.1 ycenter 0.85

    key "dismiss" action [SetVariable('datelogIndex',0),SetVariable('p_datelog',''),Return()]
    use quick_menu

screen chapter():
    #TODO code snippet to reset those variables before return
    $ chapters=[(__("A suivre ..."),"","null"),(__("Chapitre 1"),__("Rencontres"),"ch1"),(__("Chapitre 2"),__("Expériences"),"ch2"),(__("Chapitre 3"),__("Héritages"),"ch3"),(__("Chapitre 4"),__("Décisions"),"ch4"),(__("Chapitre 5"),__("Conséquences"),"ch5"),(__("Chapitre Bonus"),__("Visite de resort beach"),"map")]

    $ timos_step=0.025
    $ chapterDef=chapters[chapterNum]
    $ alphastep=0.02

    if caswitch==0:
        timer timos_step repeat True action If(alpha0 > 0, true=[SetVariable('alpha0', alpha0 - alphastep)],false=[SetVariable('alpha0',0),SetVariable('caswitch',1)])

    elif caswitch==1:
        timer timos_step repeat True action If(alpha1 > 0, true=[SetVariable('alpha1', alpha1 - (alphastep/2))],false=[SetVariable('alpha1',0),SetVariable('caswitch',2)])

    add "images/black.png"

    #Blurred bg dim
    if chapterDef[2]!="ch5":
        add "images/chapt/"+chapterDef[2]+"b.jpg":
            alpha 0.7

    else:
        add "images/chapt/"+chapterDef[2]+checkMemory('chosen_path')+"b.jpg":
            alpha 0.7
        add chapterDef[2]+checkMemory('chosen_path')+"b":
            alpha 0.7 xpos 348 ypos 232

    #Chapter text
    add "images/chapt/line_divider.png"

    textbutton ("{size=110}"+chapterDef[0]+"{/size}") style "chapt" xalign 0.5 ycenter 0.44 text_style "chapt"
    textbutton ("{size=80}"+chapterDef[1]+"{/size}") style "chapt" xalign 0.5 ycenter 0.64 text_style "chapt"

    #TODO Blurred bg no dim
    if chapterDef[2]!="ch5":
        add "images/chapt/"+chapterDef[2]+"b.jpg":
            alpha alpha1

    else:
        add "images/chapt/"+chapterDef[2]+checkMemory('chosen_path')+"b.jpg":
            alpha alpha1
        add chapterDef[2]+checkMemory('chosen_path')+"b":
            alpha alpha1 xpos 348 ypos 232

    #Clear BG
    if chapterDef[2]!="ch5":
        add "images/chapt/"+chapterDef[2]+".jpg":
            alpha alpha0

    else:
        add "images/chapt/"+chapterDef[2]+checkMemory('chosen_path')+".jpg":
            alpha alpha0
        add chapterDef[2]+checkMemory('chosen_path'):
            alpha alpha0 xpos 348 ypos 232


    key "dismiss" action [SetVariable('alpha0',1),SetVariable('alpha1',1),SetVariable('alpha2',1),Return()]

    if caswitch==2:
        use quick_menu

screen chapter5(path5):

    $ chapterTitle=__("Chapitre 5")
    $ chapterSub=__("Conséquences")
    $ timos_step=0.025
    $ alphastep=0.02
    if path5=="prettypath":
        if checkMemory('lea_swim_version')!=None:
            $ lea_swim=checkMemory('lea_swim_version')
        else:
            $ lea_swim="S1"


    if caswitch==0:
        timer timos_step repeat True action If(alpha0 > 0, true=[SetVariable('alpha0', alpha0 - alphastep)],false=[SetVariable('alpha0',0),SetVariable('caswitch',1)])

    elif caswitch==1:
        timer timos_step repeat True action If(alpha1 > 0, true=[SetVariable('alpha1', alpha1 - (alphastep/2))],false=[SetVariable('alpha1',0),SetVariable('caswitch',2)])

    add "images/black.png"


    #Blurred bg dim
    if path5!="prettypath":
        add "images/chapt/"+path5+"/blur.jpg":
            alpha 0.7
    else:
        add "images/chapt/"+path5+"/blur_"+lea_swim+".jpg":
            alpha 0.7


    # Add animations blurred dimed
    if path5=="sypath":
        add "TeaCh5_b" alpha 0.7 xpos 810 ypos 0
    elif path5=="leapath":
        add "SunCh5_b" alpha 0.7 xpos 0 ypos 0
    #elif path5=="prettypath":
        #add "d1_b" alpha 0.7 xpos 229 ypos 0
        #add "d2_b" alpha 0.7 xpos 721 ypos 0
        #add "d3_b" alpha 0.7 xpos 1093 ypos 0

    # Add blurred animations specifics to path (if path=="sypath": ....)
    if path5=="sypath":
        add "TeaCh5_b" alpha alpha1 xpos 810 ypos 0
    elif path5=="leapath":
        add "SunCh5_b" alpha alpha1 xpos 0 ypos 0
    #elif path5=="prettypath":
        #add "d1_b" alpha alpha1 xpos 229 ypos 0
        #add "d2_b" alpha alpha1 xpos 721 ypos 0
        #add "d3_b" alpha alpha1 xpos 1093 ypos 0


    #Chapter text
    add "images/chapt/line_divider.png"
    textbutton ("{size=110}"+chapterTitle+"{/size}") style "chapt" xalign 0.5 ycenter 0.44 text_style "chapt"
    textbutton ("{size=80}"+chapterSub+"{/size}") style "chapt" xalign 0.5 ycenter 0.64 text_style "chapt"

    #TODO Blurred bg no dim
    if path5!="prettypath":
        add "images/chapt/"+path5+"/blur.jpg":
            alpha alpha1
    else:
        add "images/chapt/"+path5+"/blur_"+lea_swim+".jpg":
            alpha alpha1

    #Clear BG
    if path5!="prettypath":
        add "images/chapt/"+path5+"/clear.jpg":
            alpha alpha0
    else:
        add "images/chapt/"+path5+"/clear_"+lea_swim+".jpg":
            alpha alpha0

    # Add clear animations specifics to path (if path=="sypath": ....)
    if path5=="sypath":
        add "TeaCh5" alpha alpha0 xpos 810 ypos 0
    elif path5=="leapath":
        add "SunCh5" alpha alpha0 xpos 0 ypos 0
    elif path5=="prettypath":
        add "d1" alpha alpha0 xpos 229 ypos 0
        add "d2" alpha alpha0 xpos 721 ypos 0
        add "d3" alpha alpha0 xpos 1093 ypos 0

    key "dismiss" action [SetVariable('alpha0',1),SetVariable('alpha1',1),SetVariable('alpha2',1),Return()]
    if caswitch==2:
        use quick_menu

# skip minigame screen (TODO : add this to the preferences and persistent)
screen skip_minigames:

    tag menu

    add "ui/helpbg.png":
        zoom 1
        alpha 0.98
        xcenter 0.5
        ycenter 0.5

    text _("{font=ui/gorila.ttf}{size=32}Mini Games{/size}{/font}"):
        xalign 0.5
        yalign 0.23
        color "#fff"

    textbutton _("Allow mini games") style "lang_button" text_style "lang_button" xpos 375 ypos 240 action [SetVariable("minigames","normal")]

    text ("{size=18}Play minigames and get the full experience.{/size}"):
        xpos 300
        ypos 250
        color "#fff"

    #textbutton _("Skip mini games") style "lang_button" text_style "lang_button" xpos 370 ypos 340 action [SetVariable("minigames","skip")]
    textbutton _("Skip mini games") style "lang_button" text_style "lang_button" xpos 370 ypos 340 action [SetVariable("minigames","normal")]


    text ("{size=18}Mini Games will be skipped for those willing to concentrate on the story.\nA pop-up window will give you a short description to help to catch up on the story.{/size}"):
        xpos 300
        ypos 350
        color "#fff"

    textbutton _("{font=ui/gorila.ttf}{size=24}OK{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xalign 0.74 ypos 490 action Return() #ShowMenu("preferences")


# integrate a language selector for all voices in system
# screen language chooser will be displayed when persistent is false using voice completion
# the voice completion screen will also be reused in preferences (see voice over status)
# preferences will have additional text for language


screen language_chooser:

    #add "ui_background"
    add "ui/helpbg.png":
        zoom 1.2
        alpha 1.0
        xcenter 0.5
        ycenter 0.5

    text _("{font=ui/gorila.ttf}{size=32}Language / Langue{/size}{/font}"):
        xalign 0.5
        yalign 0.18
        color "#fff"

    text ("{size=24}{b}Texts / Textes :{/b}{/size}"):
        xpos 240
        ypos 220
        color "#fff"

    textbutton _("English") style "lang_button" text_style "lang_button" xpos 290 ypos 260 action [SetVariable("textlang","english")] #style "mapyn_button" text_style "mapyn_button"
    textbutton _("Français") style "lang_button" text_style "lang_button" xpos 390 ypos 260 action [SetVariable("textlang","france")] #style "mapyn_button" text_style "mapyn_button"


    text ("{size=24}{b}Voices / Voix :{/b}{/size}"):
        xpos 240
        ypos 320
        color "#fff"

    textbutton _("English") style "lang_button" text_style "lang_button" xpos 290 ypos 360 action [SetVariable("voicelang","english")] #style "mapyn_button" text_style "mapyn_button"
    textbutton _("Français") style "lang_button" text_style "lang_button" xpos 390 ypos 360 action [SetVariable("voicelang","france")] #style "mapyn_button" text_style "mapyn_button"

    text ("{size=18}French version only include Sylvia and Valérie.\nEnglish version covers all main characters.\n\nSeules les voix de Sylvia et de Valérie sont disponibles en français.\nLa version anglaise propose les voix de tous les personnages.{/size}"):
        xpos 500
        ypos 235
        color "#fff"

    if persistent.previous_lang==True:
        text ("{size=18}The game will restart once you press OK\nLe jeu va redémarrer quand vous cliquerez sur OK{/size}"):
            xcenter 0.5
            yalign 0.72
            color "#fff"

    textbutton _("{font=ui/gorila.ttf}{size=24}OK{/font}{/size}") style "mapyn_button" text_style "mapyn_button" xalign 0.8 yalign 0.75 action Jump('language_processing') #[Return(value=None)]#,Hide("language_chooser")]

########################################
# EXIT screen
screen escapeit(screenToHide):
    if renpy.mobile==True:
        $ tsize="{size=24}"
    else:
        $ tsize="{size=20}"
    textbutton tsize+"[esc_textToDisplay]{/size}" xcenter 0.85 yalign 0.05 style "mapyn_button" text_style "mapyn_button" action [SetVariable("esc_textToDisplay",""),Hide(screenToHide),Jump(esc_labelToGo)]

#########################################
# W.I.P.
screen workinprogress:
    text _("Work in progress ...") style "WIP" xalign 0.05 yalign 0.05

screen workinprogress_r:
    text _("Work in progress ...") style "WIP" xalign 0.95 yalign 0.05

screen camtext(camtext):
    text camtext style "WIP" color "#22F" xcenter 0.8 yalign 0.05

#########################################
# Phone

screen phone2call_display(t,thedate,thename,xcenta,ycenta):
    $ dt=deltaTime(t)
    $ sdt=str(dt)[:7]
    $ thenow=thedate+dt
    $ theday=str(thenow)[:10]
    $ thetime=str(thenow)[11:16]

    text ("{alpha=0.6}{size=-1}BanaNET{/size}{size=-4} [theday] [thetime]{/size}{size=-2}{b} 4G{/b}{/size}{/alpha}") xcenter xcenta-0.015 ycenter ycenta-0.468 style "phone_h" color "#FFFEFF"
    text ("[thename]") xcenter xcenta ycenter ycenta-0.4 style "phone"
    text _("{size=-6} Call in progress ...{/size}") xcenter xcenta ycenter ycenta style "phone"
    text ("{size=+2}[sdt]{/size}") xcenter xcenta ycenter ycenta+0.04 style "phone_h"

    timer 1 repeat True action SetVariable('dt', deltaTime(t))

screen phone_display(t,thedate,thename):
    $ dt=deltaTime(t)
    $ sdt=str(dt)[:7]
    $ thenow=thedate+dt
    $ theday=str(thenow)[:10]
    $ thetime=str(thenow)[11:16]

    text ("{alpha=0.6}{size=-1}BanaNET{/size}{size=-4} [theday] [thetime]{/size} {size=-2}{b}4G+{/b}{/size}{/alpha}") xcenter 0.495 ycenter 0.192 style "phone_h" color "#FFFEFF"
    text ("[thename]") xcenter 0.51 ycenter 0.26 style "phone"
    text _("{size=-6}Call in progress ...{/size}") xcenter 0.51 ycenter 0.66 style "phone"
    text ("{size=+2}[sdt]{/size}") xcenter 0.51 ycenter 0.7 style "phone_h"

    timer 1 repeat True action SetVariable('dt', deltaTime(t))

########################################
# Narration
# we assume a variable index_na=0 and time_na=0
# and text_na

screen narration_display():
    $ txt_tab=text_na.split("\n")
    $ txt_linum=0

    for item in txt_tab:
        text "{size=-2}"+item.strip()+"{/size}" style "complog" xcenter 0.5 ycenter 0.85+(txt_linum*0.05)
        $ txt_linum+=1

    #use quick_menu
    # think about the sound!

    key "dismiss" action [Stop(channel="V0"),Hide('narration_display'),Jump(jumpto_na)]

##############################################################################
# Choice with parametrized positions
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice_pos(relativePos):

    #$ shuffle(p_topics)
    window:
        style "menu_window"
        xalign relativePos[0]
        yalign relativePos[1]

        vbox:
            style "menu"
            spacing 2

            for topics in p_topics:
                button:
                    xcenter relativePos[0]
                    ycenter relativePos[1]
                    action Return(topics[0])
                    style "menu_choice_pos_button"
                    text topics[1] style "menu_choice"

    use quick_menu


 

0