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

New levelup screen. Much faster, lighter, smaller and with less wall of texts!

git-svn-id: http://svn.net-core.org/repos/t-engine4@5238 51575b47-30f0-44d4-a5cc-537603b46e54
parent 99714fb6
No related branches found
No related tags found
No related merge requests found
......@@ -113,7 +113,7 @@ myssil_dies = function(self)
local corr = nil
for uid, e in pairs(game.level.entities) do
if e.faction == "rhalore" then e.invulnerable = 1 end
if e.faction == "rhalore" then e:setEffect(e.EFF_VICTORY_RUSH_ZIGUR, 20, {}) end
if e.define_as and e.define_as == "GRAND_CORRUPTOR" then corr = e end
end
if not corr then return end
......
......@@ -1523,3 +1523,19 @@ newEffect{
self:removeTemporaryValue("zero_resource_cost", eff.tmpid)
end,
}
newEffect{
name = "VICTORY_RUSH_ZIGUR", image = "talents/arcane_destruction.png",
desc = "Victory Rush",
long_desc = function(self, eff) return "The thrill of victory makes this creature invulnerable." end,
type = "other",
subtype = { arcane=true },
status = "beneficial",
parameters = { },
activate = function(self, eff)
eff.tmpid = self:addTemporaryValue("invulnerable", 1)
end,
deactivate = function(self, eff)
self:removeTemporaryValue("invulnerable", eff.tmpid)
end,
}
......@@ -28,13 +28,6 @@ local DamageType = require "engine.DamageType"
module(..., package.seeall, class.inherit(Dialog, mod.class.interface.TooltipsData))
local _points_text = "Stats points left: #00FF00#%d#LAST#"
local _points_left = [[
Category points left: #00FF00#%d#LAST#
Class talent points left: #00FF00#%d#LAST#
Generic talent points left: #00FF00#%d#LAST#]]
function _M:init(actor, on_finish, on_birth)
self.on_birth = on_birth
actor.no_last_learnt_talents_cap = true
......@@ -65,13 +58,22 @@ 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, game.w * 0.9, game.h * 0.9, game.w * 0.05, game.h * 0.05)
Dialog.init(self, "Levelup: "..actor.name, 650, game.h * 0.9, game.w * 0.05, game.h * 0.05)
self:generateList()
self:loadUI(self:createDisplay())
self:setupUI()
self.key:addCommands{
__TEXTINPUT = function(c)
if c == "+" and self.focus_ui and self.focus_ui.ui.onExpand then
self.focus_ui.ui:onExpand(self.focus_ui.ui.last_mz.item)
elseif c == "-" then
self.focus_ui.ui:onExpand(self.focus_ui.ui.last_mz.item)
end
end,
}
self.key:addBinds{
EXIT = function()
if self.actor.unused_stats~=self.actor_dup.unused_stats or self.actor.unused_talents_types~=self.actor_dup.unused_talents_types or
......@@ -491,7 +493,10 @@ function _M:generateList()
-- Makes up the stats list
local phys, mind = {}, {}
self.tree_stats = {{shown=true, nodes=phys, name="Physical Stats", type_stat=true}, {shown=true, nodes=mind, name="Mental Stats", type_stat=true}}
self.tree_stats = {
{shown=true, nodes=phys, name="Physical Stats", type_stat=true, desc=self.TOOLTIP_STRDEXCON},
{shown=true, nodes=mind, name="Mental Stats", type_stat=true, desc=TOOLTIP_MAGWILCUN}
}
for i, sid in ipairs{self.actor.STAT_STR, self.actor.STAT_DEX, self.actor.STAT_CON, self.actor.STAT_MAG, self.actor.STAT_WIL, self.actor.STAT_CUN } do
local s = self.actor.stats_def[sid]
......@@ -542,7 +547,11 @@ function _M:createDisplay()
tiles=game.uiset.hotkeys_display_icons,
tree=self.tree,
width=self.iw-200-10, height=self.ih-10,
tooltip=function(item) return self:getTalentDesc(item), self.uis[3].x - game.tooltip.max, nil end,
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
end,
on_use = function(item, inc) self:onUseTalent(item, inc) end,
scrollbar = true,
}
......@@ -551,7 +560,12 @@ function _M:createDisplay()
tiles=game.uiset.hotkeys_display_icons,
tree=self.tree_stats, no_cross = true,
width=200, height=210,
tooltip=function(item) return item.desc end,
dont_select_top = true,
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 item.desc, x, nil
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,
}
......
This diff is collapsed.
......@@ -35,6 +35,7 @@ function _M:init(t)
self.on_expand = t.on_expand
self.scrollbar = t.scrollbar
self.no_cross = t.no_cross
self.dont_select_top = t.dont_select_top
self.icon_size = 48
self.frame_size = 50
......@@ -53,10 +54,12 @@ function _M:init(t)
end
function _M:onUse(item, inc)
self.last_scroll = nil
self.on_use(item, inc)
end
function _M:onExpand(item, inc)
self.last_scroll = nil
item.shown = not item.shown
if self.on_expand then self.on_expand(item) end
end
......@@ -75,6 +78,58 @@ function _M:doScroll(v)
self.scroll = util.bound(self.scroll + v, 1, self.max_display)
end
function _M:moveSel(i, j)
local match = nil
if i == 0 then
local t = self.tree[self.sel_i]
if t.nodes then
self.sel_j = util.bound(self.sel_j + j, 1, #t.nodes)
match = t.nodes[self.sel_j]
end
elseif i == 1 then
local t = self.tree[self.sel_i]
if t.shown and self.sel_j == 0 and t.nodes and #t.nodes > 0 then
self.sel_j = 1
match = t.nodes[1]
else
self.sel_i = util.bound(self.sel_i + i, 1, #self.tree)
self.sel_j = 0
self.scroll = util.scroll(self.sel_i, self.scroll, self.max_display)
local t = self.tree[self.sel_i]
match = t
end
elseif i == -1 then
local t = self.tree[self.sel_i]
if t.shown and self.sel_j > 0 and t.nodes and #t.nodes > 0 then
self.sel_j = 0
match = t
else
self.sel_i = util.bound(self.sel_i + i, 1, #self.tree)
self.scroll = util.scroll(self.sel_i, self.scroll, self.max_display)
local t = self.tree[self.sel_i]
if t.shown and t.nodes and #t.nodes > 0 then
self.sel_j = 1
match = t.nodes[1]
else
self.sel_j = 0
match = t
end
end
end
for i = 1, #self.mousezones do
local mz = self.mousezones[i]
if mz.item == match then self.last_mz = mz break end
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)
self.last_scroll = nil
end
function _M:generate()
self.mouse:reset()
self.key:reset()
......@@ -86,6 +141,9 @@ function _M:generate()
self.scrollbar = Slider.new{size=self.h, max=#self.tree}
end
self.sel_i = 1
self.sel_j = 1
self.mousezones = {}
self:redrawAllItems()
......@@ -116,6 +174,8 @@ function _M:generate()
end
self.last_mz = mz
self.sel_i = mz.i
self.sel_j = mz.j
done = true
break
end
......@@ -123,19 +183,20 @@ function _M:generate()
if not done then game.tooltip_x = nil self.last_mz = nil end
end)
self.key:addBinds{
ACCEPT = function() self:onUse("left", "key") end,
MOVE_UP = function()
end,
MOVE_DOWN = function()
end,
ACCEPT = function() self:onUse(self.last_mz.item, true) end,
MOVE_UP = function() self:moveSel(-1, 0) end,
MOVE_DOWN = function() self:moveSel(1, 0) end,
MOVE_LEFT = function() self:moveSel(0, -1) end,
MOVE_RIGHT = function() self:moveSel(0, 1) end,
}
self.key:addCommands{
[{"_RETURN","ctrl"}] = function() self:onUse(self.last_mz.item, false) end,
[{"_UP","ctrl"}] = function() self.key:triggerVirtual("MOVE_UP") end,
[{"_DOWN","ctrl"}] = function() self.key:triggerVirtual("MOVE_DOWN") end,
_HOME = function()
end,
_END = function()
end,
[{"_LEFT","ctrl"}] = function() self.key:triggerVirtual("MOVE_LEFT") end,
[{"_RIGHT","ctrl"}] = function() self.key:triggerVirtual("MOVE_RIGHT") end,
_HOME = function() self.sel_i = 1 self:moveSel(-1, 0) end,
_END = function() self.sel_i = #self.tree self:moveSel(1, 0) end,
_PAGEUP = function()
end,
_PAGEDOWN = function()
......@@ -184,7 +245,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
self.last_display_y = screen_y
local mz = {}
self.mousezones = mz
if self.last_scroll ~= self.scroll then self.mousezones = mz end
local dx, dy = 0, 0
......@@ -200,7 +261,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
local key = tree.text_status
local cross = not tree.shown and self.plus or self.minus
mz[#mz+1] = {item=tree, x1=dx, y1=dy, x2=dx+cross.w + 3 + key.w, y2=dy+cross.h}
mz[#mz+1] = {i=i,j=1, item=tree, x1=dx, y1=dy, x2=dx+cross.w + 3 + key.w, y2=dy+cross.h}
if not self.no_cross then
cross.t:toScreenFull(dx+x, dy+y + (-cross.h + key.h) / 2, cross.w, cross.h, cross.tw, cross.th)
......@@ -228,7 +289,7 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
addh = key.h
end
mz[#mz+1] = {item=tal, x1=dx, y1=dy, x2=dx+self.frame_size, y2=dy+self.frame_size+addh}
mz[#mz+1] = {i=i, j=j, item=tal, x1=dx, y1=dy, x2=dx+self.frame_size, y2=dy+self.frame_size+addh}
dx = dx + self.frame_size + self.frame_offset
addh = addh + self.frame_size
......@@ -243,4 +304,6 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y)
self.scrollbar.pos = self.scroll
self.scrollbar:display(x + self.w - self.scrollbar.w, y)
end
self.last_scroll = self.scroll
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