Skip to content
Snippets Groups Projects
Commit 5c32ea1f authored by dg's avatar dg
Browse files

When changing list in inventory or store display the tooltip correctly updates

git-svn-id: http://svn.net-core.org/repos/t-engine4@3548 51575b47-30f0-44d4-a5cc-537603b46e54
parent c03fccc9
No related branches found
No related tags found
No related merge requests found
......@@ -145,6 +145,12 @@ function _M:select(item)
self.cur_item = item
end
function _M:on_focus(id, ui)
if self.focus_ui and self.focus_ui.ui == self.c_inven then self:select(self.c_inven.list[self.c_inven.sel])
elseif self.focus_ui and self.focus_ui.ui == self.c_equip then self:select(self.c_equip.list[self.c_equip.sel])
end
end
function _M:use(item, button, event)
if item then
if self.action(item.object, item.inven, item.item, button, event) then
......
......@@ -92,6 +92,12 @@ function _M:select(item)
self.cur_item = item
end
function _M:on_focus(id, ui)
if self.focus_ui and self.focus_ui.ui == self.c_inven then self:select(self.c_inven.list[self.c_inven.sel])
elseif self.focus_ui and self.focus_ui.ui == self.c_store then self:select(self.c_store.list[self.c_store.sel])
end
end
function _M:use(item)
if item and item.object then
if self.focus_ui and self.focus_ui.ui == self.c_store then
......
......@@ -401,6 +401,7 @@ function _M:moveFocus(v)
while start ~= id and cnt <= #self.uis do
if self.uis[id].ui.can_focus then
self:setFocus(id)
self:on_focus(id, self.uis[id].ui)
break
end
id = util.boundWrap(id + v, 1, #self.uis)
......@@ -408,6 +409,9 @@ function _M:moveFocus(v)
end
end
function _M:on_focus(id, ui)
end
function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event)
-- Look for focus
for i = 1, #self.uis do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment