2 mesaje
Administrator Administrator
  • Mesaje: 3449
  • Reacții: 48422
  • Mesaje utile: 29
  • Status: Pe aici.. 🤠
  • Server: Saga2 - Soon
  • Regat: Jinno
  • [ID Discord]
  • Contact:
    *Descriere:

    Iesire Rapida Metin2 - Daca apesi butonul "Iesire Joc" te va scoate instant de pe joc, nu va mai trebui sa astepti X secunde.

    *Poze / Video:
    *Link download / Code:

    Deschidem uisystem.py si cautam:
    Code:
    def __ClickExitButton(self):
    Inlocuim tot def cu:
    Conținut: Ascuns
    Reacționează ❤️ la acest mesaj și conținutul se va afișa automat.


    Nota! Daca vrei sa adaugi fereastra de confirmare din gif-ul de mai jos, fa asta dupa: confirma-iesire-joc-verificare-pvp-t2873.html

    Cum descarc de pe TeraBox?

    Afișează detalii Ascunde detalii
    • Este asemănător cu Mega.nz
    • Instalați-vă clientul lor de Download de aici
    • Faceți-vă un cont (vă puteți loga cu Facebook / Google / etc)
    • Dacă nu vreți să descărcați clientul de Download, folosiți acest site
    • Gata! Acum puteți descărca resursele

    De ce folosim TeraBox?

    • Este gratuit
    • Primești 1TB de spațiu gratuit la orice cont creat!
    • Este ușor de folosit și varianta premium este foarte ieftină
    • Fișierele nu sunt șterse niciodată
    TeraBox logo
    Te asteptam si pe serverul de Discord :p - aici ne-am strans toata comunitatea de Metin2 din Romania.
    Link: https://discord.gg/jWxeDSf7HP

    Suntem peste 1700 membri! - Avem chat activ zilnic, support, cereri, resurse. :D :ymcowboy:




    See full signature

    📢 Resurse Metin2 Premium!

    Zeci de resurse Metin2 Premium - exclusive și 100% funcționale începând cu 15.99€!.

    Vezi resursele Cumpără premium
    Premium
    Premium
    Anunț
  • Mesaje: 8
  • Reacții: 20
  • Mesaje utile: 0
  • Status: Utilizando bem meu tempo
  • Regat: Jinno
  • [ID Discord]
  • Contact:

    Medalii

    Mesaj de Kagijin »

    # Add these two helper functions inside your class,
    # preferably right above the __ClickExitButton function.
    Code:
    def __OnAcceptExit(self):
    	import app
    	app.Exit()
    
    def __OnCloseExitDialog(self):
    	if self.exitDialog:
    		self.exitDialog.Close()
    	self.exitDialog = None
    	return True
    
    # Now, replace your old __ClickExitButton function with this one:
    def __ClickExitButton(self):
    	import uiCommon # Imports the common dialogs module
    	
    	# Creates the question dialog window
    	self.exitDialog = uiCommon.QuestionDialog()
    	self.exitDialog.SetText("Do you really want to exit the game?") # You can change this text
    	
    	# Defines what happens when "Yes" is clicked (calls the __OnAcceptExit function)
    	self.exitDialog.SetAcceptEvent(self.__OnAcceptExit)
    	
    	# Defines what happens when "No" is clicked (calls the __OnCloseExitDialog function)
    	self.exitDialog.SetCancelEvent(self.__OnCloseExitDialog)
    	
    	# Opens the dialog window
    	self.exitDialog.Open()
    ---

    ### **Explanation of the Change**

    Why was this change made?

    The original `__ClickExitButton` function would instantly close the game client (`app.Exit()`). As you pointed out, this "instant close" can be problematic, as players might click it by accident. This new implementation is based on a better approach, similar to what is often seen in demonstration videos/GIFs, which uses a confirmation dialog to prevent accidental exits and improve the overall user experience.


    The original `__ClickExitButton` function would instantly close the game client (`app.Exit()`). This can be problematic as players might click it by accident, losing their progress or having to log in again. The new code replaces this instant action with a confirmation dialog, improving the user experience by preventing accidental exits.

    **How does it work?**

    The new implementation is broken down into three functions for clarity:

    1. `__ClickExitButton(self)`:
    * This is the main function that gets called when the user clicks the exit button.
    * Instead of closing the game, it now creates an instance of `uiCommon.QuestionDialog()`, which is a standard pop-up window with "Yes" and "No" buttons.
    * It sets the question text for the dialog (e.g., "Do you really want to exit the game?").
    * Crucially, it assigns other functions to the "Yes" (`SetAcceptEvent`) and "No" (`SetCancelEvent`) buttons.

    2. `__OnAcceptExit(self)`:
    * This small, dedicated function contains the single command to close the game: `app.Exit()`.
    * It is only executed if the user clicks the "Yes" button on the confirmation dialog.

    3. `__OnCloseExitDialog(self)`:
    * This function's job is to simply close the confirmation dialog window if the user clicks "No".
    * It also cleans up the reference to the dialog by setting `self.exitDialog = None`.

    📢 Resurse Metin2 Premium!

    Zeci de resurse Metin2 Premium - exclusive și 100% funcționale începând cu 15.99€!.

    Vezi resursele Cumpără premium
    Premium
    Premium
    Anunț
    Scrie răspuns

    Creează-ți un cont sau autentifică-te pentru a participa la discuție

    Trebuie să fii membru pentru a răspunde

    Creează-ți un cont

    Membrii pot crea subiecte noi și pot descărca resurse Metin2 Gratuit!


    Te poți înregistra sau conecta rapid utilizând contul tău de Discord, Github sau Google.

    Înregistrare

    Autentifică-te

    Înapoi la “Îmbunătățiri”

    Informații

    Utilizatori ce navighează pe acest forum: LegendaXXL, MDShved, rawn3cr0, sosofrg_62955 și 3 vizitatori

    Discord ID copiat: