查看: 3072|回复: 4

[已经解决] 菜单半身像不显示

[复制链接]
梦石
0
星屑
404
在线时间
53 小时
注册时间
2016-1-6
回帖
20
发表于 2016-1-10 03:19:36 | 显示全部楼层 |阅读模式

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

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

×
按照345912390前辈的《【新手菜单】第四章 人物状态页的横向排列(UI)》的做法,想制作菜单栏的半身像,但到最后时半身像的图片却不显示,像这样
脚本一切正常,我做的图片的分辨率是144*1024(为了迎合窗口的大小裁剪了)
会不会是图片太大了什么的……
捕获2.PNG

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2016-1-10 11:48:26 | 显示全部楼层
请附上你修改后的脚本,这样别人才能知道你哪里做错了
回复

使用道具 举报

梦石
0
星屑
404
在线时间
53 小时
注册时间
2016-1-6
回帖
20
 楼主| 发表于 2016-1-10 12:56:35 | 显示全部楼层
喵呜喵5 发表于 2016-1-10 11:48
请附上你修改后的脚本,这样别人才能知道你哪里做错了

啊因为觉得脚本貌似没什么问题所以就没放上来,这是Window_MenuStatus的
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ Window_MenuStatus
  4. #------------------------------------------------------------------------------
  5. #  菜单画面中,显示队伍成员状态的窗口
  6. #==============================================================================

  7. class Window_MenuStatus < Window_Selectable
  8.   #--------------------------------------------------------------------------
  9.   # ● 定义实例变量
  10.   #--------------------------------------------------------------------------
  11.   attr_reader   :pending_index            # 保留位置(整队用)
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始化对象
  14.   #--------------------------------------------------------------------------
  15.   def initialize(x, y)
  16.     super(x, y+100, window_width, window_height)
  17.     @pending_index = -1
  18.     refresh
  19.   end
  20. #--------------------------------------------------------------------------
  21.   # ● 获取窗口的宽度
  22.   #--------------------------------------------------------------------------
  23.   def window_width
  24.     Graphics.width-160
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 获取窗口的高度
  28.   #--------------------------------------------------------------------------
  29.   def window_height
  30.     Graphics.height - 96
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # ● 获取列数
  34.   #--------------------------------------------------------------------------
  35.   def col_max
  36.     return 4 #跟据分辨率的不同可以改
  37.   end  
  38.   #--------------------------------------------------------------------------
  39.   # ● 获取项目数
  40.   #--------------------------------------------------------------------------
  41.   def item_max
  42.     $game_party.members.size
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 获取项目的高度
  46.   #--------------------------------------------------------------------------
  47.   def item_height
  48.     height - standard_padding * 2
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● 获取行间距的宽度
  52.   #--------------------------------------------------------------------------
  53.   def spacing
  54.     return 0
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 绘制项目
  58.   #--------------------------------------------------------------------------
  59.   def draw_item(index)
  60.     actor = $game_party.members[index]
  61.     enabled = $game_party.battle_members.include?(actor)
  62.     rect = item_rect(index)
  63.     draw_item_background(index)
  64.     draw_actor_HalfBody(actor, rect.x, rect.y, enabled)
  65.     draw_actor_name(actor,rect.x,rect.y+96)
  66.     draw_actor_icons(actor,rect.x,rect.y+50+line_height*2)
  67.     draw_actor_level(actor,rect.x,rect.y+96+line_height*2)
  68.     draw_actor_hp(actor,rect.x, rect.y+96+line_height*4)
  69.     draw_actor_mp(actor,rect.x,rect.y+96+line_height*5)
  70.     draw_actor_tp(actor,rect.x,rect.y+96+line_height*6)
  71. end
  72.   #--------------------------------------------------------------------------
  73.   # ● 绘制项目的背景
  74.   #--------------------------------------------------------------------------
  75.   def draw_item_background(index)
  76.     if index == @pending_index
  77.       contents.fill_rect(item_rect(index), pending_color)
  78.     end
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 按下确定键时的处理
  82.   #--------------------------------------------------------------------------
  83.   def process_ok
  84.     super
  85.     $game_party.menu_actor = $game_party.members[index]
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 返回上一个选择的位置
  89.   #--------------------------------------------------------------------------
  90.   def select_last
  91.     select($game_party.menu_actor.index || 0)
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 设置保留位置(整队用)
  95.   #--------------------------------------------------------------------------
  96.   def pending_index=(index)
  97.     last_pending_index = @pending_index
  98.     @pending_index = index
  99.     redraw_item(@pending_index)
  100.     redraw_item(last_pending_index)
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 计算窗口内容的宽度
  104.   #--------------------------------------------------------------------------
  105.   def contents_width
  106.     (item_width + spacing) * item_max - spacing
  107.   end
  108.     #--------------------------------------------------------------------------
  109.   # ● 计算窗口内容的宽度
  110.   #--------------------------------------------------------------------------
  111.   def contents_height
  112.     item_height
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 获取首列位置
  116.   #--------------------------------------------------------------------------
  117.   def top_col
  118.     ox / (item_width + spacing)
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 设置首列位置
  122.   #--------------------------------------------------------------------------
  123.   def top_col=(col)
  124.     col = 0 if col < 0
  125.     col = col_max - 1 if col > col_max - 1
  126.     self.ox = col * (item_width + spacing)
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● 获取尾列位置
  130.   #--------------------------------------------------------------------------
  131.   def bottom_col
  132.     top_col + col_max - 1
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● 设置尾列位置
  136.   #--------------------------------------------------------------------------
  137.   def bottom_col=(col)
  138.     self.top_col = col - (col_max - 1)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● 确保光标在画面范围内滚动
  142.   #--------------------------------------------------------------------------
  143.   def ensure_cursor_visible
  144.     self.top_col = index if index < top_col
  145.     self.bottom_col = index if index > bottom_col
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 获取项目的绘制矩形
  149.   #--------------------------------------------------------------------------
  150.   def item_rect(index)
  151.     rect = super
  152.     rect.x = index * (item_width + spacing)
  153.     rect.y = 0
  154.     rect
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # ● 获取对齐方向
  158.   #--------------------------------------------------------------------------
  159.   def alignment
  160.     return 1
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 光标向下移动
  164.   #--------------------------------------------------------------------------
  165.   def cursor_down(wrap = false)
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 光标向上移动
  169.   #--------------------------------------------------------------------------
  170.   def cursor_up(wrap = false)
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 光标移至下一页
  174.   #--------------------------------------------------------------------------
  175.   def cursor_pagedown
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 光标移至上一页
  179.   #--------------------------------------------------------------------------
  180.   def cursor_pageup
  181.   end
  182. end
复制代码

这是Window_Base里关于加入半身像部分的
  1. #--------------------------------------------------------------------------
  2.   # ● 绘制角色半肖像图
  3.   #--------------------------------------------------------------------------
  4.   def draw_actor_HalfBody(actor, x, y, enabled = true)
  5.     draw_HalfBody(actor.face_name, actor.face_index, x, y, enabled)
  6.   end
  7.   #--------------------------------------------------------------------------
  8.   # ● 绘制角色半身肖像图
  9.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  10.   #--------------------------------------------------------------------------
  11.   def draw_HalfBody(face_name, face_index, x, y, enabled = true)
  12.     bitmap = Cache.HalfBody(face_name)
  13.     rect = Rect.new(face_index % 4 * 96, face_index / 4 * 194, 136, 194)
  14.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  15.     bitmap.dispose
  16.   end
复制代码

这是Cache里关于获取本身像的
  1.   #--------------------------------------------------------------------------
  2.   # ● 获取角色肖像图
  3.   #--------------------------------------------------------------------------
  4.   def self.HalfBody(filename)
  5.     load_bitmap("Graphics/HalfBody/", filename)
  6.   end
复制代码

这是放图片的地方
捕获2.PNG
PS:安装过分辨率突破补丁和仓库脚本_(:зゝ∠)_
回复

使用道具 举报

梦石
0
星屑
9726
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-1-10 13:52:56 | 显示全部楼层
本帖最后由 cinderelmini 于 2016-1-10 14:00 编辑
  1.   #--------------------------------------------------------------------------
  2.   # ● 绘制角色半肖像图
  3.   #--------------------------------------------------------------------------
  4.   def draw_actor_HalfBody(actor, x, y, enabled = true)
  5.     draw_HalfBody(actor.id, x, y, enabled)
  6.   end
  7.   #--------------------------------------------------------------------------
  8.   # ● 绘制角色半身肖像图
  9.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  10.   #--------------------------------------------------------------------------
  11.   def draw_HalfBody(actor_id, x, y, enabled = true)
  12.     bitmap = Cache.HalfBody("actor_" + actor_id.to_s)
  13.     contents.blt(x, y, bitmap, bitmap.rect, enabled ? 255 : translucent_alpha)
  14.     bitmap.dispose
  15.   end
复制代码
也许这样可以……
改了一下方法和图片的命名,原来那样的话,如果角色用的脸图在同一个图里的话,
半身像会是同个半身像…………
现在这样半身像的图片要改成【actor_角色id】的格式,
比如默认艾力克的半身像图片名字是【actor_1】这样……

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
404
在线时间
53 小时
注册时间
2016-1-6
回帖
20
 楼主| 发表于 2016-1-10 14:24:37 | 显示全部楼层
cinderelmini 发表于 2016-1-10 13:52
也许这样可以……
改了一下方法和图片的命名,原来那样的话,如果角色用的脸图在同一个图里的话,
半身像会 ...

行了!可以正常使用,谢谢前辈(・∀・)
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部