Project1
标题:
大神帮帮看下
[打印本页]
作者:
j1747532399l
时间:
2015-9-15 17:58
标题:
大神帮帮看下
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(320, 90,1280-640-80, 200)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@column_max = 2#
refresh
self.index = 0
end
def set_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@data.push($data_armors[@actor.armor5_id])
@data.push($data_armors[@actor.armor6_id])
@data.push($data_armors[@actor.armor7_id])
@data.push($data_armors[@actor.armor8_id])
@data.push($data_armors[@actor.armor9_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(0, 0 , 92, 32, "武器" )
self.contents.draw_text(0, 32 , 92, 32, "部位1")
self.contents.draw_text(0, 32 * 2, 92, 32, "部位2")
self.contents.draw_text(0, 32 * 3, 92, 32, "部位3")
self.contents.draw_text(0, 32 * 4, 92, 32, "部位4")
self.contents.draw_text(32*9, 0, 92, 32, "部位5")
self.contents.draw_text(32*9, 32, 92, 32, "部位6")
self.contents.draw_text(32*9, 32*2, 92, 32, "部位7")
self.contents.draw_text(32*9, 32*3, 92, 32, "部位8")
self.contents.draw_text(32*9, 32*4, 92, 32, "部位9")
draw_item_name(@data[0], 92, 32 * 0)#武器
draw_item_name(@data[4], 92, 32 * 1)#部位1
draw_item_name(@data[7], 92, 32 * 2)#部位2
draw_item_name(@data[8], 92, 32 * 3)#部位3
draw_item_name(@data[9], 92, 32 * 4)#部位4
draw_item_name(@data[1], 92*4, 0 )# 部位5
draw_item_name(@data[3], 92*4, 32 )# 部位6
draw_item_name(@data[2], 92*4, 32 * 2)# 部位7
draw_item_name(@data[4], 92*4, 32 * 3)# 部位8
draw_item_name(@data[5], 92*4, 32 * 4)# 部位9
end
复制代码
光标改成2行 为什么每个装备的部位都不正确了。
{:2_276:}
QSRI9$Z[IT2_1RH]PT3G9GE.png
(184.46 KB, 下载次数: 17)
下载附件
保存到相册
2015-9-15 17:55 上传
作者:
cinderelmini
时间:
2015-9-15 22:00
加了点东西,改了点写法……
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(320, 90,1280-640-80, 200)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@column_max = 2
refresh
self.index = 0
end
def set_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@data.push($data_armors[@actor.armor5_id])
@data.push($data_armors[@actor.armor6_id])
@data.push($data_armors[@actor.armor7_id])
@data.push($data_armors[@actor.armor8_id])
@data.push($data_armors[@actor.armor9_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(text_x(0), text_y(0), 92, 32, "武器" )
self.contents.draw_text(text_x(1), text_y(1), 92, 32, "部位1")
self.contents.draw_text(text_x(2), text_y(2), 92, 32, "部位2")
self.contents.draw_text(text_x(3), text_y(3), 92, 32, "部位3")
self.contents.draw_text(text_x(4), text_y(4), 92, 32, "部位4")
self.contents.draw_text(text_x(5), text_y(5), 92, 32, "部位5")
self.contents.draw_text(text_x(6), text_y(6), 92, 32, "部位6")
self.contents.draw_text(text_x(7), text_y(7), 92, 32, "部位7")
self.contents.draw_text(text_x(8), text_y(8), 92, 32, "部位8")
self.contents.draw_text(text_x(9), text_y(9), 92, 32, "部位9")
for i in 0..9
draw_item_name(@data[i], 92 + text_x(i), text_y(i))
end
#~ draw_item_name(@data[0], 92 + text_x(0), text_y(0))#武器
#~ draw_item_name(@data[1], 92 + text_x(1), text_y(1))#部位1
#~ draw_item_name(@data[2], 92, 32 * 2)#部位2
#~ draw_item_name(@data[3], 92, 32 * 3)#部位3
#~ draw_item_name(@data[4], 92, 32 * 4)#部位4
#~
#~ draw_item_name(@data[5], 92*4, 0 )# 部位5
#~ draw_item_name(@data[6], 92*4, 32 )# 部位6
#~ draw_item_name(@data[7], 92*4, 32 * 2)# 部位7
#~ draw_item_name(@data[8], 92*4, 32 * 3)# 部位8
#~ draw_item_name(@data[9], 92*4, 32 * 4)# 部位9
end
def line_height
return 32
end
def col_space
return 184
end
def text_x(index)
return col_space * (index % @colum_max)
end
def text_y(index)
return line_height * index / @colum_max
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1