赞 | 0 |
VIP | 0 |
好人卡 | 4 |
积分 | 1 |
经验 | 9855 |
最后登录 | 2017-2-5 |
在线时间 | 115 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 115 小时
- 注册时间
- 2010-5-3
- 帖子
- 346
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 反斗奇彬 于 2010-8-23 16:47 编辑
无影神锋的仙三式菜单里面,战斗使用物品在“仙三式战斗菜单2”那里设置,这个脚本我有点看不太懂,望高手帮忙看看
- class Zzh_Window_SkillCommand < Window_Selectable
- attr_accessor :commands
- #--------------------------------------------------------------------------
- # ● 初始化,生成commands窗口
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(-16, 160, 280, 300)
- @commands = []
- #————————生成commands窗口
- #@commands.push("技")
- @commands.push("水")
- @commands.push("火")
- @commands.push("雷")
- @commands.push("风")
- @commands.push("土")
- @commands.push("双")
- @actor=actor
- self.windowskin = nil
- if @commands == []
- @commands.push("普通技能")
- end
- @item_max = @commands.size
- self.contents = Bitmap.new(640, 480)
- self.opacity = 0
- refresh
- self.index = 0
- @oldindex=-1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- bitmap = Bitmap.new("Graphics/system/battle/menu/仙术底板.png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap, src_rect)
- x = @index*32+41
- bitmap = Bitmap.new("Graphics/system/battle/menu/仙术-"[email protected]_s+".png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(x, 27, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # 只描绘原文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@commands[self.index],1)
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.cursor_rect.empty
- return
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.cursor_rect.empty
- return
- end
- x=@index*32+42
- self.cursor_rect.set(x, 28, 30, 25)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- self_update
- if @index != @oldindex
- refresh
- end
- @oldindex=@indexend
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- @zzhaaa_1=1
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- $game_system.se_play($data_system.cursor_se)
- end
- break
- end
- end
- if mouse_not_in_rect
- @zzhaaa_1=2
- @index = index_var
- #if self.is_a?(Window_Target)
- # @index=-3
- #end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Skill
- #==============================================================================
- class Zzh_Window_SkillList < Window_Selectable
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(10, 240, 250, 128)
- @actor = actor
- self.opacity = 0
- refresh
- self.index = -1
- @column_max = 1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in [email protected]
- skill = $data_skills[@actor.skills[i]]
- if skill != nil and skill.desc == command
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #-----------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
- self.contents.font.size = 16
- $zzhok = false
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color.set(0,0,0)
- else
- self.contents.font.color.set(0,0,0,128)
- end
- x = 4
- y = index * 19-5
- rect = Rect.new(x, y, self.width / @column_max - 32, 24)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
- self.contents.draw_text(x + 28, y-2, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 120, y-2, 40, 32, skill.sp_cost.to_s, 2)
- $zzhok = true
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
-
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.cursor_rect.empty
- return
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.cursor_rect.empty
- return
- end
- # 计算光标的宽
- cursor_width = 192
- # 计算光标坐标
- x = 7#@index % @column_max * (cursor_width + 32)-3
- y = (@index-self.top_row) * 19 -2
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 19)
- end
-
- def update
- # p @index
- self_update
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- @zzhaaa_1=1
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- #if (@index != @oldindex)
- $game_system.se_play($data_system.cursor_se)
- #end
- end
- break
- end
- end
- if mouse_not_in_rect
- mouse_x, mouse_y = Mouse.get_mouse_pos
- # 当前行被显示开头行前面的情况下
- #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
- mouse_x-=26
- mouse_y-=243
- if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
- self.top_row +=1
- delay(0.1)
- end
- # 当前行被显示末尾行之后的情况下
- if self.top_row > 0 and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
- # 从当前行向末尾滚动
- self.top_row -=1
- delay(0.1)
- end
- @zzhaaa_1=2
- @index = index_var
- if self.is_a?(Window_Target)
- @index=-3
- end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- def top_row
- # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- return self.oy / 19
- end
- #--------------------------------------------------------------------------
- # ● 设置开头行
- # row : 显示开头的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row 未满 0 的场合更正为 0
- if row < 0
- row = 0
- end
- # row 超过 row_max - 1 的情况下更正为 row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
- self.oy = row * 19
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 32) / 19
- end
- end
- class Window_Help_Zzh < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(20, 330, 220, 64)
- self.contents = Bitmap.new(width, height)
- self.opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
- #--------------------------------------------------------------------------
- def set_text(text, align = 0)
- # 如果文本和对齐方式的至少一方与上次的不同
- if text != @text or align != @align
- # 再描绘文本
- self.contents.clear
- self.contents.font.size = 16
- self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
- self.contents.font.color.set(0,0,0)
- $zzhok=false
- self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
- @text = text
- @align = align
- @actor = nil
- $zzhok=true
- end
- self.visible = true
- end
- end
- class Zzh_Window_ItemCommand < Window_Selectable
- attr_accessor :commands
- #--------------------------------------------------------------------------
- # ● 初始化,生成commands窗口
- #--------------------------------------------------------------------------
- def initialize
- super(-16, 160, 280, 300)
- @commands = []
- #————————生成commands窗口
- @commands.push("恢复类")
- @commands.push("状态类")
- @commands.push("攻击类")
- self.windowskin = nil
- if @commands == []
- @commands.push("普通物品")
- end
- @item_max = @commands.size
- self.contents = Bitmap.new(640, 480)
- self.opacity = 0
- refresh
- self.index = 0
- @oldindex=-1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- bitmap = Bitmap.new("Graphics/system/battle/menu/物品底板.png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0, bitmap, src_rect)
- x = @index*32+41
- bitmap = Bitmap.new("Graphics/system/battle/menu/物品-"[email protected]_s+".png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(x, 27, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # 只描绘原文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@commands[self.index],1)
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.top_row = row
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.top_row = row - (self.page_row_max - 1)
- end
- x=@index*32+42
- self.cursor_rect.set(x, 28, 30, 25)
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- self_update
- if @index != @oldindex
- refresh
- end
- @oldindex=@indexend
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- @zzhaaa_1=1
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- $game_system.se_play($data_system.cursor_se)
- end
- break
- end
- end
- if mouse_not_in_rect
- @zzhaaa_1=2
- @index = index_var
- #if self.is_a?(Window_Target)
- # @index=-3
- #end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_Item
- #==============================================================================
- class Zzh_Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def initialize
- super(10, 240, 250, 128)#128
- self.opacity = 0
- refresh
- self.index = -1
- @column_max = 1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- if i<=13 and $data_items[i].desc== command
- @data.push($data_items[i])
- elsif i>13 and i<=35 and command=="状态类"
- @data.push($data_items[i])
- elsif i>35 and$data_items[i].desc== command
- @data.push($data_items[i])
- end
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #-----------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- number = $game_party.item_number(item.id)
- self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
- self.contents.font.size = 16
- $zzhok = false
- if $game_party.item_can_use?(item.id)
- self.contents.font.color.set(0,0,0)
- else
- self.contents.font.color.set(0,0,0,128)
- end
- x = 4
- y = index * 19-5
- rect = Rect.new(x, y, self.width / @column_max - 32, 24)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
- self.contents.draw_text(x + 28, y-2, 204, 32, item.name, 0)
- self.contents.draw_text(x + 130, y-2, 40, 32, number.to_s, 2)
- $zzhok = true
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
-
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.cursor_rect.empty
- return
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.cursor_rect.empty
- return
- end
- # 计算光标的宽
- cursor_width = 192
- # 计算光标坐标
- x = 7#@index % @column_max * (cursor_width + 32)-3
- y = (@index-self.top_row) * 19 -2
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 19)
- end
-
- def update
- self_update
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- @zzhaaa_1=1
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- #if (@index != @oldindex)
- $game_system.se_play($data_system.cursor_se)
- #end
- end
- break
- end
- end
- if mouse_not_in_rect
- mouse_x, mouse_y = Mouse.get_mouse_pos
- # 当前行被显示开头行前面的情况下
- #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
- mouse_x-=26
- mouse_y-=243
- if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
- self.top_row +=1
- delay(0.1)
- end
- # 当前行被显示末尾行之后的情况下
- if self.top_row > 0 and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
- # 从当前行向末尾滚动
- self.top_row -=1
- delay(0.1)
- end
- @zzhaaa_1=2
- @index = index_var
- if self.is_a?(Window_Target)
- @index=-3
- end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- def top_row
- # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- return self.oy / 19
- end
- #--------------------------------------------------------------------------
- # ● 设置开头行
- # row : 显示开头的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row 未满 0 的场合更正为 0
- if row < 0
- row = 0
- end
- # row 超过 row_max - 1 的情况下更正为 row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
- self.oy = row * 19
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 32) / 19
- end
- end
- class Window_Skill2_Picture < Window_Base
- def initialize
- super(-16,120,260,300)
- self.contents = Bitmap.new(640, 480)
- self.opacity = 0
- self.contents.clear
- bitmap = Bitmap.new("Graphics/System/battle/menu/特技底板.png")
- src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
- self.contents.blt(0, 0 , bitmap, src_rect)
- end
- end
- #==============================================================================
- # ■ Window_Skill
- #==============================================================================
- class Zzh_Window_SkillList2 < Window_Selectable
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(10, 200, 250, 148)
- @actor = actor
- self.opacity = 0
- refresh
- self.index = -1
- @column_max = 1
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in [email protected]
- skill = $data_skills[@actor.skills[i]]
- if skill != nil and skill.desc == command
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #-----------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- self.contents.font.name = ["华文行楷","黑体","楷体","宋体"]
- self.contents.font.size = 16
- $zzhok = false
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color.set(0,0,0)
- else
- self.contents.font.color.set(0,0,0,128)
- end
- x = 4
- y = index * 19-5
- rect = Rect.new(x, y, self.width / @column_max - 32, 24)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y-5 , bitmap, Rect.new(0, -4, 24, 28), opacity)
- self.contents.draw_text(x + 28, y-2, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 130, y-2, 40, 32, skill.sp_cost.to_s, 2)
- $zzhok = true
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
-
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.cursor_rect.empty
- return
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.cursor_rect.empty
- return
- end
- # 计算光标的宽
- cursor_width = 192
- # 计算光标坐标
- x = 7#@index % @column_max * (cursor_width + 32)-3
- y = @index * 19 -2
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 19)
- end
-
- def update
- self_update
- if self.active and @item_max > 0
- index_var = @index
- tp_index = @index
- mouse_x, mouse_y = Mouse.get_mouse_pos
- mouse_not_in_rect = true
- for i in 0...@item_max
- @index = i
- @zzhaaa_1=1
- update_cursor_rect
- top_x = self.cursor_rect.x + self.x + 16
- top_y = self.cursor_rect.y + self.y + 16
- bottom_x = top_x + self.cursor_rect.width
- bottom_y = top_y + self.cursor_rect.height
- if (mouse_x > top_x) and (mouse_y > top_y) and
- (mouse_x < bottom_x) and (mouse_y < bottom_y)
- mouse_not_in_rect = false
- if tp_index != @index
- tp_index = @index
- #if (@index != @oldindex)
- $game_system.se_play($data_system.cursor_se)
- #end
- end
- break
- end
- end
- if mouse_not_in_rect
- mouse_x, mouse_y = Mouse.get_mouse_pos
- # 当前行被显示开头行前面的情况下
- #self.contents.fill_rect(Rect.new(199,92,15,15), Color.new(255, 255, 255, 255))
- mouse_x-=26
- mouse_y-=243
- if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and (mouse_x>199)and(mouse_x<215)and(mouse_y>92)and(mouse_y<107)
- self.top_row +=1
- delay(0.1)
- end
- # 当前行被显示末尾行之后的情况下
- if self.top_row > 0 and Mouse.press?(Mouse::LEFT)and(mouse_x>199)and(mouse_x<215)and(mouse_y>12)and(mouse_y<27)
- # 从当前行向末尾滚动
- self.top_row -=1
- delay(0.1)
- end
- @zzhaaa_1=2
- @index = index_var
- if self.is_a?(Window_Target)
- @index=-3
- end
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
- def delay(seconds)
- for i in 0...(seconds * 1)
- sleep 0.01
- Graphics.update
- end
- end
- def top_row
- # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- return self.oy / 19
- end
- #--------------------------------------------------------------------------
- # ● 设置开头行
- # row : 显示开头的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row 未满 0 的场合更正为 0
- if row < 0
- row = 0
- end
- # row 超过 row_max - 1 的情况下更正为 row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
- self.oy = row * 19
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 32) / 19
- end
- end
复制代码 506-527这段是关系到战斗中使用物品的调用,数据库中已经设置好,我就是有点看不明白这段,麻烦各位帮忙解析一下 |
|