#==============================================================================
# ■ Roulette vol.1.00 (分割定義3)
#------------------------------------------------------------------------------
# 11/10/01
#==============================================================================
class Scene_Roulette
  include HIDE_ROULETTE
  #--------------------------------------------------------------------------
  # ■ フレーム更新
  #--------------------------------------------------------------------------
  def update
    #…………………………………………………………………………………………………
    # ■ ルーレットの停止
    #…………………………………………………………………………………………………
    if @roulette_window.move && @game_select_window.active == false
      # □払い戻しを描画
      draw_payout?
      @game_select_window.active = true
      @roulette_window.move = false
      #…………………………………………………………………………………………………
      # ■ 配当金を取得
      #…………………………………………………………………………………………………
      numbers?(@roulette_window.number)
      # □コインを増やす
      $game_party.gain_coin(@payout)
      # □次のルーレット開始まで待つ
      time_up = 1
      @hit_window.refresh(@hit_coin)
      #…………………………………………………………………………………………………
      # ■ 当りの場合の効果音を演奏(ME)
      #…………………………………………………………………………………………………
      if @payout > 0
        # □大当たりの場合
        if (@payout - @bet_coin) >= HIDE_ROULETTE::ME_RATE_MAX[$game_temp.roulette_type]
          $game_system.me_play(RPG::AudioFile.new(HIDE_ROULETTE::HIT_ME_MAX))
          # □次のルーレット開始まで待つ(MEの演奏時間)
          time_up = HIDE_ROULETTE::ME_MAX_TIME
        elsif @payout > @bet_coin
          $game_system.me_play(RPG::AudioFile.new(HIDE_ROULETTE::HIT_ME))
          # □次のルーレット開始まで待つ(MEの演奏時間)
          time_up = HIDE_ROULETTE::ME_TIME
        end
      end
      #…………………………………………………………………………………………………
      # ■ 次のルーレット開始まで待つ
      #…………………………………………………………………………………………………
      time = 0
      while time < time_up
        # □ゲーム画面を更新
        Graphics.update
        # □回転数値の更新(所持コイン)
        @coin_window.update($game_party.coin)
        
        @payout_coin_window.refresh(@payout)
        # □当りの演出を更新
        @hit_window.update
        if @hit_window.opacity? <= 10
          time += 1
        end
      end
      #…………………………………………………………………………………………………
      # ■ 所持コインがBetより少ない場合、初期化
      #…………………………………………………………………………………………………
      if $game_party.coin < @bet_coin
        bet_clear?
        @bet_coin == 0
      end
    end
    @roulette_window.update
    #…………………………………………………………………………………………………
    # ■ 回転数値の更新(所持コイン)
    #…………………………………………………………………………………………………
    @coin_window.update($game_party.coin)
    @total_bet_coin_window.refresh(@bet_coin)
    @payout_coin_window.refresh(@payout)
    
    #…………………………………………………………………………………………………
    # ■ bet00切り替え開始
    #…………………………………………………………………………………………………
    if @bet_table_window[0].zero && @bet_table_zero[0].zero == false
      @bet_table_zero[0].index = 0
      @bet_table_zero[0].visible = true
      @bet_table_zero[0].active = true
      
      @bet_table_window[0].index = -1
      @bet_table_window[0].zero = false
    end
    #…………………………………………………………………………………………………
    # ■ bet00切り替え戻す
    #…………………………………………………………………………………………………
    if @bet_table_zero[0].zero
      case @bet_table_zero[0].key
      when 8
        @bet_table_window[0].index = 35
      when 2
         @bet_table_window[0].index = 0
      end
      @bet_table_window[0].visible = true
      @bet_table_window[0].active = true
      @bet_table_window[0].zero = false
      @bet_table_zero[0].index = -1
      @bet_table_zero[0].zero = false
    end
    #…………………………………………………………………………………………………
    # ■ ゲーム開始ウィンドウの更新
    #…………………………………………………………………………………………………
    if @game_select_window.active
      @game_select_window.update
      update_select
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet開始ウィンドウの更新(倍率選択)
    #…………………………………………………………………………………………………
    if @bet_select[@bet_index].active
      @bet_select[@bet_index].update
      bet_select_update
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet ウィンドウの更新
    #…………………………………………………………………………………………………
    if @bet_table_window[@bet_index] != nil
      if @bet_table_window[@bet_index].active
        @bet_table_window[@bet_index].update
        case @bet_index
        when 0 # bet x36
          bet_update
        when 1 # bet x18(横2*1)
          bet_line_update
        when 2 # bet x12
          bet_x12update
        when 3 # bet x9
          bet_x9update
        when 4 # bet x6
          bet_x6update
        when 5 # bet x3(横3x1)
          bet_x3update
        when 6 # bet x2(1-18,19-36)
          bet_x2_update
        end
        return
      end
    end
    #…………………………………………………………………………………………………
    # ■ bet x36(0-00)選択ウィンドウの更新
    #…………………………………………………………………………………………………
    if @bet_table_zero[0].active
      @bet_table_zero[0].update
      bet_update02
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet x18(0-00),x12(1-0-2,0-2-00,2-00-3)
    #…………………………………………………………………………………………………
    if @bet_table_zero[1].active
      @bet_table_zero[1].update
      bet_0_00_update
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet x18(縦)選択ウィンドウの更新
    #…………………………………………………………………………………………………
    if @bet_table_rows[0].active
      @bet_table_rows[0].update
      bet_rows_update
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet x3(1列)選択ウィンドウの更新
    #…………………………………………………………………………………………………
    if @bet_table_rows[1].active
      @bet_table_rows[1].update
      bet_table_column
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet x2(36/2箇所)選択ウィンドウの更新
    #…………………………………………………………………………………………………
    if @bet_table_rows[2].active
      @bet_table_rows[2].update
      bet_x2_2_update
      return
    end
    #…………………………………………………………………………………………………
    # ■ bet 選択肢ウィンドウの更新
    #…………………………………………………………………………………………………
    if @table_choice[@bet_index] != nil
      if @table_choice[@bet_index].active
        @table_choice[@bet_index].update
        case @bet_index
        when 0 # bet x2-2選択
          bet_table6_update
        when 1 # bet x18選択
          bet_table2_update
        when 2 # bet x12選択
          bet_table3_update
        when 5 # bet x3選択
          bet_table4_update
        when 6 # bet x2-1選択
          bet_table5_update
        end
        return
      end
    end
    #…………………………………………………………………………………………………
    # ■ bet x2-2選択ウィンドウの更新
    #…………………………………………………………………………………………………
    if @table_choice[7].active
      @table_choice[7].update
      bet_table6_update
      return
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x2 (36/2箇所)選択開始)
  #--------------------------------------------------------------------------
  def bet_x2_2_update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_rows[2].visible = true
    # □変化した場合ヘルプを更新
    x = 466-61-61 ; y = 42+8
    cx = 0
    cy = @bet_table_rows[2].index
    if @table_choice[6].index > 0 # 1=EVEN 2=RED
      help = @bet_helps[10][@table_choice[6].index-1]
      index = 1
      b_index = @table_choice[6].index + 6
      cy = (@table_choice[6].index - 1)*60+60
    elsif @table_choice[7].index > 0 # 1=ODD 2=BRACK
      help = @bet_helps[11][@table_choice[7].index-1]
      index = 2
      b_index = @table_choice[7].index + 6
      cy = (2-@table_choice[7].index)*60+180
    end
    x += (cx*61) ; y += cy
    if @old_help != help
      @bet_table_rows[2].set_text(help)
      @old_help = help
    end
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,b_index,index)
    #…………………………………………………………………………………………………
    # ■ 上下 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @table_choice[6].index,@table_choice[7].index = @table_choice[7].index,@table_choice[6].index
      @table_choice[6].help_window.visible,
      @table_choice[7].help_window.visible = @table_choice[7].help_window.visible,
      @table_choice[6].help_window.visible
      @table_choice[6].active = false
      @table_choice[7].active = false
      
      if @table_choice[6].index > 0 # 1=EVEN 2=RED
        case @table_choice[6].index
        when 1 # Even
          draw_bitmap?(3)
        when 2 # Red
          draw_bitmap?(2)
        end
        @table_choice[6].update
        @table_choice[6].update_help
      end
      
      if @table_choice[7].index > 0 # 1=ODD 2=BRACK
        case @table_choice[7].index
        when 1 # Odd
          draw_bitmap?(0)
        when 2 # Brack
          draw_bitmap?(1)
        end
        @table_choice[7].update
        @table_choice[7].update_help
      end
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_rows[2].set_text("")
      case @table_choice[6].index
      when 1,2
        @table_choice[6].active = true
        @table_choice[6].help_window.visible = true
      end
      case @table_choice[7].index
      when 1,2
        @table_choice[7].active = true
        @table_choice[7].help_window.visible = true
      end
      draw_bitmap?(-1)
      @bet_table_rows[2].index = -1
      @bet_table_rows[2].active = false
      @bet_table_rows[2].visible = false
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x2 (18箇所)選択開始)
  #--------------------------------------------------------------------------
  def bet_x2_update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[6].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[9][@bet_table_window[6].index]
    if @old_help != help
      @bet_table_window[6].set_text(help)
      @old_help = help
    end
    x = 466-61-61 ; y = 42+8
    cx = 0
    cy = @bet_table_window[6].index
    x += (cx*61) ; y += (cy*300)
    index = @bet_table_window[6].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index)
    #…………………………………………………………………………………………………
    # ■ 上下 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @table_choice[6].index,@table_choice[7].index = @table_choice[7].index,@table_choice[6].index
      @table_choice[6].help_window.visible,
      @table_choice[7].help_window.visible = @table_choice[7].help_window.visible,
      @table_choice[6].help_window.visible
      @table_choice[6].active = false
      @table_choice[7].active = false
      case @bet_table_window[6].index
      when 0
        @table_choice[6].update
        @table_choice[6].update_help
      when 1
        @table_choice[7].update
        @table_choice[7].update_help
      end
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[6].set_text("")
      case @bet_table_window[6].index
      when 0
        @table_choice[6].active = true
        @table_choice[6].help_window.visible = true
      when 1
        @table_choice[7].active = true
        @table_choice[7].help_window.visible = true
      end
      @bet_table_window[6].index = -1
      @bet_table_window[6].active = false
      @bet_table_window[6].visible = false
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x2-1 カテゴリー選択開始)
  #--------------------------------------------------------------------------
  def bet_table5_update
    #…………………………………………………………………………………………………
    # ■ C ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::C)
      # □決定SEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::DECISION_SE))
      @table_choice[6].active = false
      case @table_choice[6].index
      when 0 # 1-18
        @bet_table_window[6].draw_color(@select_colors[@bet_index])
        @bet_table_window[6].index = 0
        @bet_table_window[6].active = true
        @bet_table_window[6].visible = true
        return
      when 1 # Even
        draw_bitmap?(3)
      when 2 # Red
        draw_bitmap?(2)
      end
      @bet_table_rows[2].draw_color(@select_colors[@bet_index])
      @bet_table_rows[2].index = 0
      @bet_table_rows[2].active = true
      @bet_table_rows[2].visible = true
    end
    #…………………………………………………………………………………………………
    # ■ 上下 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @table_choice[7].index = @table_choice[6].index
      @table_choice[7].active = true
      @table_choice[6].index = -1
      @table_choice[6].active = false
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @table_choice[6].index = -1
      @table_choice[6].visible = false
      @table_choice[6].active = false
      @table_choice[7].index = -1
      @table_choice[7].visible = false
      @table_choice[7].active = false
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].index = 0
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x2-2 カテゴリー選択開始)
  #--------------------------------------------------------------------------
  def bet_table6_update
    #…………………………………………………………………………………………………
    # ■ C ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::C)
      # □決定SEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::DECISION_SE))
      @table_choice[6].active = false
      case @table_choice[7].index
      when 0 # 19-36
        @bet_table_window[6].draw_color(@select_colors[@bet_index])
        @bet_table_window[6].index = 1
        @bet_table_window[6].active = true
        @bet_table_window[6].visible = true
        return
      when 1 # Odd
        draw_bitmap?(0)
      when 2 # Brack
        draw_bitmap?(1)
      end
      @bet_table_rows[2].draw_color(@select_colors[@bet_index])
      @bet_table_rows[2].index = 0
      @bet_table_rows[2].active = true
      @bet_table_rows[2].visible = true
    end
    #…………………………………………………………………………………………………
    # ■ 上下 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @table_choice[6].index = @table_choice[7].index
      @table_choice[6].active = true
      @table_choice[7].index = -1
      @table_choice[7].active = false
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @table_choice[6].index = -1
      @table_choice[6].visible = false
      @table_choice[6].active = false
      @table_choice[7].index = -1
      @table_choice[7].visible = false
      @table_choice[7].active = false
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].index = 0
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x3 (1列12箇所)選択開始)
  #--------------------------------------------------------------------------
  def bet_table_column
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_rows[1].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[7][@bet_table_rows[1].index]
    if @old_help != help
      @bet_table_rows[1].set_text(help)
      @old_help = help
    end
    x = 466 ; y = 42
    cx = @bet_table_rows[1].index % 3
    cy = 1
    x += (cx*61) ; y += (cy*30*12)
    index = @bet_table_rows[1].index + 1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,50,index)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_rows[1].set_text("")
      @bet_table_rows[1].index = -1
      @bet_table_rows[1].active = false
      @bet_table_rows[1].visible = false
      @table_choice[5].active = true
      @table_choice[5].help_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x3 (ダース12箇所)選択開始)
  #--------------------------------------------------------------------------
  def bet_x3update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[@bet_index].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[8][@bet_table_window[@bet_index].index]
    if @old_help != help
      @bet_table_window[@bet_index].set_text(help)
      @old_help = help
    end
    x = 466-61 ; y = 42+8
    cx = 0
    cy = @bet_table_window[@bet_index].index
    x += (cx*61) ; y += (cy*120)
    index = @bet_table_window[@bet_index].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].set_text("")
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].active = false
      @bet_table_window[@bet_index].visible = false
      @table_choice[5].active = true
      @table_choice[5].help_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x3 カテゴリー選択開始)
  #--------------------------------------------------------------------------
  def bet_table4_update
    #…………………………………………………………………………………………………
    # ■ C ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::C)
      # □決定SEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::DECISION_SE))
      case @table_choice[5].index
      when 0 # 1列12箇所
        @table_choice[5].active = false
        @bet_table_rows[1].draw_color(@select_colors[@bet_index])
        @bet_table_rows[1].index = 0
        @bet_table_rows[1].active = true
        @bet_table_rows[1].visible = true
      when 1 # 12箇所(ダース)
        @table_choice[5].active = false
        @bet_table_window[5].draw_color(@select_colors[@bet_index])
        @bet_table_window[5].index = 0
        @bet_table_window[5].active = true
        @bet_table_window[5].visible = true
      end
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @table_choice[5].index = -1
      @table_choice[5].visible = false
      @table_choice[5].active = false
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].index = 0
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x6 選択開始)
  #--------------------------------------------------------------------------
  def bet_x6update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[@bet_index].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[6][@bet_table_window[@bet_index].index]
    if @old_help != help
      @bet_table_window[@bet_index].set_text(help)
      @old_help = help
    end
    x = 466-61+39 ; y = 42+8
    cx = 0
    cy = @bet_table_window[@bet_index].index
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_window[@bet_index].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index,3)
    draw_coin?(x,y,@bet_index,index,5,2)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].set_text("")
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].active = false
      @bet_table_window[@bet_index].visible = false
      @bet_select[@bet_index].active = true
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x9 選択開始)
  #--------------------------------------------------------------------------
  def bet_x9update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[@bet_index].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[5][@bet_table_window[@bet_index].index]
    if @old_help != help
      @bet_table_window[@bet_index].set_text(help)
      @old_help = help
    end
    x = 466+39 ; y = 42+8
    cx = @bet_table_window[@bet_index].index % 2
    cy = @bet_table_window[@bet_index].index / 2
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_window[@bet_index].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index,3)
    draw_coin?(x,y,@bet_index,index,5,2)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].set_text("")
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].active = false
      @bet_table_window[@bet_index].visible = false
      @bet_select[@bet_index].active = true
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x12 選択開始)
  #--------------------------------------------------------------------------
  def bet_x12update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[@bet_index].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[4][@bet_table_window[@bet_index].index]
    if @old_help != help
      @bet_table_window[@bet_index].set_text(help)
      @old_help = help
    end
    x = 466-61+39 ; y = 42-6
    cx = 0
    cy = @bet_table_window[@bet_index].index
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_window[@bet_index].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,20,index,4)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].set_text("")
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].active = false
      @bet_table_window[@bet_index].visible = false
      @table_choice[2].active = true
      @table_choice[2].help_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x12 カテゴリー選択開始)
  #--------------------------------------------------------------------------
  def bet_table3_update
    #…………………………………………………………………………………………………
    # ■ C ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::C)
      # □決定SEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::DECISION_SE))
      case @table_choice[2].index
      when 0 # 横3列
        @table_choice[2].active = false
        @bet_table_window[2].draw_color(@select_colors[@bet_index])
        @bet_table_window[2].index = 0
        @bet_table_window[2].active = true
        @bet_table_window[2].visible = true
      when 1,2,3 # 1-0-2,0-2-00,2-00-3
        @zero_type = @table_choice[2].index
        draw_bitmap?(4+@table_choice[2].index)
        @table_choice[2].active = false
        @bet_table_zero[1].draw_color(@select_colors[@bet_index])
        @bet_table_zero[1].index = 0
        @bet_table_zero[1].active = true
        @bet_table_zero[1].visible = true
      end
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @table_choice[2].index = -1
      @table_choice[2].visible = false
      @table_choice[2].active = false
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].index = 0
      @bet_select.each{ |a| a.visible = true }
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x18(0-00) x12(1-0-2,0-2-00,2-00-3)選択開始)
  #--------------------------------------------------------------------------
  def bet_0_00_update
    @bet_select[1].help_window.visible = false
    @bet_table_zero[1].visible = true
    # □変化した場合ヘルプを更新
    help = ["【緑0-緑00】に賭けます。","【赤1-緑0-黒2】に賭けます。",
    "【緑0-黒2-緑00】に賭けます。","【黒2-緑00-赤3】に賭けます。"]
    if @old_help != help[@zero_type]
      @bet_table_zero[1].set_text(help[@zero_type])
      @old_help = help
    end
    # type0-00(格納場所ID)
    # indexレイヤー
    case @zero_type
    when 0 # 0-00
      x = 476+58 ; y = 12-6
      type = 1 ; index = 1
    when 1 # 1-0-2
      x = 476+58-29 ; y = 12+8
      type = 2 ; index = 3#2
    when 2 # 0-2-00
      x = 476+58 ; y = 12+8
      type = 2 ; index = 2#3
    when 3 # 2-00-3
      x = 476+58+32 ; y = 12+8
      type = 2 ; index = 2
    end
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,type,@zero_type,index)
    #…………………………………………………………………………………………………
    # ■ 右 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::RIGHT) && @zero_type > 0
      $game_system.se_play($data_system.cursor_se)
      @table_choice[2].index = @table_choice[2].index == 3 ? 1 : @table_choice[2].index += 1
      @zero_type = @table_choice[2].index
      draw_bitmap?(4+@table_choice[2].index)
      @bet_table_zero[1].update
    end
    #…………………………………………………………………………………………………
    # ■ 左 ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.repeat?(Input::LEFT) && @zero_type > 0
      $game_system.se_play($data_system.cursor_se)
      @table_choice[2].index = @table_choice[2].index == 1 ? 3 : @table_choice[2].index -= 1
      @zero_type = @table_choice[2].index
      draw_bitmap?(4+@table_choice[2].index)
      @bet_table_zero[1].update
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_zero[1].set_text("")
      @bet_table_zero[1].index = -1
      @bet_table_zero[1].active = false
      @bet_table_zero[1].visible = false
      case @zero_type
      when 0
        @table_choice[1].active = true
        @table_choice[1].help_window.visible = true
      when 1,2,3
        @table_choice[2].active = true
        @table_choice[2].help_window.visible = true
      end
      draw_bitmap?(-1)
      @zero_type = nil
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x18(縦=33) 選択開始)
  #--------------------------------------------------------------------------
  def bet_rows_update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_rows[0].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[3][@bet_table_rows[0].index]
    if @old_help != help
      @bet_table_rows[0].set_text(help)
      @old_help = help
    end
    x = 466+7 ; y = 42+8
    cx = @bet_table_rows[0].index % 3
    cy = @bet_table_rows[0].index / 3
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_rows[0].index+1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,10,index)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_rows[0].set_text("")
      @bet_table_rows[0].index = -1
      @bet_table_rows[0].active = false
      @bet_table_rows[0].visible = false
      @table_choice[1].active = true
      @table_choice[1].help_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x18(横=24) 選択開始)
  #--------------------------------------------------------------------------
  def bet_line_update
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[1].visible = true
    # □変化した場合ヘルプを更新
    help = @bet_helps[2][@bet_table_window[1].index]
    if @old_help != help
      @bet_table_window[1].set_text(help)
      @old_help = help
    end
    x = 466+39 ; y = 42-6
    cx = @bet_table_window[1].index % 2
    cy = @bet_table_window[1].index / 2
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_window[1].index+1
    win = 2
    if index % 2 == 0 or index % 2 == 1
      win = 4
    end
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,11,index,win)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[1].set_text("")
      @bet_table_window[1].index = -1
      @bet_table_window[1].active = false
      @bet_table_window[1].visible = false
      @table_choice[1].active = true
      @table_choice[1].help_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x18 カテゴリー選択開始)
  #--------------------------------------------------------------------------
  def bet_table2_update
    #…………………………………………………………………………………………………
    # ■ C ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::C)
      # □決定SEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::DECISION_SE))
      case @table_choice[1].index
      when 0 # 縦2列
        @table_choice[1].active = false
        @bet_table_rows[0].draw_color(@select_colors[@bet_index])
        @bet_table_rows[0].index = 0
        @bet_table_rows[0].active = true
        @bet_table_rows[0].visible = true
      when 1 # 横2列
        @table_choice[1].active = false
        @bet_table_window[1].draw_color(@select_colors[@bet_index])
        @bet_table_window[1].index = 0
        @bet_table_window[1].active = true
        @bet_table_window[1].visible = true
      when 2 # 0-00
        @table_choice[1].active = false
        @zero_type = 0
        draw_bitmap?(4)
        @bet_table_zero[1].draw_color(@select_colors[@bet_index])
        @bet_table_zero[1].index = 0
        @bet_table_zero[1].active = true
        @bet_table_zero[1].visible = true
      end
    end
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @table_choice[1].index = -1
      @table_choice[1].visible = false
      @table_choice[1].active = false
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].index = 0
      @bet_select.each{ |a| a.visible = true }
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(bet x36 選択開始)
  #--------------------------------------------------------------------------
  def bet_update
    if @bet_table_window[@bet_index].index == -1
      @bet_table_window[@bet_index].index = 0
    end
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_zero[0].help_window.visible = false
    # □変化した場合ヘルプを更新
    help = @bet_helps[1][@bet_table_window[@bet_index].index+1]
    if @old_help != help
      @bet_table_window[@bet_index].set_text(help)
      @old_help = help
    end
    @bet_table_window[@bet_index].help_window.visible = true
    x = 466 ; y = 42
    cx = @bet_table_window[@bet_index].index % 3
    cy = @bet_table_window[@bet_index].index / 3
    x += (cx*61) ; y += (cy*30)
    index = @bet_table_window[@bet_index].index + 1
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].visible = false
      @bet_table_window[@bet_index].active = false
      @bet_table_window[@bet_index].set_text("")
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].update_help
      @bet_select[@bet_index].active = true
    end
  end
  #--------------------------------------------------------------------------
  # ■ フレーム更新(x36(0-00) 選択開始)
  #--------------------------------------------------------------------------
  def bet_update02
    if @bet_table_zero[0].index == -1
      @bet_table_zero[0].index = 0
    end
    @bet_select[@bet_index].help_window.visible = false
    @bet_table_window[@bet_index].help_window.visible = false
    # □変化した場合ヘルプを更新
    index = @bet_table_zero[0].index == 0 ? 0 : 37
    help = @bet_helps[1][index]
    if @old_help != help
      @bet_table_zero[0].set_text(help)
      @old_help = help
    end
    @bet_table_zero[0].help_window.visible = true
    x = 476+10 ; y = 42-30-6
    cx = @bet_table_zero[0].index
    x += (cx*96)
    #…………………………………………………………………………………………………
    # ■ betコインの描画
    #…………………………………………………………………………………………………
    draw_coin?(x,y,@bet_index,index,6)
    #…………………………………………………………………………………………………
    # ■ B ボタンが押された場合
    #…………………………………………………………………………………………………
    if Input.trigger?(Input::B)
      # □キャンセルSEを演奏
      $game_system.se_play(RPG::AudioFile.new(HIDE_ROULETTE::CANCEL_SE))
      @old_help = nil
      @bet_table_window[@bet_index].index = -1
      @bet_table_window[@bet_index].zero = false
      @bet_table_window[@bet_index].visible = false
      @bet_table_window[@bet_index].active = false
      
      @bet_table_zero[0].index = -1
      @bet_table_zero[0].zero = false
      @bet_table_zero[0].visible = false
      @bet_table_zero[0].active = false
      @bet_table_zero[0].set_text("")
      @bet_select[@bet_index].help_window.visible = true
      @bet_select[@bet_index].active = true
      @bet_select[@bet_index].update_help
    end
  end
end