# ▼▲▼ MeLT. プラグインB1 : バトラーズキャンプ ▼▲▼ # # update 2007/ 7/22 # #============================================================================== # カスタマイズポイント #============================================================================== module XRXS_MeLT # # 各種ファイル名 (Windowskins) # ASB_SKIN = "MenuStatusBar" NUM_SKIN_L = "NumberL" NUM_SKIN_S = "NumberS" HP = "HP" SP = "SP" HPBAR = "MenuHPBar" SPBAR = "MenuSPBar" # ステートID=>アイコン名 関連付けハッシュ STATE_ICON = {3=>"skill_024",5=>"skill_027",7=>"skill_026",8=>"skill_025"} end class Window_MenuStatus < Window_Selectable # バトラーポジション設定 POSITIONS = [ [412, 200], [540, 264], [444, 344], [564, 400] ] # ステータスバー描画座標 EACH_X_OFFSET = 0 # 各行毎の横ずれ EVEN_X_OFFSET = 32 # 偶数行の横ずれ end #============================================================================== # ■ Window_MenuStatus [再定義] #============================================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # --- ウィンドウスライディングを搭載 --- #-------------------------------------------------------------------------- include XRXS_WindowSliding include XRXS_Cursor2 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(144 + 32, 140, 512, 384) self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 @slide_x_speed = -8 @actor_sprites = [] refresh @slide_objects = [self] + @actor_sprites self.active = false self.index = -1 @column_max = 1 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size draw_menustatus(i) end # バトラースプライトの用意 @actor_sprites.each{|sprite| sprite.dispose } @actor_sprites.clear positions = POSITIONS.dup for actor in $game_party.actors battler_bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) sprite = Sprite.new sprite.bitmap = battler_bitmap position = positions.shift sprite.x = position[0] + @slidein_count * 8 sprite.y = position[1] sprite.ox = battler_bitmap.rect.width / 2 sprite.oy = battler_bitmap.rect.height sprite.z = 201 sprite.visible = !actor.dead? @actor_sprites.push(sprite) end @slide_objects = [self] + @actor_sprites end #-------------------------------------------------------------------------- # ○ メニューステータスの描写 #-------------------------------------------------------------------------- def draw_menustatus(i) x = i * EACH_X_OFFSET + i % 2 * EVEN_X_OFFSET y = i * 64 + 4 # bar = RPG::Cache.windowskin(XRXS_MeLT::ASB_SKIN) self.contents.blt(x, y, bar, bar.rect, 160) num_skin_l = RPG::Cache.windowskin(XRXS_MeLT::NUM_SKIN_L) num_skin_s = RPG::Cache.windowskin(XRXS_MeLT::NUM_SKIN_S) hp_bitmap = RPG::Cache.windowskin(XRXS_MeLT::HP) sp_bitmap = RPG::Cache.windowskin(XRXS_MeLT::SP) hpbar_skin = RPG::Cache.windowskin(XRXS_MeLT::HPBAR) spbar_skin = RPG::Cache.windowskin(XRXS_MeLT::SPBAR) # アクターの取得 actor = $game_party.actors[i] # self.contents.font.color = Color.new(0,0,0,255) self.contents.font.size = 16 self.contents.draw_text(x + 16, y + 2, 80, 24, actor.name) # state_icon_names = [] for state_id in actor.states.sort icon_name = XRXS_MeLT::STATE_ICON[state_id] if icon_name != nil state_icon_names.push(icon_name) end end if state_icon_names.empty? self.contents.font.color = Color.new(0,64,96,255) self.contents.font.size = 14 self.contents.draw_text(x + 104, y + 2, 16, 24, "Lv.") self.contents.draw_text(x + 120, y + 2, 16, 24, actor.level.to_s, 2) else ix = x + 96 for icon_name in state_icon_names icon = RPG::Cache.icon(icon_name) self.contents.blt(ix, y + 2, icon, icon.rect) ix += 26 end end # self.contents.blt_number(x + 96, y + 45, num_skin_l, actor.hp) self.contents.blt_number(x + 96, y + 59, num_skin_s, actor.sp) self.contents.blt( x + 23, y + 34, hp_bitmap, hp_bitmap.rect) self.contents.blt( x + 32, y + 50, sp_bitmap, sp_bitmap.rect) # HP バーの描画 h = 10 rect = Rect.new(0,0,96,h) self.contents.blt(x + 98, y + 34, hpbar_skin, rect) rect.y = (actor.hp == actor.maxhp ? 2 * h : h) rect.width = 96 * actor.hp / actor.maxhp self.contents.blt(x + 98, y + 34, hpbar_skin, rect) # SP バーの描画 h = 8 rect = Rect.new(0,0,96,h) self.contents.blt(x + 98, y + 48, spbar_skin, rect) rect.y = (actor.sp == actor.maxsp ? 2 * h : h) rect.width = 96 * actor.sp / [actor.maxsp, 1].max self.contents.blt(x + 98, y + 48, spbar_skin, rect) end #-------------------------------------------------------------------------- # ● カーソルの矩形更新 #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else x = @index % 2 * 32 + 2 w = 218 - x self.cursor_rect.set(x, @index * 64 + 4, w, 64) end end #-------------------------------------------------------------------------- # ○ 解放とスライドアウト #-------------------------------------------------------------------------- def dispose @actor_sprites.each{|sprite| sprite.dispose } super end def slideout! self.index = -1 super end end