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

Project1

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

关于装备颜色的问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
跳转到指定楼层
1
发表于 2008-5-12 22:09:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
以前用数据库更改物品名颜色的脚本(http://rpg.blue/web/htm/news202.htm)来给装备区分颜色。后来又添加了二刀流+装备合成六边形界面的脚本(http://rpg.blue/web/htm/news732.htm),发现游戏中装备栏可选装备都只显示白色了,只有装备上去才显示设定好的颜色,这个如何解决?


加入二刀流+六边形界面的脚本之前




加入二刀流+六边形界面的脚本之后

Lv1.梦旅人

风之塞尔达

梦石
0
星屑
50
在线时间
57 小时
注册时间
2005-10-22
帖子
2492

贵宾

2
发表于 2008-5-12 22:25:08 | 只看该作者
描绘文字的函数被重载了吧
在程序里延续塞尔达的传说, 在画板上勾勒塞尔达的轮廓!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
3
 楼主| 发表于 2008-5-12 22:28:20 | 只看该作者
怎么办呢。。我把“更改物品名颜色”脚本换到“二刀流+装备合成六边形界面”脚本之下也没用啊
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

4
发表于 2008-5-12 22:28:53 | 只看该作者
看一下两个脚本有没有都改到window_equipitem
或者draw_item
总之看看它们都改了哪几个类吧
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
5
 楼主| 发表于 2008-5-12 22:32:44 | 只看该作者
是不是下面这两段关于装备的脚本要整合啊?{/ll}



更改物品名颜色
  1. class Window_EquipItem < Window_Selectable
  2.   #--------------------------------------------------------------------------
  3.   # ● 项目的描绘
  4.   #     index : 项目符号
  5.   #--------------------------------------------------------------------------
  6.   def draw_item(index)
  7.     item = @data[index]
  8.     ##################################################
  9.     x = 4
  10.     y = index * 32
  11.     ##################################################
  12.     case item
  13.     when RPG::Weapon
  14.       number = $game_party.weapon_number(item.id)
  15.     when RPG::Armor
  16.       number = $game_party.armor_number(item.id)
  17.     end
  18.     bitmap = RPG::Cache.icon(item.icon_name)
  19.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  20.     self.contents.font.color = text_color(item.name_color_66RPG)
  21.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  22.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  23.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  24.   end
  25. end
复制代码




二刀流+装备合成六边形界面
  1. # ■ Harts_Window_EquipItem
  2. #==============================================================================

  3. class Harts_Window_EquipItem < Window_Selectable
  4.   
  5.   
  6.   #--------------------------------------------------------------------------
  7.   # ● 初期化
  8.   # actor : 角色
  9.   # equip_type : 装備部位 (0~3)
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor, equip_type)
  12.     super(272, 314, 368, 102)
  13.     @actor = actor
  14.     @equip_type = equip_type
  15.     @column_max = 1
  16.     refresh
  17.     self.active = false
  18.     self.index = -1
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● 物品取得
  22.   #--------------------------------------------------------------------------
  23.   def item
  24.     return @data[self.index]
  25.   end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

风之塞尔达

梦石
0
星屑
50
在线时间
57 小时
注册时间
2005-10-22
帖子
2492

贵宾

6
发表于 2008-5-12 22:49:08 | 只看该作者
怎么感觉你2刀流脚本没贴完?

参照你的第一个脚本, 应该是这句
self.contents.font.color = text_color(item.name_color_66RPG)
没有了
在程序里延续塞尔达的传说, 在画板上勾勒塞尔达的轮廓!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
7
 楼主| 发表于 2008-5-12 23:11:14 | 只看该作者
我把二刀流脚本中描述颜色为normal_color的地方改为item.name_color_66RPG,结果游戏中查看装备的时候在
二刀流脚本的self.contents.font.color = item.name_color_66RPG这一行发生了TypeError   
cannot convert Fixnum into Color



回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

8
发表于 2008-5-12 23:12:11 | 只看该作者
self.contents.font.color = text_color(item.name_color_66RPG)
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
9
 楼主| 发表于 2008-5-12 23:12:46 | 只看该作者
两个脚本太长了,只能挑选自己觉得可能是冲突的那部分



更改物品名颜色脚本
  1. class Window_Base < Window
  2.   #--------------------------------------------------------------------------
  3.   # ● 描绘物品名
  4.   #     item : 物品
  5.   #     x    : 描画目标 X 坐标
  6.   #     y    : 描画目标 Y 坐标
  7.   #--------------------------------------------------------------------------
  8.   def draw_item_name(item, x, y)
  9.     if item == nil
  10.       return
  11.     end
  12.     bitmap = RPG::Cache.icon(item.icon_name)
  13.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  14.     self.contents.font.color = text_color(item.name_color_66RPG)
  15.     self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
  16.   end
  17. end
复制代码




二刀流+装备合成六边形界面脚本
  1. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  4. #
  5. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6. #==============================================================================
  7. # ■ Window_Base
  8. #------------------------------------------------------------------------------
  9. #  游戏中全部窗口的超级类。
  10. #==============================================================================

  11. class Window_Base < Window
  12.   ################## 属性增减颜色 ##############################
  13.   def up_color
  14.     return Color.new(255, 0, 0)
  15.   end
  16.   def down_color
  17.     return Color.new(0, 255, 0)
  18.   end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
231 小时
注册时间
2007-12-17
帖子
541
10
 楼主| 发表于 2008-5-12 23:13:37 | 只看该作者
二刀流+六边形界面脚本关于窗口描绘的部分


  1. #==============================================================================
  2. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  3. #
  4. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  5. #
  6. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  7. #==============================================================================
  8. # ■ Window_EquipRight
  9. #------------------------------------------------------------------------------
  10. #  装备画面、显示角色现在装备的物品的窗口。
  11. #==============================================================================

  12. class Window_EquipRight < Window_Selectable
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化对像
  15.   #     actor : 角色
  16.   #--------------------------------------------------------------------------
  17.   def initialize(actor)
  18.     super(272, 64, 368, 252)
  19.     self.contents = Bitmap.new(width - 32, height - 32)
  20.     @actor = actor
  21.     refresh
  22.     self.index = 0
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 刷新
  26.   #--------------------------------------------------------------------------
  27.   def refresh
  28.     self.contents.clear
  29.     @data = []
  30.     @data.push($data_weapons[@actor.weapon_id])
  31.     # --- ここから変更部分 ---
  32.     @data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $data_armors[@actor.armor1_id])
  33.     # --- 変更部分終わり ---
  34.     @data.push($data_armors[@actor.armor2_id])
  35.     @data.push($data_armors[@actor.armor3_id])
  36.     @data.push($data_armors[@actor.armor4_id])
  37.     @data.push($data_armors[@actor.armor5_id])
  38.     @data.push($data_armors[@actor.armor6_id])
  39.     @item_max = @data.size
  40.     self.contents.font.color = system_color
  41.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  42.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  43.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  44.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  45.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  46.     self.contents.draw_text(4, 32 * 5, 92, 32, "项链")
  47.     self.contents.draw_text(4, 32 * 6, 92, 32, "脚部")
  48.     draw_item_name(@data[0], 92, 32 * 0)
  49.     draw_item_name(@data[1], 92, 32 * 1)
  50.     draw_item_name(@data[2], 92, 32 * 2)
  51.     draw_item_name(@data[3], 92, 32 * 3)
  52.     draw_item_name(@data[4], 92, 32 * 4)
  53.     draw_item_name(@data[5], 92, 32 * 5)
  54.     draw_item_name(@data[6], 92, 32 * 6)
  55.   end
  56. end
  57. # ■ Harts_Window_EquipItem
  58. #==============================================================================

  59. class Harts_Window_EquipItem < Window_Selectable
  60.   
  61.   
  62.   #--------------------------------------------------------------------------
  63.   # ● 初期化
  64.   # actor : 角色
  65.   # equip_type : 装備部位 (0~3)
  66.   #--------------------------------------------------------------------------
  67.   def initialize(actor, equip_type)
  68.     super(272, 314, 368, 102)
  69.     @actor = actor
  70.     @equip_type = equip_type
  71.     @column_max = 1
  72.     refresh
  73.     self.active = false
  74.     self.index = -1
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 物品取得
  78.   #--------------------------------------------------------------------------
  79.   def item
  80.     return @data[self.index]
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 最強id取得
  84.   #--------------------------------------------------------------------------
  85.   def max_item_id
  86.     if @equip_type == 0
  87.       if @actor.weapon_id == 0
  88.         max = 0
  89.       else
  90.         max = $data_weapons[@actor.weapon_id].atk
  91.       end
  92.       # --- ここから追加部分 ---
  93.     # 二刀流可能なアクターの場合は、盾に二刀武器も表示
  94.     elsif @equip_type == 1 and @actor.can_two_weapons?
  95.       if @actor.weapon2_id == 0
  96.         max = 0
  97.       else
  98.         max = $data_weapons[@actor.weapon2_id].atk
  99.       end
  100.       #weapon_set = $data_classes[@actor.class_id].weapon_set
  101.       #for i in 1...$data_weapons.size
  102.       #  if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  103.       #    @data.push($data_weapons[i])
  104.       #  end
  105.       #end
  106.    
  107.     # --- 追加部分終わり ---
  108.     elsif @equip_type == 1
  109.       if @actor.armor1_id == 0
  110.         max = 0
  111.       else
  112.         max = $data_armors[@actor.armor1_id].pdef
  113.       end
  114.     elsif @equip_type == 2
  115.       if @actor.armor2_id == 0
  116.         max = 0
  117.       else
  118.         max = $data_armors[@actor.armor2_id].pdef
  119.       end
  120.     elsif @equip_type == 3
  121.       if @actor.armor3_id == 0
  122.         max = 0
  123.       else
  124.         max = $data_armors[@actor.armor3_id].pdef
  125.       end
  126.       elsif @equip_type == 4
  127.       if @actor.armor4_id == 0
  128.         max = 0
  129.       else
  130.         max = $data_armors[@actor.armor4_id].pdef
  131.       end
  132.       elsif @equip_type == 5
  133.       if @actor.armor5_id == 0
  134.         max = 0
  135.       else
  136.         max = $data_armors[@actor.armor5_id].pdef
  137.       end
  138.     end
  139.     for i in [email protected]
  140.       if @equip_type <= 1 and @actor.can_two_weapons?
  141.         if max <= $data_weapons[@data[i].id].atk
  142.           max = $data_weapons[@data[i].id].atk
  143.           item_id = @data[i].id
  144.         end
  145.       elsif #@equip_type >= 1
  146.         if max <= $data_armors[@data[i].id].pdef
  147.           max = $data_armors[@data[i].id].pdef
  148.           item_id = @data[i].id
  149.         end
  150.       end
  151.     end
  152.     return item_id
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 刷新
  156.   #--------------------------------------------------------------------------
  157.   def refresh
  158.     if self.contents != nil
  159.       self.contents.dispose
  160.       self.contents = nil
  161.     end
  162.     @data = []
  163.     # 装備可能的武器追加
  164.     if @equip_type == 0
  165.       weapon_set = $data_classes[@actor.class_id].weapon_set
  166.       for i in 1...$data_weapons.size
  167.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  168.           @data.push($data_weapons[i])
  169.         end
  170.       end
  171.     end
  172.     # --- ここから追加部分 ---
  173.     # 二刀流可能なアクターの場合は、盾に二刀武器も表示
  174.     if @equip_type == 1 and @actor.can_two_weapons?
  175.       weapon_set = $data_classes[@actor.class_id].weapon_set
  176.       for i in 1...$data_weapons.size
  177.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
  178.           @data.push($data_weapons[i])
  179.         end
  180.       end
  181.     end
  182.     # --- 追加部分終わり ---
  183.   ###########################################################################
  184. #    if Kboard.keyboard($R_Key_G)
  185. #      # 演奏取消 SE
  186. #      $game_system.se_play($data_system.cancel_se)
  187. #      # 切换到菜单画面
  188. #      $scene = Scene_Map.new
  189. #      return
  190. #    end
  191.   ###########################################################################
  192.   # 装備可能的防具追加
  193.     if @equip_type != 0
  194.       armor_set = $data_classes[@actor.class_id].armor_set
  195.       for i in 1...$data_armors.size
  196.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  197.           if $data_armors[i].kind == @equip_type-1
  198.             @data.push($data_armors[i])
  199.           end
  200.         end
  201.       end
  202.     end
  203.     # 空白追加
  204.     @data.push(nil)
  205.     # 全項目描画
  206.     @item_max = @data.size
  207.     self.contents = Bitmap.new(width - 32, row_max * 32)
  208.     for i in 0...@item_max-1
  209.       draw_item(i)
  210.     end
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 項目描画
  214.   # index : 項目编号
  215.   #--------------------------------------------------------------------------
  216.   def draw_item(index)
  217.     item = @data[index]
  218.     x = 4
  219.     y = index * 32
  220.     case item
  221.     when RPG::Weapon
  222.       number = $game_party.weapon_number(item.id)
  223.     when RPG::Armor
  224.       number = $game_party.armor_number(item.id)
  225.     end
  226.     bitmap = RPG::Cache.icon(item.icon_name)
  227.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  228.     self.contents.font.color = normal_color
  229.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  230.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  231.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● 帮助更新
  235.   #--------------------------------------------------------------------------
  236.   def update_help
  237.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  238.   end
  239. end

  240. #==============================================================================
  241. # ■ Harts_Window_EquipLeft
  242. #==============================================================================

  243. class Harts_Window_EquipLeft < Window_Base
  244.   #--------------------------------------------------------------------------
  245.   # ● 初期化
  246.   # actor : 角色
  247.   #--------------------------------------------------------------------------
  248.   def initialize(actor)
  249.     super(0, 64, 272, 352)
  250.     self.contents = Bitmap.new(width - 32, height - 32)
  251.     @actor = actor
  252.     refresh
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● リフレッシュ
  256.   #--------------------------------------------------------------------------
  257.   def refresh
  258.     self.contents.clear
  259.     draw_actor_graphic(@actor, 32, 64)
  260.     draw_actor_name(@actor, 4 + 96, 0)
  261.     draw_actor_level(@actor, 4 + 96, 32)
  262.     draw_actor_parameter(@actor, 4, 100, 0)#80=64
  263.     draw_actor_parameter(@actor, 4, 127, 1)#112=96
  264.     draw_actor_parameter(@actor, 4, 154, 2)#144=128
  265.     draw_actor_parameter(@actor, 4, 181, 7)
  266.     draw_actor_parameter(@actor, 4, 211, 3)
  267.     draw_actor_parameter(@actor, 4, 238, 4)
  268.     draw_actor_parameter(@actor, 4, 265, 5)
  269.     draw_actor_parameter(@actor, 4, 292, 6)
  270.     if @new_atk != nil and @new_atk != @actor.atk
  271.       if @new_atk > @actor.atk
  272.         self.contents.font.color = system_color
  273.       else
  274.         self.contents.font.color = disabled_color
  275.       end
  276.       self.contents.draw_text(160, 100, 40, 32, "→", 1)
  277.       self.contents.draw_text(200, 100, 36, 32, @new_atk.to_s, 2)
  278.     end
  279.     if @new_pdef != nil and @new_pdef != @actor.pdef
  280.       if @new_pdef > @actor.pdef
  281.         self.contents.font.color = system_color
  282.       else
  283.         self.contents.font.color = disabled_color
  284.       end
  285.       self.contents.draw_text(160, 127, 40, 32, "→", 1)
  286.       self.contents.draw_text(200, 127, 36, 32, @new_pdef.to_s, 2)
  287.     end
  288.     if @new_mdef != nil and @new_mdef != @actor.mdef
  289.       if @new_mdef > @actor.mdef
  290.         self.contents.font.color = system_color
  291.       else
  292.         self.contents.font.color = disabled_color
  293.       end
  294.       self.contents.draw_text(160, 154, 40, 32, "→", 1)
  295.       self.contents.draw_text(200, 154, 36, 32, @new_mdef.to_s, 2)
  296.     end
  297.     if @new_eva != nil and @new_eva != @actor.eva
  298.       if @new_eva > @actor.eva
  299.         self.contents.font.color = system_color
  300.       else
  301.         self.contents.font.color = disabled_color
  302.       end
  303.       self.contents.draw_text(160, 181, 40, 32, "→", 1)
  304.       self.contents.draw_text(200, 181, 36, 32, @new_mdef.to_s, 2)
  305.     end
  306.     if @new_str != nil and @new_str != @actor.str
  307.       if @new_str > @actor.str
  308.         self.contents.font.color = system_color
  309.       else
  310.         self.contents.font.color = disabled_color
  311.       end
  312.       self.contents.draw_text(160, 211, 40, 32, "→", 1)
  313.       self.contents.draw_text(200, 211, 36, 32, @new_str.to_s, 2)
  314.     end
  315.     if @new_dex != nil and @new_dex != @actor.dex
  316.       if @new_dex > @actor.dex
  317.         self.contents.font.color = system_color
  318.       else
  319.         self.contents.font.color = disabled_color
  320.       end
  321.       self.contents.draw_text(160, 238, 40, 32, "→", 1)
  322.       self.contents.draw_text(200, 238, 36, 32, @new_dex.to_s, 2)
  323.     end
  324.     if @new_agi != nil and @new_agi != @actor.agi
  325.       if @new_agi > @actor.agi
  326.         self.contents.font.color = system_color
  327.       else
  328.         self.contents.font.color = disabled_color
  329.       end
  330.       self.contents.draw_text(160, 265, 40, 32, "→", 1)
  331.       self.contents.draw_text(200, 265, 36, 32, @new_agi.to_s, 2)
  332.     end
  333.     if @new_int != nil and @new_int != @actor.int
  334.       if @new_int > @actor.int
  335.         self.contents.font.color = system_color
  336.       else
  337.         self.contents.font.color = disabled_color
  338.       end
  339.       self.contents.draw_text(160, 292, 40, 32, "→", 1)
  340.       self.contents.draw_text(200, 292, 36, 32, @new_int.to_s, 2)
  341.     end
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● 装備変更後設定
  345.   # new_atk : 装備変更後攻撃力
  346.   # new_pdef : 装備変更後物理防御
  347.   # new_mdef : 装備変更後魔法防御
  348.   #--------------------------------------------------------------------------
  349.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  350.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  351.       @new_atk = new_atk
  352.       @new_pdef = new_pdef
  353.       @new_mdef = new_mdef
  354.       @new_str = new_str
  355.       @new_dex = new_dex
  356.       @new_agi = new_agi
  357.       @new_int = new_int
  358.       refresh
  359.     end
  360.   end
  361. end

  362. #==============================================================================
  363. # ■ Harts_Scene_Equip
  364. #==============================================================================

  365. class Scene_Equip
  366.   include OPACITY_66RPG
  367.   #--------------------------------------------------------------------------
  368.   # ● 初期化
  369.   # actor_index : 角色编号
  370.   # equip_index : 装備编号
  371.   #--------------------------------------------------------------------------
  372.   def initialize(actor_index = 0, equip_index = -1, command_index = 0, equip_active = false, command_active = true)
  373.     @actor_index = actor_index
  374.     @equip_index = equip_index
  375.     @command_index = command_index
  376.     @equip_active = equip_active
  377.     @command_active = command_active
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 主处理
  381.   #--------------------------------------------------------------------------
  382.   def main
  383.     create_screen
  384.     @actor = $game_party.actors[@actor_index]
  385.     @title_window = Harts_Window_EquipTitle.new
  386.     @command_window = Harts_Window_EquipCommand.new
  387.     @help_window = Window_Help.new
  388.     @help_window.y = 416
  389.     @left_window = Harts_Window_EquipLeft.new(@actor)
  390.     @right_window = Window_EquipRight.new(@actor)
  391.     @item_window0 = Harts_Window_EquipItem.new(@actor, -1)
  392.     @item_window1 = Harts_Window_EquipItem.new(@actor, 0)
  393.     @item_window2 = Harts_Window_EquipItem.new(@actor, 1)
  394.     @item_window3 = Harts_Window_EquipItem.new(@actor, 2)
  395.     @item_window4 = Harts_Window_EquipItem.new(@actor, 3)
  396.     @item_window5 = Harts_Window_EquipItem.new(@actor, 4)
  397.     @item_window6 = Harts_Window_EquipItem.new(@actor, 5)
  398.     @item_window7 = Harts_Window_EquipItem.new(@actor, 6)
  399.     # 关联帮助窗口
  400.     @right_window.help_window = @help_window
  401.     @item_window0.help_window = @help_window
  402.     @item_window1.help_window = @help_window
  403.     @item_window2.help_window = @help_window
  404.     @item_window3.help_window = @help_window
  405.     @item_window4.help_window = @help_window
  406.     @item_window5.help_window = @help_window


  407.     @item_window6.help_window = @help_window
  408.     @item_window7.help_window = @help_window
  409.     ##############
  410.     @equip_window = Window_Equip.new
  411.     ##############
  412.     # 设置光标位置
  413.     @command_window.index = @command_index
  414.     @right_window.index = @equip_index
  415.     @command_window.active = @command_active
  416.     @right_window.active = @equip_active
  417.     testname = @actor.battler_name+"_h.png"
  418.     if FileTest.exist?("Graphics/battlers/#{testname}")
  419.       sp = Sprite.new
  420.       sp.bitmap=Bitmap.new("Graphics/battlers/#{testname}")
  421.       sp.opacity = 120
  422.     end   
  423.     refresh
  424.     # 执行过渡
  425.     Graphics.transition
  426.     # 主循环
  427.     loop do
  428.       # 刷新游戏画面
  429.       Graphics.update
  430.       # 刷新输入信息
  431.       Input.update
  432.       # 刷新画面
  433.       update
  434.       # 如果画面切换的话的就中断循环
  435.       if $scene != self
  436.         break
  437.       end
  438.     end
  439.     # トランジション準備
  440.     Graphics.freeze
  441.     # ウィンドウを解放
  442.     @title_window.dispose
  443.     @command_window.dispose
  444.     @help_window.dispose
  445.     @left_window.dispose
  446.     @right_window.dispose
  447.     @item_window0.dispose
  448.     @item_window1.dispose
  449.     @item_window2.dispose
  450.     @item_window3.dispose
  451.     @item_window4.dispose
  452.     @item_window5.dispose
  453.     @item_window6.dispose
  454.     @item_window7.dispose
  455.     ##############
  456.     @equip_window.dispose
  457.     ##############
  458.     dispose_screen
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ● 刷新
  462.   #--------------------------------------------------------------------------
  463.   def refresh
  464.     @item_window0.visible = (@right_window.index == -1)
  465.     @item_window1.visible = (@right_window.index == 0)
  466.     @item_window2.visible = (@right_window.index == 1)
  467.     @item_window3.visible = (@right_window.index == 2)
  468.     @item_window4.visible = (@right_window.index == 3)
  469.     @item_window5.visible = (@right_window.index == 4)
  470.     @item_window6.visible = (@right_window.index == 5)
  471.     @item_window7.visible = (@right_window.index == 6)
  472.     # 获取当前装备中的物品
  473.     item1 = @right_window.item
  474.     ##############
  475.     @equip_window.set_item(item1)
  476.     ##############
  477.     # 设置当前的物品窗口到 @item_window
  478.     case @right_window.index
  479.     when -1
  480.       @item_window = @item_window0
  481.     when 0
  482.       @item_window = @item_window1
  483.     when 1
  484.       @item_window = @item_window2
  485.     when 2
  486.       @item_window = @item_window3
  487.     when 3
  488.       @item_window = @item_window4
  489.     when 4
  490.       @item_window = @item_window5
  491.     when 5
  492.       @item_window = @item_window6
  493.     when 6
  494.       @item_window = @item_window7
  495.     end
  496.     # 右窗口被激活的情况下
  497.     if @right_window.active
  498.       # 删除变更装备后的能力
  499.     ###############################################################
  500.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  501.     end
  502.     # 物品窗口被激活的情况下
  503.     if @item_window.active
  504.       # 获取现在选中的物品
  505.       item2 = @item_window.item
  506.       # 变更装备
  507.       last_hp = @actor.hp
  508.       last_sp = @actor.sp
  509.       # --- ここから変更部分 ---
  510.       # 現在の装備を保存(装備の種類を増やしている場合はここを変更)
  511.       equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
  512.       @actor.equip(equip_type(@right_window.index, item2), item2 == nil ? 0 : item2.id)
  513.       # --- 変更部分終わり ---
  514.       # 装備変更後のパラメータを取得
  515.     ###############################################################
  516.       # 获取变更装备后的能力值
  517.       new_atk = @actor.atk
  518.       new_pdef = @actor.pdef
  519.       new_mdef = @actor.mdef
  520.       new_eva = @actor.eva
  521.       new_str = @actor.str
  522.       new_dex = @actor.dex
  523.       new_agi = @actor.agi
  524.       new_int = @actor.int



  525.       # --- ここから変更部分 ---
  526.       # 装備を戻す
  527.       for i in 0...equipments.size
  528.         @actor.equip(i - 1, equipments[i])
  529.       end
  530.       # --- 変更部分終わり ---
  531.       # 返回到装备
  532.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  533.       @actor.hp = last_hp
  534.       @actor.sp = last_sp
  535.       # 描画左窗口
  536.     ###############################################################
  537.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  538.     ###############################################################
  539.       ##################
  540.       @equip_window.set_item(item2)
  541.       ##################
  542.     end
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 更新
  546.   #--------------------------------------------------------------------------
  547.   def update
  548.     @title_window.update
  549.     @command_window.update
  550.     @left_window.update
  551.     @right_window.update
  552.     @item_window.update
  553.     ##############
  554.     @equip_window.refresh
  555.     ##############
  556.     refresh
  557.     if @command_window.active
  558.       update_command
  559.       return
  560.     end
  561.     if @right_window.active
  562.       update_right
  563.       return
  564.     end
  565.     # 物品窗口被激活的情况下: 调用 update_item
  566.     if @item_window.active
  567.       update_item
  568.       return
  569.     end
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● 更新
  573.   #--------------------------------------------------------------------------
  574.   def update_command
  575.     # 按下B的场合
  576.     if Input.trigger?(Input::B)
  577.       # 音效演奏
  578.       $game_system.se_play($data_system.cancel_se)
  579.       # 画面切换
  580.       $scene = Scene_Menu.new(2)
  581.       return
  582.     end
  583.     # 按下C的场合
  584.     if Input.trigger?(Input::C)
  585.       case @command_window.index
  586.       # 装備的場合
  587.       when 0
  588.         # 音效演奏
  589.         $game_system.se_play($data_system.decision_se)
  590.         @right_window.active = true
  591.         @command_window.active = false
  592.         @right_window.index = 0
  593.         @command_window.index = -1
  594.         return
  595.         # 最強装備的場合 
  596. =begin      
  597.       when 1
  598.       
  599.         # 音效演奏
  600.         $game_system.se_play($data_system.equip_se)
  601.         if  @actor.can_two_weapons?
  602.         # 最強装備的取得
  603.         max_weapon_id = @item_window1.max_item_id
  604.         max_weapon2_id = @item_window2.max_item_id
  605.         max_armor2_id = @item_window3.max_item_id
  606.         max_armor3_id = @item_window4.max_item_id
  607.         max_armor4_id = @item_window5.max_item_id
  608.         max_armor5_id = @item_window6.max_item_id
  609.         max_armor6_id = @item_window7.max_item_id
  610.         # 最強装備执行
  611.         @actor.equip(0, max_weapon_id)
  612.         @actor.equip(1, max_weapon2_id)
  613.         @actor.equip(2, max_armor2_id)
  614.         @actor.equip(3, max_armor3_id)
  615.         @actor.equip(4, max_armor4_id)
  616.         @actor.equip(5, max_armor5_id)
  617.         @actor.equip(6, max_armor6_id)
  618.         elsif # 最強装備的取得
  619.         max_weapon_id = @item_window1.max_item_id
  620.         max_armor1_id = @item_window2.max_item_id
  621.         max_armor2_id = @item_window3.max_item_id
  622.         max_armor3_id = @item_window4.max_item_id
  623.         max_armor4_id = @item_window5.max_item_id
  624.         max_armor5_id = @item_window6.max_item_id
  625.         max_armor6_id = @item_window7.max_item_id
  626.         # 最強装備执行
  627.         @actor.equip(0, max_weapon_id)
  628.         @actor.equip(1, max_armor1_id)
  629.         @actor.equip(2, max_armor2_id)
  630.         @actor.equip(3, max_armor3_id)
  631.         @actor.equip(4, max_armor4_id)
  632.         @actor.equip(5, max_armor5_id)
  633.         @actor.equip(6, max_armor6_id)
  634.         end
  635.         @right_window.refresh
  636.         @left_window.refresh
  637.         @item_window1.refresh
  638.         @item_window2.refresh
  639.         @item_window3.refresh
  640.         @item_window4.refresh
  641.         @item_window5.refresh
  642.         @item_window6.refresh
  643.         return
  644. =end
  645.       when 1
  646.         # 音效演奏
  647.         $game_system.se_play($data_system.cancel_se)
  648.         # 画面切换
  649.         $scene = Scene_Menu.new(2)
  650.         return
  651.       end
  652.     end
  653.     # 按下R的场合
  654.     if Input.trigger?(Input::R)
  655.       # 音效演奏
  656.       $game_system.se_play($data_system.cursor_se)
  657.       @actor_index += 1
  658.       @actor_index %= $game_party.actors.size
  659.       # 画面切换
  660.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  661.       return
  662.     end
  663.     # 按下L的场合
  664.     if Input.trigger?(Input::L)
  665.       # 音效演奏
  666.       $game_system.se_play($data_system.cursor_se)
  667.       @actor_index += $game_party.actors.size - 1
  668.       @actor_index %= $game_party.actors.size
  669.         # 画面切换
  670.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index)
  671.       return
  672.     end
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # ● 更新右边窗口
  676.   #--------------------------------------------------------------------------
  677.   def update_right
  678.     # 按下B的场合
  679.     if Input.trigger?(Input::B)
  680.       # 音效演奏
  681.       $game_system.se_play($data_system.cancel_se)
  682.       @right_window.active = false
  683.       @command_window.active = true
  684.       @right_window.index = -1
  685.       @command_window.index = 0
  686.       return
  687.     end
  688.     # 按下C的场合
  689.     if Input.trigger?(Input::C)
  690.       # 装備固定时
  691.       if @actor.equip_fix?(@right_window.index)
  692.         # 音效演奏
  693.         $game_system.se_play($data_system.buzzer_se)
  694.         return
  695.       end
  696.       # 音效演奏
  697.       $game_system.se_play($data_system.decision_se)
  698.       @right_window.active = false
  699.       @item_window.active = true
  700.       @item_window.index = 0
  701.       return
  702.     end
  703.     # 按下R的场合
  704.     if Input.trigger?(Input::R)
  705.       # 音效演奏
  706.       $game_system.se_play($data_system.cursor_se)
  707.       @actor_index += 1
  708.       @actor_index %= $game_party.actors.size
  709.       # 画面切换
  710.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  711.       return
  712.     end
  713.     # 按下L的场合
  714.     if Input.trigger?(Input::L)
  715.       # 音效演奏
  716.       $game_system.se_play($data_system.cursor_se)
  717.       @actor_index += $game_party.actors.size - 1
  718.       @actor_index %= $game_party.actors.size
  719.       # 画面切换
  720.       $scene = Scene_Equip.new(@actor_index, @right_window.index, @command_window.index, true, false)
  721.       return
  722.     end
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● 更新物品
  726.   #--------------------------------------------------------------------------
  727.   def update_item
  728.     # 按下B的场合
  729.     if Input.trigger?(Input::B)
  730.       # 音效演奏
  731.       $game_system.se_play($data_system.cancel_se)
  732.       @right_window.active = true
  733.       @item_window.active = false
  734.       @item_window.index = -1
  735.       return
  736.     end
  737.     # 按下C的场合
  738.     if Input.trigger?(Input::C)
  739.       # 音效演奏
  740.       $game_system.se_play($data_system.equip_se)
  741.       # アイテムウィンドウで現在選択されているデータを取得
  742.       item = @item_window.item
  743.       # --- ここから変更部分 ---
  744.       # 装備を変更
  745.       # @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  746.       @actor.equip(equip_type(@right_window.index, item), item == nil ? 0 : item.id)
  747.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  748.       # --- 変更部分終わり ---
  749.       # ライトウィンドウをアクティブ化
  750.       @right_window.active = true
  751.       @item_window.active = false
  752.       @item_window.index = -1
  753.       # 刷新
  754.       @right_window.refresh
  755.       # --- ここから変更部分 ---
  756.       # めんどくさいのですべてのウィンドウをリフレッシュ
  757.       @item_window1.refresh
  758.       @item_window2.refresh
  759.       @item_window3.refresh
  760.       @item_window4.refresh
  761.       @item_window5.refresh
  762.       @item_window6.refresh
  763.       @item_window7.refresh
  764.       # --- 変更部分終わり ---
  765.       return
  766.     end
  767.    
  768.   end
  769.   
  770.   # --- ここから追加部分 ---
  771.   #--------------------------------------------------------------------------
  772.   # ● 二刀流用の装備部位取得
  773.   #--------------------------------------------------------------------------
  774.   def equip_type(index, item)
  775.     return index * (item.is_a?(RPG::Armor) ? 1 : -1)
  776.   end
  777.   # --- 追加部分終わり ---
  778. end
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-27 21:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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