#==============================================================================
# ■ module HIDESP_KEY_MAKE vol.2.50
#------------------------------------------------------------------------------
# ステータス/装備/スキル画面にBACK/NEXT名を表示(デフォルト版)
# ※ Window_digits_number 4.75(必須)より下に挿入
# 09/03/20
#==============================================================================
module Key_Icon_Make
  SIZE = 16                        # 文字サイズ
  BOLD = true                      # 太文字フラグ[true/false]
  ITALIC = false                   # 斜め文字フラグ[true/false]
  SHADOW = false                   # 影文字フラグ[true/false]
  ROUND = true                     # 囲み文字フラグ[true/false]
  NAME = ["Georgia","ＭＳ Ｐゴシック"]  # フォント名
  #…………………………………………………………………………………………………
  # ■アニメーションカラーを設定
  #…………………………………………………………………………………………………
  N0 = Color.new(255,255,0,255)    # 変化色0(active=true)
  N1 = Color.new(230,230,0,255)    # 変化色1(active=true)
  N2 = Color.new(205,205,0,255)    # 変化色2(active=true)
  N3 = Color.new(180,180,0,255)    # 変化色3(active=true)
  N4 = Color.new(255,255,255,128)  # 停止色(active=false)
  #…………………………………………………………………………………………………
  # ■アニメーションカラーの影色を設定(※同じ数値に対応　N0=S0)
  #…………………………………………………………………………………………………
  S0 = Color.new(0,0,0,255)        # N0変化影色(active=true)
  S1 = Color.new(0,0,0,255)        # N1変化影色(active=true)
  S2 = Color.new(0,0,0,255)        # N2変化影色(active=true)
  S3 = Color.new(0,0,0,255)        # N3変化影色(active=true)
  S4 = Color.new(0,0,0,128)        # N4停止影色(active=false)
  #…………………………………………………………………………………………………
  # ■画像/アニメーションパターン/アニメ速度の設定
  #…………………………………………………………………………………………………
  ICONS = "kyeboard_anim"
  ACT_ANIM = [0,1,2,3,2,1]         # アニメーションループ(配列数=2以上)
  ACT_SPEED = 6                    # (0=点滅なし 大＝速い　小＝遅い)
  #…………………………………………………………………………………………………
  # ■置き換えるアクター名
  #…………………………………………………………………………………………………
  EX_NAME = []
  EX_NAME[0] = "------"            # パーティ人数が1人の場合
  EX_NAME[1] = "Arshes"            # アルシェス
  EX_NAME[2] = "Basil"             # バジル
  EX_NAME[3] = "Sirus"             # サイラス
  EX_NAME[4] = "Dorothy"           # ドロシー
  EX_NAME[5] = "Estelle"           # エステル
  EX_NAME[6] = "Felix"             # フェリックス
  EX_NAME[7] = "Gloria"            # グロリア
  EX_NAME[8] = "Hilda"             # ヒルダ
#==============================================================================
  #--------------------------------------------------------------------------
  # ■書き換え不可の項目
  #--------------------------------------------------------------------------
  NORMALS = [N0,N1,N2,N3,N4]
  SHADOWS = [S0,S1,S2,S3,S4]
  FONTS = Copy_Font.new
  FONTS.size = SIZE
  FONTS.bold = BOLD
  FONTS.italic = ITALIC
  FONTS.shadow = SHADOW
  FONTS.round = ROUND
  FONTS.name = NAME
  FONTS.normals = NORMALS
  FONTS.shadows = SHADOWS
  #--------------------------------------------------------------------------
  # ■KEYウィンドウの作成
  #--------------------------------------------------------------------------
  def make_text_key?(text,key,x,y,z = 102,fonts = FONTS,
    icon_name = ICONS,animas = ACT_ANIM,speed = ACT_SPEED)
    texts = [Rect_Draw_Icon.new(text,icon_name,key,key*16,nil,16,16)]*fonts.normals.size
    text_key = Window_digits_number.new(x,y,z,0,1,texts,fonts)
    # □アニメーション設定を代入
    text_key.animas = animas
    text_key.speed = speed
    @text_key = text_key
    @speed = speed
    @animas = animas
    # □更新
    @text_key.animation(false,@speed,@animas,0,4)
    return text_key
  end
  #--------------------------------------------------------------------------
  # ■ 前のアクターの名前を取得
  #--------------------------------------------------------------------------
  def back_name?(actor)
    index = $game_party.actors.index(actor)
    l_index = index + $game_party.actors.size - 1
    l_index %= $game_party.actors.size
    # □パーティ人数が1人の場合
    if actor == $game_party.actors[l_index]
      l_name = EX_NAME[0]
    else
      l_name = EX_NAME[$game_party.actors[l_index].id]
    end
    return l_name != nil ? l_name : "NO DATA"
  end
  #--------------------------------------------------------------------------
  # ■ 次のアクターの名前を取得
  #--------------------------------------------------------------------------
  def next_name?(actor)
    index = $game_party.actors.index(actor)
    r_index = index + 1
    r_index %= $game_party.actors.size
    # □パーティ人数が1人の場合
    if actor == $game_party.actors[r_index]
      r_name = EX_NAME[0]
    else
      r_name = EX_NAME[$game_party.actors[r_index].id]
    end
    return r_name != nil ? r_name : "NO DATA"
  end
  #--------------------------------------------------------------------------
  # ■ 更新
  #--------------------------------------------------------------------------
  def update
    if @text_key != nil
      unless self.active
        @text_key.count = 0
      end
      @text_key.animation(self.active,@speed,@animas,0,4)
    end
    super
  end
  #--------------------------------------------------------------------------
  # ■ 停止
  #--------------------------------------------------------------------------
  def active=(active)
    if @text_key != nil
      unless active
        @text_key.count = 0
        @text_key.animation(active,@speed,@animas,0,4)
      end
    end
    super
  end
  #--------------------------------------------------------------------------
  # ■ 可視化
  #--------------------------------------------------------------------------
  def visible=(visible)
    if @text_key != nil
      @text_key.visible = visible
    end
    super
  end
  #--------------------------------------------------------------------------
  # ■ 解放
  #--------------------------------------------------------------------------
  def dispose
    if @text_key != nil
      @text_key.dispose
    end
    super
  end
end