-
Notifications
You must be signed in to change notification settings - Fork 0
/
Public.lua
60 lines (47 loc) · 1.11 KB
/
Public.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- Public.lua
local gpgs = require 'plugin.gpgs.v2'
local Public = {}
Public.__index = Public
--[[
function Public.new()
local o = {}
setmetatable(o, Public)
end
]]
local authorizationState = nil
local function initListener(event)
--[[
event.name
event.isError
event.errorMessage
event.errorCode
]]
if event.isError then
native.showAlert(event.name, event.errorMessage, {'OK'})
end
native.showAlert(event.name, event.isError, {'OK'})
initiated = not event.isError
end
local function loginListener(event)
--[[
event.name
event.isError
event.errorMessage
event.errorCode
event.phase one of "logged in", "canceled", "logged out"
]]
if event.isError then
native.showAlert(event.name, event.errorMessage, {'OK'})
end
authorizationState = event.phase
native.showAlert(event.name, event.phase, {'OK'})
end
function Public.showLeaderboard()
-- gpgs.init(initListener) -- never gets called, read somewhere it's no longer needed
gpgs.enableDebug()
gpgs.login({userInitiated=false, listener=loginListener})
gpgs.logout()
end
function Public.addToLeaderboard()
end
return Public