Merhaba arkadaşlar,
Konu başlığını tam uygun koyamamış olabilirim.
Normal de girişte sunucuya bağlanıyorsun, sunucuya bağlandın,giriş yapılıyor der bu konu o kısmın değiştirilmiş halidir.
Video'da anlarsınız.
YABANCI FORUMDAN ALINTIDIR.!
Konu başlığını tam uygun koyamamış olabilirim.
Normal de girişte sunucuya bağlanıyorsun, sunucuya bağlandın,giriş yapılıyor der bu konu o kısmın değiştirilmiş halidir.
Video'da anlarsınız.
Kod:
intrologin.py açılır arat def Connect(self, id, pwd): ve sil self.stream.popupWindow.Close() self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.SetPasswordEditLineFocus, localeInfo.UI_CANCEL) eklenir self.carga_fire() constInfo.ACCOUNT_NAME = str(self.idEditLine.GetText()) self.SetPasswordEditLineFocus() arat def OnHandShake(self): ve sil self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS) arat def OnLoginStart(self): ve sil self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING) eklenir snd.PlaySound("sound/ui/loginok.wav") arat def __OnAcceptMatrixCardData(self): ve sil self.PopupNotifyMessage(localeInfo.LOGIN_PROCESSING) dosya sonuna ekle def carga_fire(self): self.AboutWindow = ui.ThinBoard() self.AboutWindow.SetParent(self) self.AboutWindow.SetSize(280,110) self.AboutWindow.SetWindowHorizontalAlignCenter() self.AboutWindow.SetWindowVerticalAlignCenter() self.AboutWindow.SetPosition(0,0) self.AboutWindow.Show() self.AboutWindow.x_counter = 450 self.AboutWindow.text1 = ui.TextLine() self.AboutWindow.text1.SetParent(self.AboutWindow) self.AboutWindow.text1.SetWindowHorizontalAlignCenter() self.AboutWindow.text1.SetHorizontalAlignCenter() self.AboutWindow.text1.SetPosition(0,5) self.AboutWindow.text1.SetText("Inicio Arrival2") self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(58, 141, 221)) self.AboutWindow.text1.Show() self.AboutWindow.text2 = ui.TextLine() self.AboutWindow.text2.SetParent(self.AboutWindow) self.AboutWindow.text2.SetPosition(8,18) self.AboutWindow.text2.SetText("Bienvenido Arrival2.") self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(40, 217, 8)) self.AboutWindow.text2.Show() self.AboutWindow.text3 = ui.TextLine() self.AboutWindow.text3.SetParent(self.AboutWindow) self.AboutWindow.text3.SetPosition(8,18+13) self.AboutWindow.text3.SetText("Disfrutalo!") self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(40, 217, 8)) self.AboutWindow.text3.Show() self.AboutWindow.text4 = ui.TextLine() self.AboutWindow.text4.SetParent(self.AboutWindow) self.AboutWindow.text4.SetPosition(8,18+13*3) self.AboutWindow.text4.SetText("Si has encontrado algun error, deberas comunicarlo ") self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(40, 217, 8)) self.AboutWindow.text4.Show() self.AboutWindow.text5 = ui.TextLine() self.AboutWindow.text5.SetParent(self.AboutWindow) self.AboutWindow.text5.SetPosition(8,18+13*4) self.AboutWindow.text5.SetText("Comenzaras tu gran aventura.") self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(40, 217, 8)) self.AboutWindow.text5.Show() self.AboutWindow.text6 = ui.TextLine() self.AboutWindow.text6.SetParent(self.AboutWindow) self.AboutWindow.text6.SetPosition(200,18+13*5) self.AboutWindow.text6.SetText("Tiempo: %d" % self.AboutWindow.x_counter) self.AboutWindow.text1.SetPackedFontColor(ui.GenerateColor(40, 217, 8)) self.AboutWindow.text6.Show() arat def onupdate ve değiştir AboutWindow = None def OnUpdate(self): if self.AboutWindow: if self.AboutWindow.x_counter > 1: self.AboutWindow.x_counter -=1 self.AboutWindow.text6.SetText("Cargando : %0.1f" % (self.AboutWindow.x_counter/25.0)) elif self.AboutWindow.x_counter == 1: self.AboutWindow.Hide() # self.AboutWindow.Delete() ServerStateChecker.Update()
YABANCI FORUMDAN ALINTIDIR.!
Python ile Metin2'de Girişte Yeni Mesaj Ekranı Oluşturma
Metin2 özel sunucularında kullanıcı deneyimini artırmak için Python GUI kullanarak giriş ekranına özel bir mesaj ekranı eklemek oldukça yaygın bir yöntemdir. Bu makalede, Python dili kullanılarak nasıl yeni bir mesaj penceresi oluşturulacağını ve bu pencerenin uiscript ile nasıl entegre edileceğini detaylıca inceleyeceğiz.
Giriş
Metin2 özel sunucuları, oyunculara sundukları özgün sistemler ile dikkat çeker. Bu sistemlerin başında C++ script dosyaları ve Python tabanlı GUI yapıları gelir. Özellikle py root ve uiscript kullanılarak oluşturulan arayüzler, kullanıcıya daha etkileyici ve interaktif bir deneyim sunabilir.
Neden Yeni Mesaj Ekranı?
Oyun başlatıldığında oyuncuya gösterilen ilk ekran, onların oyunla ilk temasıdır. Bu ekranda özel bir duyuru, sunucu güncellemesi veya özel bir mesaj göstermek, hem marka bilinirliğini artırır hem de oyuncunun dikkatini çekebilir. Bu nedenle yeni mesaj ekranı tasarımı, sunucu sahipleri için oldukça değerlidir.
Python ile GUI Penceresi Oluşturmak
Python dilinde tkinter gibi kütüphaneler kullanarak kolayca bir pencere oluşturabilirsiniz. Ancak Metin2 içinde uiscript ile çalıştığımız için doğrudan tkinter kullanamayız. Bunun yerine Metin2'nin kendi GUI sistemini kullanmalıyız. Python dosyasında bir pencere sınıfı tanımlayıp, gerekli bileşenleri (metin, buton, resim vb.) ekleyebiliriz.
Örnek Kod Yapısı
import ui, app, net, wndMgr
class WelcomeMessageWindow(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadWindow()
def __LoadWindow(self):
try:
uiScriptLoader = ui.UiScriptLoader()
uiScriptLoader.LoadScriptFile(self, 'uiscript/welcome_message.py')
except:
import dbg
dbg.LogBox('Hata: welcome_message.py dosyası yüklenemedi.')
Bu yapı sayesinde, uiscript dosyası üzerinden pencere tasarımı yapabilir ve Python tarafında bu pencereyi kontrol edebilirsiniz.
Pencere İçeriği ve Tasarımı
Mesaj ekranınızda sunucu duyuruları, günlük ödüller, PvP turnuvaları gibi bilgileri gösterebilirsiniz. Tasarım sırasında dikkat edilmesi gereken konulardan biri, pencerenin boyutunun ve pozisyonunun kullanıcı dostu olmasıdır. Ayrıca butonlara tıklanınca Python fonksiyonlarının tetiklenebilmesi için event sistemini doğru kurmanız gerekir.
Entegrasyon ve Test
Pencere tasarımı tamamlandıktan sonra, bu pencerenin ne zaman açılacağını belirlemek için pack dosyalarında veya Python ana sisteminde değişiklik yapmanız gerekebilir. Örneğin, oyuncu giriş yaptığında otomatik olarak bu pencerenin açılması gibi. Test aşamasında farklı senaryolar üzerinden çalışarak, pencerenin doğru çalışıp çalışmadığını kontrol etmelisiniz.
Sonuç
Metin2 özel sunucularında kullanıcı deneyimi, sunucu kalitesi kadar önemlidir. Python GUI kullanarak oluşturulan giriş mesaj ekranı, oyunculara özel bir dokunuş sağlayabilir. Bu tür sistemler, hem server src üzerinde geliştirmeler yapan geliştiriciler hem de Metin2 lobby gibi platformlarda paylaşım amacıyla kullanılabilir.
Creating a Welcome Message Screen with Python in Metin2
To enhance the user experience in Metin2 private servers, adding a custom message screen at login using Python GUI is a common practice. In this article, we will examine in detail how to create a new message window using Python and integrate it with uiscript.
Introduction
Metin2 private servers attract attention with their unique systems. At the top of these systems are C++ scripts and GUI structures based on Python. Interfaces created using py root and uiscript can provide users with a more impressive and interactive experience.
Why a New Message Screen?
The first screen shown to the player when starting the game is their first interaction with the game. Showing a special announcement, server update, or custom message on this screen can both increase brand awareness and capture the player's attention. Therefore, designing a new message screen is highly valuable for server owners.
Creating a GUI Window with Python
In Python, you can easily create a window using libraries like tkinter. However, since we work with uiscript within Metin2, we cannot directly use tkinter. Instead, we must use Metin2's own GUI system. You can define a window class in your Python file and add necessary components (text, buttons, images, etc.).
Example Code Structure
import ui, app, net, wndMgr
class WelcomeMessageWindow(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadWindow()
def __LoadWindow(self):
try:
uiScriptLoader = ui.UiScriptLoader()
uiScriptLoader.LoadScriptFile(self, 'uiscript/welcome_message.py')
except:
import dbg
dbg.LogBox('Error: Could not load welcome_message.py file.')
With this structure, you can design the window via the uiscript file and control the window from the Python side.
Window Content and Design
On your message screen, you can display information such as server announcements, daily rewards, PvP tournaments, etc. One important consideration during design is ensuring that the window's size and position are user-friendly. Additionally, to trigger Python functions upon clicking buttons, you need to set up the event system correctly.
Integration and Testing
After completing the window design, you may need to make changes in pack files or the main Python system to determine when the window should open. For example, you might want the window to appear automatically when the player logs in. During the testing phase, you should check whether the window functions correctly by running through various scenarios.
Conclusion
In Metin2 private servers, user experience is as important as server quality. A login message screen created using Python GUI can offer players a personalized touch. Such systems can be used by developers making improvements on server src as well as shared on platforms like Metin2 lobby.
