36 lines
1.5 KiB
Plaintext
36 lines
1.5 KiB
Plaintext
do
|
|
local DeckImporterApi = {}
|
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
|
|
|
local function getDeckImporter()
|
|
return guidReferenceApi.getObjectByOwnerAndType("Mythos", "DeckImporter")
|
|
end
|
|
|
|
---@class uiStateTable
|
|
---@field redDeck string Deck ID to load for the red player
|
|
---@field orangeDeck string Deck ID to load for the orange player
|
|
---@field whiteDeck string Deck ID to load for the white player
|
|
---@field greenDeck string Deck ID to load for the green player
|
|
---@field privateDeck boolean True to load a private deck, false to load a public deck
|
|
---@field loadNewest boolean True if the most upgraded version of the deck should be loaded
|
|
---@field investigators boolean True if investigator cards should be spawned
|
|
|
|
-- Returns a table with the full state of the UI, including options and deck IDs.
|
|
-- This can be used to persist via onSave(), or provide values for a load operation
|
|
---@return uiStateTable uiStateTable Contains data about the current UI state
|
|
DeckImporterApi.getUiState = function()
|
|
local passthroughTable = {}
|
|
for k,v in pairs(getDeckImporter().call("getUiState")) do
|
|
passthroughTable[k] = v
|
|
end
|
|
return passthroughTable
|
|
end
|
|
|
|
-- Updates the state of the UI based on the provided table. Any values not provided will be left the same.
|
|
---@return uiStateTable uiStateTable Contains data about the current UI state
|
|
DeckImporterApi.setUiState = function(uiStateTable)
|
|
return getDeckImporter().call("setUiState", uiStateTable)
|
|
end
|
|
|
|
return DeckImporterApi
|
|
end |