Skip to content
Snippets Groups Projects
Commit 7aae379d authored by dg's avatar dg
Browse files

Improved items tooltips with more color. Also when an item tooltip is show,...

Improved items tooltips with more color. Also when an item tooltip is show, pressing control will make it display the differences with your current equipped item for the same slot


git-svn-id: http://svn.net-core.org/repos/t-engine4@3529 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6b5f0118
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,11 @@ local Separator = require "engine.ui.Separator"
module(..., package.seeall, class.inherit(Dialog))
function _M:init(title, x, y, filter, action, takeall)
function _M:init(title, x, y, filter, action, takeall, actor)
self.x, self.y = x, y
self.filter = filter
self.action = action
self.actor = actor
Dialog.init(self, title or "Pickup", math.max(800, game.w * 0.8), math.max(600, game.h * 0.8))
local takeall = Button.new{text=takeall or "(*) Take all", width=self.iw - 40, fct=function() self:takeAll() end}
......
......@@ -258,7 +258,7 @@ end
-- @param filter nil or a function that filters the objects to list
-- @param action a function called when an object is selected
function _M:showPickupFloor(title, filter, action)
local d = ShowPickupFloor.new(title, self.x, self.y, filter, action, self)
local d = ShowPickupFloor.new(title, self.x, self.y, filter, action, nil, self)
game:registerDialog(d)
return d
end
......
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Base = require "engine.dialogs.ShowEquipInven"
module(..., package.seeall, class.inherit(Base))
function _M:init(...)
Base.init(self, ...)
-- Add tooltips
self.on_select = function(item)
if item.last_display_x and item.object then
game.tooltip_x, game.tooltip_y = {}, 1
game.tooltip:displayAtMap(nil, nil, item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, self.actor:getInven(item.object:wornInven())))
end
end
self.key.any_key = function(sym)
-- Control resets the tooltip
if sym == self.key._LCTRL or sym == self.key._RCTRL then local i = self.cur_item self.cur_item = nil self:select(i) end
end
end
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Base = require "engine.dialogs.ShowInventory"
module(..., package.seeall, class.inherit(Base))
function _M:init(...)
Base.init(self, ...)
self.key.any_key = function(sym)
-- Control resets the tooltip
if (sym == self.key._LCTRL or sym == self.key._RCTRL) and self.cur_item then self.cur_item.desc = nil self:select(self.cur_item) end
end
for i, item in ipairs(self.list) do item.desc = nil end
self:select(self.list[1])
end
function _M:select(item)
if item then
self.cur_item = item
if not item.desc then
item.desc = item.object:getDesc({do_color=true}, self.actor:getInven(item.object:wornInven()))
self.c_desc:createItem(item, item.desc)
end
self.c_desc:switchItem(item, item.desc)
end
end
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Base = require "engine.dialogs.ShowPickupFloor"
module(..., package.seeall, class.inherit(Base))
function _M:init(...)
Base.init(self, ...)
self.key.any_key = function(sym)
-- Control resets the tooltip
if (sym == self.key._LCTRL or sym == self.key._RCTRL) and self.cur_item then self.cur_item.desc = nil self:select(self.cur_item) end
end
for i, item in ipairs(self.list) do item.desc = nil end
self:select(self.list[1])
end
function _M:select(item)
if item then
self.cur_item = item
if not item.desc then
item.desc = item.object:getDesc({do_color=true}, self.actor:getInven(item.object:wornInven()))
self.c_desc:createItem(item, item.desc)
end
self.c_desc:switchItem(item, item.desc)
end
end
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