呼叫方式
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