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

test

git-svn-id: http://svn.net-core.org/repos/t-engine4@5686 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6124f271
No related branches found
No related tags found
No related merge requests found
......@@ -664,6 +664,8 @@ function _M:instanciate(mod, name, new_game, no_reboot)
core.wait.disable()
core.display.resetAllFonts("normal")
if mod.short_name ~= "boot" then profile:noMoreAuthWait() end
end
--- Setup write dir for a module
......
......@@ -254,7 +254,7 @@ function _M:loadModuleProfile(short_name, mod_def)
end
--- Saves a profile data
function _M:saveGenericProfile(name, data, no_sync, nowrite)
function _M:saveGenericProfile(name, data, nosync, nowrite)
-- Delay when we are currently saving
if not profile then return end
if savefile_pipe and savefile_pipe.saving then savefile_pipe:pushGeneric("saveGenericProfile", function() self:saveGenericProfile(name, data, nosync) end) return end
......@@ -397,7 +397,12 @@ function _M:waitEvent(name, cb, wait_max)
end
end
function _M:noMoreAuthWait()
self.no_more_wait_auth = true
end
function _M:waitFirstAuth(timeout)
if self.no_more_wait_auth then return end
if self.auth_tried and self.auth_tried >= 1 then return end
if not self.waiting_auth then return end
print("[PROFILE] waiting for first auth")
......
......@@ -232,7 +232,7 @@ end
--- Marks a tunnel as a tunnel and the space behind it
function _M:markTunnel(x, y, xdir, ydir, id)
-- Disable the many prints of tunnelling
-- local print = function()end
local print = function()end
x, y = x - xdir, y - ydir
local dir = util.coordToDir(xdir, ydir, x, y)
......@@ -278,7 +278,7 @@ end
function _M:tunnel(x1, y1, x2, y2, id, virtual)
if x1 == x2 and y1 == y2 then return end
-- Disable the many prints of tunnelling
-- local print = function()end
local print = function()end
local xdir, ydir = self:tunnelDir(x1, y1, x2, y2)
print("tunneling from",x1, y1, "to", x2, y2, "initial dir", xdir, ydir)
......
......@@ -27,6 +27,7 @@ module(..., package.seeall, class.inherit(Base, Focusable))
function _M:init(t)
self.title = assert(t.title, "no textbox title")
self.text = t.text or ""
self.size_title = t.size_title or t.title
self.old_text = self.text
self.on_mouse = t.on_mouse
self.hide = t.hide
......@@ -53,7 +54,7 @@ function _M:generate()
self.key:reset()
-- Draw UI
local title_w = self.font:size(self.title)
local title_w = self.font:size(self.size_title)
self.title_w = title_w
local frame_w = self.chars * self.font_mono_w + 12
self.w = title_w + frame_w
......
......@@ -36,6 +36,7 @@ function _M:init(t)
self.scrollbar = t.scrollbar
self.auto_height = t.auto_height
self.auto_width = t.auto_width
self.fct = t.fct
self.dest_area = t.dest_area and t.dest_area or { h = self.h }
......@@ -72,6 +73,7 @@ function _M:generate()
-- Add UI controls
self.mouse:registerZone(0, 0, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event)
if self.fct and button == "left" and event == "button" then self.fct() end
if button == "wheelup" and event == "button" then self.key:triggerVirtual("MOVE_UP")
elseif button == "wheeldown" and event == "button" then self.key:triggerVirtual("MOVE_DOWN")
end
......
......@@ -18,6 +18,7 @@
-- darkgod@te4.org
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local SubDialog = require "engine.ui.SubDialog"
local List = require "engine.ui.List"
local Button = require "engine.ui.Button"
......@@ -27,20 +28,60 @@ local Textbox = require "engine.ui.Textbox"
module(..., package.seeall, class.inherit(SubDialog))
function _M:init()
SubDialog.init(self, "Player Account", 100, 100)
SubDialog.init(self, "Player Account", 300, 100)
self.__showup = false
-- self.absolute = true
self:selectUI()
self:generate()
end
function _M:selectUI()
if profile.auth then
self:uiStats()
else
self:uiLogin()
end
end
function _M:uiLogin()
local bt = Button.new{text="Login", width=50, fct=function() self:login() end}
self.c_login = Textbox.new{title="Username: ", text="", chars=30, max_len=20, fct=function(text) self:login() end}
self.c_pass = Textbox.new{title="Password: ", text="", chars=30, max_len=20, hide=true, fct=function(text) self:login() end}
self.c_pass = Textbox.new{title="Password: ", size_title=self.c_login.title, text="", chars=30, max_len=20, hide=true, fct=function(text) self:login() end}
self:loadUI{
{left=0, top=0, ui=self.c_login},
{left=0, top=self.c_login.h, ui=self.c_pass},
{left=0, top=self.c_pass.h+self.c_login.h, ui=bt},
{hcenter=0, top=self.c_pass.h+self.c_login.h, ui=bt},
}
self:setupUI(true, true)
self:setupUI(false, true)
end
self:generate()
function _M:uiStats()
local logoff = Textzone.new{text="#LIGHT_BLUE##{italic}#Logout", auto_height=true, width=50, fct=function() self:logout() end}
self:loadUI{
{right=0, top=0, ui=logoff},
}
self:setupUI(false, true)
end
function _M:login()
if self.c_login.text:len() < 2 then
Dialog:simplePopup("Username", "Your username is too short")
return
end
if self.c_pass.text:len() < 4 then
Dialog:simplePopup("Password", "Your password is too short")
return
end
game:createProfile({create=false, login=self.c_login.text, pass=self.c_pass.text})
end
function _M:logout()
profile:logOut()
end
HUM !! finish
oh and Jumper algo test
\ No newline at end of file
......@@ -35,7 +35,7 @@ function _M:init()
self.list = l
l[#l+1] = {name="New Game", fct=function() game:registerDialog(require("mod.dialogs.NewGame").new()) end}
l[#l+1] = {name="Load Game", fct=function() game:registerDialog(require("mod.dialogs.LoadGame").new()) end}
l[#l+1] = {name="Online Profile", fct=function() game:registerDialog(require("mod.dialogs.Profile").new()) end}
-- l[#l+1] = {name="Online Profile", fct=function() game:registerDialog(require("mod.dialogs.Profile").new()) end}
l[#l+1] = {name="View High Scores", fct=function() game:registerDialog(require("mod.dialogs.ViewHighScores").new()) end}
l[#l+1] = {name="Addons", fct=function() game:registerDialog(require("mod.dialogs.Addons").new()) end}
-- if config.settings.install_remote then l[#l+1] = {name="Install Module", fct=function() end} end
......@@ -63,14 +63,14 @@ function _M:init()
self.c_list = List.new{width=self.iw, nb_items=#self.list, list=self.list, fct=function(item) end, font={"/data/font/DroidSans-Bold.ttf", 16}}
-- self.mainlogin = MainLogin.new()
self.mainlogin = MainLogin.new()
self:loadUI{
{left=0, top=0, ui=self.c_list},
{left=0, bottom=0, absolute=true, ui=self.c_background},
{right=0, top=0, absolute=true, ui=self.c_version},
self.c_auth and {right=0, bottom=0, absolute=true, ui=self.c_auth} or nil,
-- {left=450, top=50 + self.c_list.h + 120, absolute=true, ui=self.mainlogin},
{left=450, top=50 + self.c_list.h + 120, absolute=true, ui=self.mainlogin},
}
self:setupUI(false, true)
self.key:addBind("LUA_CONSOLE", function()
......
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