#============================================================================== # ■ ヘルプをスクロール #------------------------------------------------------------------------------ #  ヘルプウインドウにスクロール機能をつけます # 横一列に説明文を全部表示させ、左から右へスクロールさせます # スクロール開始と終了時にウェイトを設定出来、スクロールする時間も設定できます # # *月の下の宿 # URL:http://gekkasou.shiteyattari.com/ #============================================================================== module An_ScH #スクロール開始前と終了時にかけるウェイト Wait = 60 #スクロールにかける時間 #大雑把な値なので多少ぶれます Scroll = 90 #スクロール量変更 #trueにすると上のScrollで設定した値毎秒右に移動します AOD = true end #============================================================================== # ■ Window_Help #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias an_scroll_initialize initialize def initialize @an_sh_wait = 0 @an_sh_scroll = 0 an_scroll_initialize end #-------------------------------------------------------------------------- # ● テキスト設定 #-------------------------------------------------------------------------- def set_text(text, align = 0) if text != @text or align != @align scroll_contents([contents.text_size(text).width + 8, 512].max) self.ox = 0 if self.contents.width > self.width - 32 @an_sh_wait = An_ScH::Wait @an_sh_scroll = self.contents.width / An_ScH::Scroll if An_ScH::AOD @an_sh_scroll = An_ScH::Scroll / 60 end else @an_sh_wait = 0 @an_sh_scroll = 0 end self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, self.contents.width - 8, WLH, text, align) @text = text @align = align end end #-------------------------------------------------------------------------- # ● ウィンドウ内容の作成 #-------------------------------------------------------------------------- def scroll_contents(width) self.contents.dispose self.contents = Bitmap.new(width, self.height - 32) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update if @an_sh_wait > 0 @an_sh_wait -= 1 if @an_sh_wait == 0 && self.ox != 0 self.ox = 0 @an_sh_wait = An_ScH::Wait end elsif self.ox + self.width - 32 < self.contents.width self.ox = [self.ox + @an_sh_scroll, contents.width - width + 32].min elsif @an_sh_scroll > 0 @an_sh_wait = An_ScH::Wait end super end end #Ver1.02