added playermat hider
This commit is contained in:
parent
fc895bfee7
commit
d0ae38fa78
@ -46,7 +46,7 @@
|
|||||||
"Tooltip": false,
|
"Tooltip": false,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": -59.426,
|
"posX": -59.426,
|
||||||
"posY": 1.3,
|
"posY": -1,
|
||||||
"posZ": -22.721,
|
"posZ": -22.721,
|
||||||
"rotX": 0,
|
"rotX": 0,
|
||||||
"rotY": 280,
|
"rotY": 280,
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"Tooltip": false,
|
"Tooltip": false,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": -23.89,
|
"posX": -23.89,
|
||||||
"posY": 1.3,
|
"posY": -1,
|
||||||
"posZ": -30.977,
|
"posZ": -30.977,
|
||||||
"rotX": 0,
|
"rotX": 0,
|
||||||
"rotY": 190,
|
"rotY": 190,
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"Tooltip": false,
|
"Tooltip": false,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": -36.87,
|
"posX": -36.87,
|
||||||
"posY": 1.3,
|
"posY": -1,
|
||||||
"posZ": 30.977,
|
"posZ": 30.977,
|
||||||
"rotX": 0,
|
"rotX": 0,
|
||||||
"rotY": 10,
|
"rotY": 10,
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"Tooltip": false,
|
"Tooltip": false,
|
||||||
"Transform": {
|
"Transform": {
|
||||||
"posX": -59.426,
|
"posX": -59.426,
|
||||||
"posY": 1.3,
|
"posY": -1,
|
||||||
"posZ": 9.395,
|
"posZ": 9.395,
|
||||||
"rotX": 0,
|
"rotX": 0,
|
||||||
"rotY": 280,
|
"rotY": 280,
|
||||||
|
@ -56,5 +56,5 @@
|
|||||||
"scaleZ": 3
|
"scaleZ": 3
|
||||||
},
|
},
|
||||||
"Value": 0,
|
"Value": 0,
|
||||||
"XmlUI": ""
|
"XmlUI": "\u003cInclude src=\"accessories/PlayermatHider.xml\"/\u003e"
|
||||||
}
|
}
|
@ -1,7 +1,41 @@
|
|||||||
local guidReferenceApi = require("core/GUIDReferenceApi")
|
local guidReferenceApi = require("core/GUIDReferenceApi")
|
||||||
|
local objects
|
||||||
|
|
||||||
function onClick_hideShow(player, value, id)
|
function onClick_hideShow(player, matColor)
|
||||||
log(player)
|
objects = guidReferenceApi.getObjectsByOwner(matColor)
|
||||||
log(value)
|
local actionTokens = searchMat(objects.Playermat.positionToWorld({-1.1, 0.05, -0.27}), {4, 1, 1}, isActionToken)
|
||||||
log(id)
|
local pos = objects.Playermat.getPosition()
|
||||||
|
local mod = (pos.y > 0) and -3 or 3
|
||||||
|
|
||||||
|
-- move all objects
|
||||||
|
for _, obj in pairs(objects) do
|
||||||
|
obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- move action tokens
|
||||||
|
for _, obj in ipairs(actionTokens) do
|
||||||
|
obj.setLock(pos.y > 0)
|
||||||
|
obj.setPosition(obj.getPosition() + Vector(0, mod, 0))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function isActionToken(x) return x.getDescription() == 'Action Token' end
|
||||||
|
|
||||||
|
function searchMat(origin, size, filter)
|
||||||
|
local searchResult = Physics.cast({
|
||||||
|
origin = origin,
|
||||||
|
direction = { 0, 1, 0 },
|
||||||
|
orientation = objects.Playermat.getRotation(),
|
||||||
|
type = 3,
|
||||||
|
size = size,
|
||||||
|
max_distance = 0
|
||||||
|
})
|
||||||
|
|
||||||
|
local objList = {}
|
||||||
|
for _, v in ipairs(searchResult) do
|
||||||
|
if not filter or (filter and filter(v.hit_object)) then
|
||||||
|
table.insert(objList, v.hit_object)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return objList
|
||||||
end
|
end
|
||||||
|
@ -858,12 +858,16 @@ function showDrawButton(visible)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawns / destroys a clickable clue counter for this playmat with the correct amount of clues
|
-- shows / hides a clickable clue counter for this playmat and sets the correct amount of clues
|
||||||
---@param showCounter Boolean Whether the clickable clue counter should be present
|
---@param showCounter Boolean Whether the clickable clue counter should be visible
|
||||||
function clickableClues(showCounter)
|
function clickableClues(showCounter)
|
||||||
local clickerPos = ownedObjects.ClickableClueCounter.getPosition()
|
local clickerPos = ownedObjects.ClickableClueCounter.getPosition()
|
||||||
local clueCount = 0
|
local clueCount = 0
|
||||||
|
|
||||||
|
-- move clue counters
|
||||||
|
local modY = showcounter and -2.52 or 2.52
|
||||||
|
ownedObjects.ClickableClueCounter.setPosition(clickerPos + Vector(0, modY, 0))
|
||||||
|
|
||||||
if showCounter then
|
if showCounter then
|
||||||
-- current clue count
|
-- current clue count
|
||||||
clueCount = ownedObjects.ClueCounter.getVar("exposedValue")
|
clueCount = ownedObjects.ClueCounter.getVar("exposedValue")
|
||||||
@ -873,18 +877,10 @@ function clickableClues(showCounter)
|
|||||||
|
|
||||||
-- set value for clue clickers
|
-- set value for clue clickers
|
||||||
ownedObjects.ClickableClueCounter.call("updateVal", clueCount)
|
ownedObjects.ClickableClueCounter.call("updateVal", clueCount)
|
||||||
|
|
||||||
-- move clue counters up
|
|
||||||
clickerPos.y = 1.52
|
|
||||||
ownedObjects.ClickableClueCounter.setPosition(clickerPos)
|
|
||||||
else
|
else
|
||||||
-- current clue count
|
-- current clue count
|
||||||
clueCount = ownedObjects.ClickableClueCounter.getVar("val")
|
clueCount = ownedObjects.ClickableClueCounter.getVar("val")
|
||||||
|
|
||||||
-- move clue counters down
|
|
||||||
clickerPos.y = 1.3
|
|
||||||
ownedObjects.ClickableClueCounter.setPosition(clickerPos)
|
|
||||||
|
|
||||||
-- spawn clues
|
-- spawn clues
|
||||||
local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})
|
local pos = self.positionToWorld({x = -1.12, y = 0.05, z = 0.7})
|
||||||
for i = 1, clueCount do
|
for i = 1, clueCount do
|
||||||
|
@ -1,35 +1,77 @@
|
|||||||
<TableLayout>
|
<Defaults>
|
||||||
|
<Text color="White"
|
||||||
|
fontSize="100"
|
||||||
|
alignment="MiddleLeft"
|
||||||
|
font="font_teutonic-arkham"/>
|
||||||
|
<Button fontSize="100"
|
||||||
|
height="200"
|
||||||
|
width="600"
|
||||||
|
hoverClass="bGrey"
|
||||||
|
pressClass="bWhite"
|
||||||
|
selectClass="bWhite"
|
||||||
|
color="#aaaaaa"
|
||||||
|
font="font_teutonic-arkham"/>
|
||||||
|
<Button class="bGrey"
|
||||||
|
color="grey"/>
|
||||||
|
<Button class="bWhite"
|
||||||
|
color="white"/>
|
||||||
|
<Button class="activeTab"
|
||||||
|
color="#ffffff"/>
|
||||||
|
<Row preferredHeight="300"/>
|
||||||
|
</Defaults>
|
||||||
|
|
||||||
|
<TableLayout height="1600"
|
||||||
|
width="1800"
|
||||||
|
columnWidths="1000 800"
|
||||||
|
rotation="0 0 180"
|
||||||
|
position="0 0 -11"
|
||||||
|
scale="0.1 0.1 0.1"
|
||||||
|
cellBackgroundColor="none">
|
||||||
|
<Row preferredHeight="400">
|
||||||
|
<Cell columnSpan="2">
|
||||||
|
<Text fontSize="200"
|
||||||
|
alignment="UpperCenter">Playermat Hider</Text>
|
||||||
|
</Cell>
|
||||||
|
</Row>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Cell>
|
<Cell>
|
||||||
<Text>Playermat 1 (White)</Text>
|
<Text>Playermat 1 (White)</Text>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
<Button id="button1"
|
<Panel>
|
||||||
onClick="onClick">Show / Hide</Button>
|
<Button onClick="onClick_hideShow(White)">Show / Hide</Button>
|
||||||
|
</Panel>
|
||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Text>Playermat 2 (Orange)</Text>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Panel>
|
||||||
|
<Button onClick="onClick_hideShow(Orange)">Show / Hide</Button>
|
||||||
|
</Panel>
|
||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Text>Playermat 3 (Green)</Text>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Panel>
|
||||||
|
<Button onClick="onClick_hideShow(Green)">Show / Hide</Button>
|
||||||
|
</Panel>
|
||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Text>Playermat 4 (Red)</Text>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell>
|
<Cell>
|
||||||
|
<Panel>
|
||||||
|
<Button onClick="onClick_hideShow(Red)">Show / Hide</Button>
|
||||||
|
</Panel>
|
||||||
</Cell>
|
</Cell>
|
||||||
</Row>
|
</Row>
|
||||||
</TableLayout>
|
</TableLayout>
|
Loading…
Reference in New Issue
Block a user