Jump to content

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


Recommended Posts

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.

Link to comment
Share on other sites

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...