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

Project1

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

哪位朋友能帮忙整合一下夏娜的菜单和套装系统?

 关闭 [复制链接]

Lv2.观梦者 (暗夜天使)

万兽

梦石
0
星屑
597
在线时间
2271 小时
注册时间
2006-11-4
帖子
4868

贵宾

跳转到指定楼层
1
发表于 2007-7-16 23:01:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
RT
本人不是很懂代码,弄来弄去就是不行,实在没办法在向大家求助,
希望哪位可以把整合好的范例发给


要求整合后夏娜的菜单功能不变,窗口也不变,只是把套装的脚本改一下.
这个是套装的代码.
  1. module K_EQUIP
  2.       #17是 装备属性  
  3.       # [0,0,0,0,1]是套装位置 有的为 0 没有的为1 顺序依次是 武器 盾 盔 甲 饰品   
  4.       # 后面的 [0,500],[1,500] 0和1为附加属性 0-最大生命  
  5.       # 1-最大魔法值 2-力量 3- 灵巧 4-速度 5-魔力
  6.       # 500 是增加量
  7. KE  = {17  => [[0,0,0,0,1] , [0,500],[1,500]] , 18  => [[0,1,1,1,0], [2,100],[3,100],[5,100]] }
  8. #装备套装提示音效
  9. ON  = "Audio/Se/055-Right01"
  10. #卸下套装提示音效
  11. OFF = "Audio/Se/058-Wrong02"
  12.   
  13.   #UP =
  14.   end
  15.   


  16. class Game_Actor < Game_Battler
  17.   attr_accessor :on_equip


  18. alias ksetup setup
  19. def setup(actor_id)
  20. ksetup(actor_id)
  21. @on_equip = {}

  22. end
  23. end

  24. #==============================================================================
  25. # ■ Window_EquipLeft
  26. #------------------------------------------------------------------------------
  27. #  装备画面的、显示角色能力值变化的窗口。
  28. #==============================================================================

  29. class Window_EquipLeft < Window_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对像
  32.   #     actor : 角色
  33.   #--------------------------------------------------------------------------
  34.   def initialize(actor)
  35.     super(0, 64, 272, 192)
  36.     self.contents = Bitmap.new(width - 32, height - 32)
  37.     @actor = actor
  38.     refresh
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 刷新
  42.   #--------------------------------------------------------------------------
  43.   def refresh
  44.     self.contents.clear
  45.     draw_actor_name(@actor, 4, 0)
  46.     #kk

  47.   self.contents.font.color = system_color
  48.     draw_actor_level(@actor, 4, 32)
  49.     draw_actor_parameter(@actor, 4, 64, 0)
  50.     draw_actor_parameter(@actor, 4, 96, 1)
  51.     draw_actor_parameter(@actor, 4, 128, 2)
  52.     if @new_atk != nil
  53.       self.contents.font.color = system_color
  54.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  55.       self.contents.font.color = normal_color
  56.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  57.     end
  58.     if @new_pdef != nil
  59.       self.contents.font.color = system_color
  60.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  61.       self.contents.font.color = normal_color
  62.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  63.     end
  64.     if @new_mdef != nil
  65.       self.contents.font.color = system_color
  66.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  67.       self.contents.font.color = normal_color
  68.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  69.     end
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 变更装备后的能力值设置
  73.   #     new_atk  : 变更装备后的攻击力
  74.   #     new_pdef : 变更装备后的物理防御
  75.   #     new_mdef : 变更装备后的魔法防御
  76.   #--------------------------------------------------------------------------
  77.   def set_new_parameters(new_atk, new_pdef, new_mdef)
  78.     if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
  79.       @new_atk = new_atk
  80.       @new_pdef = new_pdef
  81.       @new_mdef = new_mdef
  82.       refresh
  83.     end
  84.   end
  85. end




  86. ######################################################################################


  87. #==============================================================================
  88. # ■ Scene_Equip
  89. #------------------------------------------------------------------------------
  90. #  处理装备画面的类。
  91. #==============================================================================

  92. class Scene_Equip
  93.   
  94.   #--------------------------------------------------------------------------
  95.   # ● 初始化对像
  96.   #     actor_index : 角色索引
  97.   #     equip_index : 装备索引
  98.   #--------------------------------------------------------------------------                  
  99.   def initialize(actor_index = 0, equip_index = 0)
  100.     @actor_index = actor_index
  101.     @equip_index = equip_index
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 主处理
  105.   #--------------------------------------------------------------------------
  106.   def main

  107.     # 获取角色
  108.     @actor = $game_party.actors[@actor_index]

  109.     # 生成窗口
  110.     @help_window = Window_Help.new
  111.     @left_window = Window_EquipLeft.new(@actor)
  112.     @right_window = Window_EquipRight.new(@actor)
  113.     @item_window1 = Window_EquipItem.new(@actor, 0)
  114.     @item_window2 = Window_EquipItem.new(@actor, 1)
  115.     @item_window3 = Window_EquipItem.new(@actor, 2)
  116.     @item_window4 = Window_EquipItem.new(@actor, 3)
  117.     @item_window5 = Window_EquipItem.new(@actor, 4)
  118.     # 关联帮助窗口
  119.     @right_window.help_window = @help_window
  120.     @item_window1.help_window = @help_window
  121.     @item_window2.help_window = @help_window
  122.     @item_window3.help_window = @help_window
  123.     @item_window4.help_window = @help_window
  124.     @item_window5.help_window = @help_window

  125.     # 设置光标位置
  126.     @right_window.index = @equip_index
  127.     refresh
  128.     # 执行过渡
  129.     Graphics.transition
  130.     # 主循环
  131.     loop do
  132.       # 刷新游戏画面
  133.       Graphics.update
  134.       # 刷新输入信息
  135.       Input.update
  136.       # 刷新画面
  137.       update
  138.       # 如果画面切换的话的就中断循环
  139.       if $scene != self
  140.         break
  141.       end
  142.     end
  143.     # 准备过渡
  144.     Graphics.freeze
  145.     # 释放窗口
  146.     @help_window.dispose
  147.     @left_window.dispose
  148.     @right_window.dispose
  149.     @item_window1.dispose
  150.     @item_window2.dispose
  151.     @item_window3.dispose
  152.     @item_window4.dispose
  153.     @item_window5.dispose
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 刷新
  157.   #--------------------------------------------------------------------------
  158.   def refresh
  159.     # 设置物品窗口的可视状态
  160.     @item_window1.visible = (@right_window.index == 0)
  161.     @item_window2.visible = (@right_window.index == 1)
  162.     @item_window3.visible = (@right_window.index == 2)
  163.     @item_window4.visible = (@right_window.index == 3)
  164.     @item_window5.visible = (@right_window.index == 4)
  165.     # 获取当前装备中的物品
  166.     item1 = @right_window.item
  167.     # 设置当前的物品窗口到 @item_window
  168.     case @right_window.index
  169.     when 0
  170.       @item_window = @item_window1
  171.     when 1
  172.       @item_window = @item_window2
  173.     when 2
  174.       @item_window = @item_window3
  175.     when 3
  176.       @item_window = @item_window4
  177.     when 4
  178.       @item_window = @item_window5
  179.     end
  180.     # 右窗口被激活的情况下
  181.     if @right_window.active
  182.       # 删除变更装备后的能力
  183.       @left_window.set_new_parameters(nil, nil, nil)
  184.     end
  185.     # 物品窗口被激活的情况下
  186.     if @item_window.active
  187.       # 获取现在选中的物品
  188.       item2 = @item_window.item
  189.       # 变更装备
  190.       last_hp = @actor.hp
  191.       last_sp = @actor.sp
  192.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  193.    


  194.    
  195.       # 获取变更装备后的能力值
  196.       new_atk = @actor.atk
  197.       new_pdef = @actor.pdef
  198.       new_mdef = @actor.mdef
  199.       # 返回到装备
  200.    
  201.    
  202.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  203.       @actor.hp = last_hp
  204.       @actor.sp = last_sp
  205.       # 描画左窗口
  206.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 刷新画面
  211.   #--------------------------------------------------------------------------
  212.   def update
  213.     # 刷新窗口
  214.     @left_window.update
  215.     @right_window.update
  216.     @item_window.update
  217.     refresh
  218.     # 右侧窗口被激活的情况下: 调用 update_right
  219.     if @right_window.active
  220.       update_right
  221.       return
  222.     end
  223.     # 物品窗口被激活的情况下: 调用 update_item
  224.     if @item_window.active
  225.       update_item
  226.       return
  227.     end
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 刷新画面 (右侧窗口被激活的情况下)
  231.   #--------------------------------------------------------------------------
  232.   def update_right
  233.     # 按下 B 键的情况下
  234.     if Input.trigger?(Input::B)
  235.       # 演奏取消 SE
  236.       $game_system.se_play($data_system.cancel_se)
  237.       # 切换到菜单画面
  238.       
  239.       $scene = Scene_Menu.new(2)
  240.       return
  241.     end
  242.     # 按下 C 键的情况下
  243.     if Input.trigger?(Input::C)
  244.       # 固定装备的情况下
  245.       if @actor.equip_fix?(@right_window.index)
  246.         # 演奏冻结 SE
  247.         $game_system.se_play($data_system.buzzer_se)
  248.         return
  249.       end
  250.       # 演奏确定 SE
  251.       $game_system.se_play($data_system.decision_se)
  252.       # 激活物品窗口
  253.       @right_window.active = false
  254.       @item_window.active = true
  255.       @item_window.index = 0
  256.       return
  257.     end
  258.     # 按下 R 键的情况下
  259.     if Input.trigger?(Input::R)
  260.       # 演奏光标 SE
  261.       $game_system.se_play($data_system.cursor_se)
  262.       # 移至下一位角色
  263.       @actor_index += 1
  264.       @actor_index %= $game_party.actors.size
  265.       # 切换到别的装备画面
  266.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  267.       return
  268.     end
  269.     # 按下 L 键的情况下
  270.     if Input.trigger?(Input::L)
  271.       # 演奏光标 SE
  272.       $game_system.se_play($data_system.cursor_se)
  273.       # 移至上一位角色
  274.       @actor_index += $game_party.actors.size - 1
  275.       @actor_index %= $game_party.actors.size
  276.       # 切换到别的装备画面
  277.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  278.       return
  279.     end
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● 刷新画面 (物品窗口被激活的情况下)
  283.   #--------------------------------------------------------------------------
  284.   def update_item
  285.       for k in K_EQUIP::KE.keys
  286.     if @actor.weapon_id != 0
  287.     K_EQUIP::KE[k][0][0] = 1 if $data_weapons[@actor.weapon_id].element_set.include?(k)  
  288.     end
  289.     if @actor.armor1_id != 0
  290.     K_EQUIP::KE[k][0][1] = 1 if $data_armors[@actor.armor1_id].guard_element_set.include?(k)
  291.     end
  292.     if @actor.armor2_id != 0
  293.     K_EQUIP::KE[k][0][2] = 1 if $data_armors[@actor.armor2_id].guard_element_set.include?(k)
  294.     end
  295.     if @actor.armor3_id != 0
  296.     K_EQUIP::KE[k][0][3] = 1 if $data_armors[@actor.armor3_id].guard_element_set.include?(k)
  297.     end
  298.     if @actor.armor4_id != 0
  299.     K_EQUIP::KE[k][0][4] = 1 if $data_armors[@actor.armor4_id].guard_element_set.include?(k)
  300.     end
  301.     end
  302.    
  303.     # 按下 B 键的情况下
  304.     if Input.trigger?(Input::B)
  305.       # 演奏取消 SE
  306.       $game_system.se_play($data_system.cancel_se)
  307.       # 激活右侧窗口
  308.       @right_window.active = true
  309.       @item_window.active = false
  310.       @item_window.index = -1
  311.       return
  312.     end
  313.     # 按下 C 键的情况下
  314.     if Input.trigger?(Input::C)
  315.       # 演奏装备 SE
  316.       $game_system.se_play($data_system.equip_se)
  317.       # 获取物品窗口现在选择的装备数据
  318.       item1 = @right_window.item
  319.       item = @item_window.item
  320.       # 变更装备
  321.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  322.       for k in K_EQUIP::KE.keys
  323.       if item1.is_a?(RPG::Weapon)
  324.         if $data_weapons[item1.id].element_set.include?(k)
  325.            K_EQUIP::KE[k][0][0] = 0
  326.            if $game_party.actors[@actor_index].on_equip[k]
  327.        for j in 1..K_EQUIP::KE[k].size - 1
  328.            case K_EQUIP::KE[k][j][0]
  329.            when 0
  330.           @actor.maxhp -= K_EQUIP::KE[k][j][1]
  331.            when 1
  332.           @actor.maxsp -= K_EQUIP::KE[k][j][1]
  333.            when 2
  334.           @actor.str -= K_EQUIP::KE[k][j][1]
  335.            when 3
  336.           @actor.dex -= K_EQUIP::KE[k][j][1]
  337.            when 4
  338.           @actor.agi -= K_EQUIP::KE[k][j][1]
  339.            when 5
  340.           @actor.int -= K_EQUIP::KE[k][j][1]
  341.         end
  342.       end
  343.              Audio.se_play(K_EQUIP::OFF)
  344.            $game_party.actors[@actor_index].on_equip[k] = false
  345.              end
  346.            end
  347.          end

  348.       if item1.is_a?(RPG::Armor)
  349.         if $data_armors[item1.id].guard_element_set.include?(k)
  350.      if item != nil
  351.           case item.kind
  352.         when 0
  353.            K_EQUIP::KE[k][0][1] = 0
  354.         when 1
  355.            K_EQUIP::KE[k][0][2] = 0
  356.         when 2
  357.            K_EQUIP::KE[k][0][3] = 0
  358.         when 3
  359.            K_EQUIP::KE[k][0][4] = 0
  360.          end   
  361.          end
  362.            if $game_party.actors[@actor_index].on_equip[k]
  363.             
  364.          for j in 1..K_EQUIP::KE[k].size - 1
  365.            case K_EQUIP::KE[k][j][0]
  366.            when 0
  367.           @actor.maxhp -= K_EQUIP::KE[k][j][1]
  368.            when 1
  369.           @actor.maxsp -= K_EQUIP::KE[k][j][1]
  370.            when 2
  371.           @actor.str -= K_EQUIP::KE[k][j][1]
  372.            when 3
  373.           @actor.dex -= K_EQUIP::KE[k][j][1]
  374.            when 4
  375.           @actor.agi -= K_EQUIP::KE[k][j][1]
  376.            when 5
  377.           @actor.int -= K_EQUIP::KE[k][j][1]
  378.         end
  379.       end
  380.       
  381.        Audio.se_play(K_EQUIP::OFF)
  382.               $game_party.actors[@actor_index].on_equip[k] = false
  383.         end
  384.       end  
  385.       end
  386.       

  387.            
  388.       if item.is_a?(RPG::Weapon)
  389.         if $data_weapons[item.id].element_set.include?(k)
  390.            K_EQUIP::KE[k][0][0] = 1
  391.       
  392.            if !K_EQUIP::KE[k][0].include?(0) and !$game_party.actors[@actor_index].on_equip[k]
  393.           for j in 1..K_EQUIP::KE[k].size - 1
  394.            case K_EQUIP::KE[k][j][0]
  395.            when 0
  396.           @actor.maxhp += K_EQUIP::KE[k][j][1]
  397.            when 1
  398.           @actor.maxsp += K_EQUIP::KE[k][j][1]
  399.            when 2
  400.           @actor.str += K_EQUIP::KE[k][j][1]
  401.            when 3
  402.           @actor.dex += K_EQUIP::KE[k][j][1]
  403.            when 4
  404.           @actor.agi += K_EQUIP::KE[k][j][1]
  405.            when 5
  406.           @actor.int += K_EQUIP::KE[k][j][1]
  407.         end
  408.       end
  409.        Audio.se_play(K_EQUIP::ON)
  410.            $game_party.actors[@actor_index].on_equip[k] = true
  411.          
  412.              end
  413.         end
  414.       end
  415.       if item.is_a?(RPG::Armor)
  416.         if $data_armors[item.id].guard_element_set.include?(k)
  417.       if item != nil
  418.           case item.kind
  419.         when 0
  420.            K_EQUIP::KE[k][0][1] = 1
  421.         when 1
  422.            K_EQUIP::KE[k][0][2] = 1
  423.         when 2
  424.            K_EQUIP::KE[k][0][3] = 1
  425.         when 3
  426.            K_EQUIP::KE[k][0][4] = 1
  427.          end   
  428.          end
  429.            if !K_EQUIP::KE[k][0].include?(0) and !$game_party.actors[@actor_index].on_equip[k]
  430.                  for j in 1..K_EQUIP::KE[k].size - 1
  431.            case K_EQUIP::KE[k][j][0]
  432.            when 0
  433.           @actor.maxhp += K_EQUIP::KE[k][j][1]
  434.            when 1
  435.           @actor.maxsp += K_EQUIP::KE[k][j][1]
  436.            when 2
  437.           @actor.str += K_EQUIP::KE[k][j][1]
  438.            when 3
  439.           @actor.dex += K_EQUIP::KE[k][j][1]
  440.            when 4
  441.           @actor.agi += K_EQUIP::KE[k][j][1]
  442.            when 5
  443.           @actor.int += K_EQUIP::KE[k][j][1]
  444.         end
  445.       end
  446.       Audio.se_play(K_EQUIP::ON)
  447.           $game_party.actors[@actor_index].on_equip[k] = true               
  448.            end
  449.         end
  450.       end  
  451.       
  452.     end
  453.       # 激活右侧窗口
  454.       @right_window.active = true
  455.       @item_window.active = false
  456.       @item_window.index = -1
  457.       # 再生成右侧窗口、物品窗口的内容
  458.       @right_window.refresh
  459.       @item_window.refresh
  460.       return
  461.     end
  462.   end
  463. end

复制代码

夏娜的菜单
http://rpg.blue/web/ftppic/200604/菜单.rar
余下的就麻烦各位了.

Lv2.观梦者 (暗夜天使)

万兽

梦石
0
星屑
597
在线时间
2271 小时
注册时间
2006-11-4
帖子
4868

贵宾

2
 楼主| 发表于 2007-7-16 23:01:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
RT
本人不是很懂代码,弄来弄去就是不行,实在没办法在向大家求助,
希望哪位可以把整合好的范例发给


要求整合后夏娜的菜单功能不变,窗口也不变,只是把套装的脚本改一下.
这个是套装的代码.
  1. module K_EQUIP
  2.       #17是 装备属性  
  3.       # [0,0,0,0,1]是套装位置 有的为 0 没有的为1 顺序依次是 武器 盾 盔 甲 饰品   
  4.       # 后面的 [0,500],[1,500] 0和1为附加属性 0-最大生命  
  5.       # 1-最大魔法值 2-力量 3- 灵巧 4-速度 5-魔力
  6.       # 500 是增加量
  7. KE  = {17  => [[0,0,0,0,1] , [0,500],[1,500]] , 18  => [[0,1,1,1,0], [2,100],[3,100],[5,100]] }
  8. #装备套装提示音效
  9. ON  = "Audio/Se/055-Right01"
  10. #卸下套装提示音效
  11. OFF = "Audio/Se/058-Wrong02"
  12.   
  13.   #UP =
  14.   end
  15.   


  16. class Game_Actor < Game_Battler
  17.   attr_accessor :on_equip


  18. alias ksetup setup
  19. def setup(actor_id)
  20. ksetup(actor_id)
  21. @on_equip = {}

  22. end
  23. end

  24. #==============================================================================
  25. # ■ Window_EquipLeft
  26. #------------------------------------------------------------------------------
  27. #  装备画面的、显示角色能力值变化的窗口。
  28. #==============================================================================

  29. class Window_EquipLeft < Window_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对像
  32.   #     actor : 角色
  33.   #--------------------------------------------------------------------------
  34.   def initialize(actor)
  35.     super(0, 64, 272, 192)
  36.     self.contents = Bitmap.new(width - 32, height - 32)
  37.     @actor = actor
  38.     refresh
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 刷新
  42.   #--------------------------------------------------------------------------
  43.   def refresh
  44.     self.contents.clear
  45.     draw_actor_name(@actor, 4, 0)
  46.     #kk

  47.   self.contents.font.color = system_color
  48.     draw_actor_level(@actor, 4, 32)
  49.     draw_actor_parameter(@actor, 4, 64, 0)
  50.     draw_actor_parameter(@actor, 4, 96, 1)
  51.     draw_actor_parameter(@actor, 4, 128, 2)
  52.     if @new_atk != nil
  53.       self.contents.font.color = system_color
  54.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  55.       self.contents.font.color = normal_color
  56.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  57.     end
  58.     if @new_pdef != nil
  59.       self.contents.font.color = system_color
  60.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  61.       self.contents.font.color = normal_color
  62.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  63.     end
  64.     if @new_mdef != nil
  65.       self.contents.font.color = system_color
  66.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  67.       self.contents.font.color = normal_color
  68.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  69.     end
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 变更装备后的能力值设置
  73.   #     new_atk  : 变更装备后的攻击力
  74.   #     new_pdef : 变更装备后的物理防御
  75.   #     new_mdef : 变更装备后的魔法防御
  76.   #--------------------------------------------------------------------------
  77.   def set_new_parameters(new_atk, new_pdef, new_mdef)
  78.     if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
  79.       @new_atk = new_atk
  80.       @new_pdef = new_pdef
  81.       @new_mdef = new_mdef
  82.       refresh
  83.     end
  84.   end
  85. end




  86. ######################################################################################


  87. #==============================================================================
  88. # ■ Scene_Equip
  89. #------------------------------------------------------------------------------
  90. #  处理装备画面的类。
  91. #==============================================================================

  92. class Scene_Equip
  93.   
  94.   #--------------------------------------------------------------------------
  95.   # ● 初始化对像
  96.   #     actor_index : 角色索引
  97.   #     equip_index : 装备索引
  98.   #--------------------------------------------------------------------------                  
  99.   def initialize(actor_index = 0, equip_index = 0)
  100.     @actor_index = actor_index
  101.     @equip_index = equip_index
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 主处理
  105.   #--------------------------------------------------------------------------
  106.   def main

  107.     # 获取角色
  108.     @actor = $game_party.actors[@actor_index]

  109.     # 生成窗口
  110.     @help_window = Window_Help.new
  111.     @left_window = Window_EquipLeft.new(@actor)
  112.     @right_window = Window_EquipRight.new(@actor)
  113.     @item_window1 = Window_EquipItem.new(@actor, 0)
  114.     @item_window2 = Window_EquipItem.new(@actor, 1)
  115.     @item_window3 = Window_EquipItem.new(@actor, 2)
  116.     @item_window4 = Window_EquipItem.new(@actor, 3)
  117.     @item_window5 = Window_EquipItem.new(@actor, 4)
  118.     # 关联帮助窗口
  119.     @right_window.help_window = @help_window
  120.     @item_window1.help_window = @help_window
  121.     @item_window2.help_window = @help_window
  122.     @item_window3.help_window = @help_window
  123.     @item_window4.help_window = @help_window
  124.     @item_window5.help_window = @help_window

  125.     # 设置光标位置
  126.     @right_window.index = @equip_index
  127.     refresh
  128.     # 执行过渡
  129.     Graphics.transition
  130.     # 主循环
  131.     loop do
  132.       # 刷新游戏画面
  133.       Graphics.update
  134.       # 刷新输入信息
  135.       Input.update
  136.       # 刷新画面
  137.       update
  138.       # 如果画面切换的话的就中断循环
  139.       if $scene != self
  140.         break
  141.       end
  142.     end
  143.     # 准备过渡
  144.     Graphics.freeze
  145.     # 释放窗口
  146.     @help_window.dispose
  147.     @left_window.dispose
  148.     @right_window.dispose
  149.     @item_window1.dispose
  150.     @item_window2.dispose
  151.     @item_window3.dispose
  152.     @item_window4.dispose
  153.     @item_window5.dispose
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 刷新
  157.   #--------------------------------------------------------------------------
  158.   def refresh
  159.     # 设置物品窗口的可视状态
  160.     @item_window1.visible = (@right_window.index == 0)
  161.     @item_window2.visible = (@right_window.index == 1)
  162.     @item_window3.visible = (@right_window.index == 2)
  163.     @item_window4.visible = (@right_window.index == 3)
  164.     @item_window5.visible = (@right_window.index == 4)
  165.     # 获取当前装备中的物品
  166.     item1 = @right_window.item
  167.     # 设置当前的物品窗口到 @item_window
  168.     case @right_window.index
  169.     when 0
  170.       @item_window = @item_window1
  171.     when 1
  172.       @item_window = @item_window2
  173.     when 2
  174.       @item_window = @item_window3
  175.     when 3
  176.       @item_window = @item_window4
  177.     when 4
  178.       @item_window = @item_window5
  179.     end
  180.     # 右窗口被激活的情况下
  181.     if @right_window.active
  182.       # 删除变更装备后的能力
  183.       @left_window.set_new_parameters(nil, nil, nil)
  184.     end
  185.     # 物品窗口被激活的情况下
  186.     if @item_window.active
  187.       # 获取现在选中的物品
  188.       item2 = @item_window.item
  189.       # 变更装备
  190.       last_hp = @actor.hp
  191.       last_sp = @actor.sp
  192.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  193.    


  194.    
  195.       # 获取变更装备后的能力值
  196.       new_atk = @actor.atk
  197.       new_pdef = @actor.pdef
  198.       new_mdef = @actor.mdef
  199.       # 返回到装备
  200.    
  201.    
  202.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  203.       @actor.hp = last_hp
  204.       @actor.sp = last_sp
  205.       # 描画左窗口
  206.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 刷新画面
  211.   #--------------------------------------------------------------------------
  212.   def update
  213.     # 刷新窗口
  214.     @left_window.update
  215.     @right_window.update
  216.     @item_window.update
  217.     refresh
  218.     # 右侧窗口被激活的情况下: 调用 update_right
  219.     if @right_window.active
  220.       update_right
  221.       return
  222.     end
  223.     # 物品窗口被激活的情况下: 调用 update_item
  224.     if @item_window.active
  225.       update_item
  226.       return
  227.     end
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 刷新画面 (右侧窗口被激活的情况下)
  231.   #--------------------------------------------------------------------------
  232.   def update_right
  233.     # 按下 B 键的情况下
  234.     if Input.trigger?(Input::B)
  235.       # 演奏取消 SE
  236.       $game_system.se_play($data_system.cancel_se)
  237.       # 切换到菜单画面
  238.       
  239.       $scene = Scene_Menu.new(2)
  240.       return
  241.     end
  242.     # 按下 C 键的情况下
  243.     if Input.trigger?(Input::C)
  244.       # 固定装备的情况下
  245.       if @actor.equip_fix?(@right_window.index)
  246.         # 演奏冻结 SE
  247.         $game_system.se_play($data_system.buzzer_se)
  248.         return
  249.       end
  250.       # 演奏确定 SE
  251.       $game_system.se_play($data_system.decision_se)
  252.       # 激活物品窗口
  253.       @right_window.active = false
  254.       @item_window.active = true
  255.       @item_window.index = 0
  256.       return
  257.     end
  258.     # 按下 R 键的情况下
  259.     if Input.trigger?(Input::R)
  260.       # 演奏光标 SE
  261.       $game_system.se_play($data_system.cursor_se)
  262.       # 移至下一位角色
  263.       @actor_index += 1
  264.       @actor_index %= $game_party.actors.size
  265.       # 切换到别的装备画面
  266.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  267.       return
  268.     end
  269.     # 按下 L 键的情况下
  270.     if Input.trigger?(Input::L)
  271.       # 演奏光标 SE
  272.       $game_system.se_play($data_system.cursor_se)
  273.       # 移至上一位角色
  274.       @actor_index += $game_party.actors.size - 1
  275.       @actor_index %= $game_party.actors.size
  276.       # 切换到别的装备画面
  277.       $scene = Scene_Equip.new(@actor_index, @right_window.index)
  278.       return
  279.     end
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● 刷新画面 (物品窗口被激活的情况下)
  283.   #--------------------------------------------------------------------------
  284.   def update_item
  285.       for k in K_EQUIP::KE.keys
  286.     if @actor.weapon_id != 0
  287.     K_EQUIP::KE[k][0][0] = 1 if $data_weapons[@actor.weapon_id].element_set.include?(k)  
  288.     end
  289.     if @actor.armor1_id != 0
  290.     K_EQUIP::KE[k][0][1] = 1 if $data_armors[@actor.armor1_id].guard_element_set.include?(k)
  291.     end
  292.     if @actor.armor2_id != 0
  293.     K_EQUIP::KE[k][0][2] = 1 if $data_armors[@actor.armor2_id].guard_element_set.include?(k)
  294.     end
  295.     if @actor.armor3_id != 0
  296.     K_EQUIP::KE[k][0][3] = 1 if $data_armors[@actor.armor3_id].guard_element_set.include?(k)
  297.     end
  298.     if @actor.armor4_id != 0
  299.     K_EQUIP::KE[k][0][4] = 1 if $data_armors[@actor.armor4_id].guard_element_set.include?(k)
  300.     end
  301.     end
  302.    
  303.     # 按下 B 键的情况下
  304.     if Input.trigger?(Input::B)
  305.       # 演奏取消 SE
  306.       $game_system.se_play($data_system.cancel_se)
  307.       # 激活右侧窗口
  308.       @right_window.active = true
  309.       @item_window.active = false
  310.       @item_window.index = -1
  311.       return
  312.     end
  313.     # 按下 C 键的情况下
  314.     if Input.trigger?(Input::C)
  315.       # 演奏装备 SE
  316.       $game_system.se_play($data_system.equip_se)
  317.       # 获取物品窗口现在选择的装备数据
  318.       item1 = @right_window.item
  319.       item = @item_window.item
  320.       # 变更装备
  321.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  322.       for k in K_EQUIP::KE.keys
  323.       if item1.is_a?(RPG::Weapon)
  324.         if $data_weapons[item1.id].element_set.include?(k)
  325.            K_EQUIP::KE[k][0][0] = 0
  326.            if $game_party.actors[@actor_index].on_equip[k]
  327.        for j in 1..K_EQUIP::KE[k].size - 1
  328.            case K_EQUIP::KE[k][j][0]
  329.            when 0
  330.           @actor.maxhp -= K_EQUIP::KE[k][j][1]
  331.            when 1
  332.           @actor.maxsp -= K_EQUIP::KE[k][j][1]
  333.            when 2
  334.           @actor.str -= K_EQUIP::KE[k][j][1]
  335.            when 3
  336.           @actor.dex -= K_EQUIP::KE[k][j][1]
  337.            when 4
  338.           @actor.agi -= K_EQUIP::KE[k][j][1]
  339.            when 5
  340.           @actor.int -= K_EQUIP::KE[k][j][1]
  341.         end
  342.       end
  343.              Audio.se_play(K_EQUIP::OFF)
  344.            $game_party.actors[@actor_index].on_equip[k] = false
  345.              end
  346.            end
  347.          end

  348.       if item1.is_a?(RPG::Armor)
  349.         if $data_armors[item1.id].guard_element_set.include?(k)
  350.      if item != nil
  351.           case item.kind
  352.         when 0
  353.            K_EQUIP::KE[k][0][1] = 0
  354.         when 1
  355.            K_EQUIP::KE[k][0][2] = 0
  356.         when 2
  357.            K_EQUIP::KE[k][0][3] = 0
  358.         when 3
  359.            K_EQUIP::KE[k][0][4] = 0
  360.          end   
  361.          end
  362.            if $game_party.actors[@actor_index].on_equip[k]
  363.             
  364.          for j in 1..K_EQUIP::KE[k].size - 1
  365.            case K_EQUIP::KE[k][j][0]
  366.            when 0
  367.           @actor.maxhp -= K_EQUIP::KE[k][j][1]
  368.            when 1
  369.           @actor.maxsp -= K_EQUIP::KE[k][j][1]
  370.            when 2
  371.           @actor.str -= K_EQUIP::KE[k][j][1]
  372.            when 3
  373.           @actor.dex -= K_EQUIP::KE[k][j][1]
  374.            when 4
  375.           @actor.agi -= K_EQUIP::KE[k][j][1]
  376.            when 5
  377.           @actor.int -= K_EQUIP::KE[k][j][1]
  378.         end
  379.       end
  380.       
  381.        Audio.se_play(K_EQUIP::OFF)
  382.               $game_party.actors[@actor_index].on_equip[k] = false
  383.         end
  384.       end  
  385.       end
  386.       

  387.            
  388.       if item.is_a?(RPG::Weapon)
  389.         if $data_weapons[item.id].element_set.include?(k)
  390.            K_EQUIP::KE[k][0][0] = 1
  391.       
  392.            if !K_EQUIP::KE[k][0].include?(0) and !$game_party.actors[@actor_index].on_equip[k]
  393.           for j in 1..K_EQUIP::KE[k].size - 1
  394.            case K_EQUIP::KE[k][j][0]
  395.            when 0
  396.           @actor.maxhp += K_EQUIP::KE[k][j][1]
  397.            when 1
  398.           @actor.maxsp += K_EQUIP::KE[k][j][1]
  399.            when 2
  400.           @actor.str += K_EQUIP::KE[k][j][1]
  401.            when 3
  402.           @actor.dex += K_EQUIP::KE[k][j][1]
  403.            when 4
  404.           @actor.agi += K_EQUIP::KE[k][j][1]
  405.            when 5
  406.           @actor.int += K_EQUIP::KE[k][j][1]
  407.         end
  408.       end
  409.        Audio.se_play(K_EQUIP::ON)
  410.            $game_party.actors[@actor_index].on_equip[k] = true
  411.          
  412.              end
  413.         end
  414.       end
  415.       if item.is_a?(RPG::Armor)
  416.         if $data_armors[item.id].guard_element_set.include?(k)
  417.       if item != nil
  418.           case item.kind
  419.         when 0
  420.            K_EQUIP::KE[k][0][1] = 1
  421.         when 1
  422.            K_EQUIP::KE[k][0][2] = 1
  423.         when 2
  424.            K_EQUIP::KE[k][0][3] = 1
  425.         when 3
  426.            K_EQUIP::KE[k][0][4] = 1
  427.          end   
  428.          end
  429.            if !K_EQUIP::KE[k][0].include?(0) and !$game_party.actors[@actor_index].on_equip[k]
  430.                  for j in 1..K_EQUIP::KE[k].size - 1
  431.            case K_EQUIP::KE[k][j][0]
  432.            when 0
  433.           @actor.maxhp += K_EQUIP::KE[k][j][1]
  434.            when 1
  435.           @actor.maxsp += K_EQUIP::KE[k][j][1]
  436.            when 2
  437.           @actor.str += K_EQUIP::KE[k][j][1]
  438.            when 3
  439.           @actor.dex += K_EQUIP::KE[k][j][1]
  440.            when 4
  441.           @actor.agi += K_EQUIP::KE[k][j][1]
  442.            when 5
  443.           @actor.int += K_EQUIP::KE[k][j][1]
  444.         end
  445.       end
  446.       Audio.se_play(K_EQUIP::ON)
  447.           $game_party.actors[@actor_index].on_equip[k] = true               
  448.            end
  449.         end
  450.       end  
  451.       
  452.     end
  453.       # 激活右侧窗口
  454.       @right_window.active = true
  455.       @item_window.active = false
  456.       @item_window.index = -1
  457.       # 再生成右侧窗口、物品窗口的内容
  458.       @right_window.refresh
  459.       @item_window.refresh
  460.       return
  461.     end
  462.   end
  463. end

复制代码

夏娜的菜单
http://rpg.blue/web/ftppic/200604/菜单.rar
余下的就麻烦各位了.

Lv1.梦旅人

北域苍狼

梦石
0
星屑
162
在线时间
12 小时
注册时间
2005-10-16
帖子
610
3
发表于 2007-7-17 00:12:19 | 只看该作者
没下载范例,不过我私以为搜索我那个[不是教学的教学]应该会有收获
昔人更作路人去,凤凰城下孤烟起。游戏制作先行者http://www.diyrpg.net
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-4-20
帖子
329
4
发表于 2007-7-17 05:33:45 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-9-22 07:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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