1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
| class Window_Command < Window_Selectable
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
#--------------------------------------------------------------------------
# colors and font name etc.
#--------------------------------------------------------------------------
def draw_item_dis(index)
self.contents.font.name = "Arial"
self.contents.font.size -= 2
self.contents.font.color = disabled_color
rect = Rect.new(4+16, 32 * index, self.contents.width - 24, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
self.contents.font.size += 2
end
def draw_item_active(index, type)
self.contents.font.name = "Arial"
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(5,32*index+1,self.contents.width,32, @commands[index])
if type==1
self.contents.font.color = disabled_color
else
self.contents.font.color = Color.new(255,255,220,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
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
#——refresh
if self.index != @oldindex
@oldindex = self.index
refresh
end
end
end |