(Farklı bir forumdan alıntıdır!)
root > introloading.py
Arat
Altına Ekle
Arat
Altına Ekle
Locale xx > locale > xx > loadingwindow.py at
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
Loading Ekranında % Yazdırma
Metin2 özel sunucularında kullanıcı deneyimini artırmak için loading ekranlarında yükleme yüzdesi göstermek oldukça yaygın ve etkili bir özelliktir.
Yüzde Gösterimi Nedir?
Loading ekranında % yazdırma, oyun yüklenirken kullanıcının ne kadarının yüklendiğini görsel olarak takip edebilmesini sağlar. Bu, özellikle büyük boyutlu içeriklerin (örneğin haritalar, model dosyaları, ses efektleri) yüklendiği durumlarda sabırsızlığı azaltır ve daha profesyonel bir görünüm sağlar.
Uygulama Yöntemleri
1. Python Tarafında Uygulama
Python tarafında UI script (uiscript) kullanarak loading ekranında yüzde gösterimi yapmak mümkündür. Özellikle py root dosyalarında bulunan loading fonksiyonları üzerinde değişiklik yapılarak yükleme yüzdesi ekrana yazdırılabilir.
Örnek olarak, bir progress bar veya bir label nesnesi ile yükleme yüzdesi ekrana yazdırılabilir:
Kod:
[COLOR=green]import ui[/COLOR][BR][/BR][COLOR=green]import net[/COLOR][BR][/BR][BR][/BR][COLOR=green]class LoadingWindow(ui.ScriptWindow):[/COLOR][BR][/BR][COLOR=green]def __init__(self):[/COLOR][BR][/BR][COLOR=green]ui.ScriptWindow.__init__(self)[/COLOR][BR][/BR][COLOR=green]self.percentLabel = None[/COLOR][BR][/BR][BR][/BR][COLOR=green]def LoadWindow(self):[/COLOR][BR][/BR][COLOR=green]# Label nesnesi oluşturulur[/COLOR][BR][/BR][COLOR=green]self.percentLabel = ui.TextLine()[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetParent(self)[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetPosition(300, 200)[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetText('Yükleniyor: 0%')[/COLOR][BR][/BR][COLOR=green]self.percentLabel.Show()[/COLOR][BR][/BR][BR][/BR][COLOR=green]def UpdatePercent(self, percent):[/COLOR][BR][/BR][COLOR=green]if self.percentLabel:[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetText(f'Yükleniyor: {percent}%')[/COLOR][BR][/BR][BR][/BR][COLOR=green]loadingWin = LoadingWindow()[/COLOR]
2. C++ Tarafında Uygulama
C++ system tarafında, loading ekranı sırasında yükleme yüzdesi hesaplanabilir ve bu değer oyun içinde bir UI nesnesine aktarılabilir. Bu işlem için game server programming bilgisi gerekebilir.
Loading sırasında belirli dosyaların yüklendiği adımlar takip edilerek yükleme yüzdesi hesaplanabilir. Örneğin:
- Harita verileri yüklendiğinde %10 artar
- Model dosyaları yüklendiğinde %20 artar
- Ses dosyaları yüklendiğinde %30 artar
Not: C++ kodlarında yükleme yüzdesi hesaplama işlemi, sunucu tarafında değil, istemci tarafında yapılır. Bu nedenle client src üzerinde çalışmak gerekir.
Yüzde Hesaplama Algoritması
Yükleme yüzdesi hesaplamak için genellikle şu algoritma kullanılır:
Yüzde = (Yüklenen Dosya Sayısı / Toplam Dosya Sayısı) * 100
Bu hesaplama, her yükleme adımında güncellenmelidir. Bu sayede kullanıcı, yükleme sürecinin ne kadar tamamlandığını takip edebilir.
Py GUI ve Uiscript Entegrasyonu
Py GUI kütüphaneleri ile uiscript kullanarak loading ekranına dinamik bir yüzde gösterimi entegre edilebilir. Bu sayede hem estetik hem de işlevsel bir arayüz elde edilir.
Sonuç
Loading ekranında % yazdırmak, Metin2 özel sunucularında kullanıcı memnuniyetini artırır. Hem python gui hem de C++ sistemlerinde uygulanabilir. Doğru yapılandırıldığında, kullanıcılar için daha şeffaf ve keyifli bir giriş deneyimi sunar.
Kaynaklar:
Metin2 Lobby
Displaying Percentage on Loading Screen
Displaying a loading percentage on the loading screen is a common and effective feature for enhancing user experience in Metin2 private servers.
What Is Percentage Display?
Displaying a percentage on the loading screen allows users to visually track how much of the game has been loaded. This reduces impatience during loading of large content such as maps, model files, and sound effects, providing a more professional appearance.
Implementation Methods
1. Implementation in Python
Using UI scripts (uiscript) in Python, it's possible to display loading percentages on the loading screen. Modifications can be made to the loading functions found in py root files to print the loading percentage on screen.
For example, a progress bar or a label object can be used to display the loading percentage:
Kod:
[COLOR=green]import ui[/COLOR][BR][/BR][COLOR=green]import net[/COLOR][BR][/BR][BR][/BR][COLOR=green]class LoadingWindow(ui.ScriptWindow):[/COLOR][BR][/BR][COLOR=green]def __init__(self):[/COLOR][BR][/BR][COLOR=green]ui.ScriptWindow.__init__(self)[/COLOR][BR][/BR][COLOR=green]self.percentLabel = None[/COLOR][BR][/BR][BR][/BR][COLOR=green]def LoadWindow(self):[/COLOR][BR][/BR][COLOR=green]# Create label object[/COLOR][BR][/BR][COLOR=green]self.percentLabel = ui.TextLine()[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetParent(self)[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetPosition(300, 200)[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetText('Loading: 0%')[/COLOR][BR][/BR][COLOR=green]self.percentLabel.Show()[/COLOR][BR][/BR][BR][/BR][COLOR=green]def UpdatePercent(self, percent):[/COLOR][BR][/BR][COLOR=green]if self.percentLabel:[/COLOR][BR][/BR][COLOR=green]self.percentLabel.SetText(f'Loading: {percent}%')[/COLOR][BR][/BR][BR][/BR][COLOR=green]loadingWin = LoadingWindow()[/COLOR]
2. Implementation in C++
On the C++ system side, the loading percentage can be calculated during the loading screen and passed to a UI element within the game. This process may require knowledge of game server programming.
During loading, specific file loading steps can be tracked to calculate the loading percentage. For example:
- When map data is loaded, +10%
- When model files are loaded, +20%
- When sound files are loaded, +30%
Note: The calculation of loading percentage in C++ code occurs on the client side, not the server side. Therefore, modifications must be made to client src.
Percentage Calculation Algorithm
The following algorithm is commonly used to calculate the loading percentage:
Percentage = (Loaded File Count / Total File Count) * 100
This calculation should be updated at each loading step, allowing users to track the progress of the loading process.
Py GUI and Uiscript Integration
Dynamic percentage display can be integrated into the loading screen using Py GUI libraries and uiscript. This provides both aesthetic and functional interface elements.
Conclusion
Displaying a percentage on the loading screen increases user satisfaction in Metin2 private servers. It can be implemented in both python gui and C++ systems. When configured correctly, it offers a more transparent and enjoyable entry experience for users.
Sources:
Metin2 Lobby
