Jump to content

Função de abas (window)


Recommended Posts

Queria saber como realizo uma função de trocar de window

Tenho o seguinte code abaixo:

function fds()
  if window == 1 then 
    dxDrawImage(x*1450, y*285, x*355, y*708, "assets/wallpaper/1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)	
  elseif window == 2 then 
        dxDrawImage(x*1450, y*285, x*355, y*708, "assets/wallpaper/1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawText(hours..":"..minutes, x*1495, y*310, x*1155, y*35, tocolor(255, 255, 255, 255), 0.90, "default-bold-small", "left", "top", false, false, false, false, false)
    dxDrawImage(x*1711, y*310, x*58, y*14, "assets/status_bar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1450, y*285, x*355, y*708, "assets/overlay.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

	dxDrawImage(x*1485, y*365, x*65, y*65, "assets/icons/spotify.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1560, y*365, x*60, y*60, "assets/icons/seguro.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1635, y*365, x*60, y*60, "assets/icons/uber.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1710, y*365, x*60, y*60, "assets/icons/paypal.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1485, y*445, x*65, y*65, "assets/icons/uber-eats.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1560, y*445, x*65, y*65, "assets/icons/whatsapp.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1635, y*445, x*65, y*65, "assets/icons/camera.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1710, y*445, x*65, y*65, "assets/icons/chrome.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawImage(x*1485, y*525, x*65, y*65, "assets/icons/config.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

    dxDrawImage(x*1600, y*900, x*60, y*60, "assets/icons/contatos.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)	
    dxDrawImage(x*1520, y*900, x*60, y*60, "assets/icons/chamada.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1680, y*900, x*58, y*58, "assets/icons/camera.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

  end
      dxDrawImage(x*1450, y*285, x*355, y*708, "assets/wallpaper/2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	dxDrawText(hours..":"..minutes, x*1558.5, y*425, x*111, y*111, tocolor(255, 255, 255, 255), 1.0, gotham, "left", "top", false, false, false, false, false)
    dxDrawImage(x*1711, y*310, x*58, y*14, "assets/status_bar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1450, y*285, x*355, y*708, "assets/overlay.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1593.5, y*355, x*60, y*60, "assets/cad.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1450, y*930, x*361, y*35, "assets/linha.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(x*1485.5, y*485, x*285, y*104, "assets/box.png", 0, 0, 0, tocolor(255, 255, 255, 185), false)
    dxDrawImage(x*1485.5, y*485, x*285, y*104, "assets/antibug.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
 
end
addEventHandler("onClientRender", getRootElement(), fds)

 

Queria saber como coloco uma imagem pra quando clicar nela me mover para outra window (aba)

 

(Script de Celular com ligação)

Link to comment

Veja se vai funcionar:

function click ( button, state)
	if state == 'down' then
    	if isMouseInPosition ( x*1600, y*900, x*60, y*60) and isEventHandlerAdded ("onClientRender", root, fds) then --Aqui você coloca a posição da imagem e verifica se o evento da página que irá remover está ativo.
      		removeEventHandler("onClientRender", root, fds)
      		addEventHandler('onClientRender', root, novaJanela)
    	end
    end
end
addEventHandler ( "onClientClick", root, click)

function isMouseInPosition ( x, y, width, height)
	if ( not isCursorShowing( ) ) then
		return false
	end
	local sx, sy = guiGetScreenSize ( )
	local cx, cy = getCursorPosition ( )
	local cx, cy = ( cx * sx ), ( cy * sy )
	
	return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end
function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
    if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then
        local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
        if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
            for i, v in ipairs( aAttachedFunctions ) do
                if v == func then
                    return true
                end
            end
        end
    end
    return false
end
Edited by Boechat
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...