Jump to content

[GUÍA]Agregar botón de Salida Rapida


Mensajes recomendados

Os voy a enseñar a poner un botón de salida rápida en la pestaña de "Cambiar personaje, salir, fin del juego...".

1-> Vamos a buscar:

locale/ui/systemdialog.py
2-> Si no tenéis ningún botón nuevo en esa ventana os dejo mi script si lo tenéis os dejo el código.

Script completo:

 

 

import uiScriptLocale

ROOT = "d:/ymir work/ui/public/"

window = {
	"name" : "SystemDialog",
	"style" : ("float",),

	"x" : (SCREEN_WIDTH  - 200) /2,
	"y" : (SCREEN_HEIGHT - 288) /2,

	"width" : 200,
	"height" : 288,

	"children" :
	(
		{
			"name" : "board",
			"type" : "thinboard",

			"x" : 0,
			"y" : 0,

			"width" : 200,
			"height" : 258,

			"children" :
			(
				{
					"name" : "help_button",
					"type" : "button",

					"x" : 10,
					"y" : 17,

					"text" : uiScriptLocale.SYSTEM_HELP,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "system_option_button",
					"type" : "button",

					"x" : 10,
					"y" : 57,

					"text" : uiScriptLocale.SYSTEMOPTION_TITLE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "game_option_button",
					"type" : "button",

					"x" : 10,
					"y" : 87,

					"text" : uiScriptLocale.GAMEOPTION_TITLE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "change_button",
					"type" : "button",

					"x" : 10,
					"y" : 117,

					"text" : uiScriptLocale.SYSTEM_CHANGE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "logout_button",
					"type" : "button",

					"x" : 10,
					"y" : 147,

					"text" : uiScriptLocale.SYSTEM_LOGOUT,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{			
					"name": "salida_rapida_button",		
					"type": "button",		
					"x": 10,			
					"y": 174,		
					"text": "Salida Rapida",		
					"text_color": 0xffF8BF24,	
					"default_image": ROOT + "XLarge_Button_01.sub",	
					"over_image": ROOT + "XLarge_Button_02.sub",			
					"down_image": ROOT + "XLarge_Button_03.sub"		
				},
				{
					"name" : "exit_button",
					"type" : "button",

					"x" : 10,
					"y" : 202,

					"text" : uiScriptLocale.SYSTEM_EXIT,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "cancel_button",
					"type" : "button",

					"x" : 10,
					"y" : 230,

					"text" : uiScriptLocale.CANCEL,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
			),
		},
	),
}

 

Script solo del botón:

 

 

				{			
					"name": "salida_rapida_button",		
					"type": "button",		
					"x": 10,			
					"y": 174,		
					"text": "Salida Rapida",		
					"text_color": 0xffF8BF24,	
					"default_image": ROOT + "XLarge_Button_01.sub",	
					"over_image": ROOT + "XLarge_Button_02.sub",			
					"down_image": ROOT + "XLarge_Button_03.sub"		
				}, 

 

 

3-> Ya podéis cerrar el "systemdialog.py" y vamos al archivo "uisystem.py" del root. Dentro buscamos:

self.GetChild("cancel_button").SAFE_SetEvent(self.Close) 
y agregamos:

		self.GetChild("salida_rapida_button").SAFE_SetEvent(self.SalidaRapida) 
Quedaría así:

330703b1b0.png

 

4-> Ahora en el mismo archivo buscamos:

def SetOpenHelpWindowEvent(self, event):
Y encima de esa linea escribimos:

	def SalidaRapida(self):
		app.Exit()
Quedaría así:

c0e0fc4b4f.png

 

Y ya estaría listo.

Enlace para comentar
Compartir en otros sitios

Unirse a la conversación

Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.

Guest
Responder a este tema...

×   Has pegado contenido con formato .   Eliminar formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incorporado automáticamente.   Mostrar un enlace en su lugar

×   Se ha restaurado el contenido anterior. .   Borrar editor

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

  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...