赞 | 451 |
VIP | 56 |
好人卡 | 75 |
积分 | 424 |
经验 | 124650 |
最后登录 | 2024-11-24 |
在线时间 | 7602 小时 |
Lv5.捕梦者 (管理员) 老黄鸡
- 梦石
- 0
- 星屑
- 42409
- 在线时间
- 7602 小时
- 注册时间
- 2009-7-6
- 帖子
- 13506
|
本帖最后由 fux2 于 2011-1-30 20:28 编辑
以下是脚本文件
Scripts.rar
(159.62 KB, 下载次数: 676)
- class Window_KeyCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(553, 83, 144, 600)
- self.contents = Bitmap.new(width - 29, height - 29)
- self.opacity = 0
- @item_max = 7
- @column_max = 7
- @commands = ["A", "S", "D", "F","G","H","J"]
- refresh
- self.index = -1
- self.active = false
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- super
- if self.active and @item_max > 0 and @index >= 0
- if Input.repeat?(Input::DOWN)
- if @column_max >= 2 and @index < @item_max - 1
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- if Input.repeat?(Input::UP)
- if @column_max >= 2 and @index > 0
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- end
- end
-
- def update2
- 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
- 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
- @index = -1
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
-
- def refresh(actor=nil)
- self.contents.clear
- if actor != nil
- u = 0
- for key in ["A", "S", "D", "F","G","H","J"]
- skill = $game_skills[actor.key[key]]
- if !skill.nil?
- bitmap = RPG::Cache.icon(skill.icon_name)
- y = u * 32 - 10
- self.contents.font.size = 12
- self.contents.font.color = Color.new(255,255,255,255)
- self.contents.blt(4,y+35,bitmap,Rect.new(0,0,30,30))
- self.contents.draw_text(4, y+44, 128, 32, "SP:#{skill.sp_cost}")
- end
- u += 1
- end
- end
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- y = index * 32
- self.contents.font.size = 16
- self.contents.font.color = Color.new(20,20,20)
- self.contents.draw_text(25, y+33, 128, 32, @commands[index])
- self.contents.font.color = Color.new(135,175,255)
- self.contents.draw_text(24, y+32, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index
- # 当前行被显示开头行前面的情况下
- 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
- # 计算光标的宽
- cursor_width = self.width / @column_max - 30
- # 计算光标坐标
- y = @index * 32
- # 更新国标矩形
- self.cursor_rect.set(6, y+26, 28, 28)
- end
- end
- #==============================================================================
- # ■ Scene_Key
- #------------------------------------------------------------------------------
- # 处理中快捷键的类。
- #==============================================================================
- class Scene_Item_Key < Scene_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0)
- @actor_index = actor_index
- super()
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main_start
- super
- # 获取角色
- @actor = $game_party.actors[@actor_index]
- # 生成帮助窗口、状态窗口、特技窗口
- @help_window = Window_Help.new
- @item_window = Window_Item.new#(@actor)
- @item_window.z -= 98
- @item_window.height = 256
- @item_window.back_opacity = 160
- @help_window.back_opacity = 160
- @key_window = Window_Item_KeyCommand.new
- @key_window.refresh(@actor)
- # 关联帮助窗口
- @item_window.help_window = @help_window
-
-
- @windows.push(@help_window)
- @windows.push(@item_window)
- @windows.push(@key_window)
- end
- def make_sprite
- @spriteset = Spriteset_Map.new
- @arpg_actor = ARPG_Actor.new
- end
- def dispose_sprite
- @spriteset.dispose
- @arpg_actor.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新命令窗口
- @arpg_actor.update
- if @item_window.active
- update_item
- return
- end
- if @key_window.active
- update_key
- return
- end
- end
-
- def get_up
- $fux2.x = Mouse.get_mouse_pos[0] - 8
- $fux2.y = Mouse.get_mouse_pos[1] - 8
- end
- #--------------------------------------------------------------------------
- # ● 刷新技能窗口
- #--------------------------------------------------------------------------
- def update_item
- @item_window.update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的场合下
- if Input.trigger?(Input::C)
- item = @item_window.item
- return if !$game_party.item_can_use?(item.id)
- M.ok
- @item_window.active = false
- @key_window.active = true
- @key_window.index = 0
- end
-
- if Mouse.trigger?(Mouse::LEFT)
- M.ok
- @key_window.index = -1
- item = @item_window.data[@item_window.index]
- return if item == nil
- $fux2.bitmap = RPG::Cache.icon(item.icon_name)
- loop do
- Graphics.update
- # 刷新输入情报
- Input.update
- if Mouse.press?(Mouse::LEFT)
- @key_window.update2
- get_up
- else
- @key_window.refresh
- if @key_window.index >= 0
- $fux2.bitmap.dispose
- @key_window.update2
- item = @item_window.item
- case @key_window.index
- when 0
- key_start("Z",item)
- when 1
- key_start("X",item)
- when 2
- key_start("C",item)
- when 3
- key_start("V",item)
- when 4
- key_start("B",item)
- when
- key_start("N",item)
- when 6
- key_start("M",item)
- end
- else
- $fux2.bitmap.dispose
- @item_window.active = true
- @key_window.active = false
- @key_window.index = -1
- @key_window.refresh(@actor)
- M.eq
- end
- break
- end
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新选择键位
- #--------------------------------------------------------------------------
- def update_key
- @key_window.update
- if Input.trigger?(Input::C)
- item = @item_window.item
- case @key_window.index
- when 0
- key_start("Z",item)
- when 1
- key_start("X",item)
- when 2
- key_start("C",item)
- when 3
- key_start("V",item)
- when 4
- key_start("B",item)
- when
- key_start("N",item)
- when 6
- key_start("M",item)
- end
- end
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- @item_window.active = true
- @key_window.active = false
- @key_window.index = -1
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置键位
- #--------------------------------------------------------------------------
- def key_start(key,item)
- if item.nil?
- @actor.item_key[key] = 0
- else
- @actor.item_key[key] = item.id
- end
- @item_window.active = true
- @key_window.active = false
- @key_window.index = -1
- @key_window.refresh(@actor)
- M.eq
- return
- end
- end
- #==============================================================================
- # ■ Window_Item_KeyCommand
- #------------------------------------------------------------------------------
- # 选择快捷键的窗口
- #==============================================================================
- class Window_Item_KeyCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(585, 83, 144, 600)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- @item_max = 7
- @column_max = 7
- @commands = ["Z", "X", "C","V","B","N","M"]
- refresh
- self.index = -1
- self.active = false
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh(actor=nil)
- self.contents.clear
- if actor != nil
- u = 0
- for key in ["Z", "X", "C","V","B","N","M"]
- item = $data_items[actor.item_key[key]]
- if !item.nil?
- if $game_party.item_number(item.id) == 0
- actor.item_key[key] = 0
- refresh(actor)
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- y = u * 32 - 10
- self.contents.font.size = 12
- self.contents.font.color = Color.new(255,255,255,255)
- self.contents.blt(0,y+35,bitmap,Rect.new(0,0,32,32))
- self.contents.draw_text(6, y+44, 128, 32, "x")
- self.contents.draw_text(13, y+44, 128, 32, "#{$game_party.item_number(item.id)}")
- end
- u += 1
- end
- end
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- y = index * 32
- self.contents.font.size = 16
- self.contents.font.color = Color.new(20,20,20)
- self.contents.draw_text(25, y+33, 128, 32, @commands[index])
- self.contents.font.color = Color.new(135,175,255)
- self.contents.draw_text(24, y+32, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update
- super
- if self.active and @item_max > 0 and @index >= 0
- if Input.repeat?(Input::DOWN)
- if @column_max >= 2 and @index < @item_max - 1
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- end
- end
- if Input.repeat?(Input::UP)
- if @column_max >= 2 and @index > 0
- $game_system.se_play($data_system.cursor_se)
- @index -= 1
- end
- end
- end
- end
-
- def update2
- 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
- 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
- @index = -1
- update_cursor_rect
- Mouse.click_lock
- else
- Mouse.click_unlock
- end
- end
- end
-
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index
- # 当前行被显示开头行前面的情况下
- 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
- cursor_width = self.width / @column_max - 32
- # 计算光标坐标
- y = @index * 32
- # 更新国标矩形
- self.cursor_rect.set(6, y+26, 28, 28)
- end
- end
- #==============================================================================
- # ■ Scene_Key
- #------------------------------------------------------------------------------
- # 处理中快捷键的类。
- #==============================================================================
- class Scene_Key < Scene_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0)
- @actor_index = actor_index
- super()
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main_start
- super
- @actor = $game_party.actors[@actor_index]
- # 生成帮助窗口、状态窗口、特技窗口
- @help_window = Window_Help.new
- @skill_window = Window_Skill.new(@actor)
- @skill_window.z -= 98
- @skill_window.height = 256
- @skill_window.back_opacity = 160
- @help_window.back_opacity = 160
- @key_window = Window_KeyCommand.new
- @key_window.refresh(@actor)
- # 关联帮助窗口
- @skill_window.help_window = @help_window
- @windows.push(@help_window)
- @windows.push(@skill_window)
- @windows.push(@key_window)
- end
- def make_sprite
- @spriteset = Spriteset_Map.new
- @arpg_actor = ARPG_Actor.new
- end
- def dispose_sprite
- @spriteset.dispose
- @arpg_actor.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新命令窗口
- @arpg_actor.update
- if @skill_window.active
- update_skill
- return
- end
- if @key_window.active
- update_key
- return
- end
- end
- def get_up
- $fux2.x = Mouse.get_mouse_pos[0] - 8
- $fux2.y = Mouse.get_mouse_pos[1] - 8
- update
- end
- #--------------------------------------------------------------------------
- # ● 刷新技能窗口
- #--------------------------------------------------------------------------
- def update_skill
- @skill_window.update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的场合下
- if Input.trigger?(Input::C)
- M.ok
- @skill_window.active = false
- @key_window.active = true
- @key_window.index = 0
- end
-
- if Mouse.trigger?(Mouse::LEFT)
- M.ok
- skill = @skill_window.data[@skill_window.index]
- return if skill == nil
- $fux2.bitmap = RPG::Cache.icon(skill.icon_name)
- M.ok
- loop do
- Graphics.update
- # 刷新输入情报
- Input.update
- if Mouse.press?(Mouse::LEFT)
- @key_window.update2
- get_up
- else
- $fux2.bitmap.dispose
- @key_window.refresh
- if @key_window.index >= 0
- @key_window.update
- skill = @skill_window.skill
- case @key_window.index
- when 0
- key_start("A",skill)
- when 1
- key_start("S",skill)
- when 2
- key_start("D",skill)
- when 3
- key_start("F",skill)
- when 4
- key_start("G",skill)
- when 5
- key_start("H",skill)
- when 6
- key_start("J",skill)
- end
- else
- $fux2.bitmap.dispose
- @skill_window.active = true
- @key_window.active = false
- @key_window.index = -1
- @key_window.refresh(@actor)
- M.eq
- end
- break
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新选择键位
- #--------------------------------------------------------------------------
- def update_key
- @key_window.update
- if Input.trigger?(Input::C)
- skill = @skill_window.skill
- case @key_window.index
- when 0
- key_start("A",skill)
- when 1
- key_start("S",skill)
- when 2
- key_start("D",skill)
- when 3
- key_start("F",skill)
- when 4
- key_start("G",skill)
- when 5
- key_start("H",skill)
- when 6
- key_start("J",skill)
- end
- end
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- @skill_window.active = true
- @key_window.active = false
- @key_window.index = -1
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置键位
- #--------------------------------------------------------------------------
- def key_start(key,skill)
- if skill.nil?
- @actor.key[key] = 0
- else
- @actor.key[key] = skill.id
- end
- @skill_window.active = true
- @key_window.active = false
- @key_window.index = -1
- @key_window.refresh(@actor)
- M.eq
- return
- end
- end
复制代码 |
|