赞 | 0 |
VIP | 8 |
好人卡 | 27 |
积分 | 56 |
经验 | 41413 |
最后登录 | 2012-10-21 |
在线时间 | 833 小时 |
Lv4.逐梦者 弓箭手?剑兰
- 梦石
- 0
- 星屑
- 5584
- 在线时间
- 833 小时
- 注册时间
- 2010-11-17
- 帖子
- 1140
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 一箭烂YiJL 于 2011-4-1 18:00 编辑
0.前言
不知道前人是否有做过类似这样的东西呢?
但是不可不承认的是这是一件很渣的东西,
嗯~由于是一时的无聊想法,所以它用了很短的时间制造,同时也很废。
1.版本功能说明
1.0 : 按下delete按钮,就会删除存挡,如无存档,则发出错误一声。
1.1 : 按下delete就会弹出选择窗, 然后选择删除。
1.1(载图存档版) : 跟1.1功能一样,只是专用于载图存档。
1.1(新式菜单版) : 跟1.1功能一样,只是专用于新式菜单。
1.1的载图存档版和新式菜单版没有范例,只在5.脚本里提供。
2. 1.1版效果载图
正常:
载图存档版:
新式菜单版:
3.范例
最简洁的:
删除存档_v1.0.zip
(282.52 KB, 下载次数: 1908)
有窗口选择的:
删除存档_v1.1.zip
(283.19 KB, 下载次数: 4243)
4.版本讯息
- *1.1.0* (2011-04-01) By 一箭烂(YiJL)
*会弹出选择窗选择是否删除
- *1.0.0* (2011-04-27) By 一箭烂(YiJL)
*初版
5.脚本
1.1载图存档版:
- #==============================================================================
- # ■ 删除存档v1.1(载图存档版) by 一箭烂
- #------------------------------------------------------------------------------
- # 按下delete就会弹出选择窗, 然后选择删除。
- #
- # - *1.1.0* (2011-04-01) By 一箭烂(YiJL)
- # *会弹出选择窗选择是否删除
- #
- # - *1.0.0* (2011-04-27) By 一箭烂(YiJL)
- # *初版
- #==============================================================================
- class Scene_File
- Key = Win32API.new("user32","GetAsyncKeyState","i","i")
- #--------------------------------------------------------------------------
- # ● 开始
- #--------------------------------------------------------------------------
- alias del_start start
- def start
- del_start
- @del_window = Window_DelFile.new
- @del_window.z = 500
- end
- #--------------------------------------------------------------------------
- # ● 更新幀
- #--------------------------------------------------------------------------
- alias del_update update
- def update
- del_update
- @del_window.update
- end
- #--------------------------------------------------------------------------
- # ● 更新选择
- #--------------------------------------------------------------------------
- def update_savefile_selection
- if Input.trigger?(Input::C)
- if @del_window.visible
- case @del_window.index
- when 0
- do_delete
- @del_window.visible = false
- when 1
- @del_window.visible = false
- end
- else
- determine_savefile
- end
- elsif Input.trigger?(Input::B)
- if @del_window.visible
- @del_window.visible = false
- else
- Sound.play_cancel
- return_scene
- end
- elsif Key.call(0x2E) & 1 != 0
- @del_window.visible = true
- end
- if @refresh_index != @command_window.index and @del_window.visible == false
- @refresh_index = @command_window.index
- @savefile_window.dispose
- create_savefile_window
- end
- @command_window.active = !@del_window.visible
- end
- #--------------------------------------------------------------------------
- # ● 删除存档
- #--------------------------------------------------------------------------
- def do_delete
- if FileTest.exist?(SAVE_DIR + make_filename(@command_window.index))
- File.delete(SAVE_DIR + make_filename(@command_window.index))
- @refresh_index = @command_window.index
- @savefile_window.dispose
- create_savefile_window
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # ● 退出场景
- #--------------------------------------------------------------------------
- alias del_terminate terminate
- def terminate
- del_terminate
- @del_window.dispose
- end
- end
- #==============================================================================
- # ■ Window_DelFile
- #==============================================================================
- class Window_DelFile < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super((544-250)/2, (416-100)/2, 250, 90)
- self.contents.draw_text(0, 0, 250-32, 24, "是否删除存档?", 1)
- self.contents.draw_text(0, 32, 93, 24, "是", 1)
- self.contents.draw_text(125, 32, 93, 24, "否", 1)
- @item_max = 2
- @column_max = 2
- @index = 1
- self.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- super
- if self.visible
- if cursor_movable?
- last_index = @index
- if Input.repeat?(Input::DOWN)
- cursor_down(Input.trigger?(Input::DOWN))
- end
- if Input.repeat?(Input::UP)
- cursor_up(Input.trigger?(Input::UP))
- end
- if @index != last_index
- Sound.play_cursor
- end
- end
- update_cursor
- call_update_help
- end
- end
- #--------------------------------------------------------------------------
- # ● 选择矩形
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (contents.width + @spacing) / @column_max - @spacing
- rect.height = WLH
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * WLH + 32
- return rect
- end
- end
复制代码 1.1新式菜单版:
- #==============================================================================
- # ■ 删除存档v1.1(新式菜单版) by 一箭烂
- #------------------------------------------------------------------------------
- # 按下delete就会弹出选择窗, 然后选择删除。
- #
- # - *1.1.0* (2011-04-01) By 一箭烂(YiJL)
- # *会弹出选择窗选择是否删除
- #
- # - *1.0.0* (2011-04-27) By 一箭烂(YiJL)
- # *初版
- #==============================================================================
- class Scene_File < Scene_Menu_Base
- Key = Win32API.new("user32","GetAsyncKeyState","i","i")
- #--------------------------------------------------------------------------
- # ● 开始
- #--------------------------------------------------------------------------
- alias del_start start
- def start
- del_start
- @del_window = Window_DelFile.new
- @del_window.z = 500
- end
- #--------------------------------------------------------------------------
- # ● 更新幀
- #--------------------------------------------------------------------------
- alias del_update update
- def update
- del_update
- @del_window.update
- end
- #--------------------------------------------------------------------------
- # ● 更新选择
- #--------------------------------------------------------------------------
- def update_savefile_selection
- if Input.trigger?(Input::C)
- if @del_window.visible
- case @del_window.index
- when 0
- do_delete
- @del_window.visible = false
- when 1
- @del_window.visible = false
- end
- else
- determine_savefile
- end
- elsif Input.trigger?(Input::B)
- if @del_window.visible
- @del_window.visible = false
- else
- Sound.play_cancel
- return_scene
- end
- elsif Key.call(0x2E) & 1 != 0
- @del_window.visible = true
- end
- if @refresh_index != @file_command_window.index and @del_window.visible == false
- @refresh_index = @file_command_window.index
- @savefile_window.dispose
- create_savefile_window
- end
- @file_command_window.active = !@del_window.visible
- end
- #--------------------------------------------------------------------------
- # ● 删除存档
- #--------------------------------------------------------------------------
- def do_delete
- if FileTest.exist?(SAVE_DIR + make_filename(@file_command_window.index))
- File.delete(SAVE_DIR + make_filename(@file_command_window.index))
- @refresh_index = @file_command_window.index
- @savefile_window.dispose
- create_savefile_window
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # ● 退出场景
- #--------------------------------------------------------------------------
- alias del_terminate terminate
- def terminate
- del_terminate
- @del_window.dispose
- end
- end
- #==============================================================================
- # ■ Window_DelFile
- #==============================================================================
- class Window_DelFile < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super((544-250)/2, (416-100)/2, 250, 90)
- self.contents.draw_text(0, 0, 250-32, 24, "是否删除存档?", 1)
- self.contents.draw_text(0, 32, 93, 24, "是", 1)
- self.contents.draw_text(125, 32, 93, 24, "否", 1)
- @item_max = 2
- @column_max = 2
- @index = 1
- self.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- super
- if self.visible
- if cursor_movable?
- last_index = @index
- if Input.repeat?(Input::DOWN)
- cursor_down(Input.trigger?(Input::DOWN))
- end
- if Input.repeat?(Input::UP)
- cursor_up(Input.trigger?(Input::UP))
- end
- if @index != last_index
- Sound.play_cursor
- end
- end
- update_cursor
- call_update_help
- end
- end
- #--------------------------------------------------------------------------
- # ● 选择矩形
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (contents.width + @spacing) / @column_max - @spacing
- rect.height = WLH
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * WLH + 32
- return rect
- end
- end
复制代码
|
评分
-
查看全部评分
|