Esc menüsüne hızlı çıkış ekleme

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 290

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Root uisystem.py aratılır;
Kod:
self.GetChild("mall_button").SAFE_SetEvent(self.__ClickInGameShopButton)
Altına eklenir ( );
Kod:
self.GetChild("VectorsCks").SAFE_SetEvent(self.__Vctrs)

Aratılır;
Kod:
def __ClickInGameShopButton(self):
Kod bloğunun altına eklenir ( );
Kod:
def __Vctrs(self):         import app         app.Exit()


Locale > locale_interface.txt en altına eklenir ( )
Kod:
CKS    Hızlı Çıkışş

Locale > systemdialog.py aratılır;
Kod:
"name" : "logout_button",
Kod bloğunun altına eklenir ( );
Kod:
{                     "name" : "VectorsCks",                     "type" : "button",                     "x" : 10,                     "y" : 222,                     "text" : uiScriptLocale.CKS,                     "text_color" : 0xffF8BF24,                     "default_image" : ROOT + "XLarge_Button_01.sub",                     "over_image" : ROOT + "XLarge_Button_02.sub",                     "down_image" : ROOT + "XLarge_Button_03.sub",                 },

Aynı .py içerisinde;
288 olan rakkamları 288+35 olarak değiştireceksiniz.3 adet var hepside değiştirilecek.
217 > 217+35
247 > 247+35 olarak değiştirilerek.


Kodları verdiğim sitelerden alt kısımdan kopyalayın.

Esc Menüsüne Hızlı Çıkış Ekleme


Metin2 özel sunucularında kullanıcı deneyimini artırmak, hem oyuncuların hem de geliştiricilerin işini kolaylaştırır. Bu yazıda, Metin2 özel sunucu geliştirme sürecinde sıklıkla karşılaşılan bir ihtiyaç olan Esc menüsüne hızlı çıkış butonu ekleme işlemini detaylıca ele alacağız. Bu işlem; C++ sistem bilgisi, client src düzenlemeleri, UIScript ve py root üzerinde küçük değişiklikler içerir.

Neden Hızlı Çıkış Butonu Gerekli?
Metin2 oyununda varsayılan olarak Esc menüsü açıldığında oyundan çıkış için birden fazla adımdan oluşan bir yol izlenmesi gerekir. Oyuncuların bu yoldan uzaklaştırılması, kullanıcı dostu bir sistem için önemli bir adımdır. Özellikle PvP sunucularında, hızlı çıkışlar sıkça tercih edilir. Bu nedenle, doğrudan oyundan çıkış sağlayacak bir buton eklemek büyük kolaylık sağlar.

Geliştirme Ortamı Hazırlığı
Öncelikle, client src ve uiscript dosyalarına erişimimiz olması gerekir. Bu işlemler sırasında Python GUI ve py root üzerinden çalışacağımız için, Python bilgisi de önemli olacaktır. Ayrıca, Martysama gibi kaynaklar da yardımcı olabilir.

Adım Adım Uygulama
1. UI Script Dosyası Düzenlenir:
root/locale_tr/ui/gameExitQuestionDialog.py dosyasına benzer bir yapı oluşturulur. Bu dosya, çıkışı onaylayan küçük bir pencere oluşturur. Ancak biz doğrudan çıkış yapmak istiyoruz. Bu yüzden, uiGame.py dosyasında Esc menüsüne yeni bir buton tanımlanmalıdır.

2. uiGame.py Dosyasında Değişiklik:
Bu dosyada, ESC_KEY fonksiyonuna yeni bir buton tanımlaması yapılır. Bu buton, doğrudan game.Exit() fonksiyonunu çağırarak oyundan çıkmayı sağlar. Bu işlem sırasında PyCallVoid kullanılır.

3. Client Tarafında Görsel Değişiklikler:
Grafiksel olarak butonun görünmesi için UIScript dosyasında ilgili pencereye yeni bir buton nesnesi eklenmelidir. Bu nesne, Esc menüsüne entegre edilir ve arka planda python system üzerinden çalışır.

Sunucu Tarafında İnce Ayarlar
Oyuncu hızlı çıkış yaptığında, sunucu tarafında auth ve game server bağlantılarının düzgün kapatılması önemlidir. Bu, DB tabanlı işlemlerde veri kaybını önler. C++ source üzerinde yapılan ayarlar, oyuncu bağlantısının güvenli bir şekilde koparılmasını sağlar.

Test ve Derleme Aşaması
Değişiklikler tamamlandıktan sonra, Metin2 compile işlemi gerçekleştirilir. Client derlenir ve test sunucusunda butonun çalışıp çalışmadığı kontrol edilir. Gerekirse source edit işlemleriyle tekrar düzenlenebilir.

Sonuç
Metin2 özel sunucu geliştirme sürecinde kullanıcı dostu özellikler eklemek, sunucunuzu diğerlerinden ayırır. Esc menüsüne hızlı çıkış ekleme işlemi, küçük ama etkili bir değişikliktir. Bu işlemi doğru şekilde uygulamak için hem C++ hem de Python bilgisi gerekebilir. Geliştiriciler için bu tür küçük projeler, core sistemleri daha iyi anlamalarına yardımcı olur.


Adding Quick Exit Button to Esc Menu


Improving user experience in Metin2 private servers makes things easier for both players and developers. In this article, we will thoroughly examine how to add a quick exit button to the Esc menu, which is a common need during Metin2 private server development. This process includes minor modifications in C++ systems, client src files, UIScript, and py root.

Why Is a Quick Exit Button Necessary?
In the default Metin2 game, exiting the game from the Esc menu requires multiple steps. Avoiding this complex path enhances user-friendliness. Especially on PvP servers, quick exits are frequently preferred. Therefore, adding a button that directly exits the game provides significant convenience.

Preparation of Development Environment
Firstly, access to client src and uiscript files is necessary. Since we will be working with Python GUI and py root during these operations, knowledge of Python will also be important. Additionally, sources like Martysama can be helpful.

Step-by-Step Implementation
1. Editing UI Script File:
A structure similar to root/locale_tr/ui/gameExitQuestionDialog.py file must be created. This file creates a small window to confirm exit. However, we want direct exit. Thus, a new button should be defined in the uiGame.py file within the Esc menu.

2. Changes in uiGame.py:
In this file, a new button definition is added to the ESC_KEY function. This button calls the game.Exit() function directly to exit the game. During this process, PyCallVoid is used.

3. Visual Changes on Client Side:
To make the button visible, a new button object must be added to the relevant window in the UIScript file. This object is integrated into the Esc menu and works through the python system in the background.

Fine Tunings on Server Side
When a player performs a quick exit, properly closing auth and game server connections is important. This prevents data loss in DB-based operations. Settings made on C++ source ensure safe disconnection of the player connection.

Testing and Compilation Stage
After completing the changes, Metin2 compile operation is performed. The client is compiled and tested on a test server to check if the button functions correctly. If needed, further adjustments can be made via source edit operations.

Conclusion
Adding user-friendly features in Metin2 private server development distinguishes your server from others. Adding a quick exit button to the Esc menu is a small but impactful change. Implementing this correctly may require both C++ and Python knowledge. For developers, such small projects help better understanding of core systems.​
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Geri
Üst Alt