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

Project1

 找回密码
 注册会员
搜索

夜想曲快捷键右置。悬赏2V

查看数: 2265 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2011-1-29 16:37

正文摘要:

#============================================================================== # ■ Window_Item_KeyCommand #------------------------------------------------------------------------------ #  选择快捷键 ...

回复

shanruiwen 发表于 2011-1-29 16:56:28
情况不明

评分

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

查看全部评分

fux2 发表于 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
复制代码
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-2-18 03:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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