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

moar steam stuff

parent 6c948f8f
No related branches found
No related tags found
No related merge requests found
......@@ -497,6 +497,10 @@ function string.parseHex(str)
return res
end
function string.toHex(str,spacer)
return string.gsub(str, ".", function(c) return string.format("%02X%s",string.byte(c), spacer or "") end)
end
function __get_uid_surface(uid, w, h)
uid = tonumber(uid)
local e = uid and __uids[uid]
......
......@@ -87,6 +87,8 @@ function _M:updateUI()
end
function _M:uiLogin(uis)
if core.steam then return self:uiLoginSteam(uis) end
local str = Textzone.new{auto_width=true, auto_height=true, text="#GOLD#Online Profile"}
local bt = Button.new{text="Login", width=50, fct=function() self:login() end}
self.c_login = Textbox.new{title="Username: ", text="", chars=20, max_len=20, fct=function(text) self:login() end}
......@@ -99,6 +101,15 @@ function _M:uiLogin(uis)
uis[#uis+1] = {hcenter=0, bottom=0, ui=bt}
end
function _M:uiLoginSteam(uis)
local str = Textzone.new{auto_width=true, auto_height=true, text="#GOLD#Online Profile"}
local bt = Button.new{text="Login with Steam", fct=function() self:loginSteam() end}
uis[#uis+1] = {left=10, bottom=bt.h + str.h, ui=Separator.new{dir="vertical", size=self.iw - 20}}
uis[#uis+1] = {hcenter=0, bottom=bt.h, ui=str}
uis[#uis+1] = {hcenter=0, bottom=0, ui=bt}
end
function _M:uiStats(uis)
self.logged_url = "http://te4.org/users/"..profile.auth.page
local str1 = Textzone.new{auto_width=true, auto_height=true, text="#GOLD#Online Profile#WHITE#"}
......@@ -124,6 +135,10 @@ function _M:login()
game:createProfile({create=false, login=self.c_login.text, pass=self.c_pass.text})
end
function _M:loginSteam()
print("<<<", core.steam.sessionTicket():toHex())
end
function _M:logout()
profile:logOut()
self:on_recover_focus()
......
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