Merge pull request #617 from argonui/additional-vp-card
Added additional VP card
This commit is contained in:
commit
1dd8c80373
@ -24,7 +24,8 @@
|
||||
"UnderworldMarketHelper.3650ea",
|
||||
"Subject5U-21Helper.1335e8",
|
||||
"Auto-failCounter.a9a321",
|
||||
"ElderSignCounter.e62cb5"
|
||||
"ElderSignCounter.e62cb5",
|
||||
"AdditionalVictoryPoints.958bc0"
|
||||
],
|
||||
"ContainedObjects_path": "Fan-MadeAccessories.aa8b38",
|
||||
"CustomMesh": {
|
||||
|
@ -0,0 +1,61 @@
|
||||
{
|
||||
"AltLookAngle": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"Autoraise": true,
|
||||
"CardID": 266600,
|
||||
"ColorDiffuse": {
|
||||
"b": 0.71324,
|
||||
"g": 0.71324,
|
||||
"r": 0.71324
|
||||
},
|
||||
"CustomDeck": {
|
||||
"2666": {
|
||||
"BackIsHidden": true,
|
||||
"BackURL": "http://cloud-3.steamusercontent.com/ugc/2342503777940351785/F64D8EFB75A9E15446D24343DA0A6EEF5B3E43DB/",
|
||||
"FaceURL": "http://cloud-3.steamusercontent.com/ugc/2424696374431626355/0E8E98639A52981073EE7914612AB4E929BE79EA/",
|
||||
"NumHeight": 1,
|
||||
"NumWidth": 1,
|
||||
"Type": 0,
|
||||
"UniqueBack": false
|
||||
}
|
||||
},
|
||||
"Description": "",
|
||||
"DragSelectable": true,
|
||||
"GMNotes": "{\"class\":\"Mythos\",\"cycle\":\"Utility\",\"id\":\"ADDVP\",\"type\":\"Story\",\"victory\":1}",
|
||||
"GUID": "958bc0",
|
||||
"Grid": true,
|
||||
"GridProjection": false,
|
||||
"Hands": true,
|
||||
"HideWhenFaceDown": true,
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": false,
|
||||
"LuaScriptState": "{\"notes\":\"Click to type\",\"vp\":1}",
|
||||
"LuaScript_path": "Fan-MadeAccessories.aa8b38/AdditionalVictoryPoints.958bc0.ttslua",
|
||||
"MeasureMovement": false,
|
||||
"Name": "CardCustom",
|
||||
"Nickname": "Additional Victory Points",
|
||||
"SidewaysCard": false,
|
||||
"Snap": true,
|
||||
"Sticky": true,
|
||||
"Tags": [
|
||||
"ScenarioCard"
|
||||
],
|
||||
"Tooltip": true,
|
||||
"Transform": {
|
||||
"posX": -61.591,
|
||||
"posY": 4.834,
|
||||
"posZ": -74.678,
|
||||
"rotX": 0,
|
||||
"rotY": 270,
|
||||
"rotZ": 0,
|
||||
"scaleX": 1,
|
||||
"scaleY": 1,
|
||||
"scaleZ": 1
|
||||
},
|
||||
"Value": 0,
|
||||
"XmlUI": ""
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
-- Additional Victory Point Card
|
||||
local victoryDisplayApi = require("core/VictoryDisplayApi")
|
||||
|
||||
local MIN_VALUE = -10
|
||||
local MAX_VALUE = 99
|
||||
local vp, notes
|
||||
|
||||
function onSave()
|
||||
return JSON.encode({ vp = vp, notes = notes })
|
||||
end
|
||||
|
||||
function onLoad(savedData)
|
||||
if savedData and savedData ~= "" then
|
||||
local loadedData = JSON.decode(savedData)
|
||||
vp = loadedData.vp
|
||||
notes = loadedData.notes
|
||||
else
|
||||
vp = 1
|
||||
notes = "Click to type"
|
||||
end
|
||||
|
||||
createButtons()
|
||||
createTextbox()
|
||||
end
|
||||
|
||||
function createButtons()
|
||||
self.createButton({
|
||||
label = tostring(vp),
|
||||
click_function = "click_function",
|
||||
function_owner = self,
|
||||
position = { 0, 1, -0.05 },
|
||||
height = 600,
|
||||
width = 1000,
|
||||
font_size = 1000,
|
||||
font_color = { 0, 0, 0, 100 },
|
||||
color = { 0, 0, 0, 0 },
|
||||
scale = { 0.25, 0.25, 0.25 }
|
||||
})
|
||||
end
|
||||
|
||||
function createTextbox()
|
||||
self.createInput({
|
||||
input_function = "input_function",
|
||||
function_owner = self,
|
||||
label = "Click to type",
|
||||
value = notes,
|
||||
alignment = 2,
|
||||
position = { x = 0, y = 1, z = 0.825 },
|
||||
width = 4250,
|
||||
height = 2250,
|
||||
font_size = 360,
|
||||
scale = { 0.2, 0.2, 0.2 }
|
||||
})
|
||||
end
|
||||
|
||||
function updateNotes()
|
||||
local md = JSON.decode(self.getGMNotes())
|
||||
md.victory = vp
|
||||
self.setGMNotes(JSON.encode(md))
|
||||
victoryDisplayApi.update()
|
||||
end
|
||||
|
||||
function updateSave()
|
||||
self.script_state = JSON.encode({ vp = vp, notes = notes })
|
||||
end
|
||||
|
||||
function input_function(_, _, inputValue, selected)
|
||||
if selected == false then
|
||||
notes = inputValue
|
||||
updateSave()
|
||||
end
|
||||
end
|
||||
|
||||
function click_function(_, _, isRightClick)
|
||||
vp = math.min(math.max(vp + (isRightClick and -1 or 1), MIN_VALUE), MAX_VALUE)
|
||||
self.editButton({ index = 0, label = tostring(vp) })
|
||||
updateSave()
|
||||
updateNotes()
|
||||
end
|
@ -7,7 +7,7 @@ do
|
||||
end
|
||||
|
||||
-- triggers an update of the victory count
|
||||
---@param delay number Delay in seconds after which the update call is executed
|
||||
---@param delay? number Delay in seconds after which the update call is executed
|
||||
VictoryDisplayApi.update = function(delay)
|
||||
getVictoryDisplay().call("startUpdate", delay)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user