ミニゲーム用共通処理モジュール



ミニゲームで使用する共通モジュールを抜きだしたものです。

※これだけあっても何もできません。
※また、更に縁取り文字貪藻矢射妥←ダイヤモンドベースモジュールが必要です。

変更点
2008:11:16
 ちょろっと修正

2008:11:23
 clear関数の高さを絶対値から相対値へ変更
 ベースモジュールを別スクリプトとして定義

2012:01:21
・共通メッセージをこちらで設定

2012:03:03
・一部の共通モジュールのクラス化

2013:06:01
・一部の共通モジュールのクラス化 part2
・SE/MEの設定をファイル名のみからRPG::AudioFile.newに変更

#==============================================================================
# ミニゲーム用共通処理モジュール By 貪藻矢射妥←
#------------------------------------------------------------------------------
# 
# ミニゲームなどで使用する共通処理関数をモジュール化したもの。
# これで、スクリプトの行数削減ができるんるん♪
# 
# ※・・・ちなみに、これだけ導入しても意味がないので気をつけてください。
# 
#==============================================================================
# 変更履歴
# 
# 2008:11:16
# ・ちょろっと修正
# 
# 2008:11:23
# ・clear関数の高さを絶対値から相対値へ変更
# 
# 2012:01:21
# ・共通メッセージをこちらで設定
# 
# 2012:03:03
# ・一部の共通モジュールのクラス化
# 
# 2013:06:01
# ・一部の共通モジュールのクラス化 part2
# ・SE/MEの設定をファイル名のみからRPG::AudioFile.newに変更

module MINI_GAME
  # 入力金額最高桁数
  MAX_DIG = 7
  
  # 所持金
  HAVE_GOLD = "所持金"
  # 賭け金
  BET_GOLD  = "賭け金"
  # 獲得時の文章
  GET_GOLD  = "Get Gold!! "
  # 消失時の文章
  LOST_GOLD = "Lost Gold! "
  
  # 警告時のSE
  ERROR_SE     = RPG::AudioFile.new("WWL 警告3",    90, 100)
  # ファンファーレ1
  JACK_POT_ME1 = RPG::AudioFile.new("002-Victory02", 100, 100)
  # ファンファーレ2
  JACK_POT_ME2 = RPG::AudioFile.new("009-Fanfare03", 100, 100)
  # ファンファーレ3
  JACK_POT_ME3 = RPG::AudioFile.new("008-Fanfare02", 100, 100)
  # ファンファーレ4
  JACK_POT_ME4 = RPG::AudioFile.new("007-Fanfare01", 100, 100)
  # ファンファーレ5
  JACK_POT_ME5 = RPG::AudioFile.new("011-Item02",    100, 100)
  # ファンファーレ6
  JACK_POT_ME6 = RPG::AudioFile.new("010-Item01",    100, 100)
  # ハズレのME
  LOOSE_ME     = RPG::AudioFile.new("WWL あかん!",  90, 100)
  
  RECT_MINI = [4, 0, 160 + 10 - 32 - 8, 32]
  
  # 賭け金が所持金を上回る場合のエラーメッセージ
  MG_ERR_BET_UPPER = "賭け金が所持金を上回ってます!!"
  # 賭け金未設定のエラーメッセージ
  MG_ERR_BET_ZERO  = "賭け金を設定してください!!"
end

module TITLE_BM
  include BM
  DRAW_COLOR = Color.new(200, 200, 220, MAX8BIT)
  
  #--------------------------------------------------------------------------
  # ● クリアー
  #--------------------------------------------------------------------------
  def clear
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    self.contents = Bitmap.new(width - 32, height - 32)
  end
end

class Window_Info_Gold < Window_Base
  include RUBY_SYS
  include MINI_GAME
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(480 - 10, 64, 160 + 10, 64)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    clear
    
    draw_shadow_text(RECT_MINI, HAVE_GOLD, system_color, 1)
  end
end

class Window_Info_Bet < Window_Base
  include RUBY_SYS
  include MINI_GAME
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(480 - 10, 192, 160 + 10, 64)
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    clear
    
    draw_shadow_text(RECT_MINI, BET_GOLD, system_color, 1)
  end
end

class Window_Bet_Gold < Window_Base
  include RUBY_SYS
  include MINI_GAME
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(480 - 10, 256, 160 + 10, 64)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(bet)
    clear
    
    draw_shadow_text(RECT_MINI, bet.to_s)
  end
end

class Window_Info_Space < Window_Base
  include RUBY_SYS
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 380, 480 - 10, 64)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(text)
    clear
    
    draw_shadow_text([4, 0, 430, 32], text)
  end
end

class Window_Info_Space2 < Window_Base
  include RUBY_SYS
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 380 - 64, 480 - 10, 64)
    refresh(@cnt, @max)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh(cnt, max)
    clear
    
    if max != nil
      curr = max.to_i - cnt.to_i
      if curr != 0
        text = "あと " + curr.to_s + " 枚交換可能です。"
      else
        text = " "
      end
    else
      text = cnt
    end
    rectr = [4, 0, 300, 32]
    draw_shadow_text(rectr, text)
  end
end

class Window_Title_Root < Window_Base
  include RUBY_SYS
  include BM
  include TITLE_BM
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ1
  #--------------------------------------------------------------------------
  def refresh(text)
    clear
    
    draw_shadow_text([4, 0, 640 - 32 - 10, 32], text, DRAW_COLOR)
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ2
  #--------------------------------------------------------------------------
  def refresh_ex(text)
    clear
    
    draw_shadow_text([4, 0], transfer(text), DRAW_COLOR)
  end
end

戻る