| 赞 | 275 |
| VIP | |
| 好人卡 | |
| 积分 | 154 |
| 经验 | |
| 最后登录 | 2026-9-15 |
| 在线时间 | 2109 小时 |
- 梦石
- 1
- 星屑
- 14374
- 在线时间
- 2109 小时
- 注册时间
- 2017-9-28
- 回帖
- 607
|
发表于 2020-3-11 22:45:43
|
显示全部楼层
- # =============================================================================
- # TheoAllen - 快速存储和读取
- # Version : 1.1
- # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
- # (This script documentation is written in informal indonesian language)
- # =============================================================================
- ($imported ||= {})[:Theo_Quick] = true
- # =============================================================================
- # CHANGE LOGS:
- # -----------------------------------------------------------------------------
- # - 2013.05.11 - Nambahin switch id
- # - 2013.05.04 - Script selesai
- # =============================================================================
- =begin
- 介绍:
- 该脚本可以让玩家在游戏中按某个键来进行快速存/读档
- 存档文件也可以存在指定存档文件下
-
- 使用方法:
- 插入到插件脚本之下,Main之上
- 编辑下面的设置。
-
- 使用条款 :
- 署名脚本作者, TheoAllen. 你可以自由编辑此脚本,只要你不声明你是脚本的原作者
- 如果你想用此脚本于商业游戏,请和我共享收益.别忘了给我一份免费的游戏拷贝.
- =end
- # =============================================================================
- # 设定部分:
- # =============================================================================
- module THEO
- module SAVE
-
- SAVE_BUTTON = :F5 # 快速存档的按键
- LOAD_BUTTON = :F6 # 快速读档的按键
-
- INDEX = 0 # 快速存/读档时保存到哪个文件(默认为0)
-
- SHOW_COUNT = 150 # 通知窗口的宽度 (默认:150)
- FADEIN = 16 # 淡入速度 (默认:16)
- FADEOUT = 16 # 淡出速度 (默认:16)
-
- SAVE_NOTIFY = "游戏已保存"
- # 显示快速存档时的信息
-
- LOAD_NOTIFY = "游戏已读取"
- # 显示快速读档时的信息
-
- SAVE_SWITCH_ID = 1
- LOAD_SWITCH_ID = 1
- # 对应的开关打开时,才会启用快速存/读档功能(*新)
-
- end
- end
- # =============================================================================
- # 设定结束
- # =============================================================================
- class Window_Notify < Window_Base
-
- def initialize
- super(Graphics.width - window_width, 0, window_width, fitting_height(1))
- self.opacity = 0
- self.contents_opacity = 0
- @show_count = 0
- refresh
- end
-
- def update_fadein
- self.contents_opacity += THEO::SAVE::FADEIN
- end
-
- def update_fadeout
- self.contents_opacity -= THEO::SAVE::FADEOUT
- end
-
- def refresh
- contents.clear
- draw_background(contents.rect)
- draw_text(0,0,contents.width,contents.height,@notify,1)
- end
-
- def show=(text)
- @notify = text
- open
- end
-
- def window_width
- return 240
- end
-
- def update
- super
- if @show_count > 0
- update_fadein
- @show_count -= 1
- else
- update_fadeout
- end
- end
-
- def open
- refresh
- @show_count = THEO::SAVE::SHOW_COUNT
- self.contents_opacity = 0
- self
- end
-
- def close
- @show_count = 0
- self
- end
-
- def draw_background(rect)
- temp_rect = rect.clone
- temp_rect.width /= 2
- contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
- temp_rect.x = temp_rect.width
- contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
- end
-
- def back_color1
- Color.new(0, 0, 0, 192)
- end
-
- def back_color2
- Color.new(0, 0, 0, 0)
- end
- end
-
- class Scene_Map < Scene_Base
-
- alias start_quick_save_load start
- def start
- start_quick_save_load
- create_notify
- show_load_notify if $game_system.quick_load
- end
-
- def create_notify
- @notify_window = Window_Notify.new
- @notify_window.viewport = @viewport
- end
-
- alias quick_save_load_update update
- def update
- quick_save_load_update
- save_file if input_save?
- load_file if input_load?
- end
-
- def save_file
- @notify_window.close
- $game_system.on_before_save
- DataManager.save_game(THEO::SAVE::INDEX)
- show_save_notify
- end
-
- def load_file
- @notify_window.close
- DataManager.load_game(THEO::SAVE::INDEX)
- $game_system.on_after_load
- SceneManager.goto(Scene_Map)
- $game_system.quick_load = true
- end
-
- def show_save_notify
- @notify_window.show = THEO::SAVE::SAVE_NOTIFY
- end
-
- def show_load_notify
- @notify_window.show = THEO::SAVE::LOAD_NOTIFY
- $game_system.quick_load = false
- end
-
- def input_save?
- id = THEO::SAVE::SAVE_SWITCH_ID
- Input.trigger?(THEO::SAVE::SAVE_BUTTON) && (id > 0 ? $game_switches[id] : true)
- end
-
- def input_load?
- id = THEO::SAVE::LOAD_SWITCH_ID
- Input.trigger?(THEO::SAVE::LOAD_BUTTON) && (id > 0 ? $game_switches[id] : true)
- end
-
- end
- class Game_System
- attr_accessor :quick_load
-
- alias pre_quick_init initialize
- def initialize
- pre_quick_init
- @quick_load = false
- end
-
- end
复制代码 |
|