本帖最后由 金芒芒 于 2023-5-7 14:55 编辑
class Window_ShopCommand < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 0, 128, 150)#★★★★★★★★★★★★★★★★★ self.contents = Bitmap.new(width - 32, height - 32) @item_max = 3 @row_max = 3 @commands = ["买", "卖", "取消"] # @commands.x=0 # s1 = "买" # s2 = "卖" # s3 = "卖" # command = Window_Command.new(90,[s1,s2,s3]) # command.x = 320-Command.width/2 # command.y = 240-Command.height/2 refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # ● 描绘项目 # index : 项目编号 #-------------------------------------------------------------------------- def draw_item(index) y = 4 + index * 64 self.contents.draw_text(x, index * 32, 128, 32, @commands[index]) end end
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 128, 150)#★★★★★★★★★★★★★★★★★
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@row_max = 3
@commands = ["买", "卖", "取消"]
# @commands.x=0
# s1 = "买"
# s2 = "卖"
# s3 = "卖"
# command = Window_Command.new(90,[s1,s2,s3])
# command.x = 320-Command.width/2
# command.y = 240-Command.height/2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
y = 4 + index * 64
self.contents.draw_text(x, index * 32, 128, 32, @commands[index])
end
end
|