
脚本说明
修改自主站上的脚本,和小生这两天发布的另外几个不一样,只是比较小的一些改动而已,为了美化一些,仅此而已。
脚本内容
#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
# 一般的命令选择行窗口。
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(width, commands)
# 由命令的个数计算出窗口的高
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
@item = []
self.index = 0
refresh
@oldindex = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
if i != self.index
draw_item_dis(i)
else
draw_item_active(i,@item[i])
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item_dis(index)
rect = Rect.new(5, 32 * index, self.contents.width - 24, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(5,32*index+1,self.contents.width,32, @commands[index])
self.contents.draw_text(5,32*index-1,self.contents.width,32, @commands[index])
self.contents.draw_text(5-1,32*index,self.contents.width,32, @commands[index])
self.contents.draw_text(5+1,32*index,self.contents.width,32, @commands[index])
self.contents.font.color = disabled_color
self.contents.draw_text(rect, @commands[index])
end
def draw_item_active(index, type)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(5,32*index+1,self.contents.width,32, @commands[index])
self.contents.draw_text(5,32*index-1,self.contents.width,32, @commands[index])
self.contents.draw_text(5-1,32*index,self.contents.width,32, @commands[index])
self.contents.draw_text(5+1,32*index,self.contents.width,32, @commands[index])
if type==1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(4,32*index,self.contents.width,32, @commands[index])
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
@item[index] = 1
end
#--------------------------------------------------------------------------
# ● 刷新方法更新
#--------------------------------------------------------------------------
def update
super
#——这里使用的刷新方法比直接refresh节约很多内存
if self.index != @oldindex
@oldindex = self.index
refresh
end
end
def update_cursor_rect
self.cursor_rect.empty
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

