2014-02-27 62 views
0

快速信息:這是用於構建在python上的Renpy Visual Novel Game Engine(可在Github上使用)。在運行時重複更改鍵盤映射

我想要做的是鍵盤映射表的['dismiss']變量更改爲空,而一系列的轉變起到使讀者不能跳過的場景。在場景結束後,我想重新啓用默認的['dismiss'],以便用戶可以繼續讀取VN。

我至今在我的腳本是:

$ enter_off() 
################## 
# Animated Intro # 
################## 
scene bg_sky_winter_sunny with dissolve300s 
$ enter_on() 

代碼的另一部分定義是:

python early: 
    # turns enter off 
    # Also tried # config.keymap['dismiss'] = [] # Same result as below. 
    def enter_off(): 
     config.keymap['dismiss'].remove('mouseup_1') 
     config.keymap['dismiss'].remove('K_RETURN') 
     config.keymap['dismiss'].remove('K_SPACE') 
     config.keymap['dismiss'].remove('K_KP_ENTER') 
     config.keymap['dismiss'].remove('joy_dismiss') 
     return 

    # turns enter on 
    def enter_on(): 
     config.keymap['dismiss'].append('mouseup_1') 
     config.keymap['dismiss'].append('K_RETURN') 
     config.keymap['dismiss'].append('K_SPACE') 
     config.keymap['dismiss'].append('K_KP_ENTER') 
     config.keymap['dismiss'].append('joy_dismiss') 
     return 

    # copy of the default keymap in renpy-6.16.5-sdk\renpy\common\00keymap.rpy 
    def full_kb(): 
     # the rest of the code is long and unnecessary for the question. 

現在,我得到的問題是,當我使用爲介紹代碼第一塊,所述dismiss變量被設置爲空值如預期的,但在片頭端部和場景變化之後,如所預期enter_on()不工作,並且無論是在dismiss不更新引擎以包括值或不不加va提供給dismiss。我基本上都在想我處處可見的地方,但由於缺乏propper文檔,我無法真正弄清楚如何使這個工作。

這裏是有一些信息的地方几個環節:

Renpy鍵盤映射文檔:http://www.renpy.org/wiki/renpy/doc/reference/Keymap

Renpy源代碼:https://github.com/renpy/renpy

任何指針將是真棒!

回答