[Python] Oyun Seçeneklerine Gece/Gündüz Ekle

MBayraktar

Yasaklanmış Üye
Cezalı
Mesaj
225
Çözümler
2
Beğeni
181
Puan
731
Ticaret Puanı
0
M2-Hero'da Oyun Seçenekleri bölümünde Gece/Gündüz seçimi yapabileceğiniz alan bulunuyor.
Sizde aşağıdaki adımları uygulayarak bu seçeneği oyununuza ekleyebilirsiniz.1) root/uigameoption.py aç VE ara:

Python:
import interfaceModule

Altına ekle:

Python:
import background

Ara :

Python:
self.RefreshShowSalesText()

Altına ekle :

Python:
self.RefreshShowNightText()

Ara :

Python:
self.showsalesTextButtonList = []

Altına ekle :

Python:
self.showNightButtonList = []

Ara :

Python:
self.showsalesTextButtonList.append(GetObject("salestext_on_button"))
            self.showsalesTextButtonList.append(GetObject("salestext_off_button"))

Altına ekle :

Python:
 self.showNightButtonList.append(GetObject("showNight_on_button"))
            self.showNightButtonList.append(GetObject("showNight_off_button"))

Ara :

Python:
self.showsalesTextButtonList[0].SAFE_SetEvent(self.__OnClickSalesTextOnButton)
        self.showsalesTextButtonList[1].SAFE_SetEvent(self.__OnClickSalesTextOffButton)

Altına ekle :

Python:
  self.showNightButtonList[0].SAFE_SetEvent(self.__OnClickShowNightOnButton)
        self.showNightButtonList[1].SAFE_SetEvent(self.__OnClickShowNightOffButton)

Ara :

Python:
def __OnClickSalesTextOnButton(self):
        systemSetting.SetShowSalesTextFlag(TRUE)
        self.RefreshShowSalesText()
        uiPrivateShopBuilder.UpdateADBoard()
     
    def __OnClickSalesTextOffButton(self):
        systemSetting.SetShowSalesTextFlag(FALSE)
        self.RefreshShowSalesText()

Altına ekle :

Python:
  def __OnClickShowNightOnButton(self):
        background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
        background.SetEnvironmentData(1)
        constInfo.Night = 1
        self.RefreshShowNightText()

    def __OnClickShowNightOffButton(self):
        background.SetEnvironmentData(0)
        constInfo.Night = 0
        self.RefreshShowNightText()

Ara :

Python:
def RefreshShowSalesText(self):
        if systemSetting.IsShowSalesText():
            self.showsalesTextButtonList[0].Down()
            self.showsalesTextButtonList[1].SetUp()
        else:
            self.showsalesTextButtonList[0].SetUp()
            self.showsalesTextButtonList[1].Down()

Altına ekle :

Python:
 def RefreshShowNightText(self):
        if constInfo.Night == 1:
            self.showNightButtonList[0].Down()
            self.showNightButtonList[1].SetUp()
        else:
            self.showNightButtonList[0].SetUp()
            self.showNightButtonList[1].Down()

2) root/constInfo.py aç ve ara :

Python:
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"

altına ekle :

Python:
Night = 0

03) uiscript/gameoptiondialog.py aç VE başlangıçta yazan kısmı bununla değiştir :

Python:
TEMPORARY_X = +14
BUTTON_TEMPORARY_X = 5
PVP_X = -10

LINE_LABEL_X     = 30
LINE_DATA_X     = 90
LINE_STEP    = 0
SMALL_BUTTON_WIDTH     = 45
MIDDLE_BUTTON_WIDTH     = 65

Ara :

Python:
26*11+8, or 25*11+8,

Değiştir :

Python:
28*11+8,

Ve bunu dosyada herhangi bir kod bloğunun altına ekleyin :

Python:
{
                    "name" : "showNight_on_off",
                    "type" : "text",


                    "x" : LINE_LABEL_X,
                    "y" : 265+2,


                    "text" : "Hava Ayarı",
                },
                {
                    "name" : "showNight_on_button",
                    "type" : "radio_button",


                    "x" : LINE_DATA_X,
                    "y"    : 265,


                    "text" : "Gece",


                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },
                {
                    "name" : "showNight_off_button",
                    "type" : "radio_button",


                    "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH,
                    "y" : 265,


                    "text" : "Gündüz",


                    "default_image" : ROOT_PATH + "middle_button_01.sub",
                    "over_image" : ROOT_PATH + "middle_button_02.sub",
                    "down_image" : ROOT_PATH + "middle_button_03.sub",
                },

4) Oyuna girip deneyebilirsiniz.

Resimler:

Gece seçeneği

Gündüz seçeneği.
 
En son bir moderatör tarafından düzenlenmiş:
Geri
Üst