跳转到正文
iPlugin

图片进度

自动裁切、分段、缓动和拖尾的完整字段参考

先在图片组中登记 PNG,再在 Layout 元素的 progress 中引用。完整制作步骤见血条和圆周进度。下面使用自带 xerr_ui/player_status 图片组。

需要完整操作流程时,先阅读血条和圆周进度。本页代码未标为完整文件时,均为对应节点中的片段。

文件关系

config.yml
health_full.png
health_empty.png
health_trail.png
tutorial_health.yml

自动裁切示例

progress:
  namespace: xerr_ui
  basename: player_status
  image:
    full: health_full
    empty: health_empty
  fill:
    direction: left-to-right
    steps: auto
  variables:
    total: "player max health"
    current: "player health"
  refresh: 5
  transition:
    duration: 6
    delay: 0
    easing: ease-out
  trail:
    image: health_trail
    delay: 8
    duration: 12
    easing: ease-out

顶层字段

字段类型 / 省略值说明生效
namespace字符串 / 继承图片命名空间打包
basename字符串 / 继承图片组打包
variables对象 / 必填当前值和最大值重载
list图片 ID 列表 / 无旧式整图分段进度打包
image对象 / 无空图和满图打包
fill对象 / 无自动裁切设置打包
transition对象 / 无主进度缓动重载
trail对象 / 无延迟追赶层,仅自动裁切支持打包
refresh整数 1~72000 / 继承数值采样间隔,tick重载

list 和 image 不能同时使用。

variables

字段类型 / 省略值说明
totalKether / 必填最大值,必须得到大于 0 的有限数字
currentKether / 必填当前值
units整数 1~1000 / 1旧式重复分段数量;自动裁切必须为 1

先计算 total,再计算 current。求值失败时保留上一份有效结果,不当作 0%。

image

字段类型 / 省略值说明
full图片 ID / 视模式必填完整进度图片
empty图片 ID / 可选始终显示的空背景;旧式重复分段时必填

full、empty 和拖尾图片应使用相同 PNG 画布及配置高度。

fill

字段类型 / 省略值范围说明
direction字符串 / left-to-right见下表裁切方向
steps字符串 / autoauto 或 1~1000进度帧数
start-angle小数 / 0有限数字圆周起始角度,0° 向上
center.x小数 / 500~100图片内部圆心横向百分比
center.y小数 / 500~100图片内部圆心纵向百分比,向下增加

方向:

  • left-to-right
  • right-to-left
  • bottom-to-top
  • top-to-bottom
  • clockwise
  • counter-clockwise

0% 不绘制满图,100% 使用完整原图。

transition

字段类型 / 省略值范围说明
duration整数 / 00~72000 tick缓动时长;0 表示立即变化
delay整数 / 00~72000 tick开始缓动前等待
easing字符串 / linearlinear、ease-in、ease-out、ease-in-out速度曲线

首次有效值直接显示,不从零播放。

trail

字段类型 / 省略值说明
image图片 ID / 必填拖尾图片
delay整数 / 8开始追赶前等待 tick
duration整数 / 12追赶时长 tick
easing字符串 / ease-out速度曲线

拖尾要求存在 fill。回血时拖尾与主条同步,不保留错误的受伤残量。

预制图片列表 list

以下仅演示结构,必须先登记各个 bar_* 图片。

progress 片段
list:
  - bar_100
  - bar_80
  - bar_60
  - bar_40
  - bar_20
  - bar_0
variables:
  total: "100"
  current: "player health"

列表按进度选择整张图片,不能与 image 或自动 fill 混用。

重复分段 units

不写 fill 时,可以用 image.full/empty 加 variables.units 重复分段。每张图片就是一个完整分段,不会按数值自动裁切;此模式不支持 trail。

重复分段的 progress 片段
image:
  full: health_full_segment
  empty: health_empty_segment
variables:
  units: 10
  total: "player max health"
  current: "player health"

以上图片 ID 需自行登记。新配置优先使用 fill,不必为每个百分比准备图片。

资源限制

自动裁切仅支持静态 PNG:

  • 源图单边不超过 2048 像素。
  • 显示高度 1~512 GUI 像素。
  • 单组 源图宽 × 高 × (步数 + 1) 不超过 16,777,216。

超过限制时减小源图或 steps。