(C++ , Python) Chat Saat Göster Gizle Sistemi | bykatil199

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhaba arkadaşlar lazım olur diye kodlamıştım hepimiz kullanalım diye paylaşayım dedim.
Not : kodlaması bana aittir.

Sistem Videosu ;




Anlatıma Geçelim ;

----- Aratılır -----
Client Source > UserInterFace > locale_inc.h Açılır Eklenir ;

----- Altına Eklenir -----
Kod:
#define AHMET_CHAT_SAAT_SYSTEM

----- Aratılır -----
Client Source > UserInterFace > PythonApplicationModule.cpp Açılır Eklenir ;

----- Altına Eklenir -----

Kod:
#ifdef AHMET_CHAT_SAAT_SYSTEM     PyModule_AddIntConstant(poModule, "AHMET_CHAT_SAAT_SYSTEM",    1); #else     PyModule_AddIntConstant(poModule, "AHMET_CHAT_SAAT_SYSTEM",    0); #endif

----- Aratılır -----

root > uichat.py açılır aratılır ; def OnIMEReturn(self):

----- Komple Değiştirilir -----

Kod:
def OnIMEReturn(self):         text = self.GetText()         textLen=len(text)         # LAST_SENTENCE_STACK         self.__PushLastSentenceStack(text)         # END_OF_LAST_SENTENCE_STACK                          textSpaceCount=text.count(' ')         if (textLen > 0) and (textLen != textSpaceCount):             if '#' == text[0]:                 self.__SendPartyChatPacket(text)             elif '%' == text[0]:                 self.__SendGuildChatPacket(text)             elif '!' == text[0]:                 if app.AHMET_CHAT_SAAT_SYSTEM:                     if 1 == constInfo.chatsaataktifmi:                         chattime = time.strftime("[[%H:%M:%S]")                         text = chattime + " : " + text[1:]                 self.__SendShoutChatPacket(text)             else:                 self.__SendTalkingChatPacket(text)         else:             self.__ClearChat()             self.eventReturn()         return TRUE

--- Aratılır ----
root > uisystemoption.py ; def __init__(self): kod satırının en altına eklenir

---Altına Eklenir ----

Kod:
if app.AHMET_CHAT_SAAT_SYSTEM:             self.chatsaatyenile()


--- Aratılır ----
root > uisystemoption.py ; def __Initialize(self): kod satırının en altına eklenir

---Altına Eklenir ----

Kod:
if app.AHMET_CHAT_SAAT_SYSTEM:             self.chatsaatyenilela = []

--- Aratılır ----
root > uisystemoption.py ; aratılır ; self.cameraModeButtonList.append(GetObject("camera_long"))

----Altına Eklenir ----

Kod:
if app.AHMET_CHAT_SAAT_SYSTEM:                 self.chatsaatyenilela.append(GetObject("chatsaatyenilela_on_button"))                 self.chatsaatyenilela.append(GetObject("chatsaatyenilela_off_button"))

--- Aratılır ----
root > uisystemoption.py ; aratılır ; self.cameraModeButtonList[1].SAFE_SetEvent(self.__OnClickCameraModeLongButton)

----Altına Eklenir ----

Kod:
if app.AHMET_CHAT_SAAT_SYSTEM:             self.chatsaatyenilela[0].SAFE_SetEvent(self.__OnClickChatSaatOnButton)             self.chatsaatyenilela[1].SAFE_SetEvent(self.__OnClickChatSaatOffButton)


----aratılır ---- def __OnChangeMusic(self, fileName):

-------Üstüne Eklenir ------

Kod:
#Chat Saat Ekleme     if app.AHMET_CHAT_SAAT_SYSTEM:         def __OnClickChatSaatOnButton(self):             constInfo.chatsaataktifmi = 1             self.chatsaatyenile()         def __OnClickChatSaatOffButton(self):             constInfo.chatsaataktifmi = 0             self.chatsaatyenile()                  def chatsaatyenile(self):             if constInfo.chatsaataktifmi == 1:                 self.chatsaatyenilela[0].Down()                 self.chatsaatyenilela[1].SetUp()             else:                 self.chatsaatyenilela[0].SetUp()                 self.chatsaatyenilela[1].Down() #Chat Saat Ekleme


------Açılır ------
Constinfo.py açılır eklenir : chatsaataktifmi = 0

--- Açılır -----
uiscript > systemoptiondialog.py açılır eklenir ;

Kod:
{                     "name" : "nighttitle",                     "type" : "text",                     "x" : 30,                     "y" : 185+45+25+25+25+25+25+25,                     "text" : "Chat Saat",                 },                 {                     "name" : "chatsaatyenilela_on_button",                     "type" : "radio_button",                     "x" : 110,                     "y" : 185+45+25+25+25+25+25+25,                     "text" : "Aktif",                     "default_image" : ROOT_PATH + "small_Button_01.sub",                     "over_image" : ROOT_PATH + "small_Button_02.sub",                     "down_image" : ROOT_PATH + "small_Button_03.sub",                 },                              {                     "name" : "chatsaatyenilela_off_button",                     "type" : "radio_button",                     "x" : 110+50,                     "y" : 185+45+25+25+25+25+25+25,                     "text" : "Deaktif",                     "default_image" : ROOT_PATH + "small_Button_01.sub",                     "over_image" : ROOT_PATH + "small_Button_02.sub",                     "down_image" : ROOT_PATH + "small_Button_03.sub",                 },








Metin2 Özel Sunucular İçin C++ ve Python Tabanlı Chat Saat Göster/Gizle Sistemi

Metin2 özel sunucu geliştiricileri, oyuncuların deneyimini artırmak adına kullanıcı arayüzüne birçok özel sistem entegre eder. Bu sistemlerden birisi de chat saat göster/gizle özelliğidir. Bu yazıda, C++ ve Python kullanarak Metin2 özel sunucularınızda nasıl bir chat saat sistemi kurabileceğinizi adım adım anlatacağız. Bu sistem sayesinde, oyuncular istedikleri zaman chat penceresinde saati görebilecek veya gizleyebileceklerdir.

Sistem Özellikleri

- Chat penceresinde anlık saat gösterimi
- Saatin gizlenmesi ve tekrar görünür hale getirilmesi
- Oyuncu tercihlerine göre ayarlanabilirlik
- C++ backend ve Python GUI entegrasyonu

Geliştirme Ortamı

Bu projede iki ana dil kullanılır: C++ ve Python. C++, sunucu tarafında zamanlayıcıları ve veri akışlarını yönetmek için kullanılırken, Python GUI (uiscript) arayüz üzerinde saat kontrolünü sağlar. Ayrıca, py root dosyaları ile GUI elementleri entegre edilir.

Adım 1: C++ Tarafında Zamanlayıcı Oluşturmak

Sunucu tarafında, her oyuncuya özel zamanlayıcı kurulur. Bu zamanlayıcı, belirli aralıklarla oyuncunun istemcisine mevcut saati gönderir. Bu işlem, game server programming prensipleri doğrultusunda yapılır. Saat verisi genellikle db üzerinden de tutulabilir, ancak bu sistemde anlık veri işleneceği için sadece bellekte tutulur.

Adım 2: Python GUI ile Saat Arayüzünü Tanımlamak

Python tarafında uiscript kullanılarak chat penceresine özel bir saat label eklenir. Bu label, C++ tarafından gelen saat verisi ile güncellenir. Saat görünümü, oyuncu isteğine göre açılıp kapatılabilir. Bu işlem için bir toggle buton tanımlanır ve py gui üzerinden kontrol edilir.

Chat Saat Göster/Gizle Butonu

Oyuncu arayüzünde bir buton konumlandırılır. Bu butonun işlevi, saat alanının görünürlüğünü değiştirmektir. Butona tıklanınca, uiscript üzerinden bir mesaj gönderilerek saat label'inin görünürlüğü değiştirilir. Bu işlem sırasında root üzerinden nesne kontrolü yapılır.

Dikkat Edilmesi Gerekenler

- Kodlama sırasında channel yapısı dikkate alınmalıdır.
- Saat senkronizasyonu için zaman damgası doğru ayarlanmalıdır.
- Her oyuncu için farklı saat tercihi saklanabilmelidir.

Sonuç

Metin2 özel sunucularında chat saat göster/gizle sistemi, kullanıcı dostu bir deneyim sunmak için oldukça faydalıdır. C++ ve Python birlikte çalışarak hem sunucu hem de istemci tarafında verimli bir sistem oluşturulabilir. Bu sistem, source edit yaparak özelleştirilebilir ve pack dosyalarıyla kolayca dağıtım yapılabilir. Bu tarz sistemler, martysama gibi topluluklarda da popülerdir ve metin2 development sürecini zenginleştirir.


C++ and Python Based Chat Clock Show/Hide System for Metin2 Private Servers

Metin2 private server developers often integrate various custom systems into the user interface to enhance the player experience. One such system is the chat clock show/hide feature. In this article, we will explain step-by-step how to implement a chat clock system on your Metin2 private servers using C++ and Python. With this system, players can choose to show or hide the current time within the chat window at any time.

System Features

- Real-time clock display in the chat window
- Ability to hide and reveal the clock
- Configurable based on player preferences
- C++ backend and Python GUI integration

Development Environment

Two main languages are used in this project: C++ and Python. While C++ handles timers and data flow on the server side, Python GUI (uiscript) manages the clock control on the UI. Additionally, py root files integrate GUI elements.

Step 1: Creating Timer in C++

On the server side, a timer is set up per player. This timer sends the current time to the player's client at regular intervals. This process follows game server programming principles. Time data may be stored in db as well, but since this system processes live data, it is held in memory only.

Step 2: Defining Clock UI with Python GUI

In Python, a special clock label is added to the chat window using uiscript. This label updates according to the time data received from C++. The clock view can be toggled on/off based on player preference. A toggle button is defined for this purpose and controlled via py gui.

Chat Clock Show/Hide Button

A button is placed in the player interface. Its function is to change the visibility of the clock area. When clicked, a message is sent through uiscript to alter the visibility of the clock label. During this process, object control is done via root.

Important Considerations

- The channel structure must be considered during coding.
- Timestamps must be correctly configured for clock synchronization.
- Different clock preferences should be saved per player.

Conclusion

The chat clock show/hide system is highly beneficial for enhancing user-friendly experiences in Metin2 private servers. By combining C++ and Python, an efficient system can be built for both server and client sides. This system can be customized through source edit and easily distributed with pack files. Such systems are popular in communities like martysama and enrich the metin2 development process.
 

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

Benzer konular

Geri
Üst Alt