Clıent kapat buton

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
///
Metin2 Client Kapat Butonu Nasıl Eklenir?
Metin2 özel sunucularında kullanıcı deneyimini artırmak isteyen geliştiriciler için küçük ama etkili değişiklikler yapmak oldukça değerlidir. Bunlardan birisi de client tarafında kapat butonunun doğrudan görünmesidir. Standart olarak bazı Metin2 client'lerinde oyun penceresinin sağ üst köşesinde bulunan kapat butonu devre dışı bırakılmıştır. Bu durum, oyuncuların oyunu daha güvenli bir şekilde kapatmasını zorlaştırabilir. Bu yazıda, client src üzerinden nasıl bir kapat butonu ekleneceğini adım adım ele alacağız.

Neden Kapat Butonu Gerekli?
Metin2 özel sunucularında client tarafında oyunu kapatmak için genellikle ESC tuşuna basarak menüden çıkış yapılması gerekir. Ancak bu yöntem bazı oyuncular için yetersiz veya karmaşık olabilir. Özellikle yeni başlayan oyuncular için doğrudan bir 'X' butonu sunulması, kullanıcı dostu bir arayüz sağlar. Ayrıca PvP sistem sunucularında hızlı çıkış yapmak isteyen oyuncular için bu buton oldukça faydalı olabilir.

Client Kapat Butonu İçin Gerekli Dosyalar
Metin2 client tarafında kapat butonu eklemek için aşağıdaki dosyalara müdahale etmeniz gerekir:
- uiscript klasörü altında bulunan GUI tanımlamaları (örneğin: game.py, system.py)
- Python root dosyaları (py root)
- Client src dosyaları (C++ ile yazılmıştır)

Kapat Butonunun Python Tarafında Tanımlanması
Öncelikle py GUI kısmında butonun yerleştirilmesi gerekir. Bunun için game.py gibi bir dosya açılır. Burada pencere sınırları içinde bir buton tanımlanır. Örneğin:

button = ui.Button()
button.SetParent(self)
button.SetPosition(750, 10)
button.SetEvent(lambda: self.CloseGame())
button.Show()

Kapat Fonksiyonunu Yazmak
Yukarıdaki örnekte belirtilen CloseGame() fonksiyonu da tanımlanmalıdır. Bu fonksiyon, oyuncu butona bastığında oyunun düzgün bir şekilde kapanmasını sağlar. Örnek bir fonksiyon şu şekildedir:

def CloseGame(self):
app.Exit() # Oyunu tamamen sonlandırır

Client Src (C++) Tarafında Değişiklik
Bazı özel sunucularda client src tarafında kapat butonu devre dışı bırakılmıştır. Bu durumda, client src dosyalarında bulunan pencere yönetimi kodları incelenmelidir. Genellikle WndProc fonksiyonu üzerinden pencere kapatma olayı engellenmiş olabilir. Bu engel kaldırıldığında, doğrudan pencere kapatma işlemi yapılabilir. Bu işlem için C++ bilgisi gerekebilir.

Martysama ve Diğer Araçlar
Metin2 özel sunucu geliştiricileri arasında popüler olan Martysama gibi araçlarla birlikte gelen şablonlar da bu tür işlemleri kolaylaştırabilir. Bu tür kaynaklar, hem server src hem de client src üzerinde hızlıca değişiklik yapmanıza olanak tanır. Aynı zamanda compile işlemlerini daha hızlı gerçekleştirmenizi sağlar.

Sonuç
Metin2 özel sunucularında client kapat butonu eklemek, kullanıcı memnuniyetini artırabilecek küçük ama etkili bir özelliktir. Hem Python GUI hem de C++ client src üzerinden yapılabilecek bu değişiklik, geliştiricilerin dikkat etmesi gereken kullanıcı deneyimi odaklı bir konudur. Metin2Lobby olarak, bu tür gelişmeleri takip ediyor ve topluluk için rehberler hazırlıyoruz.


How to Add a Close Button to Metin2 Client?
For developers who want to enhance user experience on Metin2 private servers, making small but effective changes can be highly valuable. One such change is adding a visible close button directly on the client side. By default, in some Metin2 clients, the close button at the top-right corner of the game window is disabled. This can make it difficult for players to close the game in a secure way. In this article, we will walk you through how to add a close button via client src step by step.

Why Is a Close Button Needed?
In Metin2 private servers, players usually need to press the ESC key and exit from the menu to close the game. However, this method might be insufficient or confusing for some players. For newcomers, having a direct 'X' button can provide a more user-friendly interface. Moreover, it can be particularly useful for players wanting to quickly exit in PvP systems servers.

Files Required for Adding the Close Button
To add a close button on the Metin2 client side, you need to modify the following files:
- GUI definitions under the uiscript folder (e.g., game.py, system.py)
- Python root files (py root)
- Client src files (written in C++)

Defining the Close Button in Python Side
Firstly, the button must be placed within the py GUI. Open a file like game.py and define a button within the window boundaries. Example:

button = ui.Button()
button.SetParent(self)
button.SetPosition(750, 10)
button.SetEvent(lambda: self.CloseGame())
button.Show()

Writing the Close Function
The CloseGame() function referenced above must also be defined. It ensures the game closes properly when the player clicks the button. An example function looks like this:

def CloseGame(self):
app.Exit() # Terminates the game completely

Modifications in Client Src (C++)
In certain private servers, the close button may be disabled in the client src. In such cases, the window management code in the client src files should be examined. Usually, the window closing event is blocked through the WndProc function. Removing this block allows the window to be closed directly. This operation may require knowledge of C++.

Martysama and Other Tools
Popular tools among Metin2 private server developers, such as Martysama, can simplify operations like these. Such resources allow quick modifications on both server src and client src. Additionally, they enable faster compile processes.

Conclusion
Adding a close button to the Metin2 client is a small yet impactful feature that can increase user satisfaction on private servers. This modification can be done via both Python GUI and C++ client src, and it's a user-experience-focused topic developers should pay attention to. At Metin2Lobby, we follow such developments and prepare guides for the community.
 

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

Benzer konular

Geri
Üst Alt