Project1

标题: 大神帮帮看下 [打印本页]

作者: j1747532399l    时间: 2015-9-15 17:58
标题: 大神帮帮看下
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(320, 90,1280-640-80, 200)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     @actor = actor
  15.       @column_max =  2#
  16.     refresh
  17.     self.index = 0
  18.   end
  19.     def set_actor(actor)
  20.     @actor = actor
  21.     refresh
  22.   end

  23.   #--------------------------------------------------------------------------
  24.   # ● 获取物品
  25.   #--------------------------------------------------------------------------
  26.   def item
  27.     return @data[self.index]
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 刷新
  31.   #--------------------------------------------------------------------------
  32.   def refresh
  33.     self.contents.clear
  34.     @data = []
  35.     @data.push($data_weapons[@actor.weapon_id])
  36.     @data.push($data_armors[@actor.armor1_id])
  37.     @data.push($data_armors[@actor.armor2_id])
  38.     @data.push($data_armors[@actor.armor3_id])
  39.     @data.push($data_armors[@actor.armor4_id])
  40.     @data.push($data_armors[@actor.armor5_id])
  41.     @data.push($data_armors[@actor.armor6_id])
  42.     @data.push($data_armors[@actor.armor7_id])
  43.     @data.push($data_armors[@actor.armor8_id])
  44.     @data.push($data_armors[@actor.armor9_id])
  45.     @item_max = @data.size
  46.     self.contents.font.color = system_color
  47.     self.contents.draw_text(0,    0 ,     92, 32, "武器" )
  48.     self.contents.draw_text(0,    32 ,    92, 32, "部位1")
  49.     self.contents.draw_text(0,    32 * 2, 92, 32, "部位2")
  50.     self.contents.draw_text(0,    32 * 3, 92, 32, "部位3")
  51.     self.contents.draw_text(0,    32 * 4, 92, 32, "部位4")
  52.     self.contents.draw_text(32*9, 0,      92, 32, "部位5")
  53.     self.contents.draw_text(32*9, 32,     92, 32, "部位6")
  54.     self.contents.draw_text(32*9, 32*2,   92, 32, "部位7")
  55.     self.contents.draw_text(32*9, 32*3,   92, 32, "部位8")
  56.     self.contents.draw_text(32*9, 32*4,   92, 32, "部位9")
  57.    
  58.      
  59.     draw_item_name(@data[0], 92,   32 * 0)#武器
  60.     draw_item_name(@data[4], 92,   32 * 1)#部位1
  61.     draw_item_name(@data[7], 92,   32 * 2)#部位2
  62.     draw_item_name(@data[8], 92,   32 * 3)#部位3
  63.     draw_item_name(@data[9], 92,   32 * 4)#部位4
  64.                                     
  65.     draw_item_name(@data[1], 92*4, 0     )# 部位5
  66.     draw_item_name(@data[3], 92*4, 32    )# 部位6
  67.     draw_item_name(@data[2], 92*4, 32 * 2)# 部位7
  68.     draw_item_name(@data[4], 92*4, 32 * 3)# 部位8
  69.     draw_item_name(@data[5], 92*4, 32 * 4)# 部位9
  70.    
  71.    
  72.     end
复制代码
光标改成2行 为什么每个装备的部位都不正确了。
{:2_276:}

QSRI9$Z[IT2_1RH]PT3G9GE.png (184.46 KB, 下载次数: 17)

QSRI9$Z[IT2_1RH]PT3G9GE.png

作者: cinderelmini    时间: 2015-9-15 22:00
加了点东西,改了点写法……
  1. #==============================================================================
  2. # ■ Window_EquipRight
  3. #------------------------------------------------------------------------------
  4. #  装备画面、显示角色现在装备的物品的窗口。
  5. #==============================================================================

  6. class Window_EquipRight < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     actor : 角色
  10.   #--------------------------------------------------------------------------
  11.   def initialize(actor)
  12.     super(320, 90,1280-640-80, 200)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     @actor = actor
  15.     @column_max = 2
  16.     refresh
  17.     self.index = 0
  18.   end
  19.   
  20.   def set_actor(actor)
  21.     @actor = actor
  22.     refresh
  23.   end

  24.   #--------------------------------------------------------------------------
  25.   # ● 获取物品
  26.   #--------------------------------------------------------------------------
  27.   def item
  28.     return @data[self.index]
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 刷新
  32.   #--------------------------------------------------------------------------
  33.   def refresh
  34.     self.contents.clear
  35.     @data = []
  36.     @data.push($data_weapons[@actor.weapon_id])
  37.     @data.push($data_armors[@actor.armor1_id])
  38.     @data.push($data_armors[@actor.armor2_id])
  39.     @data.push($data_armors[@actor.armor3_id])
  40.     @data.push($data_armors[@actor.armor4_id])
  41.     @data.push($data_armors[@actor.armor5_id])
  42.     @data.push($data_armors[@actor.armor6_id])
  43.     @data.push($data_armors[@actor.armor7_id])
  44.     @data.push($data_armors[@actor.armor8_id])
  45.     @data.push($data_armors[@actor.armor9_id])
  46.    
  47.     @item_max = @data.size
  48.    
  49.     self.contents.font.color = system_color
  50.     self.contents.draw_text(text_x(0), text_y(0), 92, 32, "武器" )
  51.     self.contents.draw_text(text_x(1), text_y(1), 92, 32, "部位1")
  52.     self.contents.draw_text(text_x(2), text_y(2), 92, 32, "部位2")
  53.     self.contents.draw_text(text_x(3), text_y(3), 92, 32, "部位3")
  54.     self.contents.draw_text(text_x(4), text_y(4), 92, 32, "部位4")
  55.     self.contents.draw_text(text_x(5), text_y(5), 92, 32, "部位5")
  56.     self.contents.draw_text(text_x(6), text_y(6), 92, 32, "部位6")
  57.     self.contents.draw_text(text_x(7), text_y(7), 92, 32, "部位7")
  58.     self.contents.draw_text(text_x(8), text_y(8), 92, 32, "部位8")
  59.     self.contents.draw_text(text_x(9), text_y(9), 92, 32, "部位9")
  60.    
  61.    
  62.     for i in 0..9
  63.       draw_item_name(@data[i], 92 + text_x(i), text_y(i))
  64.     end
  65.       
  66. #~     draw_item_name(@data[0], 92 + text_x(0), text_y(0))#武器
  67. #~     draw_item_name(@data[1], 92 + text_x(1), text_y(1))#部位1
  68. #~     draw_item_name(@data[2], 92,   32 * 2)#部位2
  69. #~     draw_item_name(@data[3], 92,   32 * 3)#部位3
  70. #~     draw_item_name(@data[4], 92,   32 * 4)#部位4
  71. #~                                    
  72. #~     draw_item_name(@data[5], 92*4, 0     )# 部位5
  73. #~     draw_item_name(@data[6], 92*4, 32    )# 部位6
  74. #~     draw_item_name(@data[7], 92*4, 32 * 2)# 部位7
  75. #~     draw_item_name(@data[8], 92*4, 32 * 3)# 部位8
  76. #~     draw_item_name(@data[9], 92*4, 32 * 4)# 部位9
  77.    
  78.   end
  79.   
  80.   def line_height
  81.     return 32
  82.   end
  83.   def col_space
  84.     return 184
  85.   end
  86.   def text_x(index)
  87.     return col_space * (index % @colum_max)
  88.   end
  89.   def text_y(index)
  90.     return line_height * index / @colum_max
  91.   end
  92. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1