root > uiminimap
Kod:
self.serverInfo = self.GetChild("ServerInfo")
ara
Kod:
self.site = self.GetChild("Sitedir")
altına ekle
Kod:
self.MiniMapShowButton.SetEvent(ui.__mem_func__(self.ShowMiniMap))
ara
Kod:
self.site.SetEvent(ui.__mem_func__(self.sitecim))
altına ekle
en alta in ekle
Kod:
def sitecim(self): import os o="http://turkmmo.com" os.startfile(o)
uiscript > minimap.py
ara
Kod:
## MiniMapWindow { "name" : "MiniMapWindow", "type" : "window", "x" : 4, "y" : 5, "width" : 128, "height" : 128, },
Altına ekle
Kod:
{ "name" : "Sitedir", "type" : "button", "tooltip_text" : "Metin2 ana sayfasina yonlendirir.", "x" : 23, "y" : 116, "default_image" : "imlec_norm.tga", "over_image" : "imlec_tut.tga", "down_image" : "imlec_bas.tga", },
Roota atılacak dosyalar
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.
Metin2 Özel Sunucularında [PYTHON] Minimapa Siteye Git Ekleme
Minimap üzerinde 'Siteye Git' butonu eklemek, Metin2 özel sunucularında kullanıcı deneyimini artırmak adına oldukça popüler bir özelliktir. Bu işlem genellikle [PYTHON] tabanlı GUI sistemleri üzerinden gerçekleştirilir. Bu yazıda, nasıl [PYTHON] ile minimapa bir buton ekleyip onu websitenize yönlendireceğinizi adım adım anlatacağız.
Öncelikle, neyin ne olduğunu bilmek önemlidir:
- [PYTHON]: Metin2 sunucularında arayüz geliştirme için sıklıkla kullanılan bir programlama dilidir.
- UIScript: Python GUI sistemlerinde kullanılan betik dosyalarıdır.
- Py Root ve Py GUI: Oyunun istemci tarafında çalışan Python dosyalarıdır.
Adım 1: Gerekli Dosyaları Hazırlama
PyRoot klasörünüzde bulunan ui.py dosyasını açın. Bu dosya genellikle oyun arayüzünü kontrol eden temel dosyalardan biridir.
Adım 2: Buton Tanımı
uiMinimap.py dosyasını açarak, mevcut sınıfa yeni bir buton tanımı ekleyin. Örneğin:
Kod:
def __init__(self):[BR][/BR] ui.ScriptWindow.__init__(self)[BR][/BR] self.__CreateButton()[BR][/BR][BR][/BR]def __CreateButton(self):[BR][/BR] self.gotoSiteButton = ui.ButtonImage()[BR][/BR] self.gotoSiteButton.SetParent(self)[BR][/BR] self.gotoSiteButton.SetPosition(10, 10)[BR][/BR] self.gotoSiteButton.SetUpVisual('locale/tr/minimap/goto_site_normal.tga')[BR][/BR] self.gotoSiteButton.SetOverVisual('locale/tr/minimap/goto_site_over.tga')[BR][/BR] self.gotoSiteButton.SetDownVisual('locale/tr/minimap/goto_site_down.tga')[BR][/BR] self.gotoSiteButton.SetToolTipText('Resmi sitemize gitmek icin tiklayin')[BR][/BR] self.gotoSiteButton.SetEvent(ui.__mem_func__(self.__OnGotoSite))[BR][/BR] self.gotoSiteButton.Show()[BR][/BR]
Adım 3: Buton Fonksiyonunu Tanımlama
UYARI: Butonun tıklanması durumunda çalışacak fonksiyonu tanımlamalısınız. Bu fonksiyon, bir URL açacak şekilde yapılandırılmalıdır.
Kod:
def __OnGotoSite(self):[BR][/BR] import webbrowser[BR][/BR] webbrowser.open('https://metin2lobby.com')[BR][/BR]
Adım 4: UI Script Dosyasına Entegrasyon
UIScript dosyanızda (minimap.py) bu butonun görünmesi için gerekli tanımları yapmalısınız. Bu dosyada butonun konumu, boyutu ve görünürlüğü belirlenir.
Adım 5: Görsellerin Eklenmesi
locale/tr/minimap/ klasörü altında butonunuz için gerekli görselleri (normal, over, down) eklediğinizden emin olun. Bu görsellerin boyutları küçük olmalı ve butonunuzu estetik olarak desteklemelidir.
Test ve Derleme
Metin2 client tarafında yapılan değişikliklerin aktif olması için derleme işlemi yapılmalıdır. Gerekli tüm dosyaları kontrol ettikten sonra oyunu başlatıp test edin.
Sonuç
Minimap üzerine eklediğiniz 'Siteye Git' butonu sayesinde oyuncularınız doğrudan resmi sitemize yönlendirilebilir. Bu, hem kullanıcı dostu bir özellik hem de sunucunuzun marka bilinirliğini artırmak için etkili bir yoldur. Bu tarz özelleştirmeler, Metin2 özel sunucu geliştirme dünyasında fark yaratmanıza yardımcı olur.
[PYTHON] Adding Go To Website Button on Minimap in Metin2 Private Servers
Adding a 'Go to Website' button on the minimap is a popular feature among Metin2 private servers to enhance user experience. This process is commonly achieved using [PYTHON]-based GUI systems. In this article, we will explain step by step how to add a button to the minimap via [PYTHON] and redirect it to your website.
First, knowing what each term means is important:
- [PYTHON]: A programming language frequently used for interface development in Metin2 servers.
- UIScript: Script files used in Python GUI systems.
- Py Root and Py GUI: Python files running on the game client side.
Step 1: Prepare Required Files
Open the ui.py file located in your PyRoot folder. This file typically controls the game interface.
Step 2: Define the Button
Open the uiMinimap.py file and add a new button definition to the existing class. For example:
Kod:
def __init__(self):[BR][/BR] ui.ScriptWindow.__init__(self)[BR][/BR] self.__CreateButton()[BR][/BR][BR][/BR]def __CreateButton(self):[BR][/BR] self.gotoSiteButton = ui.ButtonImage()[BR][/BR] self.gotoSiteButton.SetParent(self)[BR][/BR] self.gotoSiteButton.SetPosition(10, 10)[BR][/BR] self.gotoSiteButton.SetUpVisual('locale/tr/minimap/goto_site_normal.tga')[BR][/BR] self.gotoSiteButton.SetOverVisual('locale/tr/minimap/goto_site_over.tga')[BR][/BR] self.gotoSiteButton.SetDownVisual('locale/tr/minimap/goto_site_down.tga')[BR][/BR] self.gotoSiteButton.SetToolTipText('Click to visit our official website')[BR][/BR] self.gotoSiteButton.SetEvent(ui.__mem_func__(self.__OnGotoSite))[BR][/BR] self.gotoSiteButton.Show()[BR][/BR]
Step 3: Define the Button Function
WARNING: You must define the function that will execute when the button is clicked. This function should open a URL.
Kod:
def __OnGotoSite(self):[BR][/BR] import webbrowser[BR][/BR] webbrowser.open('https://metin2lobby.com')[BR][/BR]
Step 4: Integrate into UI Script File
In your UIScript file (minimap.py), make sure the necessary definitions are made so that the button appears. This file defines the position, size, and visibility of the button.
Step 5: Add Images
Ensure you have added the required images (normal, over, down) for the button under the locale/tr/minimap/ folder. These images should be small in size and visually support your button design.
Testing and Compilation
To activate the changes made on the Metin2 client side, a compilation process is needed. After checking all necessary files, launch and test the game.
Conclusion
With the 'Go to Website' button added to the minimap, players can be directed directly to your official website. Such customizations serve both as a user-friendly feature and an effective way to increase brand awareness for your server. Features like these help differentiate your server in the Metin2 private server development scene.
