idenya boleh juga, =w=/
langsung ane komeng ya (agak pedes tapi no offense
)
- method yang tidak direwrite ga perlu ditulis, buang2 waktu,tenaga,pikiran, dan size
- usahakan ke depan ngasih list method2 mana yang direwrite dan di alias
- kalo bisa user dikasih pilihan (contohnya mau bikin center, left, ato right)
bonus: bugfix + contoh ngasih pilihan
- Spoiler:
- Code:
-
# rewrite: Window_ChoiceList.update_placement
# new: Window_ChoiceList.item_rect_for_text
module Choice
# ganti dengan :left, :right, atau :center
WINDOW_POSITION = :center
TEXT_POSITION = :center
end
class Window_ChoiceList < Window_Command
include Choice
def update_placement
self.width = [max_choice_width + 12, 96].max + padding * 2
self.width = [width, Graphics.width].min
self.height = fitting_height($game_message.choices.size)
case Choice::WINDOW_POSITION
when :right
self.x = (Graphics.width - width)
when :center
self.x = (Graphics.width - self.width)/ 2
when :left
self.x = padding
end
if @message_window.y >= Graphics.height / 2
self.y = @message_window.y - height
else
self.y = @message_window.y + @message_window.height
end
end
# New Method
def item_rect_for_text(index)
rect = item_rect(index)
text = $game_message.choices[index]
mid_point = (max_choice_width - text_size(text).width + padding )/2
# right_point ditambah 4 biar text yang terpanjang posisinya sama kaya
# kalo dipasang di left
right_point = max_choice_width - text_size(text).width + 4
case Choice::TEXT_POSITION
when :left
rect.x += 4
when :center
rect.x = mid_point
when :right
rect.x = right_point
end
rect.width -= 8
rect
end
end
selamat scripting