version 1
This commit is contained in:
parent
e0689dc90c
commit
f98cf3ca39
@ -33,7 +33,7 @@
|
|||||||
"IgnoreFoW": false,
|
"IgnoreFoW": false,
|
||||||
"LayoutGroupSortIndex": 0,
|
"LayoutGroupSortIndex": 0,
|
||||||
"Locked": false,
|
"Locked": false,
|
||||||
"LuaScript": "",
|
"LuaScript": "require(\"playercards/cards/KhakuNarukami\")",
|
||||||
"LuaScriptState": "",
|
"LuaScriptState": "",
|
||||||
"MeasureMovement": false,
|
"MeasureMovement": false,
|
||||||
"Name": "Card",
|
"Name": "Card",
|
||||||
|
64
src/playercards/cards/KhakuNarukami.ttslua
Normal file
64
src/playercards/cards/KhakuNarukami.ttslua
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
function onSave()
|
||||||
|
return JSON.encode()
|
||||||
|
end
|
||||||
|
|
||||||
|
function onLoad(savedData)
|
||||||
|
self.addContextMenuItem("Enable Helper", createButtons)
|
||||||
|
sigil = JSON.decode(savedData)
|
||||||
|
if sigil and sigil ~= nil then
|
||||||
|
makeXMLButton(sigil)
|
||||||
|
self.clearContextMenu()
|
||||||
|
self.addContextMenuItem("Clear Helper", deleteButtons)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function makeXMLButton(chosenToken)
|
||||||
|
self.UI.setXmlTable({
|
||||||
|
{
|
||||||
|
tag="Button",
|
||||||
|
attributes={
|
||||||
|
height=450,
|
||||||
|
width=1400,
|
||||||
|
rotation="0 0 180",
|
||||||
|
scale="0.1 0.1 1",
|
||||||
|
position="0 -55 -22",
|
||||||
|
padding="50 50 50 50",
|
||||||
|
font="font_teutonic-arkham",
|
||||||
|
fontSize=300,
|
||||||
|
iconWidth=400,
|
||||||
|
iconAlignment="Right",
|
||||||
|
onClick="remove",
|
||||||
|
id=sigil,
|
||||||
|
icon=dataForToken[sigil].icon,
|
||||||
|
color=dataForToken[sigil].color,
|
||||||
|
textColor="White",
|
||||||
|
},
|
||||||
|
value="Resolve",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create dialog window to choose sigil and create sigil-drawing button
|
||||||
|
function chooseSigil(playerColor)
|
||||||
|
self.clearContextMenu()
|
||||||
|
self.addContextMenuItem("Clear Helper", deleteButtons)
|
||||||
|
Player[playerColor].showOptionsDialog("Choose Sigil", tokenNames, 1,
|
||||||
|
function(chosenToken)
|
||||||
|
if chosenToken == "Custom Token" then
|
||||||
|
sigil = ""
|
||||||
|
else
|
||||||
|
sigil = chosenToken
|
||||||
|
end
|
||||||
|
makeXMLButton(sigil)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Delete button and remove sigil
|
||||||
|
function deleteButtons()
|
||||||
|
self.clearContextMenu()
|
||||||
|
self.addContextMenuItem("Enable Helper", chooseSigil)
|
||||||
|
self.UI.setXml("")
|
||||||
|
sigil = nil
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user