| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2014-6-28 |
| 在线时间 | 276 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 276 小时
- 注册时间
- 2012-9-27
- 回帖
- 164

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 北极七月熊 于 2013-4-29 15:11 编辑
千辛万苦终于做出想要的效果了……,虽然目前还没办法支持鼠标{:2_264:}
这是仿照一个前辈用XP写的一种方法,虽然换到用VA写各种出错泪奔~
使用的方法比较简单,只要按照VA默认的在窗口添加指令的原方法add_command,多填写上参数就可以了。
新增了四个参数:
usepic - 是否使用图片,如果使用图片,则填写true,反正false,
usepic的参数默认false,即不存在图片时使用VA默认的文字指令。
pic- 默认显示图片,默认nil
over_pic - 当正在选择时的图片,即光标移动上去的图片,默认nil
overd - 是否已经选择,无需填写
例如:add_command("新游戏", :new_game, true, nil, true, "图片1.png", "图片2.png")
------------------------------------------------------------------------------------------------
今天研究了一下Sion所提供的鼠标脚鼠标脚本,发现还是挺好兼容的。{:2_287:}
只要在
class Window_Selectable
def set_cursor
里的select(new_index) if new_index < item_max && new_index != @index
改成:
if new_index < item_max && new_index != @index
move_overd_pic?(@index)
contents.clear#新的修正
draw_all_items
select(new_index)
end
就按钮可以支持鼠标了{:2_249:}
------------------------
一个BUG,请先自行修正:
在33行:
#重置指令的参数overd为false
move_overd_pic?(last_index)
contents.clear#新增修正
draw_all_items
end
------------------------------------------------------------------------------------------------
范例下载:
http://pan.baidu.com/share/link?shareid=411995&uk=975966104
随便弄了一张图片{:2_263:}
- #encoding:utf-8
- #==============================================================================
- # ■ 图片选项(修改Window_Selectable 和 Window_Command)by 只有金刚心
- # (不支持鼠标)
- #------------------------------------------------------------------------------
- # 使用方法:按照VA默认的在窗口添加指令的原方法add_command,多填写上参数就可以了。
- # 新增参数:
- # usepic - 是否使用图片,如果使用图片,则填写true,反正false
- # usepic的参数默认false,即不存在图片时使用VA默认的文字指令
- # pic- 默认显示图片,默认nil
- # over_pic - 当正在选择时的图片,即光标移动上去的图片,默认nil
- # overd - 是否已经选择,无需填写
- # 例如:add_command("新游戏", :new_game, true, nil, true, "图片1.png", "图片2.png")
- #==============================================================================
- class Window_Selectable < Window_Base
- #--------------------------------------------------------------------------
- # ● 处理光标的移动
- #--------------------------------------------------------------------------
- def process_cursor_move
- return unless cursor_movable?
- last_index = @index
- cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
- cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
- cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
- cursor_left (Input.trigger?(:LEFT)) if Input.repeat?(:LEFT)
- cursor_pagedown if !handle?(:pagedown) && Input.trigger?(:R)
- cursor_pageup if !handle?(:pageup) && Input.trigger?(:L)
-
- #★★当光标移动时重新绘制指令★★
- if @index != last_index
- Sound.play_cursor
- #重置指令的参数overd为false
- move_overd_pic?(last_index)
- draw_all_items
- end
-
- end
-
- #--------------------------------------------------------------------------
- # ● 更新光标
- #--------------------------------------------------------------------------
- def update_cursor
- if @cursor_all
- cursor_rect.set(0, 0, contents.width, row_max * item_height)
- self.top_row = 0
- elsif @index < 0
- cursor_rect.empty
- else
- #★★更新图片指令★★
- if pic_or_text(@index) == true
- cursor_rect.empty
- overd_pic?(@index)
- redraw_item(@index)
- #保留原来的光标
- else
- ensure_cursor_visible
- cursor_rect.set(item_rect(@index))
- end
-
- end
- end
-
- #★★图片指令函数★★
- def pic_or_text(index)
- end
- def overd_pic(index)
- end
-
- end
- class Window_Command < Window_Selectable
-
- #★★添加指令★★
- #(保留原指令:name-指令名称,symbol-对应的符号,enabled-有效状态的标志,ext-任意的扩展数据)
- #(新增参数usepic-是否使用图片,pic-默认显示图片,over_pic-当正在选择时的图片,overd-是否已经选择)
- def add_command(name, symbol, enabled = true, ext = nil, usepic = false, pic = nil, over_pic = nil,overd = false)
- @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext,:usepic=>usepic, :pic=>pic, :over_pic=>over_pic, :overd=>overd})
- end
-
- #★★绘制图片指令★★
- def draw_item(index)
- #绘制图片指令
- if @list[index][:usepic] == true && @list[index][:pic] != nil
- if @list[index][:over_pic] != nil && @list[index][:overd] == true
- @bitmap = Cache.picture(@list[index][:over_pic])
- else
- @bitmap = Cache.picture(@list[index][:pic])
- end
- rect = Rect.new(0, 0, @bitmap.width, @bitmap.height)
- #图片指令的坐标参照文字指令
- contents.blt(index % col_max * (item_width + spacing), index / col_max * item_height, @bitmap, rect)
- @bitmap.dispose
- #保留原来的文字指令
- else
- change_color(normal_color, command_enabled?(index))
- draw_text(item_rect_for_text(index), command_name(index), alignment)
- end
- end
-
- #★★判断使用图片还是文字★★
- def current_usepic?
- current_data ? current_data[:usepic] : false
- end
-
- def pic_or_text(index)
- return current_usepic?
- end
-
- #★★判断光标是否移动到图片上★★
- def move_overd_pic?(index)
- @list[index][:overd] = false
- end
-
- def overd_pic?(index)
- @list[index][:overd] = true
- end
-
- end
复制代码
|
|