调用方式
UI.condition_layout.verticalAlignment(value)
记录依赖项 UI.condition_layout.verticalAlignment,然后按该名称调用。带命名空间的调用不会传入 self:请使用冒号调用,或自行传入该对象。
作用
Converts a table cell's alignV setting to a vertical offset fraction for the condition group's Table layout: 0 for nil, start or top, 0.5 for middle or center, and 1 for end or bottom (case-insensitive prefixes).
参数
| 名称 | 类型 | 作用 |
|---|---|---|
value | string | nil | Alignment name, such as "TOP", "middle" or "bottom". |
返回值
| 1 | number | nil | 0, 0.5 or 1, or nil for a non-string or unrecognized value. |
|---|
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
它不直接读取任何游戏 API。
插件如何调用它
UI.condition_layout.constructorrow[#row+1]={control=control,x=x,height=height,align=widths and cell and verticalAlignment(cell.alignV) or 0}
源码
UI/condition_layout.lua,第 30 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
UI.condition_layout.verticalAlignment(value)
if value==nil then return 0 end
if type(value)~='string' then return nil end
value=value:lower()
if value=='start' or value:sub(1,3)=='top' then return 0 end
if value=='end' or value:sub(1,6)=='bottom' then return 1 end
if value=='middle' or value:sub(1,6)=='center' then return .5 end