呼叫方式
Conditions.talent.treePicker(parent, spec, value, update)
記錄相依項目 Conditions.talent.treePicker,然後以該名稱呼叫。含命名空間的呼叫不會傳入 self:請使用冒號呼叫,或自行傳入該物件。
作用
Builds the Talent tree dropdown for the TALENT_TREE_POINTS and PRIMARY_TALENT_TREE editors, listing the client's talent trees, storing the selection in value.tree and calling update. Shows a note when the client has no Classic talent-tree layout; the dropdown is disabled when there are no trees or value.disabled is true.
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
parent | table | Condition widget group the control is added to. |
spec | number | nil | Specialization the editor is for; on progression clients a value from 1 to 4 also selects the talent group to read. |
value | table | Saved condition settings; the tree field is read and written, and disabled is honored. |
update | function | Called with no arguments after every change so the editor can refresh. |
傳回值
無。
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
它不會直接讀取任何遊戲 API。
插件如何呼叫它
相依項目
dropdown→Conditions.talent.dropdowngroup→Conditions.talent.grouptext→Conditions.talent.text
原始碼
Conditions/talent.lua,第 636 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Conditions.talent.treePicker(parent, spec, value, update)
local choices,order={},{}
local listed=addon.TalentTrees.Choices(addon.TalentTrees.ContextClass(),group(spec))
if listed then choices,order=listed.choices,listed.order
else text(parent,L['This client does not expose a Classic talent-tree layout. The saved tree reference is preserved.']) end
local picker=dropdown(parent,L['Talent tree'],function(selected) value.tree=selected;update() end)
picker:SetDisabled(#order==0 or value.disabled==true)
picker.configure=function() picker:SetList(choices,order);picker:SetValue(value.tree) end