호출 방법
Conditions.talent.treeWidget(parent, spec, value, update)
의존성 Conditions.talent.treeWidget을(를) 기록한 뒤 그 이름으로 호출하세요. 네임스페이스 호출은 self를 넘기지 않으므로 콜론 호출을 쓰거나 객체를 직접 넘기세요.
하는 일
Builds the TALENT editor controls for Classic talent trees: a tree dropdown, a talent icon, a talent dropdown for the chosen tree, and a Points comparison. Changing the tree clears the talent (and the comparison when switching from another layout), and every change calls update.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
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 TALENT condition settings; the control reads and rewrites its layout, tree, talent, node, entry, operator and value fields. |
update | function | Called with no arguments after every change so the editor can refresh. |
반환값
없음.
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
게임 API를 직접 읽지 않습니다.
애드온에서 호출하는 방식
- 특성 (widget)
if current=="tree" then treeWidget(parent,spec,value,update)
의존성
PLACEHOLDER(builtin:Conditions/talent.lua:PLACEHOLDER)block→Conditions.talent.blockdropdown→Conditions.talent.dropdowngroup→Conditions.talent.groupicon→Conditions.talent.iconinfo→Conditions.talent.infoownTrees→Conditions.talent.ownTreesplatform(builtin:Conditions/talent.lua:platform)
소스
Conditions/talent.lua, 191번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Conditions.talent.treeWidget(parent, spec, value, update)
local trees,treeOrder={},{}
-- Names, never positions: the game's for the player's class, the shipped
-- table's for another class's rotation or before the game has the data.
local listed=addon.TalentTrees.Choices(addon.TalentTrees.ContextClass(),group(spec))
if listed then trees,treeOrder=listed.choices,listed.order end
local talents,talentOrder={},{}
local talentIcon,talentPicker,treePicker
local function choices()
talents,talentOrder={},{}
if value.tree and ownTrees() then
for index=1,platform:GetTreeTalentCount(value.tree) or 0 do
local talent=platform:GetTreeTalentInfo(value.tree,index,group(spec))
if talent then talents[index]={text=talent.name,icon=talent.icon};talentOrder[#talentOrder+1]=index end
end
end
end
choices()
local box=block(parent)
talentIcon=icon(box,value,spec)
treePicker=dropdown(box,L["Talent Tree"],function(selected)
if selected==value.tree then return end
local wasTree=value.layout=="tree" or value.layout==nil and value.tree~=nil
value.tree,value.talent,value.layout=selected,nil,"tree"
if not wasTree then value.value,value.operator=nil,nil end
choices();talentPicker:SetList(talents,talentOrder);talentPicker:SetValue(nil)
talentPicker:SetDisabled(#talentOrder==0);talentIcon:SetImage(PLACEHOLDER);update()
end)
treePicker.configure=function() treePicker:SetList(trees,treeOrder);treePicker:SetValue(value.tree) end
talentPicker=dropdown(box,L["Talent"],function(selected)
value.talent,value.layout=selected,"tree"
local talent=info(value,spec);talentIcon:SetImage(talent and talent.icon or PLACEHOLDER);update()
end)
talentPicker:SetDisabled(#talentOrder==0)
talentPicker.configure=function() talentPicker:SetList(talents,talentOrder);talentPicker:SetValue(value.talent) end
parent:AddChild(addon:Widget_OperatorWidget(value,L["Points"],update))