Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Python] Éjjel-nappal állítása
#1
Thumbs Up 
Éjjal-nappal állítása állítható a kliensben, és a játékos maga döntheti el, mit szeretne, mint a GéEF-ben. Wink

1) root/uigameoption.py :

Keress rá erre:
Code:
import interfaceModule


Írd alá ezt:
Code:
import background



Keress rá erre:
Code:
self.RefreshShowSalesText()


Írd alá ezt:
Code:
self.RefreshShowNightText()



Keress rá erre:
Code:
self.showsalesTextButtonList = []


Írd alá ezt:
Code:
self.showNightButtonList = []




Keress rá erre:
Code:
        self.showsalesTextButtonList.append(GetObject("salestext_on_button"))
        self.showsalesTextButtonList.append(GetObject("salestext_off_button"))


Írd alá:
Code:
        self.showNightButtonList.append(GetObject("showNight_on_button"))
        self.showNightButtonList.append(GetObject("showNight_off_button"))




Keress rá erre:
Code:
        self.showsalesTextButtonList[0].SAFE_SetEvent(self.__OnClickSalesTextOnButton)
        self.showsalesTextButtonList[1].SAFE_SetEvent(self.__OnClickSalesTextOffButton)


Írd alá ezeket a sorokat:
Code:
        self.showNightButtonList[0].SAFE_SetEvent(self.__OnClickShowNightOnButton)
        self.showNightButtonList[1].SAFE_SetEvent(self.__OnClickShowNightOffButton)




Írd az uigameoption.py végére :
Code:
    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()



Ezt is a végére:
Code:
    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 :

Keress rá erre:
Code:
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"

Írd alá ezt:
Code:
Night = 0



3) uiscript/gameoptiondialog.py :

Írd a gameoptiondialog.py végére :
Code:
                # Night on/off button
                {
                    "name" : "showNight_on_off",
                    "type" : "text",


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


                    "text" : "Nappal",
                },
                {
                    "name" : "showNight_on_button",
                    "type" : "radio_button",


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


                    "text" : "Éjszaka",


                    "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" : "Nap",


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


Üdv, Pisti95
[Image: 1453876818-b8928becdb9a3058b7c9ff22ccc5caf6.jpeg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)