Jump to content

Recommended Posts

Posted

Buenas,

hace un tiempo ví algunos usuarios que buscaban como agregar la hora del servidor bajo el minimapa, es por esto que quise aportar con dicha funcionalidad.

El formato será el siguiente: 
image.png

ARCHIVOS NECESARIOS:
* root/uiminimap.py
* uiscript/minimap.py

Comenzaremos con el archivo "uiscript/minimap.py"; buscamos la sección "ServerInfo" y debajo agregamos lo siguiente:

				## DateInfo
				{ # Declaración y posicionamiento texto "Hora del Servidor"
					"name" : "SvDateTitle", 
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 180,

					"text" : "Hora del Servidor", # Texto plano
				},

				{ # Delaración y posicionamiento de la hora del servidor
					"name" : "Hora", 
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 195,

					"text" : "",
				},

				{ # Declaración y posicionamiento texto "Hora local"
					"name" : "LocalDateTitle", 
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 215,

					"text" : "Hora Local", # Texto plano
				},

				{ # Declaración y posicionamiento del horario local (hora de tu equipo)
					"name" : "LocalDate", 
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 230,

					"text" : "",
				},


IMPORTANTE, el indentado (tabulaciones) del nuevo bloque de código debe ser igual al de "ServerInfo".
Debiese lucir algo así:
image.png


Ahora vamos con el archivo "root/uiminimap.py".
1.
Buscar la función " __def __Initialize(self)" y agregar lo siguiente:

		self.SvDate = None
		self.LocalDate = None

Debiese lucir algo así:
image.png


2. Buscar la función "def __LoadWindow(self)" y en la inicialización del script gráfico, agregaremos lo siguiente:

			## DateInfo
			self.SvDate		= self.GetChild("SvDate")
			self.LocalDate		= self.GetChild("LocalDate")
			## End DateInfo


Debiese lucir algo así:
image.png


3. Dentro del mismo archivo, buscamos la función "def OnUpdate(self)" y agregamos lo siguiente:

		cur_time_stamp = app.GetGlobalTimeStamp()
		seconds = cur_time_stamp % 60
		minutes = (cur_time_stamp / 60) % 60
		hours = (cur_time_stamp / 60) / 60 % 24

		self.SvDate.SetText("[%02i:%02i:%02i GMT-5]" % (hours, minutes, seconds))
		self.LocalDate.SetText(time.strftime('[%H:%M:%S - %d/%m]'))

Debiese lucir algo así:
image.png


Y eso es todo, solo queda encriptar tanto el root como el uiscript y tendrás la hora del servidor debajo del minimapa 😌

Si al momento de visualizar el nuevo contenido se sobrepone a otro o simplemente le quieres
dar una nueva posición, debes dirigirte al archivo "uiscript/minimap.py", buscar la sección del texto en cuestión y modificar las variables X e Y.


¡Saludos y buena programación!

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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

Important Information

This site uses cookies to enhance your browsing experience and provide relevant content. By continuing to browse, you agree to our We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. and Terms of Use. For more information on how we protect your data, please check our Privacy Policy.