Skip to content

Commit

Permalink
Fix toasty playing over and over when clicking the same one
Browse files Browse the repository at this point in the history
Just make sure the cursor moved before playing
  • Loading branch information
poco0317 committed Jun 9, 2019
1 parent c4acf2a commit 0381772
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ local function moveCursor(x, y) -- move the cursor
end
lastClickedIndex = curIndex
if curPage == nextPage then
MESSAGEMAN:Broadcast("CursorMoved",{index = curIndex})
MESSAGEMAN:Broadcast("CursorMoved",{index = curIndex, prevIndex = oldIndex})
else
curPage = nextPage
MESSAGEMAN:Broadcast("PageMoved",{index = curIndex, page = curPage})
Expand Down Expand Up @@ -410,9 +410,10 @@ local function assetBox(i)
if lastClickedIndex == i then
confirmPick()
end
local prev = curIndex
lastClickedIndex = i
curIndex = i
MESSAGEMAN:Broadcast("CursorMoved",{index = i})
MESSAGEMAN:Broadcast("CursorMoved",{index = i, prevIndex = prev})
end
end
}
Expand Down Expand Up @@ -463,7 +464,7 @@ local function assetBox(i)

end,
CursorMovedMessageCommand = function(self, params)
if params.index == i and curType == 1 then
if params.index == i and curType == 1 and params.prevIndex ~= i then
self:play()
end
end
Expand Down

0 comments on commit 0381772

Please sign in to comment.