MaRcell Posted January 17, 2018 Share Posted January 17, 2018 My login does not appear on the screen. LINK https://ibb.co/n1visR local super = Class("Login", Container3D, function() static.getInstance = function() return LuaObject.getSingleton(static) end end).getSuperclass() function Login:paintComponent(g) local x, y = self:getLocationOnScreen() local w = self.width local h = self.height g:drawSetColor(self:getBackground()) g:drawFilledRect(x, y, w, h) super.paintComponent(self, g) end function Login:init() super.init(self) self:setStylesheet(StylesheetParser():parsestr([[ button { color: #000000; background-color: #B5E61E; cursor: pointer; } button:hover { color: #FFFFFF; background-color: #467C00; cursor: pointer; } ]])) self:setBounds(459, 216, 448, 310) self:setBackground(tocolor(80, 80 ,80, 200)) self.subPanel = Panel() self.subPanel:setBackground(tocolor(0, 135, 239 ,200)) self.subPanel:setBounds(0,0, 448, 50) self:add(self.subPanel) self.labelInfo = Label() self.labelInfo:setForeground(tocolor(255,255,255)) self.labelInfo:setBackground(tocolor(0, 0, 0)) self.labelInfo:setScale(2.0) self.labelInfo:setText("MTA Torcidas") self.labelInfo:setAlignment(Label.CENTER) self.labelInfo:setBounds(0,0, 448, 50) self:add(self.labelInfo) self.labelUser = Label() self.labelUser:setForeground(tocolor(255,255,255)) self.labelUser:setBackground(tocolor(0, 0, 0)) self.labelUser:setScale(2.0) self.labelUser:setText("Login:") self.labelUser:setAlignment(Label.LEFT) self.labelUser:setBounds(10, 60, 100, 50) self:add(self.labelUser) self.labelSenha = Label() self.labelSenha:setForeground(tocolor(255,255,255)) self.labelSenha:setBackground(tocolor(0, 0, 0)) self.labelSenha:setScale(2.0) self.labelSenha:setText("Senha:") self.labelSenha:setAlignment(Label.LEFT) self.labelSenha:setBounds(10, 120, 100, 50) self:add(self.labelSenha) self.userEdit = TextField() self.userEdit:setForeground(tocolor(0,0,0,200)) self.userEdit:setBackground(tocolor(255, 255, 255,200)) self.userEdit:setBounds(110, 60, 300, 50) self:add(self.userEdit) self.senhaEdit = PasswordField() self.senhaEdit:setForeground(tocolor(0,0,0,200)) self.senhaEdit:setBackground(tocolor(255, 255, 255,200)) self.senhaEdit:setBounds(110, 120, 300, 50) self:add(self.senhaEdit) self.loginButton = Button("Logar") self.loginButton:setForeground(tocolor(0,0,0,200)) self.loginButton:setBackground(tocolor(255, 255, 255,200)) self.loginButton:addMouseListener(self) self.loginButton:addActionListener(self) self.loginButton:setBounds(260, 180, 150, 50) self:add(self.loginButton) self.registerInfo = Label() self.registerInfo:setForeground(tocolor(255,255,255)) self.registerInfo:setBackground(tocolor(0, 0, 0)) self.registerInfo:setScale(2.0) self.registerInfo:setText("Não tem conta?") self.registerInfo:setAlignment(Label.LEFT) self.registerInfo:setBounds(10, 250, 100, 50) self:add(self.registerInfo) self.registerButton = Button("Registre - se") self.registerButton:setForeground(tocolor(0,0,0,200)) self.registerButton:setBackground(tocolor(255, 255, 255,200)) self.registerButton:addMouseListener(self) self.registerButton:addActionListener(self) self.registerButton:setBounds(260, 250, 150, 50) self:add(self.registerButton) self:setVisible(false) return self end Toolkit.getInstance():add(Login.getInstance()) function Login:actionPerformed(e) if (e.source == self.loginButton) then local username = self.userEdit:getText() -- puxa texto edit do login: exemplo Shinigami local password = self.senhaEdit:getText() -- puxa a senha texto no senha: 123456 if (username ~= "") and (password ~= "") then -- se o edit de user e o edit de senha não estive em branco então triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Digite o login e a senha!", 255, 0, 0, false) end playSoundFrontEnd(6) elseif (e.source == self.registerButton) then local username = self.userEdit:getText() -- puxa texto edit do login: exemplo Shinigami local password = self.senhaEdit:getText() -- puxa a senha texto no senha: 123456 if (username ~= "") and (password ~= "") then -- se o edit de user e o edit de senha não estive em branco então triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) else outputChatBox("Digite o login e a senha!", 255, 0, 0, false) end playSoundFrontEnd(6) end end function Login:mouseEntered(e) -- isso aqui é uma função metodo por que ela Login: a partir do momento que tem Login: vc ta acessando o self if (e.source == self.loginButton) or (e.source == self.registerButton) then playSoundFrontEnd(3) end end function joinLogin() fadeCamera(true) setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) Login.getInstance():setVisible(true) showCursor(true) end addEvent("joinLogin", true) addEventHandler("joinLogin", getRootElement(), joinLogin) function hideLoginWindow() exports.painelGTO:showGUItimes() Login.getInstance():setVisible(false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) function hideRegisterWindow() exports.painelGTO:showGUItimes() Login.getInstance():setVisible(false) showCursor(false) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) Link to comment
raynner Posted January 17, 2018 Share Posted January 17, 2018 your dont use event "onClientRender" in dx functions ! framework.lua > Line 1 > expected symbol dont "chat(28)" Login.lua > Line 1 > attempt call Class return nil ! (dont function exist "Class", review Exports) Link to comment
MaRcell Posted January 19, 2018 Author Share Posted January 19, 2018 but it is not dx and framework / = Link to comment
raynner Posted January 20, 2018 Share Posted January 20, 2018 On 17/01/2018 at 21:12, raynner said: Você não usa o evento "onClientRender" nas funções dx! framework.lua> Linha 1> símbolo esperado não "chat (28)" Login.lua> Linha 1> tentativa de chamada Classe de retorno nulo! (Não existe a função "Classe", revise as exportações) Ignore first comment Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now