Szerző Téma: Gombok  (Megtekintve 1575 alkalommal)

Gombok
« Dátum: 2016. Augusztus 10. - 23:43:49 »
0 Show voters
Sziasztok ! :)
 
      
menu = getElementData(root, \"root.menu\")      
Count = 0
for Index, Value in pairs( menu.name ) do
Count = Count + 1
end
 
for k = 1,Count do
label[k] = guiCreateLabel(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456,\"\",true)
addEventHandler ( \"onClientGUIClick\", label[k], outputEditBox, false )
dxDrawRectangle(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456, tocolor(254, 0, 0, 255), false)   
dxDrawText(menu.name[k], screenW * 0.0908,screenH * 0.2448+(k*dif), screenW * 0.2599, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.map[k], screenW * 0.2599, screenH * 0.2448+(k*dif), screenW * 0.4290, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.player[k], screenW * 0.4290, screenH * 0.2448+(k*dif), screenW * 0.5981, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.time[k], screenW * 0.5981, screenH * 0.2448+(k*dif), screenW * 0.7672, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
end

 
Az lenne a kérdésem hogy most ez miért nem működik vagy minden labelt egyesével kell majd beirnom vagy hogy van ez ?Mi lehet benne a probléma ?

Gombok
« Válasz #1 Dátum: 2016. Augusztus 11. - 00:30:31 »
0 Show voters
Idézetet írta: tomaker date=1470865429\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
Sziasztok ! :)
 
      
menu = getElementData(root, \"root.menu\")      
Count = 0
for Index, Value in pairs( menu.name ) do
Count = Count + 1
end
 
for k = 1,Count do
label[k] = guiCreateLabel(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456,\"\",true)
addEventHandler ( \"onClientGUIClick\", label[k], outputEditBox, false )
dxDrawRectangle(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456, tocolor(254, 0, 0, 255), false)   
dxDrawText(menu.name[k], screenW * 0.0908,screenH * 0.2448+(k*dif), screenW * 0.2599, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.map[k], screenW * 0.2599, screenH * 0.2448+(k*dif), screenW * 0.4290, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.player[k], screenW * 0.4290, screenH * 0.2448+(k*dif), screenW * 0.5981, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
dxDrawText(menu.time[k], screenW * 0.5981, screenH * 0.2448+(k*dif), screenW * 0.7672, screenH * 0.3490, tocolor(255, 255, 255, 255), 2.00, \"default-bold\", \"center\", \"top\", false, false, false, false, false)
end

 
Az lenne a kérdésem hogy most ez miért nem működik vagy minden labelt egyesével kell majd beirnom vagy hogy van ez ?Mi lehet benne a probléma ?
 
Az a kérdés, hogy a dxtexteknek a string részét mindig meg kell -e adnod külön?

Gombok
« Válasz #2 Dátum: 2016. Augusztus 11. - 01:14:15 »
0 Show voters
Nem hanem az hogy a Labelhez ugye nem kell külön külön hozzá rendelni az eseményt(addEventHandler úgyértem hogy ugye nem ezt kellesz csinálnom :
 addEventHandler ( \"onClientGUIClick\", label[1], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[2], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[3], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[4], outputEditBox, false )
)

Gombok
« Válasz #3 Dátum: 2016. Augusztus 11. - 01:20:22 »
0 Show voters
Idézetet írta: tomaker date=1470870855\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
Nem hanem az hogy a Labelhez ugye nem kell külön külön hozzá rendelni az eseményt(addEventHandler úgyértem hogy ugye nem ezt kellesz csinálnom :
 addEventHandler ( \"onClientGUIClick\", label[1], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[2], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[3], outputEditBox, false )
 addEventHandler ( \"onClientGUIClick\", label[4], outputEditBox, false )
)
 
Ja hogy a loopban megadhatod e a kulcsot és nem e kell külön. Persze hogy nem kell külön. Nem tudom mi hibázhatsz a scriptben ugyanis fogalmam sincs hogy hogy készítetted el az element datát, meg különben sem nagyon tudom értelmezni hogy ez mi is akar lenni.

Gombok
« Válasz #4 Dátum: 2016. Augusztus 11. - 03:20:34 »
0 Show voters
code=lua]
for k = 1,10 do
label[k] = guiCreateLabel(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456,\"\",true)
addEventHandler ( \"onClientGUIClick\", label[k], outputEditBox, false )[

 
ebben mi lehet a probléma ? dif jól van deklarálva

Gombok
« Válasz #5 Dátum: 2016. Augusztus 11. - 11:50:00 »
0 Show voters
Idézetet írta: tomaker date=1470878434\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic

code=lua]
for k = 1,10 do
label[k] = guiCreateLabel(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456,\"\",true)
addEventHandler ( \"onClientGUIClick\", label[k], outputEditBox, false )[

 
ebben mi lehet a probléma ? dif jól van deklarálva
 
Táblával csináld, mert ezzel csak felülírod folyamatosan..

Gombok
« Válasz #6 Dátum: 2016. Augusztus 11. - 13:11:37 »
0 Show voters
az - az ?

Gombok
« Válasz #7 Dátum: 2016. Augusztus 11. - 13:16:35 »
0 Show voters
Idézetet írta: tomaker date=1470913897\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
az - az ?
 
Nem szoktam GUI-zni , te se tedd, mond hogy mit szeretnél csinálni pontosan és össze dobom neked.

Gombok
« Válasz #8 Dátum: 2016. Augusztus 11. - 16:16:42 »
0 Show voters
Ez egy lobby script akar lenni és nekem az kellene hogy minden k elemű dxDrawRectanglere rátudjak kattintani és hogy lehessen gőrgővel mozogni azért akartam beálitani a Guit mert CursorGetPos - al nehezen lehet azt megoldani hogy tudjak majd gőrgetni
 
 
local dif = (screenH * 0.3620) - (screenH * 0.3034)
local k = {}
for k = 1,10 do
dxDrawRectangle(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456, tocolor(254, 0, 0, 255), false)

Gombok
« Válasz #9 Dátum: 2016. Augusztus 11. - 16:19:06 »
0 Show voters
Idézetet írta: tomaker date=1470925002\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
Ez egy lobby script akar lenni és nekem az kellene hogy minden k elemű dxDrawRectanglere rátudjak kattintani és hogy lehessen gőrgővel mozogni azért akartam beálitani a Guit mert CursorGetPos - al nehezen lehet azt megoldani hogy tudjak majd gőrgetni
 
 
local dif = (screenH * 0.3620) - (screenH * 0.3034)
local k = {}
for k = 1,10 do
dxDrawRectangle(screenW * 0.0928, screenH * 0.2448+(k*dif), screenW * 0.6764, screenH * 0.0456, tocolor(254, 0, 0, 255), false)

 

Mit értesz lobby script alatt? A görgetés meg szimpla matek néhány lokális változóval.

Gombok
« Válasz #10 Dátum: 2016. Augusztus 11. - 16:23:24 »
0 Show voters
Tudom hogy a gőrgetés mi de én csak Guiban gondolkoztam és azért mondom hogy lehet Cursor pos - al nehezebb
Egy saját játék mód melyekben vannak pályák és pályákat csinálok és a játékosok majd a pálya között fognak választani röviden olyan mint egy CS:GO játék választó de a Játék mód teljesen más

Gombok
« Válasz #11 Dátum: 2016. Augusztus 11. - 16:31:59 »
0 Show voters
Idézetet írta: tomaker date=1470925404\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
Tudom hogy a gőrgetés mi de én csak Guiban gondolkoztam és azért mondom hogy lehet Cursor pos - al nehezebb
Egy saját játék mód melyekben vannak pályák és pályákat csinálok és a játékosok majd a pálya között fognak választani röviden olyan mint egy CS:GO játék választó de a Játék mód teljesen más
 

local screen = {guiGetScreenSize()}
local box = {200,200}
function renderPages()
dxDrawRectangle(screen[1]/2-box[1]/2-220, screen[2]/2-box[2]/2, box[1], box[2], tocolor(0,0,0,220))
dxDrawRectangle(screen[1]/2-box[1]/2, screen[2]/2-box[2]/2, box[1], box[2], tocolor(0,0,0,220))
dxDrawRectangle(screen[1]/2-box[1]/2+220, screen[2]/2-box[2]/2, box[1], box[2], tocolor(0,0,0,220))
end
addEventHandler(\"onClientRender\", getRootElement(), renderPages)
function createButtons()
g1 = guiCreateButton(screen[1]/2-box[1]/2-220, screen[2]/2-box[2]/2, box[1], box[2], \"\", false)
g2 = guiCreateButton(screen[1]/2-box[1]/2, screen[2]/2-box[2]/2, box[1], box[2], \"\", false)
g3 = guiCreateButton(screen[1]/2-box[1]/2+220, screen[2]/2-box[2]/2, box[1], box[2], \"\", false)
guiSetAlpha(g1,0)
guiSetAlpha(g2,0)
guiSetAlpha(g3,0)
addEventHandler(\"onClientGUIClick\", g1, click1)
addEventHandler(\"onClientGUIClick\", g2, click1)
addEventHandler(\"onClientGUIClick\", g3, click1)
end
addEventHandler(\"onClientResourceStart\", getRootElement(), createButtons)
function click1()
outputChatBox(\"Történés1\")
end
function click2()
outputChatBox(\"Történés2\")
end
function click3()
outputChatBox(\"Történés3\")
end

Gombok
« Válasz #12 Dátum: 2016. Augusztus 11. - 16:34:42 »
0 Show voters
jó ezt én is tudtam :D :D
De nekem loopban kéne és azt meglehet oldani ? azért nyitottam a témát

Gombok
« Válasz #13 Dátum: 2016. Augusztus 11. - 17:16:51 »
0 Show voters
Idézetet írta: tomaker date=1470926082\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"62591\" data-ipsquote-contentclass=\"forums_Topic
jó ezt én is tudtam :D :D
De nekem loopban kéne és azt meglehet oldani ? azért nyitottam a témát
 

local screen = {guiGetScreenSize()}
local box = {200,200}
showCursor(true)
positionCache = {}
function renderPages()
for i = 1,3 do
x = screen[1]/2-box[1]/2-300*i+600
dxDrawRectangle(x, screen[2]/2-box[2]/2, box[1], box[2], tocolor(0,0,0,220))
positionCache = x
end
 
end
addEventHandler(\"onClientRender\", getRootElement(), renderPages)
function clicked(button,state)
if state == \"down\" and isCursorOnElement(positionCache[1],screen[2]/2-box[2]/2, box[1], box[2] ) then
outputChatBox(\"click\")
elseif state == \"down\" and isCursorOnElement(positionCache[2],screen[2]/2-box[2]/2, box[1], box[2] ) then
outputChatBox(\"click2\")
elseif state == \"down\" and isCursorOnElement(positionCache[3],screen[2]/2-box[2]/2, box[1], box[2] ) then
outputChatBox(\"click3\")
end
end
addEventHandler(\"onClientClick\", getRootElement(), clicked)
function isCursorOnElement(x,y,w,h)
local mx,my = getCursorPosition ()
local fullx,fully = guiGetScreenSize()
cursorx,cursory = mx*fullx,my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end

Gombok
« Válasz #14 Dátum: 2016. Augusztus 11. - 17:43:40 »
0 Show voters
köszi és ezt nem lehet leröviditeni ?
 
function clicked(button,state)
        if state == \"down\" and isCursorOnElement(positionCache[1],screen[2]/2-box[2]/2, box[1], box[2] ) then
                outputChatBox(\"click\")
        elseif state == \"down\" and isCursorOnElement(positionCache[2],screen[2]/2-box[2]/2, box[1], box[2] ) then
                outputChatBox(\"click2\")
        elseif state == \"down\" and isCursorOnElement(positionCache[3],screen[2]/2-box[2]/2, box[1], box[2] ) then
                outputChatBox(\"click3\")
        end
end
addEventHandler(\"onClientClick\", getRootElement(), clicked)

 

Dupla hozzászólás automatikusan összefûzve. ( [time]2016. augusztus 11. 17:44:44[/time] )

mert vagy 15-20 gombot igy egyesével nehéz lesz beirni

Dupla hozzászólás automatikusan összefûzve. ( 2016. Augusztus 11. - 17:45:51 )

ja semmi bocs hülye vagyok  ;D ;D :D
« Utoljára szerkesztve: 2016. Augusztus 11. - 17:45:51 írta tomaker »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal