minor bugfix
This commit is contained in:
parent
4884899f30
commit
8ee07b2582
@ -1,7 +1,5 @@
|
||||
local playmatAPI = require("playermat/PlaymatApi")
|
||||
local matColor
|
||||
local handColor
|
||||
local loopId
|
||||
local matColor, handColor, loopId, hovering
|
||||
|
||||
function onLoad()
|
||||
local buttonParamaters = {}
|
||||
@ -48,12 +46,18 @@ function onDrop() updateColors() end
|
||||
-- toggles counting method briefly
|
||||
function onObjectHover(hover_color, obj)
|
||||
-- only continue if correct player hovers over "self"
|
||||
if obj ~= self or hover_color ~= handColor then return end
|
||||
if obj ~= self or hover_color ~= handColor or hovering then return end
|
||||
|
||||
-- toggle this flag so this doesn't get executed multiple times during the delay
|
||||
hovering = true
|
||||
|
||||
-- stop loop, toggle "des" and displayed value briefly, then start new loop after 2s
|
||||
Wait.stop(loopId)
|
||||
updateValue(true)
|
||||
Wait.time(function() loopId = Wait.time(updateValue, 1, -1) end, 2)
|
||||
Wait.time(function()
|
||||
loopId = Wait.time(updateValue, 1, -1)
|
||||
hovering = false
|
||||
end, 1)
|
||||
end
|
||||
|
||||
-- updates the matcolor and handcolor variable
|
||||
@ -99,7 +103,7 @@ function updateValue(toggle)
|
||||
if obj.tag == "Card" then size = size + 1 end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- update button label and color
|
||||
self.editButton({ index = 0, font_color = des and "Green" or "White", label = size })
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user