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

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: 月歌子
打印 上一主题 下一主题

[已经解决] 菜單頭像大小的修改(9樓新問題0920)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
帖子
29
11
 楼主| 发表于 2014-9-20 21:03:37 | 只看该作者
本帖最后由 月歌子 于 2015-11-11 21:54 编辑
taroxd 发表于 2014-9-20 20:46
插在下面试试看。不保证成功

class SaveActor


謝謝你,我試過了,不過好像沒有辦法


這邊附上我依樣畫葫蘆(^^"")結果出現9樓問題的修改的腳本


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; [url=home.php?mod=space&uid=474067]@MMP[/url] = actor.mmp
  30.     @face_name = actor.face_name
  31.     @face_index = actor.face_index
  32.     [url=home.php?mod=space&uid=89503]@deAd[/url] = 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. # ■ Window_J_SaveInfo
  141. #==============================================================================
  142. class Window_J_SaveInfo < Window_J_Selectable
  143.   #--------------------------------------------------------------------------
  144.   # ● オブジェクト初期化
  145.   #--------------------------------------------------------------------------
  146.   def initialize(dw, dh)
  147.     @actors = []
  148.     super(0, dh, Graphics.width - dw, Graphics.height - dh)
  149.     self.file_index = index
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 行の幅を取得
  153.   #--------------------------------------------------------------------------
  154.   def line_width
  155.     110
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 項目の高さを取得
  159.   #--------------------------------------------------------------------------
  160.   def item_height
  161.     contents_height
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● ウィンドウ内容の高さを計算
  165.   #--------------------------------------------------------------------------
  166.   def contents_height
  167.     height - standard_padding * 2
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 項目数の取得
  171.   #--------------------------------------------------------------------------
  172.   def item_max
  173.     return [@actors.size, 4].min
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● ファイル変更
  177.   #--------------------------------------------------------------------------
  178.   def file_index=(index)
  179.     return if @file_index == index
  180.     @file_index = index
  181.     header = DataManager.load_header(@file_index)
  182.     @actors   = !header.nil? ? header[:actors] : []
  183.     create_contents
  184.     refresh
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 項目の描画
  188.   #--------------------------------------------------------------------------
  189.   def draw_item(index)
  190.     return if @actors.empty? or @actors.nil?
  191.     actor = @actors[index]
  192.     rect = item_rect(index)
  193.     draw_actor_slmenu_picture( actor, x, y, width ,height,)
  194.     draw_name_back(Rect.new(x, y + 4, width, line_height))
  195.     draw_actor_name_l(actor, rect.x+4, rect.y+20, line_width)
  196.     draw_actor_face(actor, rect.x+(line_width-96)/2, rect.y+line_height*2, !actor.dead?)
  197.     #draw_actor_level_l(actor, rect.x+4, rect.y+96+line_height*1)
  198.     #draw_actor_hp_l(actor, rect.x+4, rect.y+96+line_height*2, line_width-8)
  199.     #draw_actor_mp_l(actor, rect.x+4, rect.y+96+line_height*3, line_width-8)
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● レベルの描画
  203.   #--------------------------------------------------------------------------
  204.   def draw_actor_level(actor, x, y)
  205.     change_color(system_color)
  206.     contents.draw_text(x, y, 32, line_height, Vocab::level_a)
  207.     change_color(normal_color)
  208.     contents.draw_text(x + 32, y, 24, line_height, actor.level, 2)
  209.   end
  210. #--------------------------------------------------------------------------
  211.   # ● 背景色の取得
  212.   #--------------------------------------------------------------------------
  213.   def back_color
  214.     Color.new(0, 0, 0)
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # ● ステータス背景描畫
  218.   #--------------------------------------------------------------------------
  219.   def draw_name_back(rect)
  220.     b = Bitmap.new(rect.width, rect.height)
  221.     r = Rect.new(0, 0, rect.width, rect.height)
  222.     b.fill_rect(r, back_color)
  223.     contents.blt(rect.x, rect.y, b, r, 128)
  224.     b.dispose
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● アクターの立ち絵描画
  228.   #--------------------------------------------------------------------------
  229.    def draw_actor_slmenu_picture(actor, x, y, width, height, enabled = true)
  230.     bitmap = Cache.picture(actor.m_picture)
  231.     xx = (bitmap.width  > width)  ? ((bitmap.width - width) / 2) : 0
  232.     ww = (bitmap.width  > width)  ? width : bitmap.width
  233.     yy = (bitmap.height > height) ? ((bitmap.height - height) / 2) : 0
  234.     hh = (bitmap.height > height) ? height : bitmap.height
  235.     rect = Rect.new(xx, yy, ww, hh)
  236.     xx = (bitmap.width  < width)  ? ((width - bitmap.width) / 2) : x
  237.     yy = (bitmap.height < height) ? ((height - bitmap.height) / 2) : y
  238.     contents.blt(xx, yy, bitmap, rect, enabled ? 255 : translucent_alpha)
  239.     bitmap.dispose
  240.   end
  241. end
  242.  
  243. class Game_Actor < Game_Battler
  244.   #--------------------------------------------------------------------------
  245.   # ● 公開インスタンス変数
  246.   #--------------------------------------------------------------------------
  247.   attr_accessor :m_picture             # menu立ち絵
  248.   #--------------------------------------------------------------------------
  249.   # ● セットアップ
  250.   #--------------------------------------------------------------------------
  251.   alias setup_slmenu_picture setup
  252.   def setup(actor_id)
  253.     setup_menu_picture(actor_id)
  254.     @m_picture = "Actor#{actor_id}"
  255.   end
  256. end
  257.  
  258. #==============================================================================
  259. # ■ Scene_File
  260. #------------------------------------------------------------------------------
  261. #  セーブ画面とロード画面の共通処理を行うクラスです。
  262. #==============================================================================
  263.  
  264. class Scene_File < Scene_MenuBase
  265.   #--------------------------------------------------------------------------
  266.   # ● ヘルプウィンドウの作成
  267.   #--------------------------------------------------------------------------
  268.   def create_help_window
  269.     @help_window = Window_J_Help.new(1)
  270.     @help_window.x = Graphics.width - @help_window.width
  271.     @help_window.set_text(help_window_text)
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● セーブファイルビューポートの作成
  275.   #--------------------------------------------------------------------------
  276.   def create_savefile_viewport
  277.     @savefile_viewport = Viewport.new
  278.     @savefile_viewport.rect.width -= @help_window.width
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● セーブファイルウィンドウの作成
  282.   #--------------------------------------------------------------------------
  283.   def create_savefile_windows
  284.     @savefile_windows = Array.new(item_max) do |i|
  285.       Window_J_SaveFile.new(i)
  286.     end
  287.     @savefile_windows.each {|window| window.viewport = @savefile_viewport }
  288.  
  289.     @info_window = Window_J_SaveInfo.new(@help_window.width, @savefile_windows[0].height)
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 選択状態の初期化
  293.   #--------------------------------------------------------------------------
  294.   def init_selection
  295.     @index = first_savefile_index
  296.     @savefile_windows[@index].selected = true
  297.     self.top_index = @index - visible_max / 2
  298.     ensure_cursor_visible
  299.     @info_window.file_index = @index
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 項目数の取得
  303.   #--------------------------------------------------------------------------
  304.   def item_max
  305.     DataManager.savefile_max
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 画面内に表示するセーブファイル数を取得
  309.   #--------------------------------------------------------------------------
  310.   def visible_max
  311.     @savefile_viewport.rect.width / @help_window.width
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● セーブファイルウィンドウの幅を取得
  315.   #--------------------------------------------------------------------------
  316.   def savefile_width
  317.     @savefile_windows[0].width
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ● 最初に選択状態にするファイルインデックスを取得
  321.   #--------------------------------------------------------------------------
  322.   def first_savefile_index
  323.     return 0
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 現在のインデックスの取得
  327.   #--------------------------------------------------------------------------
  328.   def index
  329.     @index
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 先頭のインデックスの取得
  333.   #--------------------------------------------------------------------------
  334.   def top_index
  335.     (@savefile_viewport.ox - @savefile_viewport.rect.width) / savefile_width
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● 先頭のインデックスの設定
  339.   #--------------------------------------------------------------------------
  340.   def top_index=(index)
  341.     index = 0 if index < 0
  342.     index = item_max - visible_max if index > item_max - visible_max
  343.     @savefile_viewport.ox = @help_window.width - (index+1) * savefile_width
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 末尾のインデックスの取得
  347.   #--------------------------------------------------------------------------
  348.   def bottom_index
  349.     top_index + visible_max - 1
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 末尾のインデックスの設定
  353.   #--------------------------------------------------------------------------
  354.   def bottom_index=(index)
  355.     self.top_index = index - (visible_max - 1)
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● セーブファイル選択の更新
  359.   #--------------------------------------------------------------------------
  360.   def update_savefile_selection
  361.     return on_savefile_ok     if Input.trigger?(:C)
  362.     return on_savefile_cancel if Input.trigger?(:B)
  363.     update_cursor
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● セーブファイル[決定]
  367.   #--------------------------------------------------------------------------
  368.   def on_savefile_ok
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● セーブファイル[キャンセル]
  372.   #--------------------------------------------------------------------------
  373.   def on_savefile_cancel
  374.     Sound.play_cancel
  375.     return_scene
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # ● カーソルの更新
  379.   #--------------------------------------------------------------------------
  380.   def update_cursor
  381.     last_index = @index
  382.     cursor_l(Input.trigger?(:LEFT))   if Input.repeat?(:LEFT)
  383.     cursor_r(Input.trigger?(:RIGHT))  if Input.repeat?(:RIGHT)
  384.     cursor_pagedown   if Input.trigger?(:L)
  385.     cursor_pageup     if Input.trigger?(:R)
  386.     if @index != last_index
  387.       Sound.play_cursor
  388.       @savefile_windows[last_index].selected = false
  389.       @savefile_windows[@index].selected = true
  390.     end
  391.     @info_window.file_index = @index
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ● カーソルを左に移動
  395.   #--------------------------------------------------------------------------
  396.   def cursor_l(wrap)
  397.     @index = (@index + 1) % item_max if @index < item_max - 1 || wrap
  398.     ensure_cursor_visible
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● カーソルを右に移動
  402.   #--------------------------------------------------------------------------
  403.   def cursor_r(wrap)
  404.     @index = (@index - 1 + item_max) % item_max if @index > 0 || wrap
  405.     ensure_cursor_visible
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● カーソルを 1 ページ後ろに移動
  409.   #--------------------------------------------------------------------------
  410.   def cursor_pagedown
  411.     if top_index + visible_max < item_max
  412.       self.top_index += visible_max
  413.       @index = [@index + visible_max, item_max - 1].min
  414.     end
  415.   end
  416.   #--------------------------------------------------------------------------
  417.   # ● カーソルを 1 ページ前に移動
  418.   #--------------------------------------------------------------------------
  419.   def cursor_pageup
  420.     if top_index > 0
  421.       self.top_index -= visible_max
  422.       @index = [@index - visible_max, 0].max
  423.     end
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● カーソル位置が画面内になるようにスクロール
  427.   #--------------------------------------------------------------------------
  428.   def ensure_cursor_visible
  429.     self.top_index = index if index < top_index
  430.     self.bottom_index = index if index > bottom_index
  431.   end
  432. end
  
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

12
发表于 2014-9-20 21:06:30 | 只看该作者
本帖最后由 taroxd 于 2014-9-20 21:07 编辑
月歌子 发表于 2014-9-20 21:03
謝謝你,我試過了,不過好像沒有辦法


那么这样再试试看
  1. class SaveActor
  2.   attr_reader :m_picture
  3.   alias m_picture_init initialize
  4.   def initialize(actor)
  5.     m_picture_init(actor)
  6.     @m_picture = "Actor#{actor.id}"
  7.   end
  8. end
复制代码
我也没仔细看脚本,不知道为什么 actor.m_picture 会返回 nil。总之试试看

点评

遊戲顯示一樣的錯誤訊息>_<  发表于 2014-9-20 21:55
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-10-8 22:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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