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

Project1

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

[已经过期] 横版菜单脚本问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
135 小时
注册时间
2012-6-14
帖子
43
跳转到指定楼层
1
发表于 2014-1-16 19:38:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 kkwo 于 2014-1-16 19:49 编辑

如题
功能都算正常...只有一点...
就是立绘的图全都挤在第一个...

如上图
请问要改哪才能让他正常分佈?
或是有别的横版菜单脚本?
附上脚本...
RUBY 代码复制
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-42 メニュー画面-改2 [Ver.1.1.0]       by Claimh
  3. #------------------------------------------------------------------------------
  4. # メニュー画面の表示を変更します
  5. #------------------------------------------------------------------------------
  6. # 立ち絵は Graphics/Pictures 以下の
  7. # Actor{アクターID} を表示します(アクター1 : Actor1.png)
  8. #------------------------------------------------------------------------------
  9. # ●立ち絵の変更
  10. #   $game_actors[アクターID].m_picture = "ファイル名"
  11. #==============================================================================
  12.  
  13.  
  14. #==============================================================================
  15. # ■ Window_Base
  16. #==============================================================================
  17. class Window_Base < Window
  18.   #--------------------------------------------------------------------------
  19.   # ● ステートおよび強化/弱体のアイコンを描画
  20.   #--------------------------------------------------------------------------
  21.   def draw_actor_icons_r(actor, x, y, width = 96)
  22.     icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
  23.     x += width - 24 * icons.size
  24.     icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) }
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● アクターの立ち絵描画
  28.   #--------------------------------------------------------------------------
  29.   def draw_actor_menu_picture(actor, x, y, width, height, enabled = true)
  30.     bitmap = Cache.picture(actor.m_picture)
  31.     xx = (bitmap.width  > width)  ? ((bitmap.width - width) / 2) : 0
  32.     ww = (bitmap.width  > width)  ? width : bitmap.width
  33.     yy = (bitmap.height > height) ? ((bitmap.height - height) / 2) : 0
  34.     hh = (bitmap.height > height) ? height : bitmap.height
  35.     rect = Rect.new(xx, yy, ww, hh)
  36.     xx = (bitmap.width  < width)  ? ((width - bitmap.width) / 2) : x
  37.     yy = (bitmap.height < height) ? ((height - bitmap.height) / 2) : y
  38.     contents.blt(xx, yy, bitmap, rect, enabled ? 255 : translucent_alpha)
  39.     bitmap.dispose
  40.   end
  41. end
  42.  
  43. #==============================================================================
  44. # ■ Game_Actor
  45. #==============================================================================
  46. class Game_Actor < Game_Battler
  47.   #--------------------------------------------------------------------------
  48.   # ● 公開インスタンス変数
  49.   #--------------------------------------------------------------------------
  50.   attr_accessor :m_picture             # menu立ち絵
  51.   #--------------------------------------------------------------------------
  52.   # ● セットアップ
  53.   #--------------------------------------------------------------------------
  54.   alias setup_menu_picture setup
  55.   def setup(actor_id)
  56.     setup_menu_picture(actor_id)
  57.     @m_picture = "Actor#{actor_id}"
  58.   end
  59. end
  60.  
  61.  
  62. #==============================================================================
  63. # ■ Window_MenuCommand
  64. #==============================================================================
  65. class Window_MenuCommand < Window_Command
  66.   #--------------------------------------------------------------------------
  67.   # ● 桁数の取得
  68.   #--------------------------------------------------------------------------
  69.   def col_max
  70.     4
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● ウィンドウ幅の取得
  74.   #--------------------------------------------------------------------------
  75.   def window_width
  76.     Graphics.width
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 表示行数の取得
  80.   #--------------------------------------------------------------------------
  81.   def visible_line_number
  82.     2 #item_max
  83.   end
  84. end
  85.  
  86.  
  87. #==============================================================================
  88. # ■ Window_HorzMenuStatus
  89. #==============================================================================
  90. class Window_HorzMenuStatus < Window_HorzCommand
  91.   WIN = false # ウィンドウ表示あり
  92.   #--------------------------------------------------------------------------
  93.   # ● 公開インスタンス変数
  94.   #--------------------------------------------------------------------------
  95.   attr_reader   :pending_index            # 保留位置(並び替え用)
  96.   #--------------------------------------------------------------------------
  97.   # ● オブジェクト初期化
  98.   #--------------------------------------------------------------------------
  99.   def initialize(x, y)
  100.     @pending_index = -1
  101.     @top_y = y
  102.     WIN ? super(x, y) : super(x-standard_padding, y-standard_padding)
  103.     self.opacity = 0 unless WIN
  104.     unselect
  105.     deactivate
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 先頭の桁の設定  ※Window_HorzCommandバグ回避
  109.   #--------------------------------------------------------------------------
  110.   def top_col=(col)
  111.     col = 0 if col < 0
  112.     col = (item_max / visible_line_number) - 1 if col > (item_max / visible_line_number) - 1
  113.     self.ox = col * (item_width + spacing)
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● 項目数の取得
  117.   #--------------------------------------------------------------------------
  118.   def item_max
  119.     $game_party.members.size
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 桁数の取得
  123.   #--------------------------------------------------------------------------
  124.   def col_max
  125.     4
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 表示行数の取得
  129.   #--------------------------------------------------------------------------
  130.   def visible_line_number
  131.     1
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 横に項目が並ぶときの空白の幅を取得
  135.   #--------------------------------------------------------------------------
  136.   def spacing
  137.     return 0
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● ウィンドウ幅の取得
  141.   #--------------------------------------------------------------------------
  142.   def window_width
  143.     Graphics.width + (WIN ? 0 : standard_padding * 2)
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● ウィンドウ高さの取得
  147.   #--------------------------------------------------------------------------
  148.   def window_height
  149.     Graphics.height - @top_y - fitting_height(1) + (WIN ? 0 : standard_padding * 2)
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 項目の高さを取得
  153.   #--------------------------------------------------------------------------
  154.   def item_height
  155.     height - standard_padding * 2
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 選択項目の有効状態を取得
  159.   #--------------------------------------------------------------------------
  160.   def current_item_enabled?
  161.     true
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● 項目の描画
  165.   #--------------------------------------------------------------------------
  166.   def draw_item(index)
  167.     actor = $game_party.members[index]
  168.     enabled = $game_party.battle_members.include?(actor)
  169.     rect = item_rect_for_text(index)
  170.     draw_item_background(index)
  171.     draw_actor_status(actor, rect.x, rect.y, rect.width, rect.height-2)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 背景色の取得
  175.   #--------------------------------------------------------------------------
  176.   def back_color
  177.     Color.new(0, 0, 0)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● ステータス背景描画
  181.   #--------------------------------------------------------------------------
  182.   def draw_status_back(rect)
  183.     b = Bitmap.new(rect.width, rect.height)
  184.     r = Rect.new(0, 0, rect.width, rect.height)
  185.     b.fill_rect(r, back_color)
  186.     contents.blt(rect.x, rect.y, b, r, 128)
  187.     b.dispose
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● アクターステータス描画
  191.   #--------------------------------------------------------------------------
  192.   def draw_actor_status(actor, x, y, width, height)
  193.     draw_actor_menu_picture(actor, x, y + line_height / 2, width, height - (y + line_height / 2))
  194.     draw_status_back(Rect.new(x, y + 4, width, line_height))
  195.     draw_actor_name( actor, x, y + 4, width)
  196.     draw_actor_icons_r(actor, x, y + 4 + line_height * 1, width)
  197.     y = height - line_height * 4 - 4
  198.     draw_status_back(Rect.new(x, y, width, line_height * 4 + 4))
  199.     draw_actor_class(actor, x, y + line_height * 0, width)
  200.     draw_actor_level(actor, x+width-60, y + line_height * 1)
  201.     draw_actor_hp(   actor, x+4, y + line_height * 2, width - 8)
  202.     draw_actor_mp(   actor, x+4, y + line_height * 3, width - 8)
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 項目の背景を描画
  206.   #--------------------------------------------------------------------------
  207.   def draw_item_background(index)
  208.     if index == @pending_index
  209.       contents.fill_rect(item_rect(index), pending_color)
  210.     end
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 決定ボタンが押されたときの処理
  214.   #--------------------------------------------------------------------------
  215.   def process_ok
  216.     super
  217.     $game_party.menu_actor = $game_party.members[index]
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 前回の選択位置を復帰
  221.   #--------------------------------------------------------------------------
  222.   def select_last
  223.     select($game_party.menu_actor.index || 0)
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 保留位置(並び替え用)の設定
  227.   #--------------------------------------------------------------------------
  228.   def pending_index=(index)
  229.     last_pending_index = @pending_index
  230.     @pending_index = index
  231.     redraw_item(@pending_index)
  232.     redraw_item(last_pending_index)
  233.   end
  234. end
  235.  
  236. #==============================================================================
  237. # ■ Window_MenuMap
  238. #==============================================================================
  239. class Window_MenuMap < Window_Base
  240.   #--------------------------------------------------------------------------
  241.   # ● オブジェクト初期化
  242.   #--------------------------------------------------------------------------
  243.   def initialize(x, y)
  244.     super(x, y, Graphics.width - 160, fitting_height(1))
  245.     refresh
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● リフレッシュ
  249.   #--------------------------------------------------------------------------
  250.   def refresh
  251.     contents.clear
  252.     draw_text(4, 0, contents_width, line_height, $game_map.display_name)
  253.   end
  254. end
  255.  
  256.  
  257. class Sprite_MenuBack < Sprite
  258.   #--------------------------------------------------------------------------
  259.   # ● オブジェクト初期化
  260.   #--------------------------------------------------------------------------
  261.   def initialize(viewport, x, y, h)
  262.     super(viewport)
  263.     self.x = x
  264.     self.y = y
  265.     self.bitmap = Bitmap.new(Graphics.width, h)
  266.     self.bitmap.fill_rect(0, 0, Graphics.width, h, Color.new(0,0,0,128))
  267.   end
  268. end
  269.  
  270.  
  271. #==============================================================================
  272. # ■ Scene_Menu
  273. #==============================================================================
  274. class Scene_Menu < Scene_MenuBase
  275.   #--------------------------------------------------------------------------
  276.   # ● ゴールドウィンドウの作成
  277.   #--------------------------------------------------------------------------
  278.   def create_gold_window
  279.     @gold_window = Window_Gold.new
  280.     @gold_window.x = Graphics.width  - @gold_window.width
  281.     @gold_window.y = Graphics.height - @gold_window.height
  282.     @map_window  = Window_MenuMap.new(0, @gold_window.y)
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● ステータスウィンドウの作成
  286.   #--------------------------------------------------------------------------
  287.   def create_status_window
  288.     @status_window = Window_HorzMenuStatus.new(0, @command_window.height)
  289.   end
  290. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-26 22:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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