Fix deck grid tooltip hover handling
This commit is contained in:
@@ -68,9 +68,16 @@ if allDeckClose ~= nil and (allDeckClose.ButtonComponent ~= nil or allDeckClose:
|
||||
allDeckClose:DisconnectEvent(ButtonClickEvent, self.AllDeckCloseHandler)
|
||||
self.AllDeckCloseHandler = nil
|
||||
end
|
||||
self.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)
|
||||
self.AllDeckCloseHandler = allDeckClose:ConnectEvent(ButtonClickEvent, function() self:CloseAllDeck() end)
|
||||
end
|
||||
self:BindClassDeckTabs()
|
||||
local allDeckGrid = _EntityService:GetEntityByPath("/ui/DeckUIGroup/DeckAllHud/Grid")
|
||||
if allDeckGrid ~= nil and (allDeckGrid.UITouchReceiveComponent ~= nil or allDeckGrid:AddComponent("UITouchReceiveComponent") ~= nil) then
|
||||
allDeckGrid:ConnectEvent(UITouchEnterEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckAllHud/Grid", ev.TouchPoint) end)
|
||||
allDeckGrid:ConnectEvent(UITouchDownEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckAllHud/Grid", ev.TouchPoint) end)
|
||||
allDeckGrid:ConnectEvent(UITouchDragEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckAllHud/Grid", ev.TouchPoint) end)
|
||||
allDeckGrid:ConnectEvent(UITouchExitEvent, function() self:UnhoverGridCard("/ui/DeckUIGroup/DeckAllHud/Grid") end)
|
||||
end
|
||||
for i = 1, 120 do
|
||||
local allCard = _EntityService:GetEntityByPath("/ui/DeckUIGroup/DeckAllHud/Grid/Card" .. tostring(i))
|
||||
if allCard ~= nil and (allCard.ButtonComponent ~= nil or allCard:AddComponent("ButtonComponent") ~= nil) then
|
||||
@@ -78,9 +85,45 @@ for i = 1, 120 do
|
||||
allCard.SpriteGUIRendererComponent.RaycastTarget = true
|
||||
end
|
||||
local slot = i
|
||||
local cardPath = "/ui/DeckUIGroup/DeckAllHud/Grid/Card" .. tostring(i)
|
||||
allCard:ConnectEvent(ButtonStateChangeEvent, function(ev)
|
||||
local state = nil
|
||||
if ev ~= nil then
|
||||
state = ev.CurrentState or ev.ButtonState or ev.State
|
||||
end
|
||||
if state == ButtonState.Highlighted or state == ButtonState.Pressed or tostring(state) == "1" or tostring(state) == "2" then
|
||||
self:HoverCardByPath(cardPath)
|
||||
else
|
||||
self:UnhoverCardByPath(cardPath)
|
||||
end
|
||||
end)
|
||||
allCard:ConnectEvent(ButtonClickEvent, function() self:OnAllDeckCardButton(slot) end)
|
||||
end
|
||||
end
|
||||
local inspectGrid = _EntityService:GetEntityByPath("/ui/DeckUIGroup/DeckInspectHud/Grid")
|
||||
if inspectGrid ~= nil and (inspectGrid.UITouchReceiveComponent ~= nil or inspectGrid:AddComponent("UITouchReceiveComponent") ~= nil) then
|
||||
inspectGrid:ConnectEvent(UITouchEnterEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckInspectHud/Grid", ev.TouchPoint) end)
|
||||
inspectGrid:ConnectEvent(UITouchDownEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckInspectHud/Grid", ev.TouchPoint) end)
|
||||
inspectGrid:ConnectEvent(UITouchDragEvent, function(ev) self:HoverGridCard("/ui/DeckUIGroup/DeckInspectHud/Grid", ev.TouchPoint) end)
|
||||
inspectGrid:ConnectEvent(UITouchExitEvent, function() self:UnhoverGridCard("/ui/DeckUIGroup/DeckInspectHud/Grid") end)
|
||||
end
|
||||
for i = 1, 60 do
|
||||
local inspectCard = _EntityService:GetEntityByPath("/ui/DeckUIGroup/DeckInspectHud/Grid/Card" .. tostring(i))
|
||||
if inspectCard ~= nil and (inspectCard.ButtonComponent ~= nil or inspectCard:AddComponent("ButtonComponent") ~= nil) then
|
||||
local cardPath = "/ui/DeckUIGroup/DeckInspectHud/Grid/Card" .. tostring(i)
|
||||
inspectCard:ConnectEvent(ButtonStateChangeEvent, function(ev)
|
||||
local state = nil
|
||||
if ev ~= nil then
|
||||
state = ev.CurrentState or ev.ButtonState or ev.State
|
||||
end
|
||||
if state == ButtonState.Highlighted or state == ButtonState.Pressed or tostring(state) == "1" or tostring(state) == "2" then
|
||||
self:HoverCardByPath(cardPath)
|
||||
else
|
||||
self:UnhoverCardByPath(cardPath)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
for i = 1, 10 do
|
||||
local cardEntity = _EntityService:GetEntityByPath("/ui/RunUIGroup/CardHand/Card" .. tostring(i))
|
||||
if cardEntity ~= nil and cardEntity.UITouchReceiveComponent ~= nil then
|
||||
@@ -105,6 +148,8 @@ for i = 1, 3 do
|
||||
local cardPath = "/ui/RunUIGroup/RewardHud/Reward" .. tostring(i)
|
||||
rc:ConnectEvent(UITouchEnterEvent, function() self:SetCardHover(cardPath, true) end)
|
||||
rc:ConnectEvent(UITouchExitEvent, function() self:SetCardHover(cardPath, false) end)
|
||||
rc:ConnectEvent(UITouchEnterEvent, function() self:HoverCardByPath(cardPath) end)
|
||||
rc:ConnectEvent(UITouchExitEvent, function() self:UnhoverCardByPath(cardPath) end)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -134,6 +179,8 @@ for i = 1, 3 do
|
||||
local cardPath = "/ui/RunUIGroup/ShopHud/Card" .. tostring(i)
|
||||
sc:ConnectEvent(UITouchEnterEvent, function() self:SetCardHover(cardPath, true) end)
|
||||
sc:ConnectEvent(UITouchExitEvent, function() self:SetCardHover(cardPath, false) end)
|
||||
sc:ConnectEvent(UITouchEnterEvent, function() self:HoverCardByPath(cardPath) end)
|
||||
sc:ConnectEvent(UITouchExitEvent, function() self:UnhoverCardByPath(cardPath) end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user