Added dump actor data in the debug window
This commit is contained in:
@@ -595,6 +595,27 @@ local instanceMixins = {
|
||||
instance:ResetWindow()
|
||||
instance:RefreshWindow(true)
|
||||
end,
|
||||
|
||||
---open a window with the keys and values of the actor object being shown in the line index
|
||||
---this function doesn't not return the values, it will 'dump' the values in a new window by calling 'dumpt'
|
||||
---@param self instance
|
||||
---@param index number
|
||||
GetActorInfoFromLineIndex = function(self, index)
|
||||
local actor = self.barras[index] and self.barras[index].minha_tabela
|
||||
if (actor) then
|
||||
local tableToDump = {}
|
||||
for k, v in pairs(actor) do
|
||||
if (type(k) == "string") then
|
||||
if (type(v) == "number" or type(v) == "string") then
|
||||
tableToDump[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
dumpt(tableToDump)
|
||||
else
|
||||
Details:Msg("no actor found in line index", index)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
---get the table with all instances, these instance could be not initialized yet, some might be open, some not in use
|
||||
|
||||
@@ -194,6 +194,29 @@ local createDebugOptionsFrame = function()
|
||||
},
|
||||
}
|
||||
|
||||
--/run Details:GetWindow(1):GetActorInfoFromLineIndex(3)
|
||||
|
||||
--create a label with the text "actor info from window and line index"
|
||||
local actorInfoLabel = detailsFramework:CreateLabel(debugOptionsPanel, "Get Actor Info From Window 'X' and Line Index 'X'", 12)
|
||||
actorInfoLabel:SetPoint("bottomleft", debugOptionsPanel, "bottomleft", 5, 50)
|
||||
|
||||
local instanceIdEntry = detailsFramework:CreateTextEntry(debugOptionsPanel, function()end, 20, 20, _, _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
|
||||
instanceIdEntry:SetPoint("topleft", actorInfoLabel, "bottomleft", 0, -5)
|
||||
instanceIdEntry:SetText("1")
|
||||
|
||||
local lineIndexEntry = detailsFramework:CreateTextEntry(debugOptionsPanel, function()end, 20, 20, _, _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
|
||||
lineIndexEntry:SetPoint("left", instanceIdEntry, "right", 5, 0)
|
||||
lineIndexEntry:SetText("1")
|
||||
|
||||
--create a button with the get "Get", when the button is pressed, it get the text in the instanceIdEntry and lineIndexEntry and call the function GetActorInfoFromWindowAndLineIndex
|
||||
local getButton = detailsFramework:CreateButton(debugOptionsPanel, function()
|
||||
local instanceId = tonumber(instanceIdEntry:GetText())
|
||||
local lineIndex = tonumber(lineIndexEntry:GetText())
|
||||
Details:GetWindow(instanceId):GetActorInfoFromLineIndex(lineIndex)
|
||||
end, 50, 20, "Get")
|
||||
getButton:SetPoint("left", lineIndexEntry, "right", 5, 0)
|
||||
getButton:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
|
||||
|
||||
options.always_boxfirst = true
|
||||
options.align_as_pairs = true
|
||||
options.align_as_pairs_string_space = 260
|
||||
|
||||
Reference in New Issue
Block a user