MTASA TÜRK
Türkiye'nin En Güncel MTA Platformu


[YARDIM] Travelling Sorunu

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı 4VCI

  • Hunter.dm1(Skype)
  • Acemi Üye
  • *
    • İleti: 177
  • Pro Vegiled Skillers
: 30 Mayıs 2018, 18:04:31
Haritan haritaya geçiş yaparken bu şekilde takılı kalıyor yardımcı olabilirmisiniz nerede hata yapıyorum?



Kod: lua
[offtopic][tt]TitleScreen = {}
TitleScreen.startTime = 0

function TitleScreen.init()
local screenWidth, screenHeight = guiGetScreenSize()
local adjustY = math.clamp( -30, -15 + (-30- -15) * (screenHeight - 480)/(900 - 480), -15 );
g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false)
hideGUIComponents('titleImage')
end

function TitleScreen.show()
    showGUIComponents('titleImage')
guiMoveToBack(g_GUI['titleImage'])
    TitleScreen.startTime = getTickCount()
    TitleScreen.bringForward = 0
    addEventHandler('onClientRender', g_Root, TitleScreen.update)
end

function TitleScreen.update()
    local secondsLeft = TitleScreen.getTicksRemaining() / 1000
    local alpha = math.min(1,math.max( secondsLeft ,0))
    guiSetAlpha(g_GUI['titleImage'], alpha)
    if alpha == 0 then
        hideGUIComponents('titleImage')
        removeEventHandler('onClientRender', g_Root, TitleScreen.update)
end
end

function TitleScreen.getTicksRemaining()
    return math.max( 0, TitleScreen.startTime - TitleScreen.bringForward + 10000 - getTickCount() )
end

-- Start the fadeout as soon as possible
function TitleScreen.bringForwardFadeout(maxSkip)
    local ticksLeft = TitleScreen.getTicksRemaining()
    local bringForward = ticksLeft - 1000
    outputDebug( 'MISC', 'bringForward ' .. bringForward )
    if bringForward > 0 then
        TitleScreen.bringForward = math.min(TitleScreen.bringForward + bringForward,maxSkip)
        outputDebug( 'MISC', 'TitleScreen.bringForward ' .. TitleScreen.bringForward )
    end
end
-------------------------------------------------------


-------------------------------------------------------
-- Travel screen - Message for client feedback when loading maps
-------------------------------------------------------
TravelScreen = {}
TravelScreen.startTime = 0

local travelScreen = {
anim = 0,
progress = 0,
size = {1024*scale,64*scale}
}

function showTravelingScreen()
travelScreen.anim = 0
travelScreen.progress = 0
end

function removeTravelingScreen()
travelScreen.anim = 0
travelScreen.progress = 0
removeEventHandler("onClientRender",getRootElement(),drawTravelScreen)
end

function drawTravelScreen()
if getElementData(localPlayer,"loginEnabled") then return end
travelScreen.anim = travelScreen.anim + 0.012
travelScreen.progress = travelScreen.progress+0.012
if travelScreen.progress >= 1 then
travelScreen.progress = 1
end
if travelScreen.anim >= 1 then
travelScreen.anim = 0
end
dxDrawImage(sX/2-256*scale,sY/2-64*scale,512*scale,256*scale,"img/travelling.png",0,0,0,tocolor(255,255,255,255))
dxDrawText("Current progress: "..math.floor(travelScreen.progress*100).."%",sX/2+travelScreen.size[1]/2-(dxGetTextWidth("Current progress: "..math.floor(travelScreen.progress*100).."%",0.3,newRace.font)),sY*0.70-dxGetFontHeight(0.3,newRace.font)-20*scale,sX/2+travelScreen.size[1]/2,sY*0.70,tocolor(255,100,0,255),0.3,newRace.font,"center","center")
dxDrawText("Loading new map...",sX/2-travelScreen.size[1]/2,sY*0.70-dxGetFontHeight(0.3,newRace.font)-20*scale,sX/2-travelScreen.size[1]/2+dxGetTextWidth("Loading new map...",0.3,newRace.font),sY*0.70,tocolor(255,100,0,255),0.3,newRace.font,"center","center")
dxDrawRectangle(sX/2-travelScreen.size[1]/2-2,sY*0.70-2,travelScreen.size[1]+4,travelScreen.size[2]+4,tocolor(40,40,40,255))
if travelScreen.progress >= 1 then
dxDrawImageSection(sX/2-travelScreen.size[1]/2,sY*0.70,travelScreen.size[1]*travelScreen.progress,64*scale,travelScreen.anim*1024,0,travelScreen.progress*1024,64,"img/bar.png")
else
dxDrawImageSection(sX/2-travelScreen.size[1]/2,sY*0.70,travelScreen.size[1]*travelScreen.progress,64*scale,travelScreen.progress*1024,0,travelScreen.progress*1024,64,"img/bar.png")
end
end


function TravelScreen.init()
    local screenWidth, screenHeight = guiGetScreenSize()
 g_GUI['travelImage']   = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-90, 512, 256, 'img/travelling.png', false, nil)
g_dxGUI['travelText1'] = dxText:create('Travelling to', screenWidth/2, screenHeight/2-130, false, newRace.font, 0.5, 'center' )
g_dxGUI['travelText2'] = dxText:create('', screenWidth/2, screenHeight/2-100, false, newRace.font, 0.5, 'center' )
g_dxGUI['travelText3'] = dxText:create('', screenWidth/2, screenHeight/2-70, false, newRace.font, 0.5, 'center' )
    g_dxGUI['travelText1']:color(102,119,136)
    hideGUIComponents( 'travelText1', 'travelText2', 'travelText3')
end

function TravelScreen.show( mapName, authorName )
    TravelScreen.startTime = getTickCount()
    g_dxGUI['travelText2']:text(mapName)
removeDxCD()
g_dxGUI['travelText3']:text(authorName and "Author: " .. authorName or "")
    showGUIComponents( 'travelText1', 'travelText2', 'travelText3')
guiMoveToBack(g_GUI['travelImage'])
end

function TravelScreen.hide()
    hideGUIComponents( 'travelText1', 'travelText2', 'travelText3')
--removeWinnerMsg()
end

function TravelScreen.getTicksRemaining()
    return math.max( 0, TravelScreen.startTime + 3000 - getTickCount() )
end[/offtopic]
« Son Düzenleme: 30 Mayıs 2018, 18:17:37 Gönderen: Narkoz »
0 (542) 315 90 74 - R25 Denizli
 


MTASA TÜRK

[YARDIM] Travelling Sorunu
« : 30 Mayıs 2018, 18:04:31 »