module MESSAGE_BACK_SCROLL
IMAGE_NAME = "Background"
SCROLL_OX = 2
SCROLL_OY = -2
end
#encoding:utf-8
#==============================================================================
# ■ Window_Message
#------------------------------------------------------------------------------
# 显示文字信息的窗口。
#==============================================================================v
class Window_Message < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias :window_message_initialize_20240426 :initialize
def initialize
window_message_initialize_20240426
create_back_scroll_bitmap
create_back_scroll_plane
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias :window_message_dispose_20240426 :dispose
def dispose
window_message_dispose_20240426
dispose_back_scroll_bitmap
dispose_back_scroll_plane
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
alias :window_message_update_20240426 :update
def update
window_message_update_20240426
update_back_scroll_plane
end
#--------------------------------------------------------------------------
# ● 生成背景位图
#--------------------------------------------------------------------------
def create_back_scroll_bitmap
@back_bitmap = Cache.system(MESSAGE_BACK_SCROLL::IMAGE_NAME)
end
#--------------------------------------------------------------------------
# ● 生成背景平面
#--------------------------------------------------------------------------
def create_back_scroll_plane
@back_scroll_viewport = Viewport.new(2, Graphics.height - window_height + 2, Graphics.width - 4, window_height - 4)
@back_scroll = Plane.new(@back_scroll_viewport)
@back_scroll.bitmap = @back_bitmap
@back_scroll.visible = false
@back_scroll.z = z - 1
end
#--------------------------------------------------------------------------
# ● 释放背景位图
#--------------------------------------------------------------------------
def dispose_back_scroll_bitmap
@back_bitmap.dispose
end
#--------------------------------------------------------------------------
# ● 释放背景平面
#--------------------------------------------------------------------------
def dispose_back_scroll_plane
@back_scroll.dispose
end
#--------------------------------------------------------------------------
# ● 更新背景平面
#--------------------------------------------------------------------------
def update_back_scroll_plane
@back_scroll.visible = open?
@back_scroll.ox += MESSAGE_BACK_SCROLL::SCROLL_OX
@back_scroll.oy += MESSAGE_BACK_SCROLL::SCROLL_OY
end
end
收起