设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2335|回复: 3
打印 上一主题 下一主题

[转载] [日站] 竖排界面

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
帖子
30
跳转到指定楼层
1
发表于 2012-7-21 11:44:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 l616631804 于 2012-7-21 11:44 编辑

转载自    http://www4.plala.or.jp/findias/codecrush/material/vxace_rgss3/index.html

各个界面的竖排。不用添加素材,可直接使用。




RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト<base> [Ver.1.0.0]          by Claimh
  3. #------------------------------------------------------------------------------
  4. # 和風なレイアウトに変更します。
  5. #==============================================================================
  6.  
  7. # デフォルトフォント設定
  8. Font.default_name = ["HGP行書体", "MS 明朝", "VL Gothic"]
  9. Font.default_outline = false
  10. Font.default_shadow = false
  11.  
  12. #==============================================================================
  13. # ■ Vocab
  14. #------------------------------------------------------------------------------
  15. #  用語とメッセージを定義するモジュールです。定数でメッセージなどを直接定義す
  16. # るほか、グローバル変数 $data_system から用語データを取得します。
  17. #==============================================================================
  18.  
  19. module Vocab
  20.   # セーブ/ロード画面
  21.   SaveMessage     = "どの書に記録しますか?"
  22.   LoadMessage     = "どの書から読み出ししますか?"
  23.   File            = "記録の書"
  24.  
  25.   # アクター対象の行動結果
  26.   ActorDamage     = "%sは %s の傷を受けた!"
  27.   ActorRecovery   = "%sの%sが %s 回復した!"
  28.   ActorGain       = "%sの%sが %s 増えた!"
  29.   ActorLoss       = "%sの%sが %s 減った!"
  30.   ActorDrain      = "%sは%sを %s 奪われた!"
  31.   ActorNoDamage   = "%sには効かない!"
  32.   ActorNoHit      = "%sには当たらない!"
  33.  
  34.   # 敵キャラ対象の行動結果
  35.   EnemyDamage     = "%sに %s の傷を与えた!"
  36.   EnemyRecovery   = "%sの%sが %s 回復した!"
  37.   EnemyGain       = "%sの%sが %s 増えた!"
  38.   EnemyLoss       = "%sの%sが %s 減った!"
  39.   EnemyDrain      = "%sの%sを %s 奪った!"
  40.   EnemyNoDamage   = "%sには効かない!"
  41.   EnemyNoHit      = "%sに当たらない!"
  42.  
  43.   # 回避/反射
  44.   Evasion         = "%sは攻撃をかわした!"
  45.   MagicEvasion    = "%sは術を打ち消した!"
  46.   MagicReflection = "%sは術を跳ね返した!"
  47.   CounterAttack   = "%sの反撃!"
  48.   Substitute      = "%sが%sをかばった!"
  49. end
  50.  
  51.  
  52. class Bitmap
  53.   #--------------------------------------------------------------------------
  54.   # ● 縦テキスト描画
  55.   #--------------------------------------------------------------------------
  56.   def draw_h_text(rect, text)
  57.     t = text.to_s.split(//)
  58.     x = rect.x
  59.     y = rect.y
  60.     t.each_index do |i|
  61.       h = text_size(t[i]).height
  62.       case t[i]
  63.       when "。", "、"
  64.         plus = h / 2
  65.         draw_text(x+plus, y-plus, rect.width, h, t[i], 1)
  66.       when "っ", "ぁ", "ぃ", "ぅ", "ぇ", "ぉ", "ゃ", "ゅ", "ょ",
  67.            "ッ", "ァ", "ィ", "ゥ", "ェ", "ォ", "ャ", "ュ", "ョ"
  68.         plus = h / 5
  69.         draw_text(x+plus, y-plus, rect.width, h, t[i], 1)
  70.       when "\n", "\r"; next
  71.       else
  72.         draw_text(x, y, rect.width, h, t[i], 1)
  73.       end
  74.       y += h
  75.     end
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 和数字描画
  79.   #--------------------------------------------------------------------------
  80.   def draw_jnum(rect, num, align=2)
  81.     draw_text(rect, ConvJnum.conv(num), align)
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 和数字描画 <縦>
  85.   #--------------------------------------------------------------------------
  86.   def draw_h_jnum(rect, num, align=2)
  87.     draw_h_text(rect, ConvJnum.conv(num), align)
  88.   end
  89. end
  90.  
  91.  
  92. module ConvJnum
  93.   #--------------------------------------------------------------------------
  94.   # ● 和数字変換
  95.   #--------------------------------------------------------------------------
  96.   def self.conv(num)
  97.     text = ""
  98.     if num / 100000000 > 0
  99.       text += conv_o(num / 100000000)
  100.       num %= 100000000
  101.     end
  102.     if num / 10000 > 0
  103.       text += conv_m(num / 10000)
  104.       num %= 10000
  105.     end
  106.     text += conv_s(num)
  107.     text = "零" if text == ""
  108.     text
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 和数字変換 (億単位)
  112.   #--------------------------------------------------------------------------
  113.   def self.conv_o(num)
  114.     conv_s(num) + "億 "
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 和数字変換 (万単位)
  118.   #--------------------------------------------------------------------------
  119.   def self.conv_m(num)
  120.     conv_s(num) + "万 "
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 和数字変換 (千単位以下)
  124.   #--------------------------------------------------------------------------
  125.   def self.conv_s(num)
  126.     text = ""
  127.     if num / 1000 > 0
  128.       text += conv_one(num / 1000, false) + "千"
  129.       num %= 1000
  130.     end
  131.     if num / 100 > 0
  132.       text += conv_one(num / 100, false) + "百"
  133.       num %= 100
  134.     end
  135.     if num / 10 > 0
  136.       text += conv_one(num / 10, false) + "十"
  137.       num %= 10
  138.     end
  139.     if num > 0
  140.       text +=conv_one(num, true)
  141.     end
  142.     text
  143.   end
  144.   def self.conv_one(num, one=false)
  145.     conv = {1=>"一", 2=>"二", 3=>"三", 4=>"四", 5=>"五",
  146.             6=>"六", 7=>"七", 8=>"八", 9=>"九"}
  147.     one ? conv[num] : (num > 1 ? conv[num] : "")
  148.   end
  149. end
  150.  
  151.  
  152. class Window_Base < Window
  153.   #--------------------------------------------------------------------------
  154.   # ● 各種文字色の取得
  155.   #--------------------------------------------------------------------------
  156.   def normal_color;      text_color(0);   end;    # 通常
  157.   def system_color;      text_color(11);   end;    # システム
  158.   def crisis_color;      text_color(17);  end;    # ピンチ
  159.   def knockout_color;    text_color(18);  end;    # 戦闘不能
  160.   def gauge_back_color;  text_color(7);  end;    # ゲージ背景
  161.   def hp_gauge_color1;   text_color(20);  end;    # HP ゲージ 1
  162.   def hp_gauge_color2;   text_color(21);  end;    # HP ゲージ 2
  163.   def mp_gauge_color1;   text_color(22);  end;    # MP ゲージ 1
  164.   def mp_gauge_color2;   text_color(23);  end;    # MP ゲージ 2
  165.   def mp_cost_color;     text_color(31);  end;    # 消費 MP
  166.   def power_up_color;    text_color(24);  end;    # 装備 パワーアップ
  167.   def power_down_color;  text_color(25);  end;    # 装備 パワーダウン
  168.   def tp_gauge_color1;   text_color(28);  end;    # TP ゲージ 1
  169.   def tp_gauge_color2;   text_color(29);  end;    # TP ゲージ 2
  170.   def tp_cost_color;     text_color(30);  end;    # 消費 TP
  171.  
  172.   #--------------------------------------------------------------------------
  173.   # ● 文字の処理
  174.   #     c    : 文字
  175.   #     text : 描画処理中の文字列バッファ(必要なら破壊的に変更)
  176.   #     pos  : 描画位置 {:x, :y, :new_x, :height}
  177.   #--------------------------------------------------------------------------
  178.   def process_character(c, text, pos)
  179.     case c
  180.     when "\r"   # キャリッジリターンは無視
  181.     when "\n"   # 改行
  182.       process_new_line(text, pos)
  183.     when "\f"   # 改ページ
  184.       process_new_page(text, pos)
  185.     when "\e"   # 制御文字
  186.       process_escape_character(obtain_escape_code(text), text, pos)
  187.     else        # 普通の文字
  188.       process_normal_character(c, pos)
  189.     end
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● シンプルなステータスの描画
  193.   #--------------------------------------------------------------------------
  194.   def draw_actor_simple_status(actor, x, y, add=120, width=124)
  195.     draw_actor_name(actor, x, y)
  196.     draw_actor_level(actor, x, y + line_height * 1)
  197.     draw_actor_icons(actor, x, y + line_height * 2)
  198.     draw_actor_class(actor, x + add, y)
  199.     draw_actor_hp(actor, x + add, y + line_height * 1, width)
  200.     draw_actor_mp(actor, x + add, y + line_height * 2, width)
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 現在値/最大値を分数形式で描画
  204.   #     current : 現在値
  205.   #     max     : 最大値
  206.   #     color1  : 現在値の色
  207.   #     color2  : 最大値の色
  208.   #--------------------------------------------------------------------------
  209.   def draw_current_and_max_values(x, y, width, current, max, color1, color2)
  210.     change_color(color1)
  211.     xr = x + width
  212.     if width < 106
  213.       draw_text(xr - 50, y, 52, line_height, current, 2)
  214.     else
  215.       draw_text(xr - 106, y, 52, line_height, current, 2)
  216.       change_color(color2)
  217.       draw_text(xr - 56, y, 12, line_height, "/", 2)
  218.       draw_text(xr - 52, y, 52, line_height, max, 2)
  219.     end
  220.   end
  221. end
  222.  
  223.  
  224. #==============================================================================
  225. # ■ Window_J_Base
  226. #------------------------------------------------------------------------------
  227. #  ゲーム中の全てのウィンドウのスーパークラスです。
  228. #==============================================================================
  229.  
  230. class Window_J_Base < Window_Base
  231.   #--------------------------------------------------------------------------
  232.   # ● オブジェクト初期化
  233.   #--------------------------------------------------------------------------
  234.   def initialize(*args)
  235.     @jmode=true
  236.     super(*args)
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 行の幅を取得
  240.   #--------------------------------------------------------------------------
  241.   def line_width
  242.     return 24
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 指定行数に適合するウィンドウの幅を計算
  246.   #--------------------------------------------------------------------------
  247.   def fitting_width(line_number)
  248.     line_number * line_width + standard_padding * 2
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● テキストの描画 <縦書き>
  252.   #     args : Bitmap#draw_text と同じ
  253.   #--------------------------------------------------------------------------
  254.   def draw_text(*args)
  255.     return super(*args) unless @jmode
  256.     if args[0].is_a?(Rect)
  257.       contents.draw_h_text(args[0], args[1])
  258.     else
  259.       contents.draw_h_text(Rect.new(args[0], args[1], args[2], args[3]), args[4])
  260.     end
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 制御文字つきテキストの描画
  264.   #--------------------------------------------------------------------------
  265.   def draw_text_ex(x, y, text)
  266.     reset_font_settings
  267.     text = convert_escape_characters(text)
  268.     pos = {:x => x, :y => y, :new_y => y, :width => calc_line_width(text)}
  269.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 通常文字の処理
  273.   #--------------------------------------------------------------------------
  274.   def process_normal_character(c, pos)
  275.     text_height = c.split(//).inject(0) {|r, t| r+=text_size(t).height}
  276.     draw_text(pos[:x], pos[:y], line_width, text_height, c)
  277.     pos[:y] += text_height
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 改行文字の処理
  281.   #--------------------------------------------------------------------------
  282.   def process_new_line(text, pos)
  283.     pos[:x] -= pos[:width]
  284.     pos[:y] = pos[:new_y]
  285.     pos[:width] = calc_line_width(text)
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 制御文字によるアイコン描画の処理
  289.   #--------------------------------------------------------------------------
  290.   def process_draw_icon(icon_index, pos)
  291.     draw_icon(icon_index, pos[:x]-pos[:width], pos[:y])
  292.     pos[:y] += 24
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● アイテム名の描画
  296.   #     enabled : 有効フラグ。false のとき半透明で描画
  297.   #--------------------------------------------------------------------------
  298.   def draw_item_name(item, x, y, enabled = true, height = 172)
  299.     return unless item
  300.     draw_icon(item.icon_index, x, y, enabled)
  301.     change_color(normal_color, enabled)
  302.     draw_text(x, y + 24, line_width, height, item.name)
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 行の幅を計算
  306.   #     restore_font_size : 計算後にフォントサイズを元に戻す
  307.   #--------------------------------------------------------------------------
  308.   def calc_line_width(text, restore_font_size = true)
  309.     result = [line_width, contents.font.size].max
  310.     last_font_size = contents.font.size
  311.     text.slice(/^.*$/).scan(/\e[\{\}]/).each do |esc|
  312.       make_font_bigger  if esc == "\e{"
  313.       make_font_smaller if esc == "\e}"
  314.       result = [result, contents.font.size].max
  315.     end
  316.     contents.font.size = last_font_size if restore_font_size
  317.     result
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● 名前の描画
  321.   #--------------------------------------------------------------------------
  322.   def draw_actor_name_l(actor, x, y, width = 112)
  323.     @jmode = false
  324.     draw_actor_name(actor, x, y, width)
  325.     @jmode = true
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● レベルの描画
  329.   #--------------------------------------------------------------------------
  330.   def draw_actor_level_l(actor, x, y)
  331.     @jmode = false
  332.     draw_actor_level(actor, x, y)
  333.     @jmode = true
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● HP の描画
  337.   #--------------------------------------------------------------------------
  338.   def draw_actor_hp_l(actor, x, y, width = 124)
  339.     @jmode = false
  340.     draw_actor_hp(actor, x, y, width)
  341.     @jmode = true
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● MP の描画
  345.   #--------------------------------------------------------------------------
  346.   def draw_actor_mp_l(actor, x, y, width = 124)
  347.     @jmode = false
  348.     draw_actor_mp(actor, x, y, width)
  349.     @jmode = true
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● シンプルなステータスの描画
  353.   #--------------------------------------------------------------------------
  354.   def draw_actor_simple_status(actor, x, y, add=120, width=124)
  355.     @jmode = false
  356.     draw_actor_name(actor, x, y, width)
  357.     draw_actor_level(actor, x, y + line_height * 1)
  358.     draw_actor_icons(actor, x, y + line_height * 2)
  359.     draw_actor_class(actor, x + add, y)
  360.     draw_actor_hp(actor, x + add, y + line_height * 1, width)
  361.     draw_actor_mp(actor, x + add, y + line_height * 2, width)
  362.     @jmode = true
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # ● シンプルなステータスの描画 <縦パターン>
  366.   #--------------------------------------------------------------------------
  367.   def draw_actor_simple_status2(actor, x, y, width=124)
  368.     @jmode = false
  369.     draw_actor_name( actor, x, y + line_height * 0, width)
  370.     draw_actor_face( actor, x+(width-96)/2, y + line_height * 1, width)
  371. #~     draw_actor_class(actor, x, y + 96 + line_height * 1, width)
  372.     draw_actor_level(actor, x, y + 96 + line_height * 2)
  373.     draw_actor_hp(   actor, x, y + 96 + line_height * 3, width)
  374.     draw_actor_mp(   actor, x, y + 96 + line_height * 4, width)
  375.     draw_actor_icons(actor, x, y + 96 + line_height * 5, width)
  376.     @jmode = true
  377.   end
  378. end
  379.  
  380.  
  381. #==============================================================================
  382. # ■ Window_J_Selectable
  383. #------------------------------------------------------------------------------
  384. #  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
  385. #==============================================================================
  386.  
  387. class Window_J_Selectable < Window_J_Base
  388.   #--------------------------------------------------------------------------
  389.   # ● 公開インスタンス変数
  390.   #--------------------------------------------------------------------------
  391.   attr_reader   :index                    # カーソル位置
  392.   attr_reader   :help_window              # ヘルプウィンドウ
  393.   attr_accessor :cursor_fix               # カーソル固定フラグ
  394.   attr_accessor :cursor_all               # カーソル全選択フラグ
  395.   #--------------------------------------------------------------------------
  396.   # ● オブジェクト初期化
  397.   #-------------------------------------------------------------------------
  398.   def initialize(x, y, width, height)
  399.     super
  400.     @index = -1
  401.     @handler = {}
  402.     @cursor_fix = false
  403.     @cursor_all = false
  404.     update_padding
  405.     deactivate
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● ウィンドウ内容の作成
  409.   #--------------------------------------------------------------------------
  410.   def create_contents
  411.     super
  412.     self.ox = contents_width - base_contents_width
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 桁数の取得
  416.   #--------------------------------------------------------------------------
  417.   def col_max
  418.     return 1
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● 縦に項目が並ぶときの空白の幅を取得
  422.   #--------------------------------------------------------------------------
  423.   def spacing
  424.     return 32
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # ● 項目数の取得
  428.   #--------------------------------------------------------------------------
  429.   def item_max
  430.     return 0
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ● 項目の高さを取得
  434.   #--------------------------------------------------------------------------
  435.   def item_height
  436.     (height - standard_padding * 2 + spacing) / col_max - spacing
  437.   end
  438.   #--------------------------------------------------------------------------
  439.   # ● 項目の高さを取得
  440.   #--------------------------------------------------------------------------
  441.   def item_width
  442.     line_width
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 行数の取得
  446.   #--------------------------------------------------------------------------
  447.   def row_max
  448.     [(item_max + col_max - 1) / col_max, 1].max
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ● ウィンドウ内容の幅を計算
  452.   #--------------------------------------------------------------------------
  453.   def contents_width
  454.     [super, row_max * item_width].max
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ● ウィンドウ内容の幅を計算
  458.   #--------------------------------------------------------------------------
  459.   def base_contents_width
  460.     width - standard_padding * 2
  461.   end
  462.   #--------------------------------------------------------------------------
  463.   # ● 下端パディングの更新
  464.   #--------------------------------------------------------------------------
  465.   def update_padding_bottom
  466.     surplus = (width - standard_padding * 2) % item_width
  467.     self.padding_bottom = padding + surplus
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ● 幅の設定
  471.   #--------------------------------------------------------------------------
  472.   def width=(width)
  473.     super
  474.     update_padding
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● アクティブ状態の変更
  478.   #--------------------------------------------------------------------------
  479.   def active=(active)
  480.     super
  481.     update_cursor
  482.     call_update_help
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● カーソル位置の設定
  486.   #--------------------------------------------------------------------------
  487.   def index=(index)
  488.     @index = index
  489.     update_cursor
  490.     call_update_help
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● 項目の選択
  494.   #--------------------------------------------------------------------------
  495.   def select(index)
  496.     self.index = index if index
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 項目の選択解除
  500.   #--------------------------------------------------------------------------
  501.   def unselect
  502.     self.index = -1
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # ● 現在の行の取得
  506.   #--------------------------------------------------------------------------
  507.   def row
  508.     index / col_max
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 先頭の行の取得
  512.   #--------------------------------------------------------------------------
  513.   def top_row
  514.     (ox - base_contents_width) / item_width
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 先頭の行の設定
  518.   #--------------------------------------------------------------------------
  519.   def top_row=(row)
  520.     row = 0 if row < 0
  521.     row = row_max - 1 if row > row_max - 1
  522.     self.ox = contents_width - base_contents_width - row * item_width
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 1 ページに表示できる行数の取得
  526.   #--------------------------------------------------------------------------
  527.   def page_row_max
  528.     base_contents_width / item_width
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ● 1 ページに表示できる項目数の取得
  532.   #--------------------------------------------------------------------------
  533.   def page_item_max
  534.     page_row_max * col_max
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ● 横選択判定
  538.   #--------------------------------------------------------------------------
  539.   def horizontal?
  540.     page_row_max == 1
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 末尾の行の取得
  544.   #--------------------------------------------------------------------------
  545.   def bottom_row
  546.     top_row + page_row_max - 1
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● 末尾の行の設定
  550.   #--------------------------------------------------------------------------
  551.   def bottom_row=(row)
  552.     self.top_row = row - (page_row_max - 1)
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 項目を描画する矩形の取得
  556.   #--------------------------------------------------------------------------
  557.   def item_rect(index)
  558.     rect = Rect.new
  559.     rect.width = item_width
  560.     rect.height = item_height
  561.     rect.x = contents_width - index / col_max * item_width - item_width
  562.     rect.y = index % col_max * (item_height + spacing)
  563.     rect
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ● 項目を描画する矩形の取得(テキスト用)
  567.   #--------------------------------------------------------------------------
  568.   def item_rect_for_text(index)
  569.     rect = item_rect(index)
  570.     rect.y += 4
  571.     rect.height -= 8
  572.     rect
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● ヘルプウィンドウの設定
  576.   #--------------------------------------------------------------------------
  577.   def help_window=(help_window)
  578.     @help_window = help_window
  579.     call_update_help
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● 動作に対応するハンドラの設定
  583.   #     method : ハンドラとして設定するメソッド (Method オブジェクト)
  584.   #--------------------------------------------------------------------------
  585.   def set_handler(symbol, method)
  586.     @handler[symbol] = method
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● ハンドラの存在確認
  590.   #--------------------------------------------------------------------------
  591.   def handle?(symbol)
  592.     @handler.include?(symbol)
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # ● ハンドラの呼び出し
  596.   #--------------------------------------------------------------------------
  597.   def call_handler(symbol)
  598.     @handler[symbol].call if handle?(symbol)
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ● カーソルの移動可能判定
  602.   #--------------------------------------------------------------------------
  603.   def cursor_movable?
  604.     active && open? && !@cursor_fix && !@cursor_all && item_max > 0
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● カーソルを下に移動
  608.   #--------------------------------------------------------------------------
  609.   def cursor_down(wrap = false)
  610.     if col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?))
  611.       select((index + 1) % item_max)
  612.     end
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● カーソルを上に移動
  616.   #--------------------------------------------------------------------------
  617.   def cursor_up(wrap = false)
  618.     if col_max >= 2 && (index > 0 || (wrap && horizontal?))
  619.       select((index - 1 + item_max) % item_max)
  620.     end
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● カーソルを右に移動
  624.   #--------------------------------------------------------------------------
  625.   def cursor_right(wrap = false)
  626.     if index >= col_max || (wrap && col_max == 1)
  627.       select((index - col_max + item_max) % item_max)
  628.     end
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ● カーソルを左に移動
  632.   #--------------------------------------------------------------------------
  633.   def cursor_left(wrap = false)
  634.     if index < item_max - col_max || (wrap && col_max == 1)
  635.       select((index + col_max) % item_max)
  636.     end
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● カーソルを 1 ページ後ろに移動
  640.   #--------------------------------------------------------------------------
  641.   def cursor_pagedown
  642.     if top_row + page_row_max < row_max
  643.       self.top_row += page_row_max
  644.       select([@index + page_item_max, item_max - 1].min)
  645.     end
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● カーソルを 1 ページ前に移動
  649.   #--------------------------------------------------------------------------
  650.   def cursor_pageup
  651.     if top_row > 0
  652.       self.top_row -= page_row_max
  653.       select([@index - page_item_max, 0].max)
  654.     end
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● フレーム更新
  658.   #--------------------------------------------------------------------------
  659.   def update
  660.     super
  661.     process_cursor_move
  662.     process_handling
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ● カーソルの移動処理
  666.   #--------------------------------------------------------------------------
  667.   def process_cursor_move
  668.     return unless cursor_movable?
  669.     last_index = @index
  670.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  671.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  672.     cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  673.     cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  674.     cursor_pagedown   if !handle?(:pagedown) && Input.trigger?(:R)
  675.     cursor_pageup     if !handle?(:pageup)   && Input.trigger?(:L)
  676.     Sound.play_cursor if @index != last_index
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 決定やキャンセルなどのハンドリング処理
  680.   #--------------------------------------------------------------------------
  681.   def process_handling
  682.     return unless open? && active
  683.     return process_ok       if ok_enabled?        && Input.trigger?(:C)
  684.     return process_cancel   if cancel_enabled?    && Input.trigger?(:B)
  685.     return process_pagedown if handle?(:pagedown) && Input.trigger?(:R)
  686.     return process_pageup   if handle?(:pageup)   && Input.trigger?(:L)
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ● 決定処理の有効状態を取得
  690.   #--------------------------------------------------------------------------
  691.   def ok_enabled?
  692.     handle?(:ok)
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● キャンセル処理の有効状態を取得
  696.   #--------------------------------------------------------------------------
  697.   def cancel_enabled?
  698.     handle?(:cancel)
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # ● 決定ボタンが押されたときの処理
  702.   #--------------------------------------------------------------------------
  703.   def process_ok
  704.     if current_item_enabled?
  705.       Sound.play_ok
  706.       Input.update
  707.       deactivate
  708.       call_ok_handler
  709.     else
  710.       Sound.play_buzzer
  711.     end
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● 決定ハンドラの呼び出し
  715.   #--------------------------------------------------------------------------
  716.   def call_ok_handler
  717.     call_handler(:ok)
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● キャンセルボタンが押されたときの処理
  721.   #--------------------------------------------------------------------------
  722.   def process_cancel
  723.     Sound.play_cancel
  724.     Input.update
  725.     deactivate
  726.     call_cancel_handler
  727.   end
  728.   #--------------------------------------------------------------------------
  729.   # ● キャンセルハンドラの呼び出し
  730.   #--------------------------------------------------------------------------
  731.   def call_cancel_handler
  732.     call_handler(:cancel)
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ● L ボタン(PageUp)が押されたときの処理
  736.   #--------------------------------------------------------------------------
  737.   def process_pageup
  738.     Sound.play_cursor
  739.     Input.update
  740.     deactivate
  741.     call_handler(:pageup)
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # ● R ボタン(PageDown)が押されたときの処理
  745.   #--------------------------------------------------------------------------
  746.   def process_pagedown
  747.     Sound.play_cursor
  748.     Input.update
  749.     deactivate
  750.     call_handler(:pagedown)
  751.   end
  752.   #--------------------------------------------------------------------------
  753.   # ● カーソルの更新
  754.   #--------------------------------------------------------------------------
  755.   def update_cursor
  756.     if @cursor_all
  757.       cursor_rect.set(0, 0, row_max * item_width, contents.height)
  758.       self.top_row = 0
  759.     elsif @index < 0
  760.       cursor_rect.empty
  761.     else
  762.       ensure_cursor_visible
  763.       cursor_rect.set(item_rect(@index))
  764.     end
  765.   end
  766.   #--------------------------------------------------------------------------
  767.   # ● カーソル位置が画面内になるようにスクロール
  768.   #--------------------------------------------------------------------------
  769.   def ensure_cursor_visible
  770.     self.top_row = row if row < top_row
  771.     self.bottom_row = row if row > bottom_row
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ● ヘルプウィンドウ更新メソッドの呼び出し
  775.   #--------------------------------------------------------------------------
  776.   def call_update_help
  777.     update_help if active && @help_window
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # ● ヘルプウィンドウの更新
  781.   #--------------------------------------------------------------------------
  782.   def update_help
  783.     @help_window.clear
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # ● 選択項目の有効状態を取得
  787.   #--------------------------------------------------------------------------
  788.   def current_item_enabled?
  789.     return true
  790.   end
  791.   #--------------------------------------------------------------------------
  792.   # ● 全項目の描画
  793.   #--------------------------------------------------------------------------
  794.   def draw_all_items
  795.     item_max.times {|i| draw_item(i) }
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # ● 項目の描画
  799.   #--------------------------------------------------------------------------
  800.   def draw_item(index)
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # ● 項目の消去
  804.   #--------------------------------------------------------------------------
  805.   def clear_item(index)
  806.     contents.clear_rect(item_rect(index))
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # ● 項目の再描画
  810.   #--------------------------------------------------------------------------
  811.   def redraw_item(index)
  812.     clear_item(index) if index >= 0
  813.     draw_item(index)  if index >= 0
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # ● 選択項目の再描画
  817.   #--------------------------------------------------------------------------
  818.   def redraw_current_item
  819.     redraw_item(@index)
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● リフレッシュ
  823.   #--------------------------------------------------------------------------
  824.   def refresh
  825.     contents.clear
  826.     draw_all_items
  827.   end
  828. end
  829.  
  830.  
  831. #==============================================================================
  832. # ■ Window_J_Help
  833. #------------------------------------------------------------------------------
  834. #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
  835. #==============================================================================
  836.  
  837. class Window_J_Help < Window_J_Base
  838.   #--------------------------------------------------------------------------
  839.   # ● オブジェクト初期化
  840.   #--------------------------------------------------------------------------
  841.   def initialize(line_number = 2)
  842.     @line_number = line_number
  843.     super(0, 0, fitting_width(line_number), Graphics.height)
  844.   end
  845.   #--------------------------------------------------------------------------
  846.   # ● テキスト設定
  847.   #--------------------------------------------------------------------------
  848.   def set_text(text)
  849.     if text != @text
  850.       @text = text
  851.       refresh
  852.     end
  853.   end
  854.   #--------------------------------------------------------------------------
  855.   # ● クリア
  856.   #--------------------------------------------------------------------------
  857.   def clear
  858.     set_text("")
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ● アイテム設定
  862.   #     item : スキル、アイテム等
  863.   #--------------------------------------------------------------------------
  864.   def set_item(item)
  865.     set_text(item ? item.description : "")
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● リフレッシュ
  869.   #--------------------------------------------------------------------------
  870.   def refresh
  871.     contents.clear
  872.     draw_text_ex((@line_number-1)*line_width, 0, @text)
  873.   end
  874. end
  875.  
  876.  
  877. #==============================================================================
  878. # ■ Window_J_Command
  879. #------------------------------------------------------------------------------
  880. #  一般的なコマンド選択を行うウィンドウです。
  881. #==============================================================================
  882.  
  883. class Window_J_Command < Window_J_Selectable
  884.   #--------------------------------------------------------------------------
  885.   # ● オブジェクト初期化
  886.   #--------------------------------------------------------------------------
  887.   def initialize(x, y)
  888.     clear_command_list
  889.     make_command_list
  890.     super(x, y, window_width, window_height)
  891.     refresh
  892.     select(0)
  893.     activate
  894.   end
  895.   #--------------------------------------------------------------------------
  896.   # ● ウィンドウ高さの取得
  897.   #--------------------------------------------------------------------------
  898.   def window_width
  899.     fitting_width(visible_line_number)
  900.   end
  901.   #--------------------------------------------------------------------------
  902.   # ● ウィンドウ高さの取得
  903.   #--------------------------------------------------------------------------
  904.   def window_height
  905.     Graphics.height
  906.   end
  907.   #--------------------------------------------------------------------------
  908.   # ● 表示行数の取得
  909.   #--------------------------------------------------------------------------
  910.   def visible_line_number
  911.     (item_max * 1.0 / col_max).round
  912.   end
  913.   #--------------------------------------------------------------------------
  914.   # ● 項目数の取得
  915.   #--------------------------------------------------------------------------
  916.   def item_max
  917.     @list.size
  918.   end
  919.   #--------------------------------------------------------------------------
  920.   # ● コマンドリストのクリア
  921.   #--------------------------------------------------------------------------
  922.   def clear_command_list
  923.     @list = []
  924.   end
  925.   #--------------------------------------------------------------------------
  926.   # ● コマンドリストの作成
  927.   #--------------------------------------------------------------------------
  928.   def make_command_list
  929.   end
  930.   #--------------------------------------------------------------------------
  931.   # ● コマンドの追加
  932.   #     name    : コマンド名
  933.   #     symbol  : 対応するシンボル
  934.   #     enabled : 有効状態フラグ
  935.   #     ext     : 任意の拡張データ
  936.   #--------------------------------------------------------------------------
  937.   def add_command(name, symbol, enabled = true, ext = nil)
  938.     @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext})
  939.   end
  940.   #--------------------------------------------------------------------------
  941.   # ● コマンド名の取得
  942.   #--------------------------------------------------------------------------
  943.   def command_name(index)
  944.     @list[index][:name]
  945.   end
  946.   #--------------------------------------------------------------------------
  947.   # ● コマンドの有効状態を取得
  948.   #--------------------------------------------------------------------------
  949.   def command_enabled?(index)
  950.     @list[index][:enabled]
  951.   end
  952.   #--------------------------------------------------------------------------
  953.   # ● 選択項目のコマンドデータを取得
  954.   #--------------------------------------------------------------------------
  955.   def current_data
  956.     index >= 0 ? @list[index] : nil
  957.   end
  958.   #--------------------------------------------------------------------------
  959.   # ● 選択項目の有効状態を取得
  960.   #--------------------------------------------------------------------------
  961.   def current_item_enabled?
  962.     current_data ? current_data[:enabled] : false
  963.   end
  964.   #--------------------------------------------------------------------------
  965.   # ● 選択項目のシンボルを取得
  966.   #--------------------------------------------------------------------------
  967.   def current_symbol
  968.     current_data ? current_data[:symbol] : nil
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # ● 選択項目の拡張データを取得
  972.   #--------------------------------------------------------------------------
  973.   def current_ext
  974.     current_data ? current_data[:ext] : nil
  975.   end
  976.   #--------------------------------------------------------------------------
  977.   # ● 指定されたシンボルを持つコマンドにカーソルを移動
  978.   #--------------------------------------------------------------------------
  979.   def select_symbol(symbol)
  980.     @list.each_index {|i| select(i) if @list[i][:symbol] == symbol }
  981.   end
  982.   #--------------------------------------------------------------------------
  983.   # ● 指定された拡張データを持つコマンドにカーソルを移動
  984.   #--------------------------------------------------------------------------
  985.   def select_ext(ext)
  986.     @list.each_index {|i| select(i) if @list[i][:ext] == ext }
  987.   end
  988.   #--------------------------------------------------------------------------
  989.   # ● 項目の描画
  990.   #--------------------------------------------------------------------------
  991.   def draw_item(index)
  992.     change_color(normal_color, command_enabled?(index))
  993.     draw_text(item_rect_for_text(index), command_name(index), alignment)
  994.   end
  995.   #--------------------------------------------------------------------------
  996.   # ● アライメントの取得
  997.   #--------------------------------------------------------------------------
  998.   def alignment
  999.     return 0
  1000.   end
  1001.   #--------------------------------------------------------------------------
  1002.   # ● 決定処理の有効状態を取得
  1003.   #--------------------------------------------------------------------------
  1004.   def ok_enabled?
  1005.     return true
  1006.   end
  1007.   #--------------------------------------------------------------------------
  1008.   # ● 決定ハンドラの呼び出し
  1009.   #--------------------------------------------------------------------------
  1010.   def call_ok_handler
  1011.     if handle?(current_symbol)
  1012.       call_handler(current_symbol)
  1013.     elsif handle?(:ok)
  1014.       super
  1015.     else
  1016.       activate
  1017.     end
  1018.   end
  1019.   #--------------------------------------------------------------------------
  1020.   # ● リフレッシュ
  1021.   #--------------------------------------------------------------------------
  1022.   def refresh
  1023.     clear_command_list
  1024.     make_command_list
  1025.     create_contents
  1026.     super
  1027.   end
  1028. end




RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <menu>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # メニュー画面変更
  5. #==============================================================================
  6.  
  7.  
  8. #==============================================================================
  9. # ■ Window_J_MenuCommand
  10. #------------------------------------------------------------------------------
  11. #  メニュー画面で表示するコマンドウィンドウです。
  12. #==============================================================================
  13.  
  14. class Window_J_MenuCommand < Window_J_Command
  15.   #--------------------------------------------------------------------------
  16.   # ● コマンド選択位置の初期化(クラスメソッド)
  17.   #--------------------------------------------------------------------------
  18.   def self.init_command_position
  19.     @@last_command_symbol = nil
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● オブジェクト初期化
  23.   #--------------------------------------------------------------------------
  24.   def initialize
  25.     super(0, 0)
  26.     self.x = Graphics.width - width
  27.     select_last
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● ウィンドウ高さの取得
  31.   #--------------------------------------------------------------------------
  32.   def window_height
  33.     140
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● コマンドリストの作成
  37.   #--------------------------------------------------------------------------
  38.   def make_command_list
  39.     add_main_commands
  40.     add_formation_command
  41.     add_original_commands
  42.     add_save_command
  43.     add_game_end_command
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 主要コマンドをリストに追加
  47.   #--------------------------------------------------------------------------
  48.   def add_main_commands
  49.     add_command(Vocab::item,   :item,   main_commands_enabled)
  50.     add_command(Vocab::skill,  :skill,  main_commands_enabled)
  51.     add_command(Vocab::equip,  :equip,  main_commands_enabled)
  52.     add_command(Vocab::status, :status, main_commands_enabled)
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 並び替えをコマンドリストに追加
  56.   #--------------------------------------------------------------------------
  57.   def add_formation_command
  58.     add_command(Vocab::formation, :formation, formation_enabled)
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● 独自コマンドの追加用
  62.   #--------------------------------------------------------------------------
  63.   def add_original_commands
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● セーブをコマンドリストに追加
  67.   #--------------------------------------------------------------------------
  68.   def add_save_command
  69.     add_command(Vocab::save, :save, save_enabled)
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● ゲーム終了をコマンドリストに追加
  73.   #--------------------------------------------------------------------------
  74.   def add_game_end_command
  75.     add_command(Vocab::game_end, :game_end)
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 主要コマンドの有効状態を取得
  79.   #--------------------------------------------------------------------------
  80.   def main_commands_enabled
  81.     $game_party.exists
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 並び替えの有効状態を取得
  85.   #--------------------------------------------------------------------------
  86.   def formation_enabled
  87.     $game_party.members.size >= 2 && !$game_system.formation_disabled
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● セーブの有効状態を取得
  91.   #--------------------------------------------------------------------------
  92.   def save_enabled
  93.     !$game_system.save_disabled
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 決定ボタンが押されたときの処理
  97.   #--------------------------------------------------------------------------
  98.   def process_ok
  99.     @@last_command_symbol = current_symbol
  100.     super
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 前回の選択位置を復帰
  104.   #--------------------------------------------------------------------------
  105.   def select_last
  106.     select_symbol(@@last_command_symbol)
  107.   end
  108. end
  109.  
  110.  
  111. #==============================================================================
  112. # ■ Window_J_MenuStatus
  113. #------------------------------------------------------------------------------
  114. #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
  115. #==============================================================================
  116.  
  117. class Window_J_MenuStatus < Window_J_Selectable
  118.   #--------------------------------------------------------------------------
  119.   # ● 公開インスタンス変数
  120.   #--------------------------------------------------------------------------
  121.   attr_reader   :pending_index            # 保留位置(並び替え用)
  122.   #--------------------------------------------------------------------------
  123.   # ● オブジェクト初期化
  124.   #--------------------------------------------------------------------------
  125.   def initialize(x, y)
  126.     super(x, y, Graphics.width, Graphics.height - y)
  127.     @pending_index = -1
  128.     refresh
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● 項目数の取得
  132.   #--------------------------------------------------------------------------
  133.   def item_max
  134.     $game_party.members.size
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 行の幅を取得
  138.   #--------------------------------------------------------------------------
  139.   def line_width
  140.     130
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 項目の高さを取得
  144.   #--------------------------------------------------------------------------
  145.   def item_height
  146.     contents_height
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 項目の描画
  150.   #--------------------------------------------------------------------------
  151.   def draw_item(index)
  152.     actor = $game_party.members[index]
  153.     enabled = $game_party.battle_members.include?(actor)
  154.     rect = item_rect_for_text(index)
  155.     draw_item_background(index)
  156.     draw_actor_simple_status2(actor, rect.x + 4, rect.y, item_width - 8)
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 項目の背景を描画
  160.   #--------------------------------------------------------------------------
  161.   def draw_item_background(index)
  162.     if index == @pending_index
  163.       contents.fill_rect(item_rect(index), pending_color)
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 決定ボタンが押されたときの処理
  168.   #--------------------------------------------------------------------------
  169.   def process_ok
  170.     super
  171.     $game_party.menu_actor = $game_party.members[index]
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 前回の選択位置を復帰
  175.   #--------------------------------------------------------------------------
  176.   def select_last
  177.     select($game_party.menu_actor.index || 0)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 保留位置(並び替え用)の設定
  181.   #--------------------------------------------------------------------------
  182.   def pending_index=(index)
  183.     last_pending_index = @pending_index
  184.     @pending_index = index
  185.     redraw_item(@pending_index)
  186.     redraw_item(last_pending_index)
  187.   end
  188. end
  189.  
  190.  
  191. #==============================================================================
  192. # ■ Scene_Map
  193. #------------------------------------------------------------------------------
  194. #  マップ画面の処理を行うクラスです。
  195. #==============================================================================
  196.  
  197. class Scene_Map < Scene_Base
  198.   #--------------------------------------------------------------------------
  199.   # ● メニュー画面の呼び出し
  200.   #--------------------------------------------------------------------------
  201.   def call_menu
  202.     Sound.play_ok
  203.     SceneManager.call(Scene_Menu)
  204.     Window_J_MenuCommand::init_command_position
  205.   end
  206. end
  207.  
  208.  
  209. #==============================================================================
  210. # ■ Scene_Menu
  211. #------------------------------------------------------------------------------
  212. #  メニュー画面の処理を行うクラスです。
  213. #==============================================================================
  214.  
  215. class Scene_Menu < Scene_MenuBase
  216.   #--------------------------------------------------------------------------
  217.   # ● コマンドウィンドウの作成
  218.   #--------------------------------------------------------------------------
  219.   def create_command_window
  220.     @command_window = Window_J_MenuCommand.new
  221.     @command_window.set_handler(:item,      method(:command_item))
  222.     @command_window.set_handler(:skill,     method(:command_personal))
  223.     @command_window.set_handler(:equip,     method(:command_personal))
  224.     @command_window.set_handler(:status,    method(:command_personal))
  225.     @command_window.set_handler(:formation, method(:command_formation))
  226.     @command_window.set_handler(:save,      method(:command_save))
  227.     @command_window.set_handler(:game_end,  method(:command_game_end))
  228.     @command_window.set_handler(:cancel,    method(:return_scene))
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● ゴールドウィンドウの作成
  232.   #--------------------------------------------------------------------------
  233.   def create_gold_window
  234.     @gold_window = Window_Gold.new
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● ステータスウィンドウの作成
  238.   #--------------------------------------------------------------------------
  239.   def create_status_window
  240.     @status_window = Window_J_MenuStatus.new(0, @command_window.height)
  241.   end
  242. end



RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <item>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # アイテム画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ Window_J_ItemCategory
  9. #------------------------------------------------------------------------------
  10. #  アイテム画面またはショップ画面で、通常アイテムや装備品の分類を選択するウィ
  11. # ンドウです。
  12. #==============================================================================
  13.  
  14. class Window_J_ItemCategory < Window_J_Command
  15.   #--------------------------------------------------------------------------
  16.   # ● 公開インスタンス変数
  17.   #--------------------------------------------------------------------------
  18.   attr_reader   :item_window
  19.   #--------------------------------------------------------------------------
  20.   # ● オブジェクト初期化
  21.   #--------------------------------------------------------------------------
  22.   def initialize
  23.     super(Graphics.width-fitting_width(1), 0)
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 桁数の取得
  27.   #--------------------------------------------------------------------------
  28.   def col_max
  29.     return 4
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● 縦に項目が並ぶときの空白の幅を取得
  33.   #--------------------------------------------------------------------------
  34.   def spacing
  35.     return 0
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● フレーム更新
  39.   #--------------------------------------------------------------------------
  40.   def update
  41.     super
  42.     @item_window.category = current_symbol if @item_window
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● コマンドリストの作成
  46.   #--------------------------------------------------------------------------
  47.   def make_command_list
  48.     add_command(Vocab::item,     :item)
  49.     add_command(Vocab::weapon,   :weapon)
  50.     add_command(Vocab::armor,    :armor)
  51.     add_command(Vocab::key_item, :key_item)
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● アイテムウィンドウの設定
  55.   #--------------------------------------------------------------------------
  56.   def item_window=(item_window)
  57.     @item_window = item_window
  58.     update
  59.   end
  60. end
  61.  
  62.  
  63. #==============================================================================
  64. # ■ Window_J_ItemList
  65. #------------------------------------------------------------------------------
  66. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  67. #==============================================================================
  68.  
  69. class Window_J_ItemList < Window_J_Selectable
  70.   #--------------------------------------------------------------------------
  71.   # ● オブジェクト初期化
  72.   #--------------------------------------------------------------------------
  73.   def initialize(x, y, width, height)
  74.     super
  75.     @category = :none
  76.     @data = []
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● カテゴリの設定
  80.   #--------------------------------------------------------------------------
  81.   def category=(category)
  82.     return if @category == category
  83.     @category = category
  84.     refresh
  85.     self.oy = 0
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 桁数の取得
  89.   #--------------------------------------------------------------------------
  90.   def col_max
  91.     return 2
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 項目数の取得
  95.   #--------------------------------------------------------------------------
  96.   def item_max
  97.     @data ? @data.size : 1
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● アイテムの取得
  101.   #--------------------------------------------------------------------------
  102.   def item
  103.     @data && index >= 0 ? @data[index] : nil
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● 選択項目の有効状態を取得
  107.   #--------------------------------------------------------------------------
  108.   def current_item_enabled?
  109.     enable?(@data[index])
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● アイテムをリストに含めるかどうか
  113.   #--------------------------------------------------------------------------
  114.   def include?(item)
  115.     case @category
  116.     when :item
  117.       item.is_a?(RPG::Item) && !item.key_item?
  118.     when :weapon
  119.       item.is_a?(RPG::Weapon)
  120.     when :armor
  121.       item.is_a?(RPG::Armor)
  122.     when :key_item
  123.       item.is_a?(RPG::Item) && item.key_item?
  124.     else
  125.       false
  126.     end
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● アイテムを許可状態で表示するかどうか
  130.   #--------------------------------------------------------------------------
  131.   def enable?(item)
  132.     $game_party.usable?(item)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● アイテムリストの作成
  136.   #--------------------------------------------------------------------------
  137.   def make_item_list
  138.     @data = $game_party.all_items.select {|item| include?(item) }
  139.     @data.push(nil) if include?(nil)
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 前回の選択位置を復帰
  143.   #--------------------------------------------------------------------------
  144.   def select_last
  145.     select(@data.index($game_party.last_item.object) || 0)
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 項目の描画
  149.   #--------------------------------------------------------------------------
  150.   def draw_item(index)
  151.     item = @data[index]
  152.     if item
  153.       rect = item_rect(index)
  154.       rect.height -= 4
  155.       draw_item_name(item, rect.x, rect.y, enable?(item))
  156.       draw_item_number(rect, item)
  157.     end
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● アイテムの個数を描画
  161.   #--------------------------------------------------------------------------
  162.   def draw_item_number(rect, item)
  163.     rect.y += rect.height - line_width
  164.     rect.height = line_width
  165.     contents.draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 1)
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● ヘルプテキスト更新
  169.   #--------------------------------------------------------------------------
  170.   def update_help
  171.     @help_window.set_item(item)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● リフレッシュ
  175.   #--------------------------------------------------------------------------
  176.   def refresh
  177.     make_item_list
  178.     create_contents
  179.     draw_all_items
  180.   end
  181. end
  182.  
  183.  
  184. #==============================================================================
  185. # ■ Scene_Item
  186. #------------------------------------------------------------------------------
  187. #  アイテム画面の処理を行うクラスです。
  188. #==============================================================================
  189.  
  190. class Scene_Item < Scene_ItemBase
  191.   #--------------------------------------------------------------------------
  192.   # ● カーソルが左列にあるかの判定
  193.   #--------------------------------------------------------------------------
  194.   def cursor_left?
  195. #~     @item_window.index % 2 == 0
  196.     true
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● ヘルプウィンドウの作成
  200.   #--------------------------------------------------------------------------
  201.   def create_help_window
  202.     @help_window = Window_J_Help.new
  203.     @help_window.viewport = @viewport
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● カテゴリウィンドウの作成
  207.   #--------------------------------------------------------------------------
  208.   def create_category_window
  209.     @category_window = Window_J_ItemCategory.new
  210.     @category_window.viewport = @viewport
  211.     @category_window.help_window = @help_window
  212.     @category_window.set_handler(:ok,     method(:on_category_ok))
  213.     @category_window.set_handler(:cancel, method(:return_scene))
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● アイテムウィンドウの作成
  217.   #--------------------------------------------------------------------------
  218.   def create_item_window
  219.     x = @help_window.width
  220.     w = Graphics.width - (@help_window.width + @category_window.width)
  221.     @item_window = Window_J_ItemList.new(x, 0, w, Graphics.height)
  222.     @item_window.viewport = @viewport
  223.     @item_window.help_window = @help_window
  224.     @item_window.set_handler(:ok,     method(:on_item_ok))
  225.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  226.     @category_window.item_window = @item_window
  227.   end
  228. end


RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <skill>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # スキル画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ Window_SkillCommand
  9. #------------------------------------------------------------------------------
  10. #  スキル画面で、コマンド(特技や魔法など)を選択するウィンドウです。
  11. #==============================================================================
  12.  
  13. class Window_J_SkillCommand < Window_J_Command
  14.   #--------------------------------------------------------------------------
  15.   # ● 公開インスタンス変数
  16.   #--------------------------------------------------------------------------
  17.   attr_reader   :skill_window
  18.   #--------------------------------------------------------------------------
  19.   # ● オブジェクト初期化
  20.   #--------------------------------------------------------------------------
  21.   def initialize(x, y)
  22.     super(x, y)
  23.     @actor = nil
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● ウィンドウ幅の取得
  27.   #--------------------------------------------------------------------------
  28.   def window_width
  29.     fitting_width(visible_line_number)
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # ● ウィンドウ幅の取得
  33.   #--------------------------------------------------------------------------
  34.   def window_height
  35.     return 120
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● アクターの設定
  39.   #--------------------------------------------------------------------------
  40.   def actor=(actor)
  41.     return if @actor == actor
  42.     @actor = actor
  43.     refresh
  44.     select_last
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 表示行数の取得
  48.   #--------------------------------------------------------------------------
  49.   def visible_line_number
  50.     return 4
  51.   end
  52.   #--------------------------------------------------------------------------
  53.   # ● コマンドリストの作成
  54.   #--------------------------------------------------------------------------
  55.   def make_command_list
  56.     return unless @actor
  57.     @actor.added_skill_types.sort.each do |stype_id|
  58.       name = $data_system.skill_types[stype_id]
  59.       add_command(name, :skill, true, stype_id)
  60.     end
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● フレーム更新
  64.   #--------------------------------------------------------------------------
  65.   def update
  66.     super
  67.     @skill_window.stype_id = current_ext if @skill_window
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● スキルウィンドウの設定
  71.   #--------------------------------------------------------------------------
  72.   def skill_window=(skill_window)
  73.     @skill_window = skill_window
  74.     update
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 前回の選択位置を復帰
  78.   #--------------------------------------------------------------------------
  79.   def select_last
  80.     skill = @actor.last_skill.object
  81.     if skill
  82.       select_ext(skill.stype_id)
  83.     else
  84.       select(0)
  85.     end
  86.   end
  87. end
  88.  
  89.  
  90. #==============================================================================
  91. # ■ Window_SkillStatus
  92. #------------------------------------------------------------------------------
  93. #  スキル画面で、スキル使用者のステータスを表示するウィンドウです。
  94. #==============================================================================
  95.  
  96. class Window_SkillStatus < Window_Base
  97.   #--------------------------------------------------------------------------
  98.   # ● ウィンドウ幅の取得
  99.   #--------------------------------------------------------------------------
  100.   def window_width
  101.     Graphics.width - fitting_height(2) - 120
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● リフレッシュ
  105.   #--------------------------------------------------------------------------
  106.   def refresh
  107.     contents.clear
  108.     return unless @actor
  109.     draw_actor_face(@actor, 0, 0)
  110.     draw_actor_simple_status(@actor, 108, line_height / 2, 90)
  111.   end
  112. end
  113.  
  114.  
  115. #==============================================================================
  116. # ■ Window_J_SkillList
  117. #------------------------------------------------------------------------------
  118. #  スキル画面で、使用できるスキルの一覧を表示するウィンドウです。
  119. #==============================================================================
  120.  
  121. class Window_J_SkillList < Window_J_Selectable
  122.   #--------------------------------------------------------------------------
  123.   # ● オブジェクト初期化
  124.   #--------------------------------------------------------------------------
  125.   def initialize(x, y, width, height)
  126.     super
  127.     @actor = nil
  128.     @stype_id = 0
  129.     @data = []
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● アクターの設定
  133.   #--------------------------------------------------------------------------
  134.   def actor=(actor)
  135.     return if @actor == actor
  136.     @actor = actor
  137.     refresh
  138.     self.oy = 0
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● スキルタイプ ID の設定
  142.   #--------------------------------------------------------------------------
  143.   def stype_id=(stype_id)
  144.     return if @stype_id == stype_id
  145.     @stype_id = stype_id
  146.     refresh
  147.     self.oy = 0
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 桁数の取得
  151.   #--------------------------------------------------------------------------
  152.   def col_max
  153.     return 1
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 項目数の取得
  157.   #--------------------------------------------------------------------------
  158.   def item_max
  159.     @data ? @data.size : 1
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● スキルの取得
  163.   #--------------------------------------------------------------------------
  164.   def item
  165.     @data && index >= 0 ? @data[index] : nil
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 選択項目の有効状態を取得
  169.   #--------------------------------------------------------------------------
  170.   def current_item_enabled?
  171.     enable?(@data[index])
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● スキルをリストに含めるかどうか
  175.   #--------------------------------------------------------------------------
  176.   def include?(item)
  177.     item && item.stype_id == @stype_id
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● スキルを許可状態で表示するかどうか
  181.   #--------------------------------------------------------------------------
  182.   def enable?(item)
  183.     @actor && @actor.usable?(item)
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● スキルリストの作成
  187.   #--------------------------------------------------------------------------
  188.   def make_item_list
  189.     @data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 前回の選択位置を復帰
  193.   #--------------------------------------------------------------------------
  194.   def select_last
  195.     select(@data.index(@actor.last_skill.object) || 0)
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 項目の描画
  199.   #--------------------------------------------------------------------------
  200.   def draw_item(index)
  201.     skill = @data[index]
  202.     if skill
  203.       rect = item_rect(index)
  204.       rect.width -= 4
  205.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  206.       draw_skill_cost(rect, skill)
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● スキルの使用コストを描画
  211.   #--------------------------------------------------------------------------
  212.   def draw_skill_cost(rect, skill)
  213.     rect.y = rect.height - line_width
  214.     rect.height = line_width
  215.     if @actor.skill_tp_cost(skill) > 0
  216.       change_color(tp_cost_color, enable?(skill))
  217.       contents.draw_text(rect, @actor.skill_tp_cost(skill), 2)
  218.     elsif @actor.skill_mp_cost(skill) > 0
  219.       change_color(mp_cost_color, enable?(skill))
  220.       contents.draw_text(rect, @actor.skill_mp_cost(skill), 2)
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● ヘルプテキスト更新
  225.   #--------------------------------------------------------------------------
  226.   def update_help
  227.     @help_window.set_item(item)
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● リフレッシュ
  231.   #--------------------------------------------------------------------------
  232.   def refresh
  233.     make_item_list
  234.     create_contents
  235.     draw_all_items
  236.   end
  237. end
  238.  
  239.  
  240. #==============================================================================
  241. # ■ Scene_Skill
  242. #------------------------------------------------------------------------------
  243. #  スキル画面の処理を行うクラスです。処理共通化の便宜上、スキルも「アイテム」
  244. # として扱っています。
  245. #==============================================================================
  246.  
  247. class Scene_Skill < Scene_ItemBase
  248.   #--------------------------------------------------------------------------
  249.   # ● カーソルが左列にあるかの判定
  250.   #--------------------------------------------------------------------------
  251.   def cursor_left?
  252. #~     @item_window.index % 2 == 0
  253.     true
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● ヘルプウィンドウの作成
  257.   #--------------------------------------------------------------------------
  258.   def create_help_window
  259.     @help_window = Window_J_Help.new
  260.     @help_window.viewport = @viewport
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● コマンドウィンドウの作成
  264.   #--------------------------------------------------------------------------
  265.   def create_command_window
  266.     @command_window = Window_J_SkillCommand.new(0, 0)
  267.     @command_window.x = Graphics.width - @command_window.width
  268.     @command_window.viewport = @viewport
  269.     @command_window.help_window = @help_window
  270.     @command_window.actor = @actor
  271.     @command_window.set_handler(:skill,    method(:command_skill))
  272.     @command_window.set_handler(:cancel,   method(:return_scene))
  273.     @command_window.set_handler(:pagedown, method(:next_actor))
  274.     @command_window.set_handler(:pageup,   method(:prev_actor))
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● ステータスウィンドウの作成
  278.   #--------------------------------------------------------------------------
  279.   def create_status_window
  280.     @status_window = Window_SkillStatus.new(@help_window.width, 0)
  281.     @status_window.viewport = @viewport
  282.     @status_window.actor = @actor
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● アイテムウィンドウの作成
  286.   #--------------------------------------------------------------------------
  287.   def create_item_window
  288.     wx = @help_window.width
  289.     wy = @status_window.height
  290.     ww = Graphics.width - wx
  291.     wh = Graphics.height - wy
  292.     @item_window = Window_J_SkillList.new(wx, wy, ww, wh)
  293.     @item_window.actor = @actor
  294.     @item_window.viewport = @viewport
  295.     @item_window.help_window = @help_window
  296.     @item_window.set_handler(:ok,     method(:on_item_ok))
  297.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  298.     @command_window.skill_window = @item_window
  299.   end
  300. end


RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <equip>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # 装備画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ Window_EquipStatus
  9. #------------------------------------------------------------------------------
  10. #  装備画面で、アクターの能力値変化を表示するウィンドウです。
  11. #==============================================================================
  12.  
  13. class Window_EquipStatus < Window_Base
  14.   #--------------------------------------------------------------------------
  15.   # ● オブジェクト初期化
  16.   #--------------------------------------------------------------------------
  17.   def initialize(x, y)
  18.     super(x, y, window_width, window_height)
  19.     @actor = nil
  20.     @temp_actor = nil
  21.     refresh
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● ウィンドウ幅の取得
  25.   #--------------------------------------------------------------------------
  26.   def window_width
  27.     Graphics.width - fitting_height(2) - fitting_height(1)
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● ウィンドウ高さの取得
  31.   #--------------------------------------------------------------------------
  32.   def window_height
  33.     fitting_height(visible_line_number)
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 表示行数の取得
  37.   #--------------------------------------------------------------------------
  38.   def visible_line_number
  39.     (7.0 / col_max).round
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 桁数の取得
  43.   #--------------------------------------------------------------------------
  44.   def col_max
  45.     return 2
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● リフレッシュ
  49.   #--------------------------------------------------------------------------
  50.   def refresh
  51.     contents.clear
  52.     draw_actor_name(@actor, 4, 0) if @actor
  53.     6.times do |i|
  54.       x = (i % col_max) * contents_width / col_max
  55.       y = line_height * (i / col_max)
  56.       draw_item(x, y+line_height, 2 + i)
  57.     end
  58.   end
  59. end
  60.  
  61.  
  62. #==============================================================================
  63. # ■ Window_J_EquipCommand
  64. #------------------------------------------------------------------------------
  65. #  スキル画面で、コマンド(装備変更、最強装備など)を選択するウィンドウです。
  66. #==============================================================================
  67.  
  68. class Window_J_EquipCommand < Window_J_Command
  69.   #--------------------------------------------------------------------------
  70.   # ● オブジェクト初期化
  71.   #--------------------------------------------------------------------------
  72.   def initialize(x, y, width)
  73.     super(x, y)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● ウィンドウ幅の取得
  77.   #--------------------------------------------------------------------------
  78.   def window_width
  79.     fitting_width(1)
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 桁数の取得
  83.   #--------------------------------------------------------------------------
  84.   def col_max
  85.     return 3
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● コマンドリストの作成
  89.   #--------------------------------------------------------------------------
  90.   def make_command_list
  91.     add_command(Vocab::equip2,   :equip)
  92.     add_command(Vocab::optimize, :optimize)
  93.     add_command(Vocab::clear,    :clear)
  94.   end
  95. end
  96.  
  97.  
  98. #==============================================================================
  99. # ■ Window_J_EquipSlot
  100. #------------------------------------------------------------------------------
  101. #  装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
  102. #==============================================================================
  103.  
  104. class Window_J_EquipSlot < Window_J_Selectable
  105.   #--------------------------------------------------------------------------
  106.   # ● 公開インスタンス変数
  107.   #--------------------------------------------------------------------------
  108.   attr_reader   :status_window            # ステータスウィンドウ
  109.   attr_reader   :item_window              # アイテムウィンドウ
  110.   #--------------------------------------------------------------------------
  111.   # ● オブジェクト初期化
  112.   #--------------------------------------------------------------------------
  113.   def initialize(x, y, height)
  114.     super(x, y, window_width, height)
  115.     @actor = nil
  116.     refresh
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ● ウィンドウ高さの取得
  120.   #--------------------------------------------------------------------------
  121.   def window_width
  122.     fitting_width(visible_line_number)
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 表示行数の取得
  126.   #--------------------------------------------------------------------------
  127.   def visible_line_number
  128.     return 5
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ● アクターの設定
  132.   #--------------------------------------------------------------------------
  133.   def actor=(actor)
  134.     return if @actor == actor
  135.     @actor = actor
  136.     refresh
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● フレーム更新
  140.   #--------------------------------------------------------------------------
  141.   def update
  142.     super
  143.     @item_window.slot_id = index if @item_window
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 項目数の取得
  147.   #--------------------------------------------------------------------------
  148.   def item_max
  149.     @actor ? @actor.equip_slots.size : 0
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● アイテムの取得
  153.   #--------------------------------------------------------------------------
  154.   def item
  155.     @actor ? @actor.equips[index] : nil
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 項目の描画
  159.   #--------------------------------------------------------------------------
  160.   def draw_item(index)
  161.     return unless @actor
  162.     rect = item_rect_for_text(index)
  163.     change_color(system_color, enable?(index))
  164.     draw_text(rect.x, rect.y, line_width, 96, slot_name(index))
  165.     draw_item_name(@actor.equips[index], rect.x, rect.y + 92, enable?(index))
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 装備スロットの名前を取得
  169.   #--------------------------------------------------------------------------
  170.   def slot_name(index)
  171.     @actor ? Vocab::etype(@actor.equip_slots[index]) : ""
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 装備スロットを許可状態で表示するかどうか
  175.   #--------------------------------------------------------------------------
  176.   def enable?(index)
  177.     @actor ? @actor.equip_change_ok?(index) : false
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 選択項目の有効状態を取得
  181.   #--------------------------------------------------------------------------
  182.   def current_item_enabled?
  183.     enable?(index)
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● ステータスウィンドウの設定
  187.   #--------------------------------------------------------------------------
  188.   def status_window=(status_window)
  189.     @status_window = status_window
  190.     call_update_help
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● アイテムウィンドウの設定
  194.   #--------------------------------------------------------------------------
  195.   def item_window=(item_window)
  196.     @item_window = item_window
  197.     update
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● ヘルプテキスト更新
  201.   #--------------------------------------------------------------------------
  202.   def update_help
  203.     super
  204.     @help_window.set_item(item) if @help_window
  205.     @status_window.set_temp_actor(nil) if @status_window
  206.   end
  207. end
  208.  
  209.  
  210. #==============================================================================
  211. # ■ Window_J_EquipItem
  212. #------------------------------------------------------------------------------
  213. #  装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
  214. #==============================================================================
  215.  
  216. class Window_J_EquipItem < Window_J_ItemList
  217.   #--------------------------------------------------------------------------
  218.   # ● 公開インスタンス変数
  219.   #--------------------------------------------------------------------------
  220.   attr_reader   :status_window            # ステータスウィンドウ
  221.   #--------------------------------------------------------------------------
  222.   # ● オブジェクト初期化
  223.   #--------------------------------------------------------------------------
  224.   def initialize(x, y, width, height)
  225.     super
  226.     @actor = nil
  227.     @slot_id = 0
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● 桁数の取得
  231.   #--------------------------------------------------------------------------
  232.   def col_max
  233.     return 1
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● アクターの設定
  237.   #--------------------------------------------------------------------------
  238.   def actor=(actor)
  239.     return if @actor == actor
  240.     @actor = actor
  241.     refresh
  242.     self.oy = 0
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 装備スロット ID の設定
  246.   #--------------------------------------------------------------------------
  247.   def slot_id=(slot_id)
  248.     return if @slot_id == slot_id
  249.     @slot_id = slot_id
  250.     refresh
  251.     self.oy = 0
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● アイテムをリストに含めるかどうか
  255.   #--------------------------------------------------------------------------
  256.   def include?(item)
  257.     return true if item == nil
  258.     return false unless item.is_a?(RPG::EquipItem)
  259.     return false if @slot_id < 0
  260.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  261.     return @actor.equippable?(item)
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● アイテムを許可状態で表示するかどうか
  265.   #--------------------------------------------------------------------------
  266.   def enable?(item)
  267.     return true
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 前回の選択位置を復帰
  271.   #--------------------------------------------------------------------------
  272.   def select_last
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ● ステータスウィンドウの設定
  276.   #--------------------------------------------------------------------------
  277.   def status_window=(status_window)
  278.     @status_window = status_window
  279.     call_update_help
  280.   end
  281.   #--------------------------------------------------------------------------
  282.   # ● ヘルプテキスト更新
  283.   #--------------------------------------------------------------------------
  284.   def update_help
  285.     super
  286.     if @actor && @status_window
  287.       temp_actor = Marshal.load(Marshal.dump(@actor))
  288.       temp_actor.force_change_equip(@slot_id, item)
  289.       @status_window.set_temp_actor(temp_actor)
  290.     end
  291.   end
  292. end
  293.  
  294.  
  295. #==============================================================================
  296. # ■ Scene_Equip
  297. #------------------------------------------------------------------------------
  298. #  装備画面の処理を行うクラスです。
  299. #==============================================================================
  300.  
  301. class Scene_Equip < Scene_MenuBase
  302.   #--------------------------------------------------------------------------
  303.   # ● ヘルプウィンドウの作成
  304.   #--------------------------------------------------------------------------
  305.   def create_help_window
  306.     @help_window = Window_J_Help.new
  307.     @help_window.viewport = @viewport
  308.   end
  309.   #--------------------------------------------------------------------------
  310.   # ● ステータスウィンドウの作成
  311.   #--------------------------------------------------------------------------
  312.   def create_status_window
  313.     @status_window = Window_EquipStatus.new(@help_window.width, 0)
  314.     @status_window.viewport = @viewport
  315.     @status_window.actor = @actor
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● コマンドウィンドウの作成
  319.   #--------------------------------------------------------------------------
  320.   def create_command_window
  321.     wx = @help_window.width + @status_window.width
  322.     @command_window = Window_J_EquipCommand.new(wx, 0, 0)
  323.     @command_window.viewport = @viewport
  324.     @command_window.help_window = @help_window
  325.     @command_window.set_handler(:equip,    method(:command_equip))
  326.     @command_window.set_handler(:optimize, method(:command_optimize))
  327.     @command_window.set_handler(:clear,    method(:command_clear))
  328.     @command_window.set_handler(:cancel,   method(:return_scene))
  329.     @command_window.set_handler(:pagedown, method(:next_actor))
  330.     @command_window.set_handler(:pageup,   method(:prev_actor))
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● スロットウィンドウの作成
  334.   #--------------------------------------------------------------------------
  335.   def create_slot_window
  336.     wx = Graphics.width - @command_window.width
  337.     wy = @status_window.height
  338.     wh = Graphics.height - wy
  339.     @slot_window = Window_J_EquipSlot.new(wx, wy, wh)
  340.     @slot_window.x -= @slot_window.width
  341.     @slot_window.viewport = @viewport
  342.     @slot_window.help_window = @help_window
  343.     @slot_window.status_window = @status_window
  344.     @slot_window.actor = @actor
  345.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  346.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● アイテムウィンドウの作成
  350.   #--------------------------------------------------------------------------
  351.   def create_item_window
  352.     wx = @help_window.width
  353.     wy = @status_window.height
  354.     ww = Graphics.width - wx - @slot_window.width - @command_window.width
  355.     wh = Graphics.height - wy
  356.     @item_window = Window_J_EquipItem.new(wx, wy, ww, wh)
  357.     @item_window.viewport = @viewport
  358.     @item_window.help_window = @help_window
  359.     @item_window.status_window = @status_window
  360.     @item_window.actor = @actor
  361.     @item_window.set_handler(:ok,     method(:on_item_ok))
  362.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  363.     @slot_window.item_window = @item_window
  364.   end
  365. end



RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <file>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # ファイル画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ SaveActor  : セーブファイル用のダミーアクター
  9. #==============================================================================
  10. class SaveActor
  11.   #--------------------------------------------------------------------------
  12.   # ● 公開インスタンス変数
  13.   #--------------------------------------------------------------------------
  14.   attr_reader :name
  15.   attr_reader :level
  16.   attr_reader :hp
  17.   attr_reader :mp
  18.   attr_reader :mhp
  19.   attr_reader :mmp
  20.   attr_reader :face_name
  21.   attr_reader :face_index
  22.   #--------------------------------------------------------------------------
  23.   # ● オブジェクト初期化
  24.   #--------------------------------------------------------------------------
  25.   def initialize(actor)
  26.     @name = actor.name
  27.     @level = actor.level
  28.     @hp = actor.hp; @mhp = actor.mhp
  29.     @mp = actor.mp; @mmp = actor.mmp
  30.     @face_name = actor.face_name
  31.     @face_index = actor.face_index
  32.     @dead = actor.dead?
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 戦闘不能判定
  36.   #--------------------------------------------------------------------------
  37.   def dead?
  38.     @dead
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● HP の割合を取得
  42.   #--------------------------------------------------------------------------
  43.   def hp_rate
  44.     @hp.to_f / @mhp
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● MP の割合を取得
  48.   #--------------------------------------------------------------------------
  49.   def mp_rate
  50.     @mmp > 0 ? @mp.to_f / @mmp : 0
  51.   end
  52. end
  53.  
  54. #==============================================================================
  55. # ■ Game_Party
  56. #==============================================================================
  57. class Game_Party < Game_Unit
  58.   #--------------------------------------------------------------------------
  59.   # ● セーブファイル表示用の顔グラフィック画像情報
  60.   #--------------------------------------------------------------------------
  61.   def member_for_savefile
  62.     members.collect { |actor| SaveActor.new(actor) }
  63.   end
  64. end
  65.  
  66. #==============================================================================
  67. # ■ DataManager
  68. #==============================================================================
  69. class << DataManager
  70.   #--------------------------------------------------------------------------
  71.   # ● セーブヘッダの作成
  72.   #--------------------------------------------------------------------------
  73.   alias make_save_header_faces make_save_header
  74.   def make_save_header
  75.     header = make_save_header_faces
  76.     header[:actors] = $game_party.member_for_savefile
  77.     header
  78.   end
  79. end
  80.  
  81.  
  82. #==============================================================================
  83. # ■ Window_J_SaveFile
  84. #------------------------------------------------------------------------------
  85. #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
  86. #==============================================================================
  87.  
  88. class Window_J_SaveFile < Window_J_Base
  89.   #--------------------------------------------------------------------------
  90.   # ● 公開インスタンス変数
  91.   #--------------------------------------------------------------------------
  92.   attr_reader   :selected                 # 選択状態
  93.   #--------------------------------------------------------------------------
  94.   # ● オブジェクト初期化
  95.   #     index : セーブファイルのインデックス
  96.   #--------------------------------------------------------------------------
  97.   def initialize(index)
  98.     lw = fitting_width(1)
  99.     dx = Graphics.width - lw
  100.     super(dx - index * lw - lw, 0, lw, window_height)
  101.     @file_index = index
  102.     refresh
  103.     @selected = false
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # ● ウィンドウ高さ
  107.   #--------------------------------------------------------------------------
  108.   def window_height
  109.     return 200
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● リフレッシュ
  113.   #--------------------------------------------------------------------------
  114.   def refresh
  115.     contents.clear
  116.     change_color(normal_color)
  117.     name = Vocab::File + " " + ConvJnum.conv(@file_index + 1)
  118.     draw_text(0, 4, line_width, contents_height, name)
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 選択状態の設定
  122.   #--------------------------------------------------------------------------
  123.   def selected=(selected)
  124.     @selected = selected
  125.     update_cursor
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● カーソルの更新
  129.   #--------------------------------------------------------------------------
  130.   def update_cursor
  131.     if @selected
  132.       cursor_rect.set(0, 0, line_width, contents_height)
  133.     else
  134.       cursor_rect.empty
  135.     end
  136.   end
  137. end
  138.  
  139.  
  140. #==============================================================================
  141. # ■ Window_J_SaveInfo
  142. #==============================================================================
  143. class Window_J_SaveInfo < Window_J_Selectable
  144.   #--------------------------------------------------------------------------
  145.   # ● オブジェクト初期化
  146.   #--------------------------------------------------------------------------
  147.   def initialize(dw, dh)
  148.     @actors = []
  149.     super(0, dh, Graphics.width - dw, Graphics.height - dh)
  150.     self.file_index = index
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● 行の幅を取得
  154.   #--------------------------------------------------------------------------
  155.   def line_width
  156.     110
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 項目の高さを取得
  160.   #--------------------------------------------------------------------------
  161.   def item_height
  162.     contents_height
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● ウィンドウ内容の高さを計算
  166.   #--------------------------------------------------------------------------
  167.   def contents_height
  168.     height - standard_padding * 2
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● 項目数の取得
  172.   #--------------------------------------------------------------------------
  173.   def item_max
  174.     return [@actors.size, 4].min
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● ファイル変更
  178.   #--------------------------------------------------------------------------
  179.   def file_index=(index)
  180.     return if @file_index == index
  181.     @file_index = index
  182.     header = DataManager.load_header(@file_index)
  183.     @actors   = !header.nil? ? header[:actors] : []
  184.     create_contents
  185.     refresh
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 項目の描画
  189.   #--------------------------------------------------------------------------
  190.   def draw_item(index)
  191.     return if @actors.empty? or @actors.nil?
  192.     actor = @actors[index]
  193.     rect = item_rect(index)
  194.     draw_actor_name_l(actor, rect.x+4, rect.y, line_width)
  195.     draw_actor_face(actor, rect.x+(line_width-96)/2, rect.y+line_height*1, !actor.dead?)
  196.     draw_actor_level_l(actor, rect.x+4, rect.y+96+line_height*1)
  197.     draw_actor_hp_l(actor, rect.x+4, rect.y+96+line_height*2, line_width-8)
  198.     draw_actor_mp_l(actor, rect.x+4, rect.y+96+line_height*3, line_width-8)
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● レベルの描画
  202.   #--------------------------------------------------------------------------
  203.   def draw_actor_level(actor, x, y)
  204.     change_color(system_color)
  205.     contents.draw_text(x, y, 32, line_height, Vocab::level_a)
  206.     change_color(normal_color)
  207.     contents.draw_text(x + 32, y, 24, line_height, actor.level, 2)
  208.   end
  209. end
  210.  
  211.  
  212. #==============================================================================
  213. # ■ Scene_File
  214. #------------------------------------------------------------------------------
  215. #  セーブ画面とロード画面の共通処理を行うクラスです。
  216. #==============================================================================
  217.  
  218. class Scene_File < Scene_MenuBase
  219.   #--------------------------------------------------------------------------
  220.   # ● ヘルプウィンドウの作成
  221.   #--------------------------------------------------------------------------
  222.   def create_help_window
  223.     @help_window = Window_J_Help.new(1)
  224.     @help_window.x = Graphics.width - @help_window.width
  225.     @help_window.set_text(help_window_text)
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● セーブファイルビューポートの作成
  229.   #--------------------------------------------------------------------------
  230.   def create_savefile_viewport
  231.     @savefile_viewport = Viewport.new
  232.     @savefile_viewport.rect.width -= @help_window.width
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● セーブファイルウィンドウの作成
  236.   #--------------------------------------------------------------------------
  237.   def create_savefile_windows
  238.     @savefile_windows = Array.new(item_max) do |i|
  239.       Window_J_SaveFile.new(i)
  240.     end
  241.     @savefile_windows.each {|window| window.viewport = @savefile_viewport }
  242.  
  243.     @info_window = Window_J_SaveInfo.new(@help_window.width, @savefile_windows[0].height)
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 選択状態の初期化
  247.   #--------------------------------------------------------------------------
  248.   def init_selection
  249.     @index = first_savefile_index
  250.     @savefile_windows[@index].selected = true
  251.     self.top_index = @index - visible_max / 2
  252.     ensure_cursor_visible
  253.     @info_window.file_index = @index
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● 項目数の取得
  257.   #--------------------------------------------------------------------------
  258.   def item_max
  259.     DataManager.savefile_max
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● 画面内に表示するセーブファイル数を取得
  263.   #--------------------------------------------------------------------------
  264.   def visible_max
  265.     @savefile_viewport.rect.width / @help_window.width
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● セーブファイルウィンドウの幅を取得
  269.   #--------------------------------------------------------------------------
  270.   def savefile_width
  271.     @savefile_windows[0].width
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 最初に選択状態にするファイルインデックスを取得
  275.   #--------------------------------------------------------------------------
  276.   def first_savefile_index
  277.     return 0
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 現在のインデックスの取得
  281.   #--------------------------------------------------------------------------
  282.   def index
  283.     @index
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 先頭のインデックスの取得
  287.   #--------------------------------------------------------------------------
  288.   def top_index
  289.     (@savefile_viewport.ox - @savefile_viewport.rect.width) / savefile_width
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 先頭のインデックスの設定
  293.   #--------------------------------------------------------------------------
  294.   def top_index=(index)
  295.     index = 0 if index < 0
  296.     index = item_max - visible_max if index > item_max - visible_max
  297.     @savefile_viewport.ox = @help_window.width - (index+1) * savefile_width
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 末尾のインデックスの取得
  301.   #--------------------------------------------------------------------------
  302.   def bottom_index
  303.     top_index + visible_max - 1
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 末尾のインデックスの設定
  307.   #--------------------------------------------------------------------------
  308.   def bottom_index=(index)
  309.     self.top_index = index - (visible_max - 1)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● セーブファイル選択の更新
  313.   #--------------------------------------------------------------------------
  314.   def update_savefile_selection
  315.     return on_savefile_ok     if Input.trigger?(:C)
  316.     return on_savefile_cancel if Input.trigger?(:B)
  317.     update_cursor
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● セーブファイル[決定]
  321.   #--------------------------------------------------------------------------
  322.   def on_savefile_ok
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● セーブファイル[キャンセル]
  326.   #--------------------------------------------------------------------------
  327.   def on_savefile_cancel
  328.     Sound.play_cancel
  329.     return_scene
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● カーソルの更新
  333.   #--------------------------------------------------------------------------
  334.   def update_cursor
  335.     last_index = @index
  336.     cursor_l(Input.trigger?(:LEFT))   if Input.repeat?(:LEFT)
  337.     cursor_r(Input.trigger?(:RIGHT))  if Input.repeat?(:RIGHT)
  338.     cursor_pagedown   if Input.trigger?(:L)
  339.     cursor_pageup     if Input.trigger?(:R)
  340.     if @index != last_index
  341.       Sound.play_cursor
  342.       @savefile_windows[last_index].selected = false
  343.       @savefile_windows[@index].selected = true
  344.     end
  345.     @info_window.file_index = @index
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● カーソルを左に移動
  349.   #--------------------------------------------------------------------------
  350.   def cursor_l(wrap)
  351.     @index = (@index + 1) % item_max if @index < item_max - 1 || wrap
  352.     ensure_cursor_visible
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● カーソルを右に移動
  356.   #--------------------------------------------------------------------------
  357.   def cursor_r(wrap)
  358.     @index = (@index - 1 + item_max) % item_max if @index > 0 || wrap
  359.     ensure_cursor_visible
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ● カーソルを 1 ページ後ろに移動
  363.   #--------------------------------------------------------------------------
  364.   def cursor_pagedown
  365.     if top_index + visible_max < item_max
  366.       self.top_index += visible_max
  367.       @index = [@index + visible_max, item_max - 1].min
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● カーソルを 1 ページ前に移動
  372.   #--------------------------------------------------------------------------
  373.   def cursor_pageup
  374.     if top_index > 0
  375.       self.top_index -= visible_max
  376.       @index = [@index - visible_max, 0].max
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● カーソル位置が画面内になるようにスクロール
  381.   #--------------------------------------------------------------------------
  382.   def ensure_cursor_visible
  383.     self.top_index = index if index < top_index
  384.     self.bottom_index = index if index > bottom_index
  385.   end
  386. end



RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <title>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # タイトル画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ Window_J_TitleCommand
  9. #------------------------------------------------------------------------------
  10. #  タイトル画面で、ニューゲーム/コンティニューを選択するウィンドウです。
  11. #==============================================================================
  12.  
  13. class Window_J_TitleCommand < Window_J_Command
  14.   #--------------------------------------------------------------------------
  15.   # ● オブジェクト初期化
  16.   #--------------------------------------------------------------------------
  17.   def initialize
  18.     super(0, 0)
  19.     update_placement
  20.     select_symbol(:continue) if continue_enabled
  21.     self.openness = 0
  22.     open
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● ウィンドウ幅の取得
  26.   #--------------------------------------------------------------------------
  27.   def window_height
  28.     return 160
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● ウィンドウ位置の更新
  32.   #--------------------------------------------------------------------------
  33.   def update_placement
  34.     self.x = 10
  35.     self.y = (Graphics.height - height) - 10
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● コマンドリストの作成
  39.   #--------------------------------------------------------------------------
  40.   def make_command_list
  41.     add_command(Vocab::new_game, :new_game)
  42.     add_command(Vocab::continue, :continue, continue_enabled)
  43.     add_command(Vocab::shutdown, :shutdown)
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● コンティニューの有効状態を取得
  47.   #--------------------------------------------------------------------------
  48.   def continue_enabled
  49.     DataManager.save_file_exists?
  50.   end
  51. end
  52.  
  53.  
  54. #==============================================================================
  55. # ■ Scene_Title
  56. #------------------------------------------------------------------------------
  57. #  タイトル画面の処理を行うクラスです。
  58. #==============================================================================
  59.  
  60. class Scene_Title < Scene_Base
  61.   #--------------------------------------------------------------------------
  62.   # ● ゲームタイトルの描画
  63.   #--------------------------------------------------------------------------
  64.   def draw_game_title
  65.     @foreground_sprite.bitmap.font.size = 48
  66.     rect = Rect.new(420, 0, Graphics.width-420, Graphics.height / 2)
  67.     @foreground_sprite.bitmap.draw_h_text(rect, $data_system.game_title)
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● コマンドウィンドウの作成
  71.   #--------------------------------------------------------------------------
  72.   def create_command_window
  73.     @command_window = Window_J_TitleCommand.new
  74.     @command_window.set_handler(:new_game, method(:command_new_game))
  75.     @command_window.set_handler(:continue, method(:command_continue))
  76.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  77.   end
  78. end




RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <battle>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # バトル画面変更
  5. #==============================================================================
  6.  
  7. class Window_BattleLog < Window_Selectable
  8.   #--------------------------------------------------------------------------
  9.   # ● 背景色の取得
  10.   #--------------------------------------------------------------------------
  11.   def back_color
  12.     Color.new(255, 255, 255, back_opacity)
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 背景の不透明度を取得
  16.   #--------------------------------------------------------------------------
  17.   def back_opacity
  18.     return 164
  19.   end
  20. end
  21.  
  22.  
  23. class Game_Troop < Game_Unit
  24.   #--------------------------------------------------------------------------
  25.   # ● 敵キャラ名の後ろにつける文字の表
  26.   #--------------------------------------------------------------------------
  27.   LETTER_TABLE_FULL = ['ノ壱','ノ弐','ノ参','ノ肆','ノ伍',
  28.                        'ノ陸','ノ漆','ノ捌','ノ玖','ノ拾']
  29. end
  30.  
  31.  
  32. #==============================================================================
  33. # ■ Game_Battler
  34. #==============================================================================
  35. class Game_Actor < Game_Battler
  36.   attr_reader :r_st   # 戦闘時のステートルーレット
  37.   #--------------------------------------------------------------------------
  38.   # ● セットアップ
  39.   #--------------------------------------------------------------------------
  40.   alias setup_rst setup
  41.   def setup(actor_id)
  42.     setup_rst(actor_id)
  43.     @r_st = FvRouletStates.new(self)
  44.   end
  45. end
  46.  
  47.  
  48.  
  49. #==============================================================================
  50. # ■ FvRouletStates
  51. #==============================================================================
  52. class FvRouletStates
  53.   WAIT = 40   # 切り替えタイミング(frame)
  54.   #--------------------------------------------------------------------------
  55.   # ● オブジェクト初期化
  56.   #--------------------------------------------------------------------------
  57.   def initialize(actor)
  58.     reset_states(actor)
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # ● ステート情報リセット
  62.   #--------------------------------------------------------------------------
  63.   def reset_states(actor)
  64.     act_sts = actor.states.select {|s| s.icon_index != 0}
  65.     return false if act_sts == @states
  66.     @states = act_sts
  67.     @index = 0
  68.     @wait = WAIT
  69.     true
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● ステート情報切り替え
  73.   #--------------------------------------------------------------------------
  74.   def next_state
  75.     @index = (@index + 1) % @states.size
  76.     @wait = WAIT
  77.     true
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● フレーム更新
  81.   #--------------------------------------------------------------------------
  82.   def update(actor)
  83.     return true if reset_states(actor)
  84.     return false if @states.size < 2
  85.     @wait -= 1
  86.     return next_state if @wait == 0
  87.     false
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● アイコンIndex
  91.   #--------------------------------------------------------------------------
  92.   def icon_index
  93.     return 0 if @states.empty?
  94.     @states[@index].icon_index
  95.   end
  96. end
  97.  
  98.  
  99. #==============================================================================
  100. # ■ Spriteset_Battle
  101. #------------------------------------------------------------------------------
  102. #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
  103. # スの内部で使用されます。
  104. #==============================================================================
  105.  
  106. class Spriteset_Battle
  107.   #--------------------------------------------------------------------------
  108.   # ● マップ画面を加工した戦闘背景用ビットマップの作成
  109.   #--------------------------------------------------------------------------
  110.   def create_blurry_background_bitmap
  111.     source = SceneManager.background_bitmap
  112.     bitmap = Bitmap.new(640, 480)
  113.     bitmap.stretch_blt(bitmap.rect, source, source.rect)
  114. #~     bitmap.radial_blur(120, 16)
  115.     bitmap.blur
  116.     bitmap
  117.   end
  118. end
  119.  
  120.  
  121. #==============================================================================
  122. # ■ Window_BattleStatus
  123. #------------------------------------------------------------------------------
  124. #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。
  125. #==============================================================================
  126.  
  127. class Window_J_BattleStatus < Window_J_Selectable
  128.   #--------------------------------------------------------------------------
  129.   # ● オブジェクト初期化
  130.   #--------------------------------------------------------------------------
  131.   def initialize
  132.     super(0, 0, window_width, window_height)
  133.     refresh
  134.     self.openness = 0
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● ウィンドウ幅の取得
  138.   #--------------------------------------------------------------------------
  139.   def item_width
  140.     base_contents_width / visible_line_number
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● ウィンドウ幅の取得
  144.   #--------------------------------------------------------------------------
  145.   def window_width
  146.     Graphics.width - 128
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● ウィンドウ高さの取得
  150.   #--------------------------------------------------------------------------
  151.   def window_height
  152.     fitting_height(visible_line_number)
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 表示行数の取得
  156.   #--------------------------------------------------------------------------
  157.   def visible_line_number
  158.     return 4
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 項目数の取得
  162.   #--------------------------------------------------------------------------
  163.   def item_max
  164.     $game_party.battle_members.size
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● HP/MP/TPの行の高さ取得
  168.   #--------------------------------------------------------------------------
  169.   def gauge_line_height
  170.     return 18
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 横に項目が並ぶときの空白の幅を取得
  174.   #--------------------------------------------------------------------------
  175.   def spacing
  176.     return 0
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● リフレッシュ
  180.   #--------------------------------------------------------------------------
  181.   def refresh
  182.     contents.clear
  183.     draw_all_items
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 項目の描画
  187.   #--------------------------------------------------------------------------
  188.   def draw_item(index)
  189.     actor = $game_party.battle_members[index]
  190.     draw_basic_area(basic_area_rect(index), actor)
  191.     draw_gauge_area(gauge_area_rect(index), actor)
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 基本エリアの矩形を取得
  195.   #--------------------------------------------------------------------------
  196.   def basic_area_rect(index)
  197.     rect = item_rect(index)
  198.     rect.height -= gauge_area_height
  199.     rect
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● ゲージエリアの矩形を取得
  203.   #--------------------------------------------------------------------------
  204.   def gauge_area_rect(index)
  205.     rect = item_rect(index)
  206.     rect.y += contents_height - gauge_area_height - 8
  207.     rect.height = gauge_area_height
  208.     rect.width -= 24
  209.     rect
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● ルーレットステートの描画矩形
  213.   #--------------------------------------------------------------------------
  214.   def rst_area_rect(index)
  215.     r= basic_area_rect(index)
  216.     Rect.new(r.x+r.width-24, contents_height - 24, 24, 24)
  217.   end
  218.   #--------------------------------------------------------------------------
  219.   # ● ゲージエリアの高さを取得
  220.   #--------------------------------------------------------------------------
  221.   def gauge_area_height
  222.     return (gauge_line_height * ($data_system.opt_display_tp ? 3 : 2))
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 基本エリアの描画
  226.   #--------------------------------------------------------------------------
  227.   def draw_basic_area(rect, actor)
  228.     draw_actor_face(actor, rect.x+2, rect.y+2, !actor.dead?)
  229.     x = rect.x + rect.width - line_width
  230.     draw_actor_name(actor, x, rect.y, item_height)
  231.     draw_roulet_st(actor, actor.index)
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● ゲージエリアの描画
  235.   #--------------------------------------------------------------------------
  236.   def draw_gauge_area(rect, actor)
  237.     if $data_system.opt_display_tp
  238.       draw_gauge_area_with_tp(rect, actor)
  239.     else
  240.       draw_gauge_area_without_tp(rect, actor)
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● ゲージエリアの描画(TP あり)
  245.   #--------------------------------------------------------------------------
  246.   def draw_gauge_area_with_tp(rect, actor)
  247.     @jmode = false
  248.     draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 0, rect.width)
  249.     draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width)
  250.     draw_actor_tp(actor, rect.x, rect.y + gauge_line_height * 2, rect.width)
  251.     @jmode = true
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● ゲージエリアの描画(TP なし)
  255.   #--------------------------------------------------------------------------
  256.   def draw_gauge_area_without_tp(rect, actor)
  257.     @jmode = false
  258.     draw_actor_hp(actor, rect.x, rect.y + gauge_line_height * 1, rect.width)
  259.     draw_actor_mp(actor, rect.x, rect.y + gauge_line_height * 2, rect.width)
  260.     @jmode = true
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 名前の描画
  264.   #--------------------------------------------------------------------------
  265.   def draw_actor_name(actor, x, y, height = 112)
  266.     change_color(hp_color(actor))
  267.     draw_text(x, y, line_width, height, actor.name)
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● アクターの顔グラフィック描画
  271.   #--------------------------------------------------------------------------
  272.   def draw_actor_face(actor, x, y, enabled = true)
  273.     bitmap = Cache.face(actor.face_name)
  274.     rect = Rect.new(actor.face_index % 4 * 96 + 14, actor.face_index / 4 * 96 + 30, 96-26, 32)
  275.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  276.     bitmap.dispose
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● ルーレットステート描画
  280.   #--------------------------------------------------------------------------
  281.   def draw_roulet_st(actor, index)
  282.     return if actor.r_st.icon_index == 0
  283.     rect = rst_area_rect(index)
  284.     draw_icon(actor.r_st.icon_index, rect.x, rect.y)
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● ルーレットステート再描画
  288.   #--------------------------------------------------------------------------
  289.   def redraw_roulet_st(actor, index)
  290.     contents.clear_rect(rst_area_rect(index))
  291.     draw_roulet_st(actor, index)
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● フレーム更新
  295.   #--------------------------------------------------------------------------
  296.   def update
  297.     super
  298.     $game_party.battle_members.each do |actor|
  299.       redraw_roulet_st(actor, actor.index) if actor.r_st.update(actor)
  300.     end
  301.   end
  302. end
  303.  
  304.  
  305. #==============================================================================
  306. # ■ Window_J_BattleActor
  307. #------------------------------------------------------------------------------
  308. #  バトル画面で、行動対象のアクターを選択するウィンドウです。
  309. #==============================================================================
  310.  
  311. class Window_J_BattleActor < Window_J_BattleStatus
  312.   #--------------------------------------------------------------------------
  313.   # ● オブジェクト初期化
  314.   #     info_viewport : 情報表示用ビューポート
  315.   #--------------------------------------------------------------------------
  316.   def initialize(info_viewport)
  317.     super()
  318.     self.y = info_viewport.rect.y
  319.     self.visible = false
  320.     self.openness = 255
  321.     @info_viewport = info_viewport
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● ウィンドウの表示
  325.   #--------------------------------------------------------------------------
  326.   def show
  327.     if @info_viewport
  328.       width_remain = Graphics.width - width
  329.       self.x = width_remain
  330.       @info_viewport.rect.width = width_remain
  331.       select(0)
  332.     end
  333.     super
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● ウィンドウの非表示
  337.   #--------------------------------------------------------------------------
  338.   def hide
  339.     @info_viewport.rect.width = Graphics.width if @info_viewport
  340.     super
  341.   end
  342. end
  343.  
  344.  
  345. #==============================================================================
  346. # ■ Window_J_PartyCommand
  347. #------------------------------------------------------------------------------
  348. #  バトル画面で、戦うか逃げるかを選択するウィンドウです。
  349. #==============================================================================
  350.  
  351. class Window_J_PartyCommand < Window_J_Command
  352.   #--------------------------------------------------------------------------
  353.   # ● オブジェクト初期化
  354.   #--------------------------------------------------------------------------
  355.   def initialize
  356.     super(0, 0)
  357.     self.openness = 0
  358.     deactivate
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● ウィンドウ幅の取得
  362.   #--------------------------------------------------------------------------
  363.   def window_width
  364.     fitting_width(visible_line_number)
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● ウィンドウ高さの取得
  368.   #--------------------------------------------------------------------------
  369.   def window_height
  370.     fitting_width(4)
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 表示行数の取得
  374.   #--------------------------------------------------------------------------
  375.   def visible_line_number
  376.     return 2
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● コマンドリストの作成
  380.   #--------------------------------------------------------------------------
  381.   def make_command_list
  382.     add_command(Vocab::fight,  :fight)
  383.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● セットアップ
  387.   #--------------------------------------------------------------------------
  388.   def setup
  389.     clear_command_list
  390.     make_command_list
  391.     refresh
  392.     select(0)
  393.     activate
  394.     open
  395.   end
  396. end
  397.  
  398.  
  399. #==============================================================================
  400. # ■ Window_J_ActorCommand
  401. #------------------------------------------------------------------------------
  402. #  バトル画面で、アクターの行動を選択するウィンドウです。
  403. #==============================================================================
  404.  
  405. class Window_J_ActorCommand < Window_J_Command
  406.   #--------------------------------------------------------------------------
  407.   # ● オブジェクト初期化
  408.   #--------------------------------------------------------------------------
  409.   def initialize
  410.     super(0, 0)
  411.     self.openness = 0
  412.     deactivate
  413.     @actor = nil
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ● ウィンドウ幅の取得
  417.   #--------------------------------------------------------------------------
  418.   def window_width
  419.     fitting_width(visible_line_number)
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● ウィンドウ高さの取得
  423.   #--------------------------------------------------------------------------
  424.   def window_height
  425.     fitting_width(4)
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● 表示行数の取得
  429.   #--------------------------------------------------------------------------
  430.   def visible_line_number
  431.     return 4
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ● コマンドリストの作成
  435.   #--------------------------------------------------------------------------
  436.   def make_command_list
  437.     return unless @actor
  438.     add_attack_command
  439.     add_skill_commands
  440.     add_guard_command
  441.     add_item_command
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 攻撃コマンドをリストに追加
  445.   #--------------------------------------------------------------------------
  446.   def add_attack_command
  447.     add_command(Vocab::attack, :attack, @actor.attack_usable?)
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● スキルコマンドをリストに追加
  451.   #--------------------------------------------------------------------------
  452.   def add_skill_commands
  453.     @actor.added_skill_types.sort.each do |stype_id|
  454.       name = $data_system.skill_types[stype_id]
  455.       add_command(name, :skill, true, stype_id)
  456.     end
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 防御コマンドをリストに追加
  460.   #--------------------------------------------------------------------------
  461.   def add_guard_command
  462.     add_command(Vocab::guard, :guard, @actor.guard_usable?)
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # ● アイテムコマンドをリストに追加
  466.   #--------------------------------------------------------------------------
  467.   def add_item_command
  468.     add_command(Vocab::item, :item)
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ● セットアップ
  472.   #--------------------------------------------------------------------------
  473.   def setup(actor)
  474.     @actor = actor
  475.     clear_command_list
  476.     make_command_list
  477.     refresh
  478.     select(0)
  479.     activate
  480.     open
  481.   end
  482. end
  483.  
  484.  
  485. #==============================================================================
  486. # ■ Window_BattleSkill
  487. #------------------------------------------------------------------------------
  488. #  バトル画面で、使用するスキルを選択するウィンドウです。
  489. #==============================================================================
  490.  
  491. class Window_J_BattleSkill < Window_J_SkillList
  492.   #--------------------------------------------------------------------------
  493.   # ● オブジェクト初期化
  494.   #     info_viewport : 情報表示用ビューポート
  495.   #--------------------------------------------------------------------------
  496.   def initialize(help_window, info_viewport)
  497.     y = help_window.height
  498.     super(0, y, Graphics.width, info_viewport.rect.y - y)
  499.     self.visible = false
  500.     @help_window = help_window
  501.     @info_viewport = info_viewport
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● ウィンドウの表示
  505.   #--------------------------------------------------------------------------
  506.   def show
  507.     select_last
  508.     @help_window.show
  509.     super
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● ウィンドウの非表示
  513.   #--------------------------------------------------------------------------
  514.   def hide
  515.     @help_window.hide
  516.     super
  517.   end
  518. end
  519.  
  520.  
  521. #==============================================================================
  522. # ■ Window_J_BattleItem
  523. #------------------------------------------------------------------------------
  524. #  バトル画面で、使用するアイテムを選択するウィンドウです。
  525. #==============================================================================
  526.  
  527. class Window_J_BattleItem < Window_J_ItemList
  528.   #--------------------------------------------------------------------------
  529.   # ● オブジェクト初期化
  530.   #     info_viewport : 情報表示用ビューポート
  531.   #--------------------------------------------------------------------------
  532.   def initialize(help_window, info_viewport)
  533.     y = help_window.height
  534.     super(0, y, Graphics.width, info_viewport.rect.y - y)
  535.     self.visible = false
  536.     @help_window = help_window
  537.     @info_viewport = info_viewport
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● 桁数の取得
  541.   #--------------------------------------------------------------------------
  542.   def col_max
  543.     return 1
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ● アイテムをリストに含めるかどうか
  547.   #--------------------------------------------------------------------------
  548.   def include?(item)
  549.     $game_party.usable?(item)
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● ウィンドウの表示
  553.   #--------------------------------------------------------------------------
  554.   def show
  555.     select_last
  556.     @help_window.show
  557.     super
  558.   end
  559.   #--------------------------------------------------------------------------
  560.   # ● ウィンドウの非表示
  561.   #--------------------------------------------------------------------------
  562.   def hide
  563.     @help_window.hide
  564.     super
  565.   end
  566. end
  567.  
  568.  
  569. #==============================================================================
  570. # ■ Scene_Battle
  571. #------------------------------------------------------------------------------
  572. #  バトル画面の処理を行うクラスです。
  573. #==============================================================================
  574.  
  575. class Scene_Battle < Scene_Base
  576.   #--------------------------------------------------------------------------
  577.   # ● パーティコマンドウィンドウの作成
  578.   #--------------------------------------------------------------------------
  579.   def create_party_command_window
  580.     @party_command_window = Window_J_PartyCommand.new
  581.     @party_command_window.x = Graphics.width
  582.     @party_command_window.viewport = @info_viewport
  583.     @party_command_window.set_handler(:fight,  method(:command_fight))
  584.     @party_command_window.set_handler(:escape, method(:command_escape))
  585.     @party_command_window.unselect
  586.   end
  587.   #--------------------------------------------------------------------------
  588.   # ● アクターコマンドウィンドウの作成
  589.   #--------------------------------------------------------------------------
  590.   def create_actor_command_window
  591.     @actor_command_window = Window_J_ActorCommand.new
  592.     @actor_command_window.viewport = @info_viewport
  593.     @actor_command_window.set_handler(:attack, method(:command_attack))
  594.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  595.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  596.     @actor_command_window.set_handler(:item,   method(:command_item))
  597.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  598.     @actor_command_window.x = Graphics.width
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ● ステータスウィンドウの作成
  602.   #--------------------------------------------------------------------------
  603.   def create_status_window
  604.     @status_window = Window_J_BattleStatus.new
  605.     @status_window.x = 128
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● アクターウィンドウの作成
  609.   #--------------------------------------------------------------------------
  610.   def create_actor_window
  611.     @actor_window = Window_J_BattleActor.new(@info_viewport)
  612.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  613.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● スキルウィンドウの作成
  617.   #--------------------------------------------------------------------------
  618.   def create_skill_window
  619.     @skill_window = Window_J_BattleSkill.new(@help_window, @info_viewport)
  620.     @skill_window.set_handler(:ok,     method(:on_skill_ok))
  621.     @skill_window.set_handler(:cancel, method(:on_skill_cancel))
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ● アイテムウィンドウの作成
  625.   #--------------------------------------------------------------------------
  626.   def create_item_window
  627.     @item_window = Window_J_BattleItem.new(@help_window, @info_viewport)
  628.     @item_window.set_handler(:ok,     method(:on_item_ok))
  629.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● 情報表示ビューポートの更新
  633.   #--------------------------------------------------------------------------
  634.   def update_info_viewport
  635.     move_info_viewport(@party_command_window.width)  if @party_command_window.active
  636.     move_info_viewport(@actor_command_window.width) if @actor_command_window.active
  637.     move_info_viewport(64)  if BattleManager.in_turn?
  638.   end
  639. end




RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-31 和風レイアウト <end>          by Claimh
  3. #------------------------------------------------------------------------------
  4. # 終了画面変更
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8. # ■ Window_GameEnd
  9. #------------------------------------------------------------------------------
  10. #  ゲーム終了画面で、タイトルへ/シャットダウンを選択するウィンドウです。
  11. #==============================================================================
  12.  
  13. class Window_J_GameEnd < Window_J_Command
  14.   #--------------------------------------------------------------------------
  15.   # ● オブジェクト初期化
  16.   #--------------------------------------------------------------------------
  17.   def initialize
  18.     super(0, 0)
  19.     update_placement
  20.     self.openness = 0
  21.     open
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● ウィンドウ高さの取得
  25.   #--------------------------------------------------------------------------
  26.   def window_height
  27.     return 160
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● ウィンドウ位置の更新
  31.   #--------------------------------------------------------------------------
  32.   def update_placement
  33.     self.x = (Graphics.width - width) / 2
  34.     self.y = (Graphics.height - height) / 2
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● コマンドリストの作成
  38.   #--------------------------------------------------------------------------
  39.   def make_command_list
  40.     add_command(Vocab::to_title, :to_title)
  41.     add_command(Vocab::shutdown, :shutdown)
  42.     add_command(Vocab::cancel,   :cancel)
  43.   end
  44. end
  45.  
  46.  
  47. #==============================================================================
  48. # ■ Scene_End
  49. #------------------------------------------------------------------------------
  50. #  ゲーム終了画面の処理を行うクラスです。
  51. #==============================================================================
  52.  
  53. class Scene_End < Scene_MenuBase
  54.   #--------------------------------------------------------------------------
  55.   # ● コマンドウィンドウの作成
  56.   #--------------------------------------------------------------------------
  57.   def create_command_window
  58.     @command_window = Window_J_GameEnd.new
  59.     @command_window.set_handler(:to_title, method(:command_to_title))
  60.     @command_window.set_handler(:shutdown, method(:command_shutdown))
  61.     @command_window.set_handler(:cancel,   method(:return_scene))
  62.   end
  63. end


点评

楼主如果把它汉化就更好了  发表于 2012-7-24 18:59

Lv1.梦旅人

梦石
0
星屑
124
在线时间
276 小时
注册时间
2008-5-28
帖子
120
2
发表于 2012-7-22 18:35:34 | 只看该作者
横排的叫“菜单”,这竖排的实在不像“菜单”,像科举的金榜
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
76 小时
注册时间
2012-7-4
帖子
120
3
发表于 2012-7-22 19:36:50 | 只看该作者
黑衣客 发表于 2012-7-22 18:35
横排的叫“菜单”,这竖排的实在不像“菜单”,像科举的金榜

哈哈     恭喜大侠上榜了!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
45
在线时间
138 小时
注册时间
2011-11-15
帖子
216
4
发表于 2012-7-28 23:19:12 手机端发表。 | 只看该作者
表示支持,但是竖的菜单添加内容也要重新写了,愁
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-2 15:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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