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

If there is room on the screen a new pane will appear in the levelup dialog to replace the tooltip

git-svn-id: http://svn.net-core.org/repos/t-engine4@5309 51575b47-30f0-44d4-a5cc-537603b46e54
parent 827f4312
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ require "mod.class.interface.TooltipsData"
local Dialog = require "engine.ui.Dialog"
local Textzone = require "engine.ui.Textzone"
local TextzoneList = require "engine.ui.TextzoneList"
local TalentTrees = require "mod.dialogs.elements.TalentTrees"
local Separator = require "engine.ui.Separator"
local DamageType = require "engine.DamageType"
......@@ -58,7 +59,10 @@ function _M:init(actor, on_finish, on_birth)
if v.type == "subclass" and v.name == actor.descriptor.subclass then self.desc_def = v break end
end
Dialog.init(self, "Levelup: "..actor.name, 740, game.h * 0.9, game.w * 0.05, game.h * 0.05)
Dialog.init(self, "Levelup: "..actor.name, game.w * 0.9, game.h * 0.9, game.w * 0.05, game.h * 0.05)
if game.w * 0.9 >= 1000 then
self.no_tooltip = true
end
self:generateList()
......@@ -551,14 +555,19 @@ function _M:createDisplay()
self.c_tree = TalentTrees.new{
tiles=game.uiset.hotkeys_display_icons,
tree=self.tree,
width=self.iw-200-10, height=self.ih-10,
width=530, height=self.ih-10,
tooltip=function(item)
local x = self.display_x + self.uis[3].x - game.tooltip.max
if self.display_x + self.w + game.tooltip.max <= game.w then x = self.display_x + self.w end
return self:getTalentDesc(item), x, nil
local ret = self:getTalentDesc(item), x, nil
if self.no_tooltip then
self.c_desc:erase()
self.c_desc:switchItem(ret, ret)
end
return ret
end,
on_use = function(item, inc) self:onUseTalent(item, inc) end,
scrollbar = true,
scrollbar = true, no_tooltip = self.no_tooltip,
}
self.c_stat = TalentTrees.new{
......@@ -569,10 +578,16 @@ function _M:createDisplay()
tooltip=function(item)
local x = self.display_x + self.uis[1].x + self.uis[1].ui.w
if self.display_x + self.w + game.tooltip.max <= game.w then x = self.display_x + self.w end
return self:getStatDesc(item), x, nil
local ret = self:getStatDesc(item), x, nil
if self.no_tooltip then
self.c_desc:erase()
self.c_desc:switchItem(ret, ret)
end
return ret
end,
on_use = function(item, inc) self:onUseTalent(item, inc) end,
on_expand = function(item) self.actor.__hidden_talent_types[item.type] = not item.shown end,
no_tooltip = self.no_tooltip,
}
self.c_points = Textzone.new{
......@@ -583,7 +598,7 @@ function _M:createDisplay()
local vsep = Separator.new{dir="horizontal", size=self.ih - 20}
local hsep = Separator.new{dir="vertical", size=180}
return {
local ret = {
{left=0, top=0, ui=self.c_stat},
{left=self.c_stat, top=10, ui=vsep},
{left=vsep, top=0, ui=self.c_tree},
......@@ -591,6 +606,18 @@ function _M:createDisplay()
{left=10, top=210, ui=hsep},
{left=0, top=hsep, ui=self.c_points},
}
if self.no_tooltip then
local vsep2 = Separator.new{dir="horizontal", size=self.ih - 20}
self.c_desc = TextzoneList.new{
width=self.iw - 200 - 530 - 40, height = self.ih,
scrollbar = true,
}
ret[#ret+1] = {right=0, top=0, ui=self.c_desc}
ret[#ret+1] = {right=self.c_desc.w, top=0, ui=vsep2}
end
return ret
end
function _M:getStatDesc(item)
......
......@@ -36,6 +36,7 @@ function _M:init(t)
self.scrollbar = t.scrollbar
self.no_cross = t.no_cross
self.dont_select_top = t.dont_select_top
self.no_tooltip = t.no_tooltip
self.icon_size = 48
self.frame_size = 50
......@@ -71,7 +72,7 @@ function _M:updateTooltip()
end
local mz = self.last_mz
local str = self.tooltip(mz.item)
game:tooltipDisplayAtMap(mz.tx or (self.last_display_x + mz.x2), mz.ty or (self.last_display_y + mz.y1), str)
if not self.no_tooltip then game:tooltipDisplayAtMap(mz.tx or (self.last_display_x + mz.x2), mz.ty or (self.last_display_y + mz.y1), str) end
end
function _M:doScroll(v)
......@@ -130,7 +131,7 @@ function _M:moveSel(i, j)
if not self.last_mz then return end
local str, fx, fy = self.tooltip(self.last_mz.item)
self.last_mz.tx, self.last_mz.ty = fx or (self.last_display_x + self.last_mz.x2), fy or (self.last_display_y + self.last_mz.y1)
game:tooltipDisplayAtMap(self.last_mz.tx, self.last_mz.ty, str)
if not self.no_tooltip then game:tooltipDisplayAtMap(self.last_mz.tx, self.last_mz.ty, str) end
end
function _M:generate()
......@@ -164,7 +165,7 @@ function _M:generate()
if not self.last_mz or mz.item ~= self.last_mz.item then
local str, fx, fy = self.tooltip(mz.item)
mz.tx, mz.ty = fx or (self.last_display_x + mz.x2), fy or (self.last_display_y + mz.y1)
game:tooltipDisplayAtMap(mz.tx, mz.ty, str)
if not self.no_tooltip then game:tooltipDisplayAtMap(mz.tx, mz.ty, str) end
end
if event == "button" and (button == "left" or button == "right") then
......
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