Project1

标题: 快速存读档 [打印本页]

作者: taroxd    时间: 2014-5-21 16:07
标题: 快速存读档
本帖最后由 taroxd 于 2014-9-21 07:28 编辑

快速存/读档 S键为存,L键为读。需要全键盘脚本

RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2. # ● require Taroxd基础设置,全键盘控制
  3. #    快速存档读档
  4. #--------------------------------------------------------------------------
  5.  
  6. module Taroxd::QuickSL
  7.   KEY_SAVE = Keyboard::S                   # 存档键
  8.   KEY_LOAD = Keyboard::L                   # 读档键
  9.   #--------------------------------------------------------------------------
  10.   # ● 存档位置
  11.   #--------------------------------------------------------------------------
  12.   def quick_save_index
  13.     0
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 快速存档
  17.   #--------------------------------------------------------------------------
  18.   def quick_save
  19.     if DataManager.save_game(quick_save_index)
  20.       on_quick_save_success
  21.     else
  22.       Sound.play_buzzer
  23.     end
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 快速读档
  27.   #--------------------------------------------------------------------------
  28.   def quick_load
  29.     if DataManager.load_game(quick_save_index)
  30.       on_quick_load_success
  31.     else
  32.       Sound.play_buzzer
  33.     end
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 快速存档成功时的处理
  37.   #--------------------------------------------------------------------------
  38.   def on_quick_save_success
  39.     Sound.play_save
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 快速读档成功时的处理
  43.   #--------------------------------------------------------------------------
  44.   def on_quick_load_success
  45.     Sound.play_load
  46.     SceneManager.scene.fadeout_all
  47.     $game_system.on_after_load
  48.     SceneManager.goto(Scene_Map)
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 监听快速存档键的按下
  52.   #--------------------------------------------------------------------------
  53.   def update_call_quick_save
  54.     quick_save if !$game_system.save_disabled && Keyboard.trigger?(KEY_SAVE)
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 监听快速读档键的按下
  58.   #--------------------------------------------------------------------------
  59.   def update_call_quick_load
  60.     quick_load if Keyboard.trigger?(KEY_LOAD)
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 监听快速存/读档键的按下
  64.   #--------------------------------------------------------------------------
  65.   def update_call_quickSL
  66.     update_call_quick_save
  67.     update_call_quick_load
  68.   end
  69. end
  70.  
  71. class Scene_Map < Scene_Base
  72.   include Taroxd::QuickSL
  73.   #--------------------------------------------------------------------------
  74.   # ● 场景更新
  75.   #--------------------------------------------------------------------------
  76.   def_after(:update_scene) { update_call_quickSL unless scene_changing? }
  77. end
  78.  
  79. class Scene_Title < Scene_Base
  80.   include Taroxd::QuickSL
  81.   #--------------------------------------------------------------------------
  82.   # ● 场景更新
  83.   #--------------------------------------------------------------------------
  84.   def_after(:update) { update_call_quick_load unless scene_changing? }
  85. end
  86.  
  87. class Game_Interpreter
  88.   include Taroxd::QuickSL
  89. end





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1