papam77 Posted March 31, 2013 Posted March 31, 2013 Hello, how can move up MapName in tops ? local bankgothic = guiCreateFont("bankgothic.ttf",11) local x,y = guiGetScreenSize() -- -- toptimes_client.lua -- Created = {} CToptimes = {} CToptimes.__index = CToptimes CToptimes.instances = {} g_Settings = {} --------------------------------------------------------------------------- -- Client -- Handle events from Race -- -- This is the 'interface' from Race -- --------------------------------------------------------------------------- addEventHandler('onClientResourceStart', g_ResRoot, function() triggerServerEvent('onLoadedAtClient_tt', g_Me) end ) addEvent('onClientMapStarting', true) addEventHandler('onClientMapStarting', getRootElement(), function(mapinfo) outputDebug( 'TOPTIMES', 'onClientMapStarting' ) if g_CToptimes then g_CToptimes:onMapStarting(mapinfo) end end ) addEvent('onClientMapStopping', true) addEventHandler('onClientMapStopping', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientMapStopping' ) if g_CToptimes then g_CToptimes:onMapStopping() end end ) addEvent('onClientPlayerFinish', true) addEventHandler('onClientPlayerFinish', getRootElement(), function() outputDebug( 'TOPTIMES', 'onClientPlayerFinish' ) if g_CToptimes then g_CToptimes:doAutoShow() end end ) addEvent('onClientSetMapName', true) addEventHandler('onClientSetMapName', getRootElement(), function(manName) if g_CToptimes then g_CToptimes:setWindowTitle(manName) end end ) function updateSettings(settings, playeradmin) outputDebug( 'TOPTIMES', 'updateSettings' ) if g_CToptimes then if settings and settings.gui_x and settings.gui_y then g_CToptimes:setWindowPosition( settings.gui_x, settings.gui_y ) g_CToptimes.startshow = settings.startshow end -- If admin changed this setting manually, then show the table to him if playeradmin == getLocalPlayer() then g_CToptimes:doToggleToptimes(true) end end end --------------------------------------------------------------------------- -- -- CToptimes:create() -- -- -- --------------------------------------------------------------------------- function CToptimes:create() outputDebug ( 'TOPTIMES', 'CToptimes:create' ) local id = #CToptimes.instances + 1 CToptimes.instances[id] = setmetatable( { id = id, bManualShow = false, -- via key press bAutoShow = false, -- when player finished bGettingUpdates = false, -- server should send us updates to the toptimes listStatus = 'Empty', -- 'Empty', 'Loading' or 'Full' gui = {}, -- all gui items lastSeconds = 0, targetFade = 0, currentFade = 0, autoOffTimer = Timer:create(), hasTimes = false }, self ) CToptimes.instances[id]:postCreate() return CToptimes.instances[id] end --------------------------------------------------------------------------- -- -- CToptimes:destroy() -- -- -- --------------------------------------------------------------------------- function CToptimes:destroy() self:setHotKey(nil) self:closeWindow() self.autoOffTimer:destroy() CToptimes.instances[self.id] = nil self.id = 0 end --------------------------------------------------------------------------- -- -- CToptimes:postCreate() -- -- -- --------------------------------------------------------------------------- function CToptimes:postCreate() self:openWindow() self:setWindowPosition( 0.7, 0.02 ) self:setHotKey('F5') end --------------------------------------------------------------------------- -- -- CToptimes:openWindow() -- -- -- --------------------------------------------------------------------------- function CToptimes:openWindow () if self.gui['container'] then return end self.size = {} self.size.x = 320 self.size.y = 300 local sizeX = self.size.x local sizeY = self.size.y -- windowbg is the root gui element. -- windowbg holds the backround image, to which the required alpha is applied self.gui['windowbg'] = guiCreateStaticImage(100, 100, sizeX, sizeY, 'img/timepassedbg.png', false, nil) guiSetAlpha(self.gui['windowbg'], 1) guiSetVisible( self.gui['windowbg'], false ) -- windowbg as parent: self.gui['container'] = guiCreateStaticImage(0,0.1,1,1, 'img/blank.png', true, self.gui['windowbg']) guiSetProperty ( self.gui['container'], 'InheritsAlpha', 'false' ) -- container as parent: self.gui['paneTimes'] = guiCreateStaticImage(0,0,1,1, 'img/blank.png', true, self.gui['container']) self.gui['bar'] = guiCreateStaticImage(0, 0, sizeX, 0, 'img/timepassedbg.png', false, self.gui['container']) guiSetAlpha(self.gui['bar'], 1) self.gui['title0'] = guiCreateLabel(0, 2, sizeX, 30, '', false, self.gui['windowbg'] ) guiLabelSetHorizontalAlign ( self.gui['title0'], 'center' ) guiSetFont(self.gui['title0'], "default-bold-small") guiLabelSetColor ( self.gui['title0'],255,127,0) self.gui['title'] = guiCreateLabel(0, 2, sizeX, 30, '', false, self.gui['container'] ) guiLabelSetHorizontalAlign ( self.gui['title'], 'center' ) guiSetFont(self.gui['title'], "default-bold-small") guiLabelSetColor ( self.gui['title'],255,127,0, 0 ) self.gui['header'] = guiCreateLabel(19, 21, sizeX-30, 15, ' # Time Name', false, self.gui['container'] ) guiSetFont(self.gui['header'], bankgothic) guiLabelSetColor ( self.gui['header'],255,127,0 ) self.gui['headerul'] = guiCreateLabel(0, 21, sizeX, 15," ", false, self.gui['container'] ) guiLabelSetHorizontalAlign ( self.gui['headerul'], 'center' ) guiLabelSetColor ( self.gui['headerul'], 255,127,0 ) self.gui['paneLoading'] = guiCreateStaticImage(0,0,1,1, 'img/blank.png', true, self.gui['container']) -- paneLoading as parent: self.gui['busy'] = guiCreateLabel(sizeX/4, 38, sizeX/2, 15, 'Please wait', false, self.gui['paneLoading'] ) self.gui['busy2'] = guiCreateLabel(sizeX/4, 53, sizeX/2, 15, 'until next map', false, self.gui['paneLoading'] ) guiLabelSetHorizontalAlign ( self.gui['busy'], 'center' ) guiLabelSetHorizontalAlign ( self.gui['busy2'], 'center' ) guiSetFont(self.gui['busy'], "default-bold-small") guiSetFont(self.gui['busy2'], "default-bold-small") -- paneTimes as parent: -- All the labels in the time list self.gui['listTimes'] = {} self:updateLabelCount(12) WszystkieToptimy = {} end --------------------------------------------------------------------------- -- -- CToptimes:closeWindow() -- -- -- --------------------------------------------------------------------------- function CToptimes:closeWindow () destroyElement( self.gui['windowbg'] ) self.gui = {} end --------------------------------------------------------------------------- -- -- CToptimes:setWindowPosition() -- -- -- --------------------------------------------------------------------------- function CToptimes:setWindowPosition ( gui_x, gui_y ) if self.gui['windowbg'] then local screenWidth, screenHeight = guiGetScreenSize() local posX = screenWidth/2 + 63 + ( screenWidth * (gui_x - 0.56) ) local posY = 14 + ( screenHeight * (gui_y - 0.01) ) local posXCurve = { {0, 0}, {0.7, screenWidth/2 + 63}, {1, screenWidth - self.size.x} } local posYCurve = { {0, 0}, {0.02, 59}, {1, screenHeight - self.size.y} } -- 1280 0-1000 -- 0.0 = 1280/2 - 140 = 0 -- 0.5 = 1280/2 - 140 = 500
Castillo Posted March 31, 2013 Posted March 31, 2013 self.gui['title'] = guiCreateLabel(0, 2, sizeX, 30, '', false, self.gui['container'] ) Try changing the position from that one.
papam77 Posted April 1, 2013 Author Posted April 1, 2013 self.gui['title'] = guiCreateLabel(0, 2, sizeX, 30, '', false, self.gui['container'] ) Try changing the position from that one. Still don't work.
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