Skip to content
Snippets Groups Projects
Commit 46dbcf5d authored by DarkGod's avatar DarkGod
Browse files

starting to add rexo achievements picture

parent 881da4b1
No related branches found
No related tags found
No related merge requests found
Showing
with 35 additions and 9 deletions
......@@ -18,6 +18,7 @@
-- darkgod@te4.org
require "engine.class"
local Shader = require "engine.Shader"
local Dialog = require "engine.ui.Dialog"
local Image = require "engine.ui.Image"
local Textzone = require "engine.ui.Textzone"
......@@ -25,14 +26,16 @@ local Textzone = require "engine.ui.Textzone"
module(..., package.seeall, class.inherit(Dialog))
function _M:init(title, a)
local c_image = Image.new{file=a.image or "trophy_gold.png", shadow=true, width=64, height=64}
local c_desc = Textzone.new{width=500, auto_height=true, text=a.desc}
local c_image = Image.new{file=a.image or "trophy_gold.png", shadow=true, width=128, height=128}
local c_desc = Textzone.new{width=500, auto_height=true, text=a.desc, font={"/data/font/DroidSans-Bold.ttf", 26}}
c_desc:setTextShadow(1)
c_desc:setShadowShader(Shader.default.textoutline and Shader.default.textoutline.shad, 1.2)
Dialog.init(self, title, 10, 10)
self:loadUI{
{left=0, vcenter=0, ui=c_image},
{right=0, vcenter=0, ui=c_desc},
{left=4, vcenter=0, ui=c_image},
{left=c_image.w+14, vcenter=0, ui=c_desc},
}
self:setupUI(true, true, nil, nil, math.max(c_image.h, c_desc.h))
......
......@@ -40,7 +40,7 @@ function _M:init(title, player)
self.c_main = Checkbox.new{title="All achieved", default=true, fct=function() end, on_change=function(s) if s then self:switchTo("main") end end}
self.c_all = Checkbox.new{title="Everything", default=false, fct=function() end, on_change=function(s) if s then self:switchTo("all") end end}
self.c_image = Image.new{file="trophy_gold.png", width=64, height=64, shadow=true}
self.c_image = Image.new{file="trophy_gold.png", width=128, height=128, shadow=true}
self.c_desc = TextzoneList.new{scrollbar=true, width=math.floor(self.iw * 0.4 - 10), height=self.ih - self.c_self.h}
self:generateList("main")
......@@ -79,7 +79,7 @@ function _M:init(title, player)
{left=self.c_self.w+self.c_main.w, top=0, ui=self.c_all},
{left=0, top=self.c_self.h, ui=self.c_list},
{left=self.iw * 0.6 + 10, top=self.c_self.h, ui= self.c_image},
{left=self.c_list.w+sep.w, top=self.c_self.h, ui= self.c_image},
{left=self.c_list.w+sep.w, top=self.c_image.h + self.c_self.h, ui=self.c_desc},
{left=self.iw * 0.6 - 5, top=self.c_self.h + 5, ui=sep},
}
......@@ -110,6 +110,8 @@ function _M:select(item)
also = "#GOLD#Also achieved by your current character#LAST#\n"
end
self.c_image.item = item.tex
self.c_image.iw = item.tex[6]
self.c_image.ih = item.tex[7]
local track = self:getTrack(item.a)
local desc = ("#GOLD#Achieved on:#LAST# %s\n#GOLD#Achieved by:#LAST# %s\n%s\n#GOLD#Description:#LAST# %s"):format(item.when, item.who, also, item.desc):toTString()
if track then
......
......@@ -162,7 +162,7 @@ end
--- Show an achievement gain dialog
function _M:showAchievement(title, a)
if not config.settings.cheat then
if not config.settings.cheat or 1 then
local color = a.huge and "GOLD" or "LIGHT_GREEN"
game:registerDialog(Achievement.new("New Achievement: #"..color.."#"..a.name, a))
end
......
......@@ -60,7 +60,7 @@ function _M:display(x, y)
end
if self.shadow then
self.item[1]:toScreenFull(x + 5, y + 5, self.w, self.h, self.item[2], self.item[3], 0, 0, 0, 0.5)
self.item[1]:toScreenFull(x + 5, y + 5, self.w, self.h, self.item[2] * self.w / self.iw, self.item[3] * self.h / self.ih, 0, 0, 0, 0.5)
end
self.item[1]:toScreenFull(x, y, self.w, self.h, self.item[2] * self.w / self.iw, self.item[3] * self.h / self.ih)
......
......@@ -105,12 +105,19 @@ function _M:generate()
}
end
function _M:setShadowShader(shader, power)
self.shadow_shader = shader
self.shadow_power = power
end
function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y, local_x, local_y)
if not self.list then return end
offset_x = offset_x and offset_x or 0
offset_y = (offset_y and offset_y) or (self.scrollbar and self.scrollbar.pos or 0)
local_x = local_x and local_x or 0
local_y = local_y and local_y or 0
local shader = self.shadow_shader
local loffset_y = offset_y - local_y
local current_y = 0
......@@ -152,8 +159,17 @@ function _M:display(x, y, nb_keyframes, screen_x, screen_y, offset_x, offset_y,
end
local one_by_tex_h = 1 / item._tex_h
if self.text_shadow then item._tex:toScreenPrecise(x + current_x + 1, y + current_y + 1, item.w, item.h - (clip_y_start + clip_y_end), 0, item.w / item._tex_w, clip_y_start * one_by_tex_h, (item.h - clip_y_end) * one_by_tex_h, 0, 0, 0, self.text_shadow) end
if self.text_shadow then
if shader then
shader:use(true)
shader:uniOutlineSize(self.shadow_power, self.shadow_power)
shader:uniTextSize(item._tex_w, item._tex_h)
else
item._tex:toScreenPrecise(x + current_x + 1, y + current_y + 1, item.w, item.h - (clip_y_start + clip_y_end), 0, item.w / item._tex_w, clip_y_start * one_by_tex_h, (item.h - clip_y_end) * one_by_tex_h, 0, 0, 0, self.text_shadow)
end
end
item._tex:toScreenPrecise(x + current_x, y + current_y, item.w, item.h - (clip_y_start + clip_y_end), 0, item.w / item._tex_w, clip_y_start * one_by_tex_h, (item.h - clip_y_end) * one_by_tex_h )
if self.text_shadow and shader then shader:use(false) end
-- add only visible part of item
current_y = current_y + item.h - clip_y_start
end
......
......@@ -38,6 +38,11 @@ local PERMADEATH_ONE = 3
function _M:newAchievement(t)
t.id = t.id or t.name
t.id = t.id:upper():gsub("[ ]", "_")
if not fs.exists("/data/gfx/achievements/"..t.id:lower()..".png") then
t.image = "trophy_gold.png"
print("Achievement with default image not found", t.id, "/data/gfx/achievements/"..t.id:lower()..".png")
else t.image = "achievements/"..t.id:lower()..".png"
end
WA.newAchievement(self, t)
......
game/modules/tome/data/gfx/achievements/almost_master_of_arena.png

43.4 KiB

game/modules/tome/data/gfx/achievements/arena_battler_20.png

42.5 KiB

game/modules/tome/data/gfx/achievements/arena_battler_50.png

43.9 KiB

game/modules/tome/data/gfx/achievements/caldizar.png

41.6 KiB

game/modules/tome/data/gfx/achievements/event_cultists.png

40.5 KiB

game/modules/tome/data/gfx/achievements/event_fearscape.png

42.7 KiB

game/modules/tome/data/gfx/achievements/event_meteor.png

42.2 KiB

game/modules/tome/data/gfx/achievements/event_naga.png

42.3 KiB

game/modules/tome/data/gfx/achievements/event_oldbattlefield.png

41 KiB

game/modules/tome/data/gfx/achievements/event_pedestals.png

40.5 KiB

game/modules/tome/data/gfx/achievements/event_ratlich.png

39.8 KiB

game/modules/tome/data/gfx/achievements/exploration_almost_master_of_arena.png

42.6 KiB

game/modules/tome/data/gfx/achievements/exploration_arena_battler_20.png

41.9 KiB

game/modules/tome/data/gfx/achievements/exploration_arena_battler_50.png

43.6 KiB

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