Merge pull request #750 from dscarpac/family-xml
Changed Family Inheritance Helper to XML
This commit is contained in:
commit
d12efd2500
@ -58,5 +58,5 @@
|
|||||||
"scaleZ": 1
|
"scaleZ": 1
|
||||||
},
|
},
|
||||||
"Value": 0,
|
"Value": 0,
|
||||||
"XmlUI": ""
|
"XmlUI": "\u003cInclude src=\"playercards/FamilyInheritance.xml\"/\u003e"
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,6 @@ function createButtons()
|
|||||||
local upgradeSheet = findUpgradeSheet()
|
local upgradeSheet = findUpgradeSheet()
|
||||||
if upgradeSheet then
|
if upgradeSheet then
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
log(4)
|
|
||||||
if upgradeSheet.call("isUpgradeActive", i) then
|
if upgradeSheet.call("isUpgradeActive", i) then
|
||||||
table.insert(hypothesisList, customizableList[i])
|
table.insert(hypothesisList, customizableList[i])
|
||||||
end
|
end
|
||||||
|
@ -1,26 +1,23 @@
|
|||||||
|
require("playercards/CardsWithHelper")
|
||||||
local playermatApi = require("playermat/PlayermatApi")
|
local playermatApi = require("playermat/PlayermatApi")
|
||||||
local searchLib = require("util/SearchLib")
|
local searchLib = require("util/SearchLib")
|
||||||
local tokenManager = require("core/token/TokenManager")
|
local tokenManager = require("core/token/TokenManager")
|
||||||
|
|
||||||
|
local isHelperEnabled = false
|
||||||
local clickableResourceCounter = nil
|
local clickableResourceCounter = nil
|
||||||
local foundTokens = 0
|
local foundTokens = 0
|
||||||
|
|
||||||
|
function updateSave()
|
||||||
|
self.script_state = JSON.encode({ isHelperEnabled = isHelperEnabled })
|
||||||
|
end
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
self.addContextMenuItem("Add 4 resources",
|
self.addTag("CardWithHelper")
|
||||||
function(playerColor)
|
if savedData and savedData ~= "" then
|
||||||
Player[playerColor].clearSelectedObjects()
|
local loadedData = JSON.decode(savedData)
|
||||||
add4(playerColor)
|
isHelperEnabled = loadedData.isHelperEnabled
|
||||||
end)
|
end
|
||||||
self.addContextMenuItem("Take all resources",
|
checkOptionPanel()
|
||||||
function(playerColor)
|
|
||||||
Player[playerColor].clearSelectedObjects()
|
|
||||||
takeAll(playerColor)
|
|
||||||
end)
|
|
||||||
self.addContextMenuItem("Discard all resources",
|
|
||||||
function(playerColor)
|
|
||||||
Player[playerColor].clearSelectedObjects()
|
|
||||||
loseAll(playerColor)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function searchSelf()
|
function searchSelf()
|
||||||
@ -40,7 +37,7 @@ function searchSelf()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add4(playerColor)
|
function add4()
|
||||||
searchSelf()
|
searchSelf()
|
||||||
|
|
||||||
local newCount = foundTokens + 4
|
local newCount = foundTokens + 4
|
||||||
@ -51,7 +48,7 @@ function add4(playerColor)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function takeAll(playerColor)
|
function takeAll(player)
|
||||||
searchSelf()
|
searchSelf()
|
||||||
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
local matColor = playermatApi.getMatColorByPosition(self.getPosition())
|
||||||
playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
|
playermatApi.updateCounter(matColor, "ResourceCounter", _, foundTokens)
|
||||||
@ -59,14 +56,25 @@ function takeAll(playerColor)
|
|||||||
if clickableResourceCounter then
|
if clickableResourceCounter then
|
||||||
clickableResourceCounter.call("updateVal", 0)
|
clickableResourceCounter.call("updateVal", 0)
|
||||||
end
|
end
|
||||||
printToColor("Moved " .. foundTokens .. " resource(s) to " .. matColor .. "'s resource pool.", playerColor)
|
printToColor("Moved " .. foundTokens .. " resource(s) to " .. matColor .. "'s resource pool.", player.color)
|
||||||
end
|
end
|
||||||
|
|
||||||
function loseAll(playerColor)
|
function loseAll(player)
|
||||||
searchSelf()
|
searchSelf()
|
||||||
|
|
||||||
if clickableResourceCounter then
|
if clickableResourceCounter then
|
||||||
clickableResourceCounter.call("updateVal", 0)
|
clickableResourceCounter.call("updateVal", 0)
|
||||||
end
|
end
|
||||||
printToColor("Discarded " .. foundTokens .. " resource(s).", playerColor)
|
printToColor("Discarded " .. foundTokens .. " resource(s).", player.color)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hide buttons
|
||||||
|
function shutOff()
|
||||||
|
self.UI.hide("Helper")
|
||||||
|
updateSave()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- show buttons
|
||||||
|
function initialize()
|
||||||
|
self.UI.show("Helper")
|
||||||
|
updateSave()
|
||||||
end
|
end
|
||||||
|
37
xml/playercards/FamilyInheritance.xml
Normal file
37
xml/playercards/FamilyInheritance.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<Defaults>
|
||||||
|
<Button padding="30 30 30 30"
|
||||||
|
font="font_teutonic-arkham"
|
||||||
|
textColor="white"
|
||||||
|
fontSize="235"
|
||||||
|
shadow="#405041B3"
|
||||||
|
shadowDistance="-15 15"/>
|
||||||
|
<TableLayout position="130 0 -22"
|
||||||
|
rotation="0 0 270"
|
||||||
|
height="460"
|
||||||
|
width="2600"
|
||||||
|
scale="0.1 0.1 1"
|
||||||
|
cellSpacing="80"
|
||||||
|
cellBackgroundColor="rgba(1,1,1,0)"/>
|
||||||
|
</Defaults>
|
||||||
|
|
||||||
|
<TableLayout id="Helper"
|
||||||
|
active="false">
|
||||||
|
<Row>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="loseAll"
|
||||||
|
color="#6D202C"
|
||||||
|
fontSize="195"
|
||||||
|
text="Discard all"/>
|
||||||
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="takeAll"
|
||||||
|
color="#173B0B"
|
||||||
|
text="Move all"/>
|
||||||
|
</Cell>
|
||||||
|
<Cell>
|
||||||
|
<Button onClick="add4"
|
||||||
|
color="#77674D"
|
||||||
|
text="Place 4"/>
|
||||||
|
</Cell>
|
||||||
|
</Row>
|
||||||
|
</TableLayout>
|
Loading…
Reference in New Issue
Block a user