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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
| #==============================================================================
# ** Window_MenuActor
#------------------------------------------------------------------------------
# This window is for selecting actors that will be the target of item or
# skill use.
#==============================================================================
class Window_MenuActor < Window_Selectable
ACTOR_WINDOW_WIDTH = 248
ACTOR_WINDOW_HEIGHT = 372
MARGIN = 16
ITEM = 0
EQUIP = 1
#--------------------------------------------------------------------------
# * Modified
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(Graphics.width - ACTOR_WINDOW_WIDTH - MARGIN, MARGIN, window_width, window_height)
self.z = 200
self.visible = false
@item_type = ITEM
draw_header
refresh
end
#--------------------------------------------------------------------------
# * Override
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# * Override
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
$game_party.members.size
end
#--------------------------------------------------------------------------
# * Override
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
ACTOR_WINDOW_WIDTH
end
#--------------------------------------------------------------------------
# * Override
# * Get Window Height
#--------------------------------------------------------------------------
def window_height
ACTOR_WINDOW_HEIGHT
end
#--------------------------------------------------------------------------
# * Override
# * Calculate Height of Window Contents
#--------------------------------------------------------------------------
def contents_height
height - standard_padding * 2
end
#--------------------------------------------------------------------------
# * Override
# * Get Item Height
#--------------------------------------------------------------------------
def item_height
#(window_height - 4 * standard_padding - line_height) / 3
return 96
end
#--------------------------------------------------------------------------
# * Override
# * Get Rectangle for Drawing Items
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * (item_height + standard_padding) + line_height + standard_padding
rect
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
$game_party.target_actor = $game_party.members[index] unless @cursor_all
call_ok_handler
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select($game_party.target_actor.index || 0)
end
#--------------------------------------------------------------------------
# * Set Position of Cursor for Item
#--------------------------------------------------------------------------
def select_for_item(item)
@cursor_fix = item.for_user?
@cursor_all = item.for_all?
if @cursor_fix
select($game_party.menu_actor.index)
elsif @cursor_all
select(0)
else
select_last
end
end
#--------------------------------------------------------------------------
# * New Method
# * Set Window Header
#--------------------------------------------------------------------------
def set_item_type(item)
@item_type = ITEM if item.is_a?(RPG::UsableItem)
@item_type = EQUIP if item.is_a?(RPG::EquipItem)
draw_header
end
#--------------------------------------------------------------------------
# * New Method
# * Draw Window Header
#--------------------------------------------------------------------------
def draw_header
#draw_text(0,0, contents.width, line_height, Vocab::ITEM_USE, Bitmap::ALIGN_CENTER) if @item_type == ITEM
draw_text(0,0, contents.width, line_height, "Utiliser sur qui", 1) if @item_type == ITEM
draw_text(0,0, contents.width, line_height, Vocab::ITEM_EQUIP, Bitmap::ALIGN_CENTER) if @item_type == EQUIP
end
#--------------------------------------------------------------------------
# * Override
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
current_actor = $game_party.members[index]
is_in_party = $game_party.battle_members.include?(current_actor)
rect = item_rect(index)
draw_actor_face(current_actor, rect.x, rect.y, is_in_party)
draw_actor_icons(current_actor, rect.x, rect.y)
end
end
|