查看: 3023|回复: 4

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

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

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

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

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

梦石
1
星屑
23246
在线时间
9564 小时
注册时间
2012-6-19
回帖
7018

开拓者短篇九导演组冠军

发表于 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的
[pre lang="ruby" line="1"]#encoding:utf-8
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
#  菜单画面中,显示队伍成员状态的窗口
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_reader   :pending_index            # 保留位置(整队用)
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y+100, window_width, window_height)
    @pending_index = -1
    refresh
  end
#--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width-160
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的高度
  #--------------------------------------------------------------------------
  def window_height
    Graphics.height - 96
  end
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return 4 #跟据分辨率的不同可以改
  end  
  #--------------------------------------------------------------------------
  # ● 获取项目数
  #--------------------------------------------------------------------------
  def item_max
    $game_party.members.size
  end
  #--------------------------------------------------------------------------
  # ● 获取项目的高度
  #--------------------------------------------------------------------------
  def item_height
    height - standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● 获取行间距的宽度
  #--------------------------------------------------------------------------
  def spacing
    return 0
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    actor = $game_party.members[index]
    enabled = $game_party.battle_members.include?(actor)
    rect = item_rect(index)
    draw_item_background(index)
    draw_actor_HalfBody(actor, rect.x, rect.y, enabled)
    draw_actor_name(actor,rect.x,rect.y+96)
    draw_actor_icons(actor,rect.x,rect.y+50+line_height*2)
    draw_actor_level(actor,rect.x,rect.y+96+line_height*2)
    draw_actor_hp(actor,rect.x, rect.y+96+line_height*4)
    draw_actor_mp(actor,rect.x,rect.y+96+line_height*5)
    draw_actor_tp(actor,rect.x,rect.y+96+line_height*6)
end
  #--------------------------------------------------------------------------
  # ● 绘制项目的背景
  #--------------------------------------------------------------------------
  def draw_item_background(index)
    if index == @pending_index
      contents.fill_rect(item_rect(index), pending_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● 按下确定键时的处理
  #--------------------------------------------------------------------------
  def process_ok
    super
    $game_party.menu_actor = $game_party.members[index]
  end
  #--------------------------------------------------------------------------
  # ● 返回上一个选择的位置
  #--------------------------------------------------------------------------
  def select_last
    select($game_party.menu_actor.index || 0)
  end
  #--------------------------------------------------------------------------
  # ● 设置保留位置(整队用)
  #--------------------------------------------------------------------------
  def pending_index=(index)
    last_pending_index = @pending_index
    @pending_index = index
    redraw_item(@pending_index)
    redraw_item(last_pending_index)
  end
  #--------------------------------------------------------------------------
  # ● 计算窗口内容的宽度
  #--------------------------------------------------------------------------
  def contents_width
    (item_width + spacing) * item_max - spacing
  end
    #--------------------------------------------------------------------------
  # ● 计算窗口内容的宽度
  #--------------------------------------------------------------------------
  def contents_height
    item_height
  end
  #--------------------------------------------------------------------------
  # ● 获取首列位置
  #--------------------------------------------------------------------------
  def top_col
    ox / (item_width + spacing)
  end
  #--------------------------------------------------------------------------
  # ● 设置首列位置
  #--------------------------------------------------------------------------
  def top_col=(col)
    col = 0 if col < 0
    col = col_max - 1 if col > col_max - 1
    self.ox = col * (item_width + spacing)
  end
  #--------------------------------------------------------------------------
  # ● 获取尾列位置
  #--------------------------------------------------------------------------
  def bottom_col
    top_col + col_max - 1
  end
  #--------------------------------------------------------------------------
  # ● 设置尾列位置
  #--------------------------------------------------------------------------
  def bottom_col=(col)
    self.top_col = col - (col_max - 1)
  end
  #--------------------------------------------------------------------------
  # ● 确保光标在画面范围内滚动
  #--------------------------------------------------------------------------
  def ensure_cursor_visible
    self.top_col = index if index < top_col
    self.bottom_col = index if index > bottom_col
  end
  #--------------------------------------------------------------------------
  # ● 获取项目的绘制矩形
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super
    rect.x = index * (item_width + spacing)
    rect.y = 0
    rect
  end
  #--------------------------------------------------------------------------
  # ● 获取对齐方向
  #--------------------------------------------------------------------------
  def alignment
    return 1
  end
  #--------------------------------------------------------------------------
  # ● 光标向下移动
  #--------------------------------------------------------------------------
  def cursor_down(wrap = false)
  end
  #--------------------------------------------------------------------------
  # ● 光标向上移动
  #--------------------------------------------------------------------------
  def cursor_up(wrap = false)
  end
  #--------------------------------------------------------------------------
  # ● 光标移至下一页
  #--------------------------------------------------------------------------
  def cursor_pagedown
  end
  #--------------------------------------------------------------------------
  # ● 光标移至上一页
  #--------------------------------------------------------------------------
  def cursor_pageup
  end
end
[/pre]
这是Window_Base里关于加入半身像部分的
[pre lang="ruby" line="389"] #--------------------------------------------------------------------------
  # ● 绘制角色半肖像图
  #--------------------------------------------------------------------------
  def draw_actor_HalfBody(actor, x, y, enabled = true)
    draw_HalfBody(actor.face_name, actor.face_index, x, y, enabled)
  end
  #--------------------------------------------------------------------------
  # ● 绘制角色半身肖像图
  #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  #--------------------------------------------------------------------------
  def draw_HalfBody(face_name, face_index, x, y, enabled = true)
    bitmap = Cache.HalfBody(face_name)
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 194, 136, 194)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end[/pre]
这是Cache里关于获取本身像的
[pre lang="ruby" line="134"]  #--------------------------------------------------------------------------
  # ● 获取角色肖像图
  #--------------------------------------------------------------------------
  def self.HalfBody(filename)
    load_bitmap("Graphics/HalfBody/", filename)
  end[/pre]
这是放图片的地方
捕获2.PNG
PS:安装过分辨率突破补丁和仓库脚本_(:зゝ∠)_
回复

使用道具 举报

梦石
0
星屑
9716
在线时间
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.

在本版发帖返回顶部