设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2175|回复: 2
打印 上一主题 下一主题

[已经解决] 夜想曲快捷键右置。悬赏2V

[复制链接]

Lv1.梦旅人

殲滅天使·玲

梦石
0
星屑
121
在线时间
204 小时
注册时间
2008-2-20
帖子
2292

贵宾

跳转到指定楼层
1
发表于 2011-1-29 16:37:15 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
2星屑
  1. #==============================================================================
  2. # ■ Window_Item_KeyCommand
  3. #------------------------------------------------------------------------------
  4. #  选择快捷键的窗口
  5. #==============================================================================
  6. class Window_Item_KeyCommand < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(160-16, 480-78, 346, 96)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.opacity = 0
  14.     @item_max = 7
  15.     @column_max = 7
  16.     @commands = ["Z", "X", "C","V","B","N","M"]
  17.     refresh
  18.     self.index = -1
  19.     self.active = false
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh(actor=nil)
  25.     self.contents.clear
  26.     if actor != nil
  27.       u = 0
  28.       for key in ["Z", "X", "C","V","B","N","M"]
  29.         item = $data_items[actor.item_key[key]]
  30.         if !item.nil?
  31.           if $game_party.item_number(item.id) == 0
  32.             actor.item_key[key] = 0
  33.             refresh(actor)
  34.             return
  35.           end
  36.           bitmap = RPG::Cache.icon(item.icon_name)
  37.           x = 58 + u * (320-32)/4
  38.           self.contents.font.size = 12
  39.           self.contents.font.color = Color.new(255,255,255,255)
  40.           self.contents.blt(x,16,bitmap,Rect.new(0,0,30,30))
  41.           self.contents.draw_text(x, 24, 128, 32, item.name)
  42.           self.contents.draw_text(x+25, 12, 128, 32, "x")
  43.           self.contents.draw_text(x+32, 12, 128, 32, "#{$game_party.item_number(item.id)}")
  44.         end
  45.           u += 1
  46.       end
  47.     end
  48.     for i in 0...@item_max
  49.       draw_item(i)
  50.     end
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● 描绘项目
  54.   #     index : 项目编号
  55.   #--------------------------------------------------------------------------
  56.   def draw_item(index)
  57.     x = 53 + index * (320-32)/4
  58.     self.contents.font.size = 16
  59.     self.contents.font.color = Color.new(20,20,20)
  60.     self.contents.draw_text(x+1, 1, 128, 32, @commands[index])
  61.     self.contents.font.color = Color.new(135,175,255)
  62.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● 更新光标举行
  66.   #--------------------------------------------------------------------------
  67.   def update_cursor_rect
  68.     # 光标位置不满 0 的情况下
  69.     if @index < 0
  70.       self.cursor_rect.empty
  71.       return
  72.     end
  73.     # 获取当前的行
  74.     row = @index / @column_max
  75.     # 当前行被显示开头行前面的情况下
  76.     if row < self.top_row
  77.       # 从当前行向开头行滚动
  78.       self.top_row = row
  79.     end
  80.     # 当前行被显示末尾行之后的情况下
  81.     if row > self.top_row + (self.page_row_max - 1)
  82.       # 从当前行向末尾滚动
  83.       self.top_row = row - (self.page_row_max - 1)
  84.     end
  85.     # 计算光标的宽
  86.     cursor_width = self.width / @column_max - 32
  87.     # 计算光标坐标
  88.     x = @index % @column_max * (320-32)/4
  89.     y = @index / @column_max * 32 - self.oy
  90.     # 更新国标矩形
  91.     self.cursor_rect.set(48+x, y+8, 64, 40)
  92.   end
  93. end
  94. #==============================================================================
  95. # ■ Scene_Key
  96. #------------------------------------------------------------------------------
  97. #  处理中快捷键的类。
  98. #==============================================================================

  99. class Scene_Item_Key < Scene_Base
  100.   #--------------------------------------------------------------------------
  101.   # ● 初始化对像
  102.   #     actor_index : 角色索引
  103.   #--------------------------------------------------------------------------
  104.   def initialize(actor_index = 0)
  105.     @actor_index = actor_index
  106.     super()
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 主处理
  110.   #--------------------------------------------------------------------------
  111.   def main_start
  112.     super
  113.     # 获取角色
  114.     @actor = $game_party.actors[@actor_index]
  115.     # 生成帮助窗口、状态窗口、特技窗口
  116.     @help_window = Window_Help.new
  117.     @item_window = Window_Item.new#(@actor)
  118.     @item_window.z -= 98
  119.     @item_window.height = 256
  120.     @item_window.back_opacity = 160
  121.     @help_window.back_opacity = 160
  122.     @key_window = Window_Item_KeyCommand.new
  123.     @key_window.refresh(@actor)
  124.     # 关联帮助窗口
  125.     @item_window.help_window = @help_window
  126.    
  127.    
  128.     @windows.push(@help_window)
  129.     @windows.push(@item_window)
  130.     @windows.push(@key_window)
  131.   end
  132.   def make_sprite
  133.     @spriteset = Spriteset_Map.new
  134.     @arpg_actor = ARPG_Actor.new
  135.   end
  136.   def dispose_sprite
  137.     @spriteset.dispose
  138.     @arpg_actor.dispose
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 刷新画面
  142.   #--------------------------------------------------------------------------
  143.   def update
  144.     # 刷新命令窗口
  145.     @arpg_actor.update
  146.     if @item_window.active
  147.       update_item
  148.       return
  149.     end
  150.     if @key_window.active
  151.       update_key
  152.       return
  153.     end
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 刷新技能窗口
  157.   #--------------------------------------------------------------------------
  158.   def update_item
  159.     @item_window.update
  160.     # 按下 B 键的情况下
  161.     if Input.trigger?(Input::B)
  162.       # 演奏取消 SE
  163.       $game_system.se_play($data_system.cancel_se)
  164.       # 切换到菜单画面
  165.       $scene = Scene_Map.new
  166.       return
  167.     end
  168.     # 按下 C 键的场合下
  169.     if Input.trigger?(Input::C)
  170.       item = @item_window.item
  171.       return if !$game_party.item_can_use?(item.id)
  172.       M.ok
  173.       @item_window.active = false
  174.       @key_window.active = true
  175.       @key_window.index = 0
  176.     end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 刷新选择键位
  180.   #--------------------------------------------------------------------------
  181.   def update_key
  182.     @key_window.update
  183.     if Input.trigger?(Input::C)
  184.       item = @item_window.item
  185.       case @key_window.index
  186.       when 0
  187.         key_start("Z",item)
  188.       when 1
  189.         key_start("X",item)
  190.       when 2
  191.         key_start("C",item)
  192.       when 3
  193.         key_start("V",item)
  194.       when 4
  195.         key_start("B",item)
  196.       when
  197.         key_start("N",item)
  198.       when 6
  199.         key_start("M",item)
  200.       end
  201.     end
  202.     if Input.trigger?(Input::B)
  203.       # 演奏取消 SE
  204.       $game_system.se_play($data_system.cancel_se)
  205.       @item_window.active = true
  206.       @key_window.active = false
  207.       @key_window.index = -1
  208.       return
  209.     end
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 设置键位
  213.   #--------------------------------------------------------------------------
  214.   def key_start(key,item)
  215.     if item.nil?
  216.       @actor.item_key[key] = 0
  217.     else
  218.       @actor.item_key[key] = item.id
  219.     end
  220.     @item_window.active = true
  221.     @key_window.active = false
  222.     @key_window.index = -1
  223.     @key_window.refresh(@actor)
  224.     M.eq
  225.     return
  226.   end
  227. end
复制代码
  1. #==============================================================================
  2. # ■ Window_KeyCommand
  3. #------------------------------------------------------------------------------
  4. #  选择快捷键的窗口
  5. #==============================================================================
  6. class Window_KeyCommand < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(73-16, 480-106, 520, 155)#(73-16, 480-71, 520, 155)
  12.     self.contents = Bitmap.new(width - 29, height - 29)
  13.     self.opacity = 0
  14.     @item_max = 7
  15.     @column_max = 7
  16.     @commands = ["A", "S", "D", "F","G","H","J"]
  17.     refresh
  18.     self.index = -1
  19.     self.active = false
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh(actor=nil)
  25.     self.contents.clear
  26.     if actor != nil
  27.       u = 0
  28.       for key in ["A", "S", "D", "F","G","H","J"]
  29.         skill = $game_skills[actor.key[key]]
  30.         if !skill.nil?
  31.           bitmap = RPG::Cache.icon(skill.icon_name)
  32.           x = 305 + u * (180)/6
  33.           self.contents.font.size = 12
  34.           self.contents.font.color = Color.new(255,255,255,255)
  35.           self.contents.blt(x,16,bitmap,Rect.new(0,0,30,30))
  36.           self.contents.draw_text(x+16, 8, 128, 32, skill.name)
  37.           self.contents.draw_text(x, 24, 128, 32, "SP:#{skill.sp_cost}")
  38.         end
  39.           u += 1
  40.       end
  41.     end
  42.     for i in 0...@item_max
  43.       draw_item(i)
  44.     end
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 描绘项目
  48.   #     index : 项目编号
  49.   #--------------------------------------------------------------------------
  50.   def draw_item(index)
  51.     x = 315 + index * (180)/6
  52.     self.contents.font.size = 16
  53.     self.contents.font.color = Color.new(20,20,20)
  54.     self.contents.draw_text(x+1, 1, 128, 32, @commands[index])
  55.     self.contents.font.color = Color.new(135,175,255)
  56.     self.contents.draw_text(x, 0, 128, 32, @commands[index])
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 更新光标举行
  60.   #--------------------------------------------------------------------------
  61.   def update_cursor_rect
  62.     # 光标位置不满 0 的情况下
  63.     if @index < 0
  64.       self.cursor_rect.empty
  65.       return
  66.     end
  67.     # 获取当前的行
  68.     row = @index / @column_max
  69.     # 当前行被显示开头行前面的情况下
  70.     if row < self.top_row
  71.       # 从当前行向开头行滚动
  72.       self.top_row = row
  73.     end
  74.     # 当前行被显示末尾行之后的情况下
  75.     if row > self.top_row + (self.page_row_max - 1)
  76.       # 从当前行向末尾滚动
  77.       self.top_row = row - (self.page_row_max - 1)
  78.     end
  79.     # 计算光标的宽
  80.     cursor_width = self.width / @column_max - 30
  81.     # 计算光标坐标
  82.     x = @index % @column_max * (180)/6
  83.     y = @index / @column_max * 32 - self.oy
  84.     # 更新国标矩形
  85.     self.cursor_rect.set(305+x, y+8, 30, 40)
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Scene_Key
  90. #------------------------------------------------------------------------------
  91. #  处理中快捷键的类。
  92. #==============================================================================

  93. class Scene_Key < Scene_Base
  94.   #--------------------------------------------------------------------------
  95.   # ● 初始化对像
  96.   #     actor_index : 角色索引
  97.   #--------------------------------------------------------------------------
  98.   def initialize(actor_index = 0)
  99.     @actor_index = actor_index
  100.     super()
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 主处理
  104.   #--------------------------------------------------------------------------
  105.   def main_start
  106.     super
  107.     @actor = $game_party.actors[@actor_index]
  108.     # 生成帮助窗口、状态窗口、特技窗口
  109.     @help_window = Window_Help.new
  110.     @skill_window = Window_Skill.new(@actor)
  111.     @skill_window.z -= 98
  112.     @skill_window.height = 256
  113.     @skill_window.back_opacity = 160
  114.     @help_window.back_opacity = 160
  115.     @key_window = Window_KeyCommand.new
  116.     @key_window.refresh(@actor)
  117.     # 关联帮助窗口
  118.     @skill_window.help_window = @help_window
  119.     @windows.push(@help_window)
  120.     @windows.push(@skill_window)
  121.     @windows.push(@key_window)
  122.   end
  123.   def make_sprite
  124.     @spriteset = Spriteset_Map.new
  125.     @arpg_actor = ARPG_Actor.new
  126.   end
  127.   def dispose_sprite
  128.     @spriteset.dispose
  129.     @arpg_actor.dispose
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 刷新画面
  133.   #--------------------------------------------------------------------------
  134.   def update
  135.     # 刷新命令窗口
  136.     @arpg_actor.update
  137.     if @skill_window.active
  138.       update_skill
  139.       return
  140.     end
  141.     if @key_window.active
  142.       update_key
  143.       return
  144.     end
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 刷新技能窗口
  148.   #--------------------------------------------------------------------------
  149.   def update_skill
  150.     @skill_window.update
  151.     # 按下 B 键的情况下
  152.     if Input.trigger?(Input::B)
  153.       # 演奏取消 SE
  154.       $game_system.se_play($data_system.cancel_se)
  155.       # 切换到菜单画面
  156.       $scene = Scene_Map.new
  157.       return
  158.     end
  159.     # 按下 C 键的场合下
  160.     if Input.trigger?(Input::C)
  161.       M.ok
  162.       @skill_window.active = false
  163.       @key_window.active = true
  164.       @key_window.index = 0
  165.     end
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 刷新选择键位
  169.   #--------------------------------------------------------------------------
  170.   def update_key
  171.     @key_window.update
  172.     if Input.trigger?(Input::C)
  173.       skill = @skill_window.skill
  174.       case @key_window.index
  175.       when 0
  176.         key_start("A",skill)
  177.       when 1
  178.         key_start("S",skill)
  179.       when 2
  180.         key_start("D",skill)
  181.       when 3
  182.         key_start("F",skill)
  183.       when 4
  184.         key_start("G",skill)
  185.       when 5
  186.         key_start("H",skill)
  187.       when 6
  188.         key_start("J",skill)
  189.       end
  190.     end
  191.     if Input.trigger?(Input::B)
  192.       # 演奏取消 SE
  193.       $game_system.se_play($data_system.cancel_se)
  194.       @skill_window.active = true
  195.       @key_window.active = false
  196.       @key_window.index = -1
  197.       return
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 设置键位
  202.   #--------------------------------------------------------------------------
  203.   def key_start(key,skill)
  204.     if skill.nil?
  205.       @actor.key[key] = 0
  206.     else
  207.       @actor.key[key] = skill.id
  208.     end
  209.     @skill_window.active = true
  210.     @key_window.active = false
  211.     @key_window.index = -1
  212.     @key_window.refresh(@actor)
  213.     M.eq
  214.     return
  215.   end
  216. end
复制代码
技能栏的脚本是上面那个,物品栏是下面那个。自己折腾不出来 - -。

然后效果如下。

坐标是…X565 Y145 左边这一排第一格的左上角坐标。    X605 Y145  右边这一排第一格的左上角坐标。
然后目的是把这个技能栏和物品栏丢进格子里- -。
还有光标的描绘。就这样。恩= =

最佳答案

查看完整内容

站位不解释 替换为 特技:物品:

发帖前请看版规。进水区请到版规贴留名哦亲~chu~❤

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39850
在线时间
7493 小时
注册时间
2009-7-6
帖子
13485

开拓者贵宾

2
发表于 2011-1-29 16:37:16 | 只看该作者
本帖最后由 fux2 于 2011-1-30 09:14 编辑

站位不解释
替换为
特技:
  1. #==============================================================================
  2. # ■ Window_KeyCommand
  3. #------------------------------------------------------------------------------
  4. #  选择快捷键的窗口
  5. #==============================================================================
  6. class Window_KeyCommand < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(553, 83, 144, 600)
  12.     self.contents = Bitmap.new(width - 29, height - 29)
  13.     self.opacity = 0
  14.     @item_max = 7
  15.     @column_max = 7
  16.     @commands = ["A", "S", "D", "F","G","H","J"]
  17.     refresh
  18.     self.index = -1
  19.     self.active = false
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh(actor=nil)
  25.     self.contents.clear
  26.     if actor != nil
  27.       u = 0
  28.       for key in ["A", "S", "D", "F","G","H","J"]
  29.         skill = $game_skills[actor.key[key]]
  30.         if !skill.nil?
  31.           bitmap = RPG::Cache.icon(skill.icon_name)
  32.           y = u * 32 - 10
  33.           self.contents.font.size = 12
  34.           self.contents.font.color = Color.new(255,255,255,255)
  35.           self.contents.blt(4,y+35,bitmap,Rect.new(0,0,30,30))
  36.           self.contents.draw_text(4, y+44, 128, 32, "SP:#{skill.sp_cost}")
  37.         end
  38.           u += 1
  39.       end
  40.     end
  41.     for i in 0...@item_max
  42.       draw_item(i)
  43.     end
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 描绘项目
  47.   #     index : 项目编号
  48.   #--------------------------------------------------------------------------
  49.   def draw_item(index)
  50.     y = index * 32
  51.     self.contents.font.size = 16
  52.     self.contents.font.color = Color.new(20,20,20)
  53.     self.contents.draw_text(25, y+33, 128, 32, @commands[index])
  54.     self.contents.font.color = Color.new(135,175,255)
  55.     self.contents.draw_text(24, y+32, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● 更新光标举行
  59.   #--------------------------------------------------------------------------
  60.   def update_cursor_rect
  61.     # 光标位置不满 0 的情况下
  62.     if @index < 0
  63.       self.cursor_rect.empty
  64.       return
  65.     end
  66.     # 获取当前的行
  67.     row = @index
  68.     # 当前行被显示开头行前面的情况下
  69.     if row < self.top_row
  70.       # 从当前行向开头行滚动
  71.       self.top_row = row
  72.     end
  73.     # 当前行被显示末尾行之后的情况下
  74.     if row > self.top_row + (self.page_row_max - 1)
  75.       # 从当前行向末尾滚动
  76.       self.top_row = row - (self.page_row_max - 1)
  77.     end
  78.     if self.active and @item_max > 0 and @index >= 0
  79.       if Input.repeat?(Input::DOWN)
  80.         if @column_max >= 2 and @index < @item_max - 1
  81.           $game_system.se_play($data_system.cursor_se)
  82.           @index += 1
  83.         end
  84.       end
  85.       if Input.repeat?(Input::UP)
  86.         if @column_max >= 2 and @index > 0
  87.           $game_system.se_play($data_system.cursor_se)
  88.           @index -= 1
  89.         end
  90.       end
  91.     end
  92.     # 计算光标的宽
  93.     cursor_width = self.width / @column_max - 30
  94.     # 计算光标坐标
  95.     y = @index * 32
  96.     # 更新国标矩形
  97.     self.cursor_rect.set(6, y+26, 28, 28)
  98.   end
  99. end
  100. #==============================================================================
  101. # ■ Scene_Key
  102. #------------------------------------------------------------------------------
  103. #  处理中快捷键的类。
  104. #==============================================================================

  105. class Scene_Item_Key < Scene_Base
  106.   #--------------------------------------------------------------------------
  107.   # ● 初始化对像
  108.   #     actor_index : 角色索引
  109.   #--------------------------------------------------------------------------
  110.   def initialize(actor_index = 0)
  111.     @actor_index = actor_index
  112.     super()
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 主处理
  116.   #--------------------------------------------------------------------------
  117.   def main_start
  118.     super
  119.     # 获取角色
  120.     @actor = $game_party.actors[@actor_index]
  121.     # 生成帮助窗口、状态窗口、特技窗口
  122.     @help_window = Window_Help.new
  123.     @item_window = Window_Item.new#(@actor)
  124.     @item_window.z -= 98
  125.     @item_window.height = 256
  126.     @item_window.back_opacity = 160
  127.     @help_window.back_opacity = 160
  128.     @key_window = Window_Item_KeyCommand.new
  129.     @key_window.refresh(@actor)
  130.     # 关联帮助窗口
  131.     @item_window.help_window = @help_window
  132.    
  133.    
  134.     @windows.push(@help_window)
  135.     @windows.push(@item_window)
  136.     @windows.push(@key_window)
  137.   end
  138.   def make_sprite
  139.     @spriteset = Spriteset_Map.new
  140.     @arpg_actor = ARPG_Actor.new
  141.   end
  142.   def dispose_sprite
  143.     @spriteset.dispose
  144.     @arpg_actor.dispose
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● 刷新画面
  148.   #--------------------------------------------------------------------------
  149.   def update
  150.     # 刷新命令窗口
  151.     @arpg_actor.update
  152.     if @item_window.active
  153.       update_item
  154.       return
  155.     end
  156.     if @key_window.active
  157.       update_key
  158.       return
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 刷新技能窗口
  163.   #--------------------------------------------------------------------------
  164.   def update_item
  165.     @item_window.update
  166.     # 按下 B 键的情况下
  167.     if Input.trigger?(Input::B)
  168.       # 演奏取消 SE
  169.       $game_system.se_play($data_system.cancel_se)
  170.       # 切换到菜单画面
  171.       $scene = Scene_Map.new
  172.       return
  173.     end
  174.     # 按下 C 键的场合下
  175.     if Input.trigger?(Input::C)
  176.       item = @item_window.item
  177.       return if !$game_party.item_can_use?(item.id)
  178.       M.ok
  179.       @item_window.active = false
  180.       @key_window.active = true
  181.       @key_window.index = 0
  182.     end
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 刷新选择键位
  186.   #--------------------------------------------------------------------------
  187.   def update_key
  188.     @key_window.update
  189.     if Input.trigger?(Input::C)
  190.       item = @item_window.item
  191.       case @key_window.index
  192.       when 0
  193.         key_start("Z",item)
  194.       when 1
  195.         key_start("X",item)
  196.       when 2
  197.         key_start("C",item)
  198.       when 3
  199.         key_start("V",item)
  200.       when 4
  201.         key_start("B",item)
  202.       when
  203.         key_start("N",item)
  204.       when 6
  205.         key_start("M",item)
  206.       end
  207.     end
  208.     if Input.trigger?(Input::B)
  209.       # 演奏取消 SE
  210.       $game_system.se_play($data_system.cancel_se)
  211.       @item_window.active = true
  212.       @key_window.active = false
  213.       @key_window.index = -1
  214.       return
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 设置键位
  219.   #--------------------------------------------------------------------------
  220.   def key_start(key,item)
  221.     if item.nil?
  222.       @actor.item_key[key] = 0
  223.     else
  224.       @actor.item_key[key] = item.id
  225.     end
  226.     @item_window.active = true
  227.     @key_window.active = false
  228.     @key_window.index = -1
  229.     @key_window.refresh(@actor)
  230.     M.eq
  231.     return
  232.   end
  233. end
复制代码
物品:
  1. #==============================================================================
  2. # ■ Window_Item_KeyCommand
  3. #------------------------------------------------------------------------------
  4. #  选择快捷键的窗口
  5. #==============================================================================
  6. class Window_Item_KeyCommand < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(585, 83, 144, 600)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.opacity = 0
  14.     @item_max = 7
  15.     @column_max = 7
  16.     @commands = ["Z", "X", "C","V","B","N","M"]
  17.     refresh
  18.     self.index = -1
  19.     self.active = false
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh(actor=nil)
  25.     self.contents.clear
  26.     if actor != nil
  27.       u = 0
  28.       for key in ["Z", "X", "C","V","B","N","M"]
  29.         item = $data_items[actor.item_key[key]]
  30.         if !item.nil?
  31.           if $game_party.item_number(item.id) == 0
  32.             actor.item_key[key] = 0
  33.             refresh(actor)
  34.             return
  35.           end
  36.           bitmap = RPG::Cache.icon(item.icon_name)
  37.           y = u * 32 - 10
  38.           self.contents.font.size = 12
  39.           self.contents.font.color = Color.new(255,255,255,255)
  40.           self.contents.blt(0,y+35,bitmap,Rect.new(0,0,32,32))
  41.           self.contents.draw_text(6, y+44, 128, 32, "x")
  42.           self.contents.draw_text(13, y+44, 128, 32, "#{$game_party.item_number(item.id)}")
  43.         end
  44.           u += 1
  45.       end
  46.     end
  47.     for i in 0...@item_max
  48.       draw_item(i)
  49.     end
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● 描绘项目
  53.   #     index : 项目编号
  54.   #--------------------------------------------------------------------------
  55.   def draw_item(index)
  56.     y = index * 32
  57.     self.contents.font.size = 16
  58.     self.contents.font.color = Color.new(20,20,20)
  59.     self.contents.draw_text(25, y+33, 128, 32, @commands[index])
  60.     self.contents.font.color = Color.new(135,175,255)
  61.     self.contents.draw_text(24, y+32, 128, 32, @commands[index])
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 更新光标举行
  65.   #--------------------------------------------------------------------------
  66.   def update_cursor_rect
  67.     # 光标位置不满 0 的情况下
  68.     if @index < 0
  69.       self.cursor_rect.empty
  70.       return
  71.     end
  72.     # 获取当前的行
  73.     row = @index
  74.     # 当前行被显示开头行前面的情况下
  75.     if row < self.top_row
  76.       # 从当前行向开头行滚动
  77.       self.top_row = row
  78.     end
  79.     # 当前行被显示末尾行之后的情况下
  80.     if row > self.top_row + (self.page_row_max - 1)
  81.       # 从当前行向末尾滚动
  82.       self.top_row = row - (self.page_row_max - 1)
  83.     end
  84.     # 计算光标的宽
  85.     if self.active and @item_max > 0 and @index >= 0
  86.       if Input.repeat?(Input::DOWN)
  87.         if @column_max >= 2 and @index < @item_max - 1
  88.           $game_system.se_play($data_system.cursor_se)
  89.           @index += 1
  90.         end
  91.       end
  92.       if Input.repeat?(Input::UP)
  93.         if @column_max >= 2 and @index > 0
  94.           $game_system.se_play($data_system.cursor_se)
  95.           @index -= 1
  96.         end
  97.       end
  98.     end
  99.     cursor_width = self.width / @column_max - 32
  100.     # 计算光标坐标
  101.     y = @index * 32
  102.     # 更新国标矩形
  103.     self.cursor_rect.set(6, y+26, 28, 28)
  104.   end
  105. end

  106. #==============================================================================
  107. # ■ Scene_Key
  108. #------------------------------------------------------------------------------
  109. #  处理中快捷键的类。
  110. #==============================================================================

  111. class Scene_Key < Scene_Base
  112.   #--------------------------------------------------------------------------
  113.   # ● 初始化对像
  114.   #     actor_index : 角色索引
  115.   #--------------------------------------------------------------------------
  116.   def initialize(actor_index = 0)
  117.     @actor_index = actor_index
  118.     super()
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 主处理
  122.   #--------------------------------------------------------------------------
  123.   def main_start
  124.     super
  125.     @actor = $game_party.actors[@actor_index]
  126.     # 生成帮助窗口、状态窗口、特技窗口
  127.     @help_window = Window_Help.new
  128.     @skill_window = Window_Skill.new(@actor)
  129.     @skill_window.z -= 98
  130.     @skill_window.height = 256
  131.     @skill_window.back_opacity = 160
  132.     @help_window.back_opacity = 160
  133.     @key_window = Window_KeyCommand.new
  134.     @key_window.refresh(@actor)
  135.     # 关联帮助窗口
  136.     @skill_window.help_window = @help_window
  137.     @windows.push(@help_window)
  138.     @windows.push(@skill_window)
  139.     @windows.push(@key_window)
  140.   end
  141.   def make_sprite
  142.     @spriteset = Spriteset_Map.new
  143.     @arpg_actor = ARPG_Actor.new
  144.   end
  145.   def dispose_sprite
  146.     @spriteset.dispose
  147.     @arpg_actor.dispose
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 刷新画面
  151.   #--------------------------------------------------------------------------
  152.   def update
  153.     # 刷新命令窗口
  154.     @arpg_actor.update
  155.     if @skill_window.active
  156.       update_skill
  157.       return
  158.     end
  159.     if @key_window.active
  160.       update_key
  161.       return
  162.     end
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 刷新技能窗口
  166.   #--------------------------------------------------------------------------
  167.   def update_skill
  168.     @skill_window.update
  169.     # 按下 B 键的情况下
  170.     if Input.trigger?(Input::B)
  171.       # 演奏取消 SE
  172.       $game_system.se_play($data_system.cancel_se)
  173.       # 切换到菜单画面
  174.       $scene = Scene_Map.new
  175.       return
  176.     end
  177.     # 按下 C 键的场合下
  178.     if Input.trigger?(Input::C)
  179.       M.ok
  180.       @skill_window.active = false
  181.       @key_window.active = true
  182.       @key_window.index = 0
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 刷新选择键位
  187.   #--------------------------------------------------------------------------
  188.   def update_key
  189.     @key_window.update
  190.     if Input.trigger?(Input::C)
  191.       skill = @skill_window.skill
  192.       case @key_window.index
  193.       when 0
  194.         key_start("A",skill)
  195.       when 1
  196.         key_start("S",skill)
  197.       when 2
  198.         key_start("D",skill)
  199.       when 3
  200.         key_start("F",skill)
  201.       when 4
  202.         key_start("G",skill)
  203.       when 5
  204.         key_start("H",skill)
  205.       when 6
  206.         key_start("J",skill)
  207.       end
  208.     end
  209.     if Input.trigger?(Input::B)
  210.       # 演奏取消 SE
  211.       $game_system.se_play($data_system.cancel_se)
  212.       @skill_window.active = true
  213.       @key_window.active = false
  214.       @key_window.index = -1
  215.       return
  216.     end
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● 设置键位
  220.   #--------------------------------------------------------------------------
  221.   def key_start(key,skill)
  222.     if skill.nil?
  223.       @actor.key[key] = 0
  224.     else
  225.       @actor.key[key] = skill.id
  226.     end
  227.     @skill_window.active = true
  228.     @key_window.active = false
  229.     @key_window.index = -1
  230.     @key_window.refresh(@actor)
  231.     M.eq
  232.     return
  233.   end
  234. end
复制代码
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
343 小时
注册时间
2010-8-14
帖子
315
3
发表于 2011-1-29 16:56:28 | 只看该作者
情况不明

评分

参与人数 1星屑 -60 收起 理由
fux2 -60 请勿打酱油

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-10 09:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表