So for the demo I attached on the forum thread, it'd be great if when I asked for my trophy list, it would cache, and GJ.awardTropy() would update the cache on success, that way I don't need to re-ask the server if the trophy list via GJ.fetchAllTrophies()
I'm wiling to offer a pull request if you like.
Here's my implementiation:
GJ = require "gamejolt"
function love.load()
GJ.init(48003, "01c30651babd8798ee2e972dae7ffc14")
GJ.authUser("josefnpat",170094)
GJ.openSession()
trophies = GJ.fetchAllTrophies()
end
time = 0
function love.update(dt)
time = time + dt
if time > 10 and not time_awarded then
GJ.giveTrophy(16524)
trophies = GJ.fetchAllTrophies()
time_awarded = true
end
end
log = ""
function love.draw()
love.graphics.printf(love.timer.getFPS(),0,0,love.graphics.getWidth(),"right")
local s = ""
for i,v in pairs(trophies) do
s = s .. i .. ":\n"
for j,w in pairs(v) do
s = s .. j .. " - " .. w .. "\n"
end
s = s .. "\n"
end
love.graphics.print(s.."\n\n"..log)
end
function love.mousepressed()
GJ.giveTrophy(16523)
trophies = GJ.fetchAllTrophies()
end
function love.keypressed(key)
if key == "b" then
GJ.giveTrophy(16525)
trophies = GJ.fetchAllTrophies()
end
end
function love.quit()
GJ.closeSession()
end
So for the demo I attached on the forum thread, it'd be great if when I asked for my trophy list, it would cache, and
GJ.awardTropy()
would update the cache on success, that way I don't need to re-ask the server if the trophy list viaGJ.fetchAllTrophies()
I'm wiling to offer a pull request if you like.
Here's my implementiation: