WIP commit to split PR into parts

This commit is contained in:
Chr1Z93 2022-12-08 12:01:10 +01:00
parent d4beeeb95d
commit d53302c9e0
6 changed files with 166 additions and 83 deletions

View File

@ -65,13 +65,23 @@
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118466515932/AFCE53F1E1D9580D166F53AD9EB0D77A331D4A26/"
},
{
"Name": "font_teutonic",
"Name": "font_teutonic-arkham",
"Type": 1,
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118466409230/EA26C778B3A2C7D7F3FB2765BD6EB6FDACAB863E/"
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118467703445/89328E273B4C5180BF491516CE998DE3C604E162/"
},
{
"Name": "font_uglyqua",
"Type": 1,
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118466516005/113C19D37CFFA9E554394FD5B11B32967F846A62/"
},
{
"Name": "option_image1",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118468280563/911BA319CD7502258D570B23BD51B3D8DA8B2AC3/"
},
{
"Name": "option_image2",
"Type": 0,
"URL": "http://cloud-3.steamusercontent.com/ugc/2027213118470839572/FB133C41A6D8915A44C138BCF947ECFE3D111813/"
}
]

View File

@ -611,34 +611,28 @@ function onClick_toggleOption(_, id)
self.UI.setAttribute("toggle" .. id, "isOn", state)
optionPanel[id] = state
applyChange(id, state)
end
local PlayerMatAPI = require("playermat/PlaymatApi")
function onClick_applySettings()
local printed = false
function applyChange(id, state)
-- option 1: Snap tags
if id == "1" then
printToAll("Playermat snap tags " .. (state and "en" or "dis") .."abled.", "White")
PlayerMatAPI.setLimitSnapsByType(state, "All")
for id, state in pairs(optionPanel) do
if not printed then
printToAll("---------------------", "White")
printToAll("Applying settings...", "White")
printed = true
end
-- option 2: Draw 1 button
elseif id=="2" then
printToAll("'Draw 1' button " .. (state and "en" or "dis") .."abled.", "White")
PlayerMatAPI.showDrawButton(state, "All")
if state then print(id) end
-- option 1: Snap tags
if id == "1" then
printToAll("Playermat snap tags " .. (state and "en" or "dis") .."abled.", "White")
PlayerMatAPI.setLimitSnapsByType(state, "All")
end
-- option 3: Clickable clue counters
elseif id=="3" then
printToAll("Clickable clue counters " .. (state and "en" or "dis") .."abled.", "White")
PlayerMatAPI.clickableClues(state, "All")
end
if not printed then
printToAll("---------------------", "White")
printToAll("Not settings selected!", "White")
end
end
function onClick_toggleUi(_, title)
@ -649,7 +643,7 @@ function onClick_toggleUi(_, title)
if UI.getValue('title') ~= title and title ~= 'Hidden' then
UI.setValue('title', title)
if title == "Option Panel" then
if title == "Options" then
UI.show('optionPanel')
else
update_window_content(title)

View File

@ -45,8 +45,9 @@ local RESOURCE_COUNTER
-- global variable so it can be reset by the Clean Up Helper
activeInvestigatorId = "00000"
local drawButton = false
function onSave() return JSON.encode({zoneID = zoneID, playerColor = PLAYER_COLOR, activeInvestigatorId = activeInvestigatorId}) end
function onSave() return JSON.encode({zoneID = zoneID, playerColor = PLAYER_COLOR, activeInvestigatorId = activeInvestigatorId, drawButton = drawButton}) end
function onLoad(save_state)
self.interactable = DEBUG
@ -96,8 +97,11 @@ function onLoad(save_state)
zoneID = state.zoneID
PLAYER_COLOR = state.playerColor
activeInvestigatorId = state.activeInvestigatorId
drawButton = state.drawButton
end
showDrawButton(drawButton)
if getObjectFromGUID(zoneID) == nil then spawnDeckZone() end
COLLISION_ENABLED = true
end
@ -648,11 +652,40 @@ function spawnToken(position, tokenType)
Global.call('spawnToken', {position, tokenType, PLAY_ZONE_ROTATION})
end
-- Sets this playermat's draw 1 button to visible
---@param visibleButton Boolean. Whether the draw 1 button should be visible
function showDrawButton(visibleButton)
drawButton = visibleButton
if drawButton then
self.createButton({
label = "Draw 1",
click_function = "doDrawOne",
function_owner = mat,
position = { 1.84, 0.1, -0.36 },
scale = { 0.12, 0.12, 0.12 },
width = 800,
height = 280,
font_size = 180
})
else
-- remove button with index 9 if 10 buttons are present (because index starts at 0)
if #self.getButtons() == 10 then
self.removeButton(9)
end
end
end
-- Spawns / destroys a clickable clue counter for this playmat
---@param clickableCounter Boolean. Whether the clickable clue counter should be present
function clickableClues(clickableCounter)
print("dummy function for clue counters")
end
-- Sets this playermat's snap points to limit snapping to matching card types or not. If matchTypes
-- is true, the main card slot snap points will only snap assets, while the investigator area point
-- will only snap Investigators. If matchTypes is false, snap points will be reset to snap all
-- cards.
-- @param matchTypes Boolean. Whether snap points should only snap for the matching card types.
---@param matchTypes Boolean. Whether snap points should only snap for the matching card types.
function setLimitSnapsByType(matchTypes)
local snaps = self.getSnapPoints()
for i, snap in ipairs(snaps) do

View File

@ -13,9 +13,9 @@ do
-- matchTypes is true, the main card slot snap points will only snap assets, while the
-- investigator area point will only snap Investigators. If matchTypes is false, snap points will
-- be reset to snap all cards.
-- @param matchCardTypes Boolean. Whether snap points should only snap for the matching card
---@param matchCardTypes Boolean. Whether snap points should only snap for the matching card
-- types.
-- @param matColor String for one of the active player colors - White, Orange, Green, Red. Also
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
-- accepts "All" as a special value which will apply the setting to all four mats.
PlaymatApi.setLimitSnapsByType = function(matchCardTypes, matColor)
for _, mat in ipairs(internal.getMatForColor(matColor)) do
@ -23,10 +23,31 @@ do
end
end
-- Sets the requested playermat's draw 1 button to visible
---@param visibleButton Boolean. Whether the draw 1 button should be visible or not
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
-- accepts "All" as a special value which will apply the setting to all four mats.
PlaymatApi.showDrawButton = function(visibleButton, matColor)
for _, mat in ipairs(internal.getMatForColor(matColor)) do
mat.call("showDrawButton", visibleButton)
end
end
-- Spawns a clickable clue counter for the requested playermat
---@param visibleButton Boolean. Whether the clickable counter should be present or not
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
-- accepts "All" as a special value which will apply the setting to all four mats.
PlaymatApi.clickableClues = function(clickableCounter, matColor)
for _, mat in ipairs(internal.getMatForColor(matColor)) do
mat.call("clickableClues", clickableCounter)
end
end
-- Convenience function to look up a mat's object by color, or get all mats.
-- @param matColor String for one of the active player colors - White, Orange, Green, Red. Also
---@param matColor String for one of the active player colors - White, Orange, Green, Red. Also
-- accepts "All" as a special value which will return all four mats.
-- @return Array of playermat objects. If a single mat is requested, will return a single-element
---@return Array of playermat objects. If a single mat is requested, will return a single-element
-- array to simplify processing by consumers.
internal.getMatForColor = function(matColor)
local targetMatGuid = MAT_IDS[matColor]

View File

@ -3,27 +3,26 @@
<!-- general Stuff -->
<Text color="white" fontSize="18"/>
<Button tooltipPosition="Left" color="clear"/>
<VerticalLayout color="black" visibility="Admin"/>
<!-- Window -->
<HorizontalLayout class="headerLayout" height="75" padding="5"/>
<Button class="headerButton" minWidth="50" preferredWidth="50" flexibleWidth="0" color="clear"/>
<Text class="headerText" minWidth="200" flexibleWidth="100" fontSize="32" font="font_birmingham"/>
<Text class="headerText" minWidth="200" flexibleWidth="100" fontSize="32" font="font_teutonic-arkham"/>
</Defaults>
<!-- Buttons in the bottom right of the screen -->
<VerticalLayout color="clear" rectAlignment="LowerRight" width="40" height="240" offsetXY="-1 60" spacing="2">
<VerticalLayout visibility="Admin" color="#000000" outlineSize="1 1" outline="#303030" rectAlignment="LowerRight" width="35" height="215" offsetXY="-1 60" spacing="1">
<Button icon="cthulhu" tooltip="Campaigns" onClick="onClick_toggleUi(Campaigns)"/>
<Button icon="dark-cult" tooltip="Standalone Scenarios" onClick="onClick_toggleUi(Standalone Scenarios)"/>
<Button icon="yog-sothoth" tooltip="Extras" onClick="onClick_toggleUi(Extras)"/>
<Button icon="elder-sign" tooltip="Investigators" onClick="onClick_toggleUi(Investigators)"/>
<Button icon="devourer" tooltip="Community Content" onClick="onClick_toggleUi(Community Content)"/>
<Button icon="option-gear" tooltip="Option Panel" onClick="onClick_toggleUi(Option Panel)"/>
<Button icon="option-gear" tooltip="Options" onClick="onClick_toggleUi(Options)"/>
<!--<Button icon="download" tooltip="ArkhamDB Deck Importer" onClick="onClick_toggleUi(Deck Importer)"/> -->
</VerticalLayout>
<!-- Basic UI that will be replaced based on title -->
<VerticalLayout id="load_ui" active="false" width="700" height="780" outlineSize="1 1" outline="#303030">
<VerticalLayout id="load_ui" visibility="Admin" color="black" active="false" width="700" height="780" outlineSize="1 1" outline="#303030">
<HorizontalLayout class="headerLayout">
<Button class="headerButton" icon="refresh" tooltip="Refresh List" tooltipPosition="Right" onClick="onClick_refreshList"/>
<Text id="title" class="headerText">Loadable Items</Text>

View File

@ -1,74 +1,95 @@
<!-- Default formatting -->
<Defaults>
<Text color="white" alignment="MiddleLeft"/>
<Toggle font="font_birmingham" textColor="white" fontSize="18" isOn="False" textAlignment="UpperLeft"/>
<Toggle isOn="False" rectAlignment="MiddleRight"/>
<VerticalLayout class="window" active="false" color="black" visibility="Admin" outlineSize="1 1" outline="grey" allowDragging="true" returnToOriginalPositionWhenReleased="false" width="400" height="800"/>
<VerticalLayout class="window" active="false" color="black" visibility="Admin" outlineSize="1 1" outline="grey" allowDragging="true" returnToOriginalPositionWhenReleased="false" width="500" height="800"/>
<VerticalLayout class="group" outlineSize="1 1" outline="grey" color="#222222" padding="10" spacing="5"/>
<VerticalLayout class="group-content" color="#444444" padding="5" spacing="5"/>
<VerticalLayout class="text-column" padding="5 20 0 0"/>
<Text class="group-header" fontSize="20" font="font_uglyqua"/>
<Text class="description" fontSize="14"/>
<HorizontalLayout class="group-content" color="#444444" padding="5" spacing="5"/>
<Button class="bottomButtons" hoverClass="hover" pressClass="press" selectClass="select" color="#888888" minHeight="35" fontSize="24" font="font_birmingham"/>
<Text class="group-header" fontSize="24" font="font_teutonic-arkham"/>
<Text class="option-header" fontSize="16" font="font_teutonic-arkham"/>
<Text class="description" fontSize="12"/>
<Button class="bottomButtons" hoverClass="hover" pressClass="press" selectClass="select" color="#888888" minHeight="35" fontSize="24" font="font_teutonic-arkham"/>
<Button class="hover" color="grey"/>
<Button class="press" color="white"/>
<Button class="select" color="white"/>
</Defaults>
<!-- Option Panel -->
<VerticalLayout id="optionPanel" class="window" spacing="10">
<Panel minHeight="45" padding="15 15 0 0">
<Text font="font_birmingham" fontSize="35">Option Panel</Text>
<VerticalLayout id="optionPanel" class="window">
<Panel minHeight="45" flexibleHeight="0" padding="10 10 0 0">
<Text font="font_teutonic-arkham" fontSize="35">Options</Text>
</Panel>
<VerticalLayout>
<!-- Group 1 -->
<VerticalLayout class="group">
<Panel minHeight="30">
<Text class="group-header">PLAYERMATS</Text>
<Panel minHeight="44" image="option_image1" padding="5 0 0 0">
<Text class="group-header">PLAYERMAT SETTINGS</Text>
</Panel>
<!-- Option 1 -->
<VerticalLayout class="group-content">
<Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)">Enable snap tags</Toggle>
<Text class="description">Only cards with the tag "Asset" will snap (official cards are supported by default). Disable this if you are having issues with custom content.</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Enable snap tags</Text>
<Text class="description">Only cards with the tag "Asset" will snap (official cards are supported by default).&#xA;Disable this if you are having issues with custom content.</Text>
</VerticalLayout>
<Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)" />
</HorizontalLayout>
<!-- Option 2 -->
<VerticalLayout class="group-content">
<Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)">Toggle Text 2</Toggle>
<Text class="description">Description for Option 2</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Show "Draw 1" button</Text>
<Text class="description">Displays a button below the "Upkeep" button that draws a card from your deck. Useful for multi-handed solo play.</Text>
</VerticalLayout>
<Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)"/>
</HorizontalLayout>
<!-- Option 3 -->
<VerticalLayout class="group-content">
<Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)">Toggle Text 3</Toggle>
<Text class="description">Description for Option 3</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Use clickable clue-counters</Text>
<Text class="description">Instead of automatically counting clues in the respective area on your playermat, this displays a clickable counter for clues.&#xA;Take note of each player's clue count before changing this option!</Text>
</VerticalLayout>
<Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)"/>
</HorizontalLayout>
</VerticalLayout>
<!-- Group 2 -->
<VerticalLayout class="group">
<Panel minHeight="30">
<Text class="group-header">Group 2</Text>
<Panel minHeight="44" image="option_image2" padding="5 0 0 0">
<Text class="group-header">FAN-MADE ACCESSORIES</Text>
</Panel>
<!-- Option 4 -->
<VerticalLayout class="group-content">
<Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)">Toggle Text 4</Toggle>
<Text class="description">Description for Option 4</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Toggle Text 4</Text>
<Text class="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat...</Text>
</VerticalLayout>
<Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)"/>
</HorizontalLayout>
<!-- Option 5 -->
<VerticalLayout class="group-content">
<Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)">Toggle Text 5</Toggle>
<Text class="description">Description for Option 5</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Toggle Text 5</Text>
<Text class="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat...</Text>
</VerticalLayout>
<Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)"/>
</HorizontalLayout>
<!-- Option 6 -->
<VerticalLayout class="group-content">
<Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)">Toggle Text 6</Toggle>
<Text class="description">Description for Option 6</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Toggle Text 6</Text>
<Text class="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat...</Text>
</VerticalLayout>
<Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)"/>
</HorizontalLayout>
</VerticalLayout>
<!-- Group 3 -->
@ -77,21 +98,26 @@
<Text class="group-header">Group 3</Text>
</Panel>
<!-- Option 7 -->
<VerticalLayout class="group-content">
<Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)">Toggle Text 7</Toggle>
<Text class="description">Description for Option 7</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Toggle Text 7</Text>
<Text class="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat...</Text>
</VerticalLayout>
<Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)"/>
</HorizontalLayout>
<!-- Option 8 -->
<VerticalLayout class="group-content">
<Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)">Toggle Text 8</Toggle>
<Text class="description">Description for Option 8</Text>
</VerticalLayout>
<HorizontalLayout class="group-content">
<VerticalLayout class="text-column">
<Text class="option-header">Toggle Text 8</Text>
<Text class="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat...</Text>
</VerticalLayout>
<Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)"/>
</HorizontalLayout>
</VerticalLayout>
</VerticalLayout>
<HorizontalLayout minHeight="70" padding="5" spacing="5">
<HorizontalLayout minHeight="50" flexibleHeight="0" padding="5" spacing="5">
<Button class="bottomButtons" onClick="onClick_defaultSettings">Load defaults</Button>
<Button class="bottomButtons" onClick="onClick_applySettings">Apply</Button>
<Button class="bottomButtons" onClick="onClick_toggleUi(Hidden)">Cancel</Button>
<Button class="bottomButtons" onClick="onClick_toggleUi(Hidden)">Close</Button>
</HorizontalLayout>
</VerticalLayout>