幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2068|回复: 0

[有回应] 帮忙看下改战斗选单位置在哪里

[复制链接]

14

主题

79

帖子

665

积分

⑤进阶

积分
665
QQ
发表于 2009-9-3 14:10:21 | 显示全部楼层 |阅读模式
用了CP槽
其中自带的“逃跑”用起来很舒服
但是我想做的是45°战斗,人物和HPSP的描述位置已经调整好了。
战斗选单的位置想改一下。
但是全是日文啊,实在看不懂,不知道改哪里,望帮忙!多谢!


我把所有的脚本列出来,请帮忙,谢谢!
有先后顺序
先是【追加按钮】
  1. # ▽△▽ XRXS. コマンドウィンドウ追加機構 ▽△▽
  2. # by 桜雅 在土
  3. #==============================================================================
  4. # --- XRXS.コマンドウィンドウ追加機構 ---
  5. #==============================================================================
  6. module XRXS_Window_Command
  7.   #--------------------------------------------------------------------------
  8.   # ○ コマンドを追加
  9.   #--------------------------------------------------------------------------
  10.   def add_command(command)
  11.     #
  12.     # 初期化されていない場合、無効化判別用の配列 @disabled の初期化
  13.     #
  14.     @disabled = [] if @disabled.nil?
  15.     if @commands.size != @disabled.size
  16.       for i in 0...@commands.size
  17.         @disabled[i] = false
  18.       end
  19.     end
  20.     #
  21.     # 追加
  22.     #
  23.     @commands.push(command)
  24.     @disabled.push(false)
  25.     @item_max = @commands.size
  26.     self.y -= 32
  27.     self.height += 32
  28.     self.contents.dispose
  29.     self.contents = nil
  30.     self.contents = Bitmap.new(self.width - 32, @item_max * 32)
  31.     refresh
  32.     for i in 0...@commands.size
  33.       if @disabled[i]
  34.         disable_item(i)
  35.       end
  36.     end
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ○ 項目の無効化
  40.   #     index : 項目番号
  41.   #--------------------------------------------------------------------------
  42.   def disable_item(index)
  43.     @disabled = [] if @disabled.nil?
  44.     @disabled[index] = true
  45.     draw_item(index, disabled_color)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ○ 項目の有効化
  49.   #     index : 項目番号
  50.   #--------------------------------------------------------------------------
  51.   def enable_item(index)
  52.     @disabled = [] if @disabled.nil?
  53.     @disabled[index] = false
  54.     draw_item(index, normal_color)
  55.   end
  56. end
  57. class Window_Command < Window_Selectable
  58.   #--------------------------------------------------------------------------
  59.   # ○ インクルード
  60.   #--------------------------------------------------------------------------
  61.   include XRXS_Window_Command
  62.   #--------------------------------------------------------------------------
  63.   # ● 項目の無効化
  64.   #--------------------------------------------------------------------------
  65.   def disable_item(index)
  66.     super
  67.   end
  68. end
复制代码


然后是【CP制御】# ▼▲▼ XRXS65. CP制御ターンシステム ver.β ▼▲▼ built 201120
  1. # by 桜雅 在土
  2. #==============================================================================
  3. # □ カスタマイズポイント
  4. #==============================================================================
  5. module XRXS65
  6.   #
  7.   # 「バトルスピード」(数値が高いほど早い)
  8.   #
  9.   SPEED = 4.0
  10.   #
  11.   # 戦闘開始時 CP。 固定値と占有率
  12.   #
  13.   CP_PRESET_FIXNUM = 0
  14.   CP_PRESET_RATIO  = 2.0
  15.   #
  16.   # ターンコントローラ (nil  : カウント/ターンを有効。
  17.   #                     数値 : そのインデックスをもつエネミーが支配)
  18.   #
  19.   TC = 0
  20.   #
  21.   # カウント/ターン (TCが有効な場合は無視)
  22.   #
  23.   CPT = 40
  24.   #
  25.   # CP スキン
  26.   #
  27.   SKIN        = "123"  # スキンファイル名(Graphics/Windowskinsフォルダ)
  28.   LINE_HEIGHT =  6        # スキンの"一行"の縦幅[単位:ピクセル]
  29.   #
  30.   # 表示位置セッティング
  31.   #
  32.   X_OFFSET = 144    # 横位置
  33.   Y_OFFSET = 464    # 縦位置
  34.   ALIGN    =   1    #「位置揃え」(CPメーターの位置。0:左寄せ 1:中央 2:右寄せ)
  35.   MAX      =   4    # 確保するサイズ[単位:~人分]
  36.   #
  37.   # アクターコマンドがポップしたときの効果音
  38.   #
  39.   COMMAND_UP_SE = "Audio/SE/046-Book01.ogg"
  40. end
  41. #==============================================================================
  42. # --- CP メーターの描画情報の取得 --- (Game_Battlerにインクルードされます)
  43. #==============================================================================
  44. module XRXS_CP
  45.   #--------------------------------------------------------------------------
  46.   # ○ スキンライン (スキンの何行目を使うか)
  47.   #--------------------------------------------------------------------------
  48.   def cp_linetype
  49.     # CP フルの場合はスキンの 2 行目を使う
  50.     return 2 if self.cp_full?
  51.     # 通常はスキンの 1 行目を使う
  52.     return 1
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ○ メーター量[単位:%]
  56.   #--------------------------------------------------------------------------
  57.   def cp_lineamount
  58.     # 戦闘不能の場合は 0 %として表示させる
  59.     return 0 if self.dead?
  60.     # CP値を%値に変換して返却する
  61.     return 100 * self.cp / self.max_cp
  62.   end
  63. end
  64. #
  65. # カスタマイズポイントここまで。
  66. #------------------------------------------------------------------------------
  67. #==============================================================================
  68. # --- XRXS. CP機構 ---
  69. #==============================================================================
  70. module XRXS_CP_SYSTEM
  71.   #----------------------------------------------------------------------------
  72.   # ○ 合計 AGI の取得
  73.   #----------------------------------------------------------------------------
  74.   def self.total_agi
  75.     total = 0
  76.     for battler in $game_party.actors + $game_troop.enemies
  77.       total += battler.agi
  78.     end
  79.     return total
  80.   end
  81. end
  82. #==============================================================================
  83. # --- バトラーにCP機能を追加 モジュール ---
  84. #==============================================================================
  85. module XRXS_CP
  86.   #--------------------------------------------------------------------------
  87.   # ○ 最大 CP の取得
  88.   #--------------------------------------------------------------------------
  89.   def max_cp
  90.     return 65535
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ○ CP の取得と設定
  94.   #--------------------------------------------------------------------------
  95.   def cp
  96.     return @cp == nil ? @cp = 0 : @cp
  97.   end
  98.   def cp=(n)
  99.     @cp = [[n.to_i, 0].max, self.max_cp].min
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ○ CP 初期設定
  103.   #--------------------------------------------------------------------------
  104.   def cp_preset
  105.     percent = self.max_cp * XRXS65::CP_PRESET_RATIO * (rand(16) + 16) * self.agi / XRXS_CP_SYSTEM.total_agi / 24
  106.     self.cp = XRXS65::CP_PRESET_FIXNUM + percent
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ○ CP カウントアップ
  110.   #--------------------------------------------------------------------------
  111.   def cp_update
  112.     self.cp += XRXS65::SPEED * 4096 * self.agi / XRXS_CP_SYSTEM.total_agi
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ○ CP 満タン?
  116.   #--------------------------------------------------------------------------
  117.   def cp_full?
  118.     return @cp == self.max_cp
  119.   end
  120. end
  121. class Game_Battler
  122.   include XRXS_CP
  123. end
  124. #==============================================================================
  125. # --- ガード機能 ---
  126. #==============================================================================
  127. class Game_Battler
  128.   #--------------------------------------------------------------------------
  129.   # ○ ガードフラグ
  130.   #--------------------------------------------------------------------------
  131.   def guarding=(n)
  132.     @guarding = n
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 防御中判定 [再定義]
  136.   #--------------------------------------------------------------------------
  137.   def guarding?
  138.     return @guarding
  139.   end
  140. end
  141. #==============================================================================
  142. # --- アクター「コマンド入力可能判定」:CPがないとコマンドしない ---
  143. #==============================================================================
  144. module XRXS_CP_INPUTABLE
  145.   def inputable?
  146.     return (self.cp_full? and super)
  147.   end
  148. end
  149. class Game_Actor < Game_Battler
  150.   include XRXS_CP_INPUTABLE
  151. end
  152. #==============================================================================
  153. # --- エネミー「行動可能判定」:CPがないとコマンドしない ---
  154. #==============================================================================
  155. module XRXS_CP_MOVABLE
  156.   def movable?
  157.     return (self.cp_full? and super)
  158.   end
  159. end
  160. class Game_Enemy < Game_Battler
  161.   include XRXS_CP_MOVABLE
  162. end
  163. #==============================================================================
  164. # --- 戦闘時 CPカウント ---
  165. #==============================================================================
  166. module XRXS_CP_Battle
  167.   #--------------------------------------------------------------------------
  168.   # ○ パーティ全員の CP を初期設定
  169.   #--------------------------------------------------------------------------
  170.   def cp_preset_party
  171.     for actor in $game_party.actors
  172.       actor.cp_preset
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ○ トループ全員の CP を初期設定
  177.   #--------------------------------------------------------------------------
  178.   def cp_preset_troop
  179.     for enemy in $game_troop.enemies
  180.       enemy.cp_preset
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ○ バトラー全員の CP をカウントアップ
  185.   #--------------------------------------------------------------------------
  186.   def cp_update
  187.     for battler in $game_party.actors + $game_troop.enemies
  188.       battler.cp_update
  189.     end
  190.   end
  191. end
  192. class Scene_Battle
  193.   include XRXS_CP_Battle
  194. end
  195. #==============================================================================
  196. # ■ Scene_Battle
  197. #==============================================================================
  198. class Scene_Battle
  199.   #--------------------------------------------------------------------------
  200.   # ● メイン処理
  201.   #--------------------------------------------------------------------------
  202.   alias xrxs65_main main
  203.   def main
  204.     # エクストラスプライトの初期化
  205.     @extra_sprites = [] if @extra_sprites == nil
  206.     # CP の初期化
  207.     cp_preset_party
  208.     # CP メーターの作成
  209.     @cp_meters = CP_Meters.new
  210.     # CP メーターをエクストラスプライトへ登録
  211.     @extra_sprites.push(@cp_meters)
  212.     # 呼び戻す
  213.     xrxs65_main
  214.     # メーターの解放
  215.     @cp_meters.dispose
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● プレバトルフェーズ開始
  219.   #--------------------------------------------------------------------------
  220.   alias xrxs65_start_phase1 start_phase1
  221.   def start_phase1
  222.     # 呼び戻す
  223.     xrxs65_start_phase1
  224.     # CP の初期化
  225.     cp_preset_troop
  226.     # CP メーターの更新
  227.     @cp_meters.refresh
  228.     # インデックスを計算
  229.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  230.     # アクターコマンドウィンドウに追加
  231.     @actor_command_window.add_command("逃跑")
  232.     if !$game_temp.battle_can_escape
  233.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  234.     end
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● パーティコマンドフェーズ開始
  238.   #--------------------------------------------------------------------------
  239.   alias xrxs65_start_phase2 start_phase2
  240.   def start_phase2
  241.     # 呼び戻す
  242.     xrxs65_start_phase2
  243.     # パーティコマンドウィンドウを無効化
  244.     @party_command_window.active  = false
  245.     @party_command_window.visible = false
  246.     # 強制的にフェイズ 2 を保持
  247.     @phase = 2
  248.     # ただし、既に行動可能者が存在する場合は 3 へ
  249.     start_phase3 if anybody_movable?
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ○ CP制での ターンのカウント
  253.   #--------------------------------------------------------------------------
  254.   def cp_turn_count
  255.     $game_temp.battle_turn += 1
  256.     # バトルイベントの全ページを検索
  257.     for index in 0...$data_troops[@troop_id].pages.size
  258.       # このページのスパンが [ターン] の場合
  259.       if $data_troops[@troop_id].pages[index].span == 1
  260.         # 実行済みフラグをクリア
  261.         $game_temp.battle_event_flags[index] = false
  262.       end
  263.     end
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● フレーム更新 (パーティコマンドフェーズ)
  267.   #--------------------------------------------------------------------------
  268.   alias xrxs65_update_phase2 update_phase2
  269.   def update_phase2
  270.     # パーティコマンドウィンドウのインデックスを無効化
  271.     @party_command_window.index = -1
  272.     # 呼び戻す
  273.     xrxs65_update_phase2
  274.     # 例外補正
  275.     @turn_count_time = 1 if @turn_count_time == nil
  276.     # ターンのカウント
  277.     if @turn_count_time > 0
  278.       @turn_count_time -= 1
  279.       if @turn_count_time == 0
  280.         cp_turn_count
  281.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  282.       end
  283.     end
  284.     # CP のフレーム更新
  285.     cp_update
  286.     @cp_meters.refresh
  287.     # フル CP のバトラーが存在する場合、ターン開始
  288.     start_phase3 if anybody_movable?
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ○ フル CP バトラーが存在するか?
  292.   #--------------------------------------------------------------------------
  293.   def anybody_movable?
  294.     for battler in $game_party.actors + $game_troop.enemies
  295.       return true if battler.cp_full?
  296.     end
  297.     return false
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● アクターコマンドウィンドウのセットアップ
  301.   #--------------------------------------------------------------------------
  302.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  303.   def phase3_setup_command_window
  304.     # 効果音の再生
  305.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  306.     # 呼び戻す
  307.     xrxs65_phase3_setup_command_window
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  311.   #--------------------------------------------------------------------------
  312.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  313.   def update_phase3_basic_command
  314.     # C ボタンが押された場合
  315.     if Input.trigger?(Input::C)
  316.       # アクターコマンドウィンドウのカーソル位置で分岐
  317.       case @actor_command_window.index
  318.       when @cp_escape_actor_command_index # 逃跑
  319.         if $game_temp.battle_can_escape
  320.           # 決定 SE を演奏
  321.           $game_system.se_play($data_system.decision_se)
  322.           # アクションを設定
  323.           @active_battler.current_action.kind = 0
  324.           @active_battler.current_action.basic = 4
  325.           # 次のアクターのコマンド入力へ
  326.           phase3_next_actor
  327.         else
  328.           # ブザー SE を演奏
  329.           $game_system.se_play($data_system.buzzer_se)
  330.         end
  331.         return
  332.       end
  333.     end
  334.     # 呼び戻す
  335.     xrxs_bsp1_update_phase3_basic_command
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● メインフェーズ開始
  339.   #--------------------------------------------------------------------------
  340.   alias xrxs65_start_phase4 start_phase4
  341.   def start_phase4
  342.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  343.     $game_temp.battle_turn -= 1
  344.     # フラグを退避
  345.     save_flags = $game_temp.battle_event_flags.dup
  346.     # 呼び戻す
  347.     xrxs65_start_phase4
  348.     # フラグを復旧
  349.     $game_temp.battle_event_flags = save_flags
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 行動順序作成
  353.   #--------------------------------------------------------------------------
  354.   alias xrxs65_make_action_orders make_action_orders
  355.   def make_action_orders
  356.     # 呼び戻す
  357.     xrxs65_make_action_orders
  358.     # CPが不足している場合は @action_battlers から除外する
  359.     for battler in @action_battlers.dup
  360.       @action_battlers.delete(battler) unless battler.cp_full?
  361.     end
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  365.   #--------------------------------------------------------------------------
  366.   alias xrxs65_update_phase4_step2 update_phase4_step2
  367.   def update_phase4_step2
  368.     # ガードの解除
  369.     @active_battler.guarding = false
  370.     # CPの消費
  371.     @active_battler.cp = 0
  372.     # CP メーターの更新
  373.     @cp_meters.refresh
  374.     # 呼び戻す
  375.     xrxs65_update_phase4_step2
  376.     # 例外補正
  377.     return if @active_battler == nil
  378.     # ターンコントローラ
  379.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  380.       cp_turn_count
  381.     end
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ● 基本アクション 結果作成
  385.   #--------------------------------------------------------------------------
  386.   alias xrxs65_make_basic_action_result make_basic_action_result
  387.   def make_basic_action_result
  388.     # 呼び戻す
  389.     xrxs65_make_basic_action_result
  390.     # 防御の場合
  391.     if @active_battler.current_action.basic == 1
  392.       @active_battler.guarding = true
  393.       return
  394.     end
  395.     # パーティの逃亡の場合
  396.     if @active_battler.current_action.basic == 4
  397.       # 逃走可能ではない場合
  398.       if $game_temp.battle_can_escape == false
  399.         # ブザー SE を演奏
  400.         $game_system.se_play($data_system.buzzer_se)
  401.         return
  402.       end
  403.       # パーティ全員の CP をクリア
  404.       for actor in $game_party.actors
  405.         actor.cp = 0
  406.       end
  407.       # CP メーターの更新
  408.       @cp_meters.refresh
  409.       # 逃走処理
  410.       update_phase2_escape
  411.       return
  412.     end
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  416.   #--------------------------------------------------------------------------
  417.   alias xrxs65_update_phase4_step5 update_phase4_step5
  418.   def update_phase4_step5
  419.     # 呼び戻す
  420.     xrxs65_update_phase4_step5
  421.     # CP メーターの更新
  422.     @cp_meters.refresh
  423.   end
  424. end
  425. #==============================================================================
  426. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  427. #==============================================================================
  428. class CP_Meters
  429.   #--------------------------------------------------------------------------
  430.   # ○ オブジェクト初期化
  431.   #--------------------------------------------------------------------------
  432.   def initialize
  433.     # メーター群の生成
  434.     @meters = []
  435.     for i in 0...$game_party.actors.size
  436.       make_meter(i)
  437.     end
  438.     refresh
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ○ リフレッシュ
  442.   #--------------------------------------------------------------------------
  443.   def refresh
  444.     # 戦闘メンバー数の変更を判別
  445.     for i in @meters.size...$game_party.actors.size
  446.       make_meter(i)
  447.     end
  448.     for i in $game_party.actors.size...@meters.size
  449.       @meters[i].dispose
  450.       @meters[i] = nil
  451.     end
  452.     @meters.compact!
  453.     # 表示更新
  454.     for i in 0...$game_party.actors.size
  455.       actor = $game_party.actors[i]
  456.       @meters[i].line   = actor.cp_linetype
  457.       @meters[i].amount = actor.cp_lineamount
  458.     end
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ○ メーターひとつの生成
  462.   #--------------------------------------------------------------------------
  463.   def make_meter(i)
  464.     # スキンの取得
  465.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  466.     #
  467.     space = 640 / XRXS65::MAX
  468.     case XRXS65::ALIGN
  469.     when 0
  470.       actor_x = i * space + 4
  471.     when 1
  472.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  473.     when 2
  474.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  475.     end
  476.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  477.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  478.     meter.y = XRXS65::Y_OFFSET
  479.     @meters[i] = meter
  480.   end
  481.   #--------------------------------------------------------------------------
  482.   # ○ 可視状態
  483.   #--------------------------------------------------------------------------
  484.   def visible=(b)
  485.     @meters.each{|sprite| sprite.visible = b }
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # ○ 解放
  489.   #--------------------------------------------------------------------------
  490.   def dispose
  491.     @meters.each{|sprite| sprite.dispose }
  492.   end
  493. end
  494. #==============================================================================
  495. # --- XRXS. レクタンギュラーメーター表示・極 ---
  496. #==============================================================================
  497. class MeterSprite < Sprite
  498.   #--------------------------------------------------------------------------
  499.   # ○ オブジェクト初期化
  500.   #--------------------------------------------------------------------------
  501.   def initialize(skin, line_height)
  502.     @skin   = skin
  503.     @width  = @skin.width
  504.     @height = line_height
  505.     @line   = 1
  506.     @amount = 0
  507.     @base_sprite = Sprite.new
  508.     @base_sprite.bitmap = @skin
  509.     @base_sprite.src_rect.set(0, 0, @width, @height)
  510.     @base_sprite.z = 601
  511.     super()
  512.     self.back_opacity = 160    #byakki
  513.     self.z = @base_sprite.z + 1
  514.     self.bitmap = @skin
  515.     self.line = 1
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ○ 値の設定
  519.   #--------------------------------------------------------------------------
  520.   def line=(n)
  521.     @line = n
  522.     refresh
  523.   end
  524.   def amount=(n)
  525.     @amount = n
  526.     refresh
  527.   end
  528.   def refresh
  529.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ○ 座標の設定
  533.   #--------------------------------------------------------------------------
  534.   def x=(n)
  535.     super
  536.     @base_sprite.x = n
  537.   end
  538.   def y=(n)
  539.     super
  540.     @base_sprite.y = n
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ○ 解放
  544.   #--------------------------------------------------------------------------
  545.   def dispose
  546.     @base_sprite.dispose
  547.     super
  548.   end
  549. end
复制代码

最后是【AX追加】
  1. # ▼▲▼ XRXS65A. CP制御ターンシステム「シンセ・ゲージ」 ▼▲▼ built201202
  2. # by 桜雅 在土
  3. #==============================================================================
  4. # □ カスタマイズポイント
  5. #==============================================================================
  6. class XRXS65A
  7.   #--------------------------------------------------------------------------
  8.   # 「アイコン設定」
  9.   #--------------------------------------------------------------------------
  10.   DEFAULT = "测试敌人1" # ディフォルトアイコン
  11.   # アイコンハッシュ  記述方式 : アクターID=>アイコン名
  12.   ICONS = {
  13.     1=>"测试自己人1",
  14.     2=>"测试自己人2",
  15.     3=>"测试自己人3",
  16.     4=>"测试自己人4"
  17.   }
  18.   # アイコンハッシュE  記述方式 : エネミーID=>アイコン名
  19.   ICONE = {
  20.     1=>"测试敌人1",
  21.     2=>"测试敌人2",
  22.   }
  23.   #--------------------------------------------------------------------------
  24.   # 「シンセ・ゲージ」
  25.   #--------------------------------------------------------------------------
  26.   SKIN = "123"  # スキン
  27.   X    =  32         # X 座標
  28.   Y    =  450         # Y 座標
  29. end
  30. #==============================================================================
  31. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ --- [再定義]
  32. #==============================================================================
  33. class CP_Meters
  34.   #--------------------------------------------------------------------------
  35.   # ○ オブジェクト初期化
  36.   #--------------------------------------------------------------------------
  37.   def initialize
  38.     # シンセゲージの生成
  39.     @base = Sprite.new
  40.     @base.bitmap = RPG::Cache.windowskin(XRXS65A::SKIN).dup
  41.     @base.x = XRXS65A::X
  42.     @base.y = XRXS65A::Y
  43.     @base.z = XRXS65A::X
  44.     @width  = @base.bitmap.width
  45.     @height = @base.bitmap.height
  46.     @icon_set = []
  47.     refresh
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ○ リフレッシュ
  51.   #--------------------------------------------------------------------------
  52.   def refresh
  53.     # 生成すべきバトラーの取得
  54.     need_initializes = []
  55.     for battler in $game_party.actors + $game_troop.enemies
  56.       exist = false
  57.       for set in @icon_set
  58.         exist |= (set[1] == battler)
  59.       end
  60.       need_initializes.push(battler) unless exist
  61.     end
  62.     for battler in need_initializes
  63.       iconname = nil
  64.       if battler.is_a?(Game_Actor)
  65.         iconname = XRXS65A::ICONS[battler.id]
  66.       else
  67.         iconname = XRXS65A::ICONE[battler.id]
  68.       end
  69.       if iconname == nil
  70.         iconname = XRXS65A::DEFAULT
  71.       end
  72.       sprite = Sprite.new
  73.       sprite.bitmap = RPG::Cache.icon(iconname).dup
  74.       sprite.y = XRXS65A::Y + @height / 2 - 12
  75.       @icon_set.push([sprite, battler])
  76.     end
  77.     # 更新
  78.     for set in @icon_set
  79.       set[0].x = XRXS65A::X + @width * set[1].cp / set[1].max_cp - 12
  80.       set[0].z = set[0].x
  81.       set[0].visible = false if set[1].dead? or !set[1].exist?
  82.     end
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ○ 可視状態
  86.   #--------------------------------------------------------------------------
  87.   def visible=(b)
  88.     @base.visible = b
  89.     @icon_set.each{|set| set[0].visible = b }
  90.   end
  91.   #--------------------------------------------------------------------------
  92.   # ○ 解放
  93.   #--------------------------------------------------------------------------
  94.   def dispose
  95.     @base.dispose
  96.     @icon_set.each{|set| set[0].dispose }
  97.   end
  98. end
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2024-4-25 01:12 , Processed in 0.022819 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表