本帖最后由 RyanBern 于 2015-6-28 13:46 编辑
module RB end module RB::Description # 游戏说明背景图片 Background_Img = "Help" # 翻页过渡图形,如果设置为空则是普通的淡入淡出 Transition = "Graphics/Transitions/015-Diamond01" # 文字设置区域,左边的数字代表页码(不能设置为0或者负数),右侧的是文字 # 每行文字用引号分割 Texts = { 1 => ["说明文字Line1", "说明文字Line2" ], 2 => ["第二页说明文字Line1", "第二页说明文字Line2" ], 3 => ["RyanBern", "脚本编写" ] } end class Window_Description < Window_Base def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 32, height - 32) self.visible = true self.opacity = 0 @page = 0 refresh end def refresh self.contents.clear texts = RB::Description::Texts[@page] return if texts.nil? texts.each_with_index do |text, i| self.contents.draw_text(4, i * 32, width - 32, 32, text) end end def page=(page) if @page != page @page = page refresh end end end class Scene_Help def main @page = 1 @sprite = Sprite.new @sprite.bitmap = RPG::Cache.picture(RB::Description::Background_Img) @description_window = Window_Description.new @description_window.page = @page Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @sprite.bitmap.dispose @sprite.dispose @description_window.dispose end def update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Menu.new return end if Input.trigger?(Input::LEFT) if @page > 1 $game_system.se_play($data_system.cursor_se) @page -= 1 Graphics.freeze @description_window.page = @page Graphics.transition(20, RB::Description::Transition) else $game_system.se_play($data_system.buzzer_se) end return end if Input.trigger?(Input::RIGHT) if @page < RB::Description::Texts.keys.max $game_system.se_play($data_system.cursor_se) @page += 1 Graphics.freeze @description_window.page = @page Graphics.transition(20, RB::Description::Transition) else $game_system.se_play($data_system.buzzer_se) end return end end end
module RB
end
module RB::Description
# 游戏说明背景图片
Background_Img = "Help"
# 翻页过渡图形,如果设置为空则是普通的淡入淡出
Transition = "Graphics/Transitions/015-Diamond01"
# 文字设置区域,左边的数字代表页码(不能设置为0或者负数),右侧的是文字
# 每行文字用引号分割
Texts = {
1 => ["说明文字Line1",
"说明文字Line2"
],
2 => ["第二页说明文字Line1",
"第二页说明文字Line2"
],
3 => ["RyanBern",
"脚本编写"
]
}
end
class Window_Description < Window_Base
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = true
self.opacity = 0
@page = 0
refresh
end
def refresh
self.contents.clear
texts = RB::Description::Texts[@page]
return if texts.nil?
texts.each_with_index do |text, i|
self.contents.draw_text(4, i * 32, width - 32, 32, text)
end
end
def page=(page)
if @page != page
@page = page
refresh
end
end
end
class Scene_Help
def main
@page = 1
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture(RB::Description::Background_Img)
@description_window = Window_Description.new
@description_window.page = @page
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@sprite.bitmap.dispose
@sprite.dispose
@description_window.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::LEFT)
if @page > 1
$game_system.se_play($data_system.cursor_se)
@page -= 1
Graphics.freeze
@description_window.page = @page
Graphics.transition(20, RB::Description::Transition)
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
if Input.trigger?(Input::RIGHT)
if @page < RB::Description::Texts.keys.max
$game_system.se_play($data_system.cursor_se)
@page += 1
Graphics.freeze
@description_window.page = @page
Graphics.transition(20, RB::Description::Transition)
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
插入到main前,不过没有整合到菜单里面。
使用的时候输入事件脚本
附效果图:
|