Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dbg
- import uimg
- import snd
- import systemSetting
- import net
- import chat
- import app
- import localemg
- import constInfo
- import chrmgr
- import player
- import uiPrivateShopBuilder # ±čÁŘČŁ
- import interfaceModule # ±čÁŘČŁ
- import uiSelectMusic
- import background
- import musicInfo
- blockMode = 0
- viewChatMode = 0
- MUSIC_FILENAME_MAX_LEN = 25
- MOBILE = FALSE
- if localemg.IsYMIR():
- MOBILE = TRUE
- class OptionDialog(uimg.ScriptWindow):
- def __init__(self):
- uimg.ScriptWindow.__init__(self)
- self.__Initialize()
- self.__Load()
- self.RefreshViewChat()
- self.RefreshAlwaysShowName()
- self.RefreshShowDamage()
- self.RefreshShowSalesText()
- def __del__(self):
- uimg.ScriptWindow.__del__(self)
- print " -------------------------------------- DELETE GAME OPTION DIALOG"
- def __Initialize(self):
- self.titleBar = 0
- self.nameColorModeButtonList = []
- self.viewTargetBoardButtonList = []
- self.pvpModeButtonDict = {}
- self.blockButtonList = []
- self.blockTextList = []
- self.changeMusicButton = 0
- self.selectMusicFile = 0
- self.ctrlMusicVolume = 0
- self.ctrlSoundVolume = 0
- self.musicListDlg = 0
- self.tilingApplyButton = 0
- self.cameraModeButtonList = []
- self.fogModeButtonList = []
- self.tilingModeButtonList = []
- self.ctrlShadowQuality = 0
- self.PagesTextColor = []
- self.PagesButtons = []
- self.PageList = ["OpcjeGracza", "OpcjeOgolne", "OpcjeGrafiki", "OpcjeDzwiekow"]
- self.NapisyPrzyciskowOn = ["|cfff8d090Gracz","|cfff8d090Ogólne","|cfff8d090Grafika","|cfff8d090Dźwiek"]
- self.NapisyPrzyciskowOff = ["Gracz","Ogólne","Grafika","Dźwiek"]
- self.viewChatButtonList = []
- self.alwaysShowNameButtonList = []
- self.showDamageButtonList = []
- self.showsalesTextButtonList = []
- def Destroy(self):
- self.ClearDictionary()
- self.__Initialize()
- print " -------------------------------------- DESTROY GAME OPTION DIALOG"
- def __Load_LoadScript(self, fileName):
- try:
- pyScriptLoader = uimg.PythonScriptLoader()
- pyScriptLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("OptionDialog.__Load_LoadScript")
- def __Load_BindObject(self):
- try:
- GetObject = self.GetChild
- self.titleBar = GetObject("titlebar")
- ## GAME OPTION
- self.nameColorModeButtonList.append(GetObject("name_color_normal"))
- self.nameColorModeButtonList.append(GetObject("name_color_empire"))
- self.viewTargetBoardButtonList.append(GetObject("target_board_no_view"))
- self.viewTargetBoardButtonList.append(GetObject("target_board_view"))
- self.pvpModeButtonDict[player.PK_MODE_PEACE] = GetObject("pvp_peace")
- self.pvpModeButtonDict[player.PK_MODE_REVENGE] = GetObject("pvp_revenge")
- self.pvpModeButtonDict[player.PK_MODE_GUILD] = GetObject("pvp_guild")
- self.pvpModeButtonDict[player.PK_MODE_FREE] = GetObject("pvp_free")
- self.blockButtonList.append(GetObject("block_exchange_button"))
- self.blockButtonList.append(GetObject("block_party_button"))
- self.blockButtonList.append(GetObject("block_guild_button"))
- self.blockButtonList.append(GetObject("block_whisper_button"))
- self.blockButtonList.append(GetObject("block_friend_button"))
- self.blockButtonList.append(GetObject("block_party_request_button"))
- ## SYSTEM OPTION
- self.selectMusicFile = GetObject("bgm_file")
- self.changeMusicButton = GetObject("bgm_button")
- self.ctrlMusicVolume = GetObject("music_volume_controller")
- self.ctrlSoundVolume = GetObject("sound_volume_controller")
- self.cameraModeButtonList.append(GetObject("camera_short"))
- self.cameraModeButtonList.append(GetObject("camera_long"))
- self.fogModeButtonList.append(GetObject("fog_level0"))
- self.fogModeButtonList.append(GetObject("fog_level1"))
- self.fogModeButtonList.append(GetObject("fog_level2"))
- self.tilingModeButtonList.append(GetObject("tiling_cpu"))
- self.tilingModeButtonList.append(GetObject("tiling_gpu"))
- self.tilingApplyButton=GetObject("tiling_apply")
- #self.ctrlShadowQuality = GetObject("shadow_bar")
- self.blockTextList.append(GetObject("BlockText1"))
- self.blockTextList.append(GetObject("BlockText2"))
- self.blockTextList.append(GetObject("BlockText3"))
- self.blockTextList.append(GetObject("BlockText4"))
- self.blockTextList.append(GetObject("BlockText5"))
- self.blockTextList.append(GetObject("BlockText6"))
- self.PagesTextColor.append(GetObject("Button1_Name"))
- self.PagesTextColor.append(GetObject("Button2_Name"))
- self.PagesTextColor.append(GetObject("Button3_Name"))
- self.PagesTextColor.append(GetObject("Button4_Name"))
- self.PagesButtons.append(GetObject("Zakladka_01"))
- self.PagesButtons.append(GetObject("Zakladka_02"))
- self.PagesButtons.append(GetObject("Zakladka_03"))
- self.PagesButtons.append(GetObject("Zakladka_04"))
- self.GetChild("Zakladka_01").SetEvent(lambda page="OpcjeGracza": self.PokazStrone(page))
- self.GetChild("Zakladka_02").SetEvent(lambda page="OpcjeOgolne": self.PokazStrone(page))
- self.GetChild("Zakladka_03").SetEvent(lambda page="OpcjeGrafiki": self.PokazStrone(page))
- self.GetChild("Zakladka_04").SetEvent(lambda page="OpcjeDzwiekow": self.PokazStrone(page))
- self.viewChatButtonList.append(GetObject("view_chat_on_button"))
- self.viewChatButtonList.append(GetObject("view_chat_off_button"))
- self.alwaysShowNameButtonList.append(GetObject("always_show_name_on_button"))
- self.alwaysShowNameButtonList.append(GetObject("always_show_name_off_button"))
- self.showDamageButtonList.append(GetObject("show_damage_on_button"))
- self.showDamageButtonList.append(GetObject("show_damage_off_button"))
- self.showsalesTextButtonList.append(GetObject("salestext_on_button"))
- self.showsalesTextButtonList.append(GetObject("salestext_off_button"))
- self.ctrlShopNamesRange = GetObject("salestext_range_controller")
- self.GetChild("OpcjeGracza").Show()
- self.GetChild("OpcjeOgolne").Hide()
- self.GetChild("OpcjeGrafiki").Hide()
- self.GetChild("OpcjeDzwiekow").Hide()
- global MOBILE
- if MOBILE:
- self.inputMobileButton = GetObject("input_mobile_button")
- self.deleteMobileButton = GetObject("delete_mobile_button")
- except:
- import exception
- exception.Abort("OptionDialog.__Load_BindObject")
- def __Load(self):
- global MOBILE
- if MOBILE:
- self.__Load_LoadScript("uiscript/gameoptiondialog_formobile.py")
- else:
- self.__Load_LoadScript("uiscript/gameoptiondialog.py")
- self.__Load_BindObject()
- self.SetCenterPosition()
- self.titleBar.SetCloseEvent(uimg.__mem_func__(self.Close))
- ## GAME OPTION
- self.nameColorModeButtonList[0].SAFE_SetEvent(self.__OnClickNameColorModeNormalButton)
- self.nameColorModeButtonList[1].SAFE_SetEvent(self.__OnClickNameColorModeEmpireButton)
- self.viewTargetBoardButtonList[0].SAFE_SetEvent(self.__OnClickTargetBoardViewButton)
- self.viewTargetBoardButtonList[1].SAFE_SetEvent(self.__OnClickTargetBoardNoViewButton)
- self.pvpModeButtonDict[player.PK_MODE_PEACE].SAFE_SetEvent(self.__OnClickPvPModePeaceButton)
- self.pvpModeButtonDict[player.PK_MODE_REVENGE].SAFE_SetEvent(self.__OnClickPvPModeRevengeButton)
- self.pvpModeButtonDict[player.PK_MODE_GUILD].SAFE_SetEvent(self.__OnClickPvPModeGuildButton)
- self.pvpModeButtonDict[player.PK_MODE_FREE].SAFE_SetEvent(self.__OnClickPvPModeFreeButton)
- self.blockButtonList[0].SetToggleUpEvent(self.__OnClickBlockExchangeButton)
- self.blockButtonList[1].SetToggleUpEvent(self.__OnClickBlockPartyButton)
- self.blockButtonList[2].SetToggleUpEvent(self.__OnClickBlockGuildButton)
- self.blockButtonList[3].SetToggleUpEvent(self.__OnClickBlockWhisperButton)
- self.blockButtonList[4].SetToggleUpEvent(self.__OnClickBlockFriendButton)
- self.blockButtonList[5].SetToggleUpEvent(self.__OnClickBlockPartyRequest)
- self.blockButtonList[0].SetToggleDownEvent(self.__OnClickBlockExchangeButton)
- self.blockButtonList[1].SetToggleDownEvent(self.__OnClickBlockPartyButton)
- self.blockButtonList[2].SetToggleDownEvent(self.__OnClickBlockGuildButton)
- self.blockButtonList[3].SetToggleDownEvent(self.__OnClickBlockWhisperButton)
- self.blockButtonList[4].SetToggleDownEvent(self.__OnClickBlockFriendButton)
- self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockPartyRequest)
- self.viewChatButtonList[0].SAFE_SetEvent(self.__OnClickViewChatOnButton)
- self.viewChatButtonList[1].SAFE_SetEvent(self.__OnClickViewChatOffButton)
- self.alwaysShowNameButtonList[0].SAFE_SetEvent(self.__OnClickAlwaysShowNameOnButton)
- self.alwaysShowNameButtonList[1].SAFE_SetEvent(self.__OnClickAlwaysShowNameOffButton)
- self.showDamageButtonList[0].SAFE_SetEvent(self.__OnClickShowDamageOnButton)
- self.showDamageButtonList[1].SAFE_SetEvent(self.__OnClickShowDamageOffButton)
- self.showsalesTextButtonList[0].SAFE_SetEvent(self.__OnClickSalesTextOnButton)
- self.showsalesTextButtonList[1].SAFE_SetEvent(self.__OnClickSalesTextOffButton)
- ## SYSTEM OPTION
- self.ctrlMusicVolume.SetSliderPos(float(systemSetting.GetMusicVolume()))
- self.ctrlMusicVolume.SetEvent(uimg.__mem_func__(self.OnChangeMusicVolume))
- self.ctrlSoundVolume.SetSliderPos(float(systemSetting.GetSoundVolume()) / 5.0)
- self.ctrlSoundVolume.SetEvent(uimg.__mem_func__(self.OnChangeSoundVolume))
- #self.ctrlShadowQuality.SetSliderPos(float(systemSetting.GetShadowLevel()) / 5.0)
- #self.ctrlShadowQuality.SetEvent(uimg.__mem_func__(self.OnChangeShadowQuality))
- self.changeMusicButton.SAFE_SetEvent(self.__OnClickChangeMusicButton)
- self.cameraModeButtonList[0].SAFE_SetEvent(self.__OnClickCameraModeShortButton)
- self.cameraModeButtonList[1].SAFE_SetEvent(self.__OnClickCameraModeLongButton)
- self.fogModeButtonList[0].SAFE_SetEvent(self.__OnClickFogModeLevel0Button)
- self.fogModeButtonList[1].SAFE_SetEvent(self.__OnClickFogModeLevel1Button)
- self.fogModeButtonList[2].SAFE_SetEvent(self.__OnClickFogModeLevel2Button)
- self.tilingModeButtonList[0].SAFE_SetEvent(self.__OnClickTilingModeCPUButton)
- self.tilingModeButtonList[1].SAFE_SetEvent(self.__OnClickTilingModeGPUButton)
- self.tilingApplyButton.SAFE_SetEvent(self.__OnClickTilingApplyButton)
- self.__SetCurTilingMode()
- self.ctrlShopNamesRange.SetSliderPos(float(uiPrivateShopBuilder.GetShopNamesRange()))
- self.ctrlShopNamesRange.SetEvent(uimg.__mem_func__(self.OnChangeShopNamesRange))
- self.__ClickRadioButton(self.nameColorModeButtonList, constInfo.GET_CHRNAME_COLOR_INDEX())
- self.__ClickRadioButton(self.viewTargetBoardButtonList, constInfo.GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD())
- self.__SetPeacePKMode()
- self.JakasFunkcja(self.fogModeButtonList, constInfo.GET_FOG_LEVEL_INDEX())
- self.JakasFunkcja(self.cameraModeButtonList, constInfo.GET_CAMERA_MAX_DISTANCE_INDEX())
- if musicInfo.fieldMusic==musicInfo.METIN2THEMA:
- self.selectMusicFile.SetText("|cffa08784" + uiSelectMusic.DEFAULT_THEMA)
- else:
- self.selectMusicFile.SetText("|cffa08784" + musicInfo.fieldMusic[:MUSIC_FILENAME_MAX_LEN])
- #global MOBILE
- if MOBILE:
- self.inputMobileButton.SetEvent(uimg.__mem_func__(self.__OnChangeMobilePhoneNumber))
- self.deleteMobileButton.SetEvent(uimg.__mem_func__(self.__OnDeleteMobilePhoneNumber))
- def OnChangeShopNamesRange(self):
- pos = self.ctrlShopNamesRange.GetSliderPos()
- uiPrivateShopBuilder.SetShopNamesRange(pos)
- if systemSetting.IsShowSalesText():
- uiPrivateShopBuilder.UpdateADBoard()
- def __ClickRadioButton(self, buttonList, buttonIndex):
- try:
- selButton=buttonList[buttonIndex]
- except IndexError:
- return
- for eachButton in buttonList:
- eachButton.SetUp()
- selButton.Down()
- def PokazStrone(self, page):
- for i in xrange(len(self.PageList)):
- if page == self.PageList[i]:
- self.GetChild(page).Show()
- self.PagesTextColor[i].SetText(self.NapisyPrzyciskowOn[i])
- self.PagesButtons[i].SetUpVisual("illumina/buttons/chrbutton_big_a.tga")
- else:
- self.GetChild(self.PageList[i]).Hide()
- self.PagesTextColor[i].SetText(self.NapisyPrzyciskowOff[i])
- self.PagesButtons[i].SetUpVisual("illumina/buttons/chrbutton_big_n.tga")
- def JakasFunkcja(self, buttonList, buttonIndex):
- try:
- selButton=buttonList[buttonIndex]
- except IndexError:
- return
- for eachButton in buttonList:
- eachButton.SetUp()
- selButton.Down()
- def __SetTilingMode(self, index):
- self.JakasFunkcja(self.tilingModeButtonList, index)
- self.tilingMode=index
- def __SetCameraMode(self, index):
- constInfo.SET_CAMERA_MAX_DISTANCE_INDEX(index)
- self.JakasFunkcja(self.cameraModeButtonList, index)
- def __SetFogLevel(self, index):
- constInfo.SET_FOG_LEVEL_INDEX(index)
- self.JakasFunkcja(self.fogModeButtonList, index)
- def __SetNameColorMode(self, index):
- constInfo.SET_CHRNAME_COLOR_INDEX(index)
- self.__ClickRadioButton(self.nameColorModeButtonList, index)
- def __SetTargetBoardViewMode(self, flag):
- constInfo.SET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD(flag)
- self.__ClickRadioButton(self.viewTargetBoardButtonList, flag)
- def __OnClickNameColorModeNormalButton(self):
- self.__SetNameColorMode(0)
- def __OnClickNameColorModeEmpireButton(self):
- self.__SetNameColorMode(1)
- def __OnClickTargetBoardViewButton(self):
- self.__SetTargetBoardViewMode(0)
- def __OnClickTargetBoardNoViewButton(self):
- self.__SetTargetBoardViewMode(1)
- def __OnClickCameraModeShortButton(self):
- self.__SetCameraMode(0)
- def __OnClickCameraModeLongButton(self):
- self.__SetCameraMode(1)
- def __OnClickFogModeLevel0Button(self):
- self.__SetFogLevel(0)
- def __OnClickFogModeLevel1Button(self):
- self.__SetFogLevel(1)
- def __OnClickFogModeLevel2Button(self):
- self.__SetFogLevel(2)
- def __OnClickBlockExchangeButton(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_EXCHANGE))
- def __OnClickBlockPartyButton(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_PARTY))
- def __OnClickBlockGuildButton(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_GUILD))
- def __OnClickBlockWhisperButton(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_WHISPER))
- def __OnClickBlockFriendButton(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_FRIEND))
- def __OnClickBlockPartyRequest(self):
- self.RefreshBlock()
- global blockMode
- net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_PARTY_REQUEST))
- def __OnClickViewChatOnButton(self):
- global viewChatMode
- viewChatMode = 1
- systemSetting.SetViewChatFlag(viewChatMode)
- self.RefreshViewChat()
- def __OnClickViewChatOffButton(self):
- global viewChatMode
- viewChatMode = 0
- systemSetting.SetViewChatFlag(viewChatMode)
- self.RefreshViewChat()
- def __OnClickAlwaysShowNameOnButton(self):
- systemSetting.SetAlwaysShowNameFlag(TRUE)
- self.RefreshAlwaysShowName()
- def __OnClickAlwaysShowNameOffButton(self):
- systemSetting.SetAlwaysShowNameFlag(FALSE)
- self.RefreshAlwaysShowName()
- def __OnClickShowDamageOnButton(self):
- systemSetting.SetShowDamageFlag(TRUE)
- self.RefreshShowDamage()
- def __OnClickShowDamageOffButton(self):
- systemSetting.SetShowDamageFlag(FALSE)
- self.RefreshShowDamage()
- def __OnClickSalesTextOnButton(self):
- systemSetting.SetShowSalesTextFlag(TRUE)
- self.RefreshShowSalesText()
- uiPrivateShopBuilder.UpdateADBoard()
- def __OnClickSalesTextOffButton(self):
- systemSetting.SetShowSalesTextFlag(FALSE)
- self.RefreshShowSalesText()
- def __CheckPvPProtectedLevelPlayer(self):
- if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_PROTECTED_LEVEL:
- self.__SetPeacePKMode()
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
- return 1
- return 0
- def __SetPKMode(self, mode):
- for btn in self.pvpModeButtonDict.values():
- btn.SetUp()
- if self.pvpModeButtonDict.has_key(mode):
- self.pvpModeButtonDict[mode].Down()
- def __SetPeacePKMode(self):
- self.__SetPKMode(player.PK_MODE_PEACE)
- def __RefreshPVPButtonList(self):
- self.__SetPKMode(player.GetPKMode())
- def __OnClickPvPModePeaceButton(self):
- if self.__CheckPvPProtectedLevelPlayer():
- return
- self.__RefreshPVPButtonList()
- if constInfo.PVPMODE_ENABLE:
- net.SendChatPacket("/pkmode 0", chat.CHAT_TYPE_TALKING)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_NOT_SUPPORT)
- def __OnClickPvPModeRevengeButton(self):
- if self.__CheckPvPProtectedLevelPlayer():
- return
- self.__RefreshPVPButtonList()
- if constInfo.PVPMODE_ENABLE:
- net.SendChatPacket("/pkmode 1", chat.CHAT_TYPE_TALKING)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_NOT_SUPPORT)
- def __OnClickPvPModeFreeButton(self):
- if self.__CheckPvPProtectedLevelPlayer():
- return
- self.__RefreshPVPButtonList()
- if constInfo.PVPMODE_ENABLE:
- net.SendChatPacket("/pkmode 2", chat.CHAT_TYPE_TALKING)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_NOT_SUPPORT)
- def __OnClickPvPModeGuildButton(self):
- if self.__CheckPvPProtectedLevelPlayer():
- return
- self.__RefreshPVPButtonList()
- if 0 == player.GetGuildID():
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
- return
- if constInfo.PVPMODE_ENABLE:
- net.SendChatPacket("/pkmode 4", chat.CHAT_TYPE_TALKING)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, localemg.OPTION_PVPMODE_NOT_SUPPORT)
- def OnChangePKMode(self):
- self.__RefreshPVPButtonList()
- def __OnChangeMobilePhoneNumber(self):
- global MOBILE
- if not MOBILE:
- return
- import uiCommon
- inputDialog = uiCommon.InputDialog()
- inputDialog.SetTitle(localemg.MESSENGER_INPUT_MOBILE_PHONE_NUMBER_TITLE)
- inputDialog.SetMaxLength(13)
- inputDialog.SetAcceptEvent(uimg.__mem_func__(self.OnInputMobilePhoneNumber))
- inputDialog.SetCancelEvent(uimg.__mem_func__(self.OnCloseInputDialog))
- inputDialog.Open()
- self.inputDialog = inputDialog
- def __OnDeleteMobilePhoneNumber(self):
- global MOBILE
- if not MOBILE:
- return
- import uiCommon
- questionDialog = uiCommon.QuestionDialog()
- questionDialog.SetText(localemg.MESSENGER_DO_YOU_DELETE_PHONE_NUMBER)
- questionDialog.SetAcceptEvent(uimg.__mem_func__(self.OnDeleteMobile))
- questionDialog.SetCancelEvent(uimg.__mem_func__(self.OnCloseQuestionDialog))
- questionDialog.Open()
- self.questionDialog = questionDialog
- def OnInputMobilePhoneNumber(self):
- global MOBILE
- if not MOBILE:
- return
- text = self.inputDialog.GetText()
- if not text:
- return
- text.replace('-', '')
- net.SendChatPacket("/mobile " + text)
- self.OnCloseInputDialog()
- return TRUE
- def OnInputMobileAuthorityCode(self):
- global MOBILE
- if not MOBILE:
- return
- text = self.inputDialog.GetText()
- net.SendChatPacket("/mobile_auth " + text)
- self.OnCloseInputDialog()
- return TRUE
- def OnDeleteMobile(self):
- global MOBILE
- if not MOBILE:
- return
- net.SendChatPacket("/mobile")
- self.OnCloseQuestionDialog()
- return TRUE
- def OnCloseInputDialog(self):
- self.inputDialog.Close()
- self.inputDialog = None
- return TRUE
- def OnCloseQuestionDialog(self):
- self.questionDialog.Close()
- self.questionDialog = None
- return TRUE
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- def RefreshMobile(self):
- global MOBILE
- if not MOBILE:
- return
- if player.HasMobilePhoneNumber():
- self.inputMobileButton.Hide()
- self.deleteMobileButton.Show()
- else:
- self.inputMobileButton.Show()
- self.deleteMobileButton.Hide()
- def OnMobileAuthority(self):
- global MOBILE
- if not MOBILE:
- return
- import uiCommon
- inputDialog = uiCommon.InputDialogWithDescription()
- inputDialog.SetTitle(localemg.MESSENGER_INPUT_MOBILE_AUTHORITY_TITLE)
- inputDialog.SetDescription(localemg.MESSENGER_INPUT_MOBILE_AUTHORITY_DESCRIPTION)
- inputDialog.SetAcceptEvent(uimg.__mem_func__(self.OnInputMobileAuthorityCode))
- inputDialog.SetCancelEvent(uimg.__mem_func__(self.OnCloseInputDialog))
- inputDialog.SetMaxLength(4)
- inputDialog.SetBoardWidth(310)
- inputDialog.Open()
- self.inputDialog = inputDialog
- def RefreshBlock(self):
- global blockMode
- for i in xrange(len(self.blockButtonList)):
- if 0 != (blockMode & (1 << i)):
- self.blockButtonList[i].Down()
- self.blockTextList[i].SetPackedFontColor(0x77c3a777)
- else:
- self.blockButtonList[i].SetUp()
- self.blockTextList[i].SetPackedFontColor(0x77847b71)
- def RefreshViewChat(self):
- if systemSetting.IsViewChat():
- self.viewChatButtonList[0].Down()
- self.viewChatButtonList[1].SetUp()
- else:
- self.viewChatButtonList[0].SetUp()
- self.viewChatButtonList[1].Down()
- def RefreshAlwaysShowName(self):
- if systemSetting.IsAlwaysShowName():
- self.alwaysShowNameButtonList[0].Down()
- self.alwaysShowNameButtonList[1].SetUp()
- else:
- self.alwaysShowNameButtonList[0].SetUp()
- self.alwaysShowNameButtonList[1].Down()
- def RefreshShowDamage(self):
- if systemSetting.IsShowDamage():
- self.showDamageButtonList[0].Down()
- self.showDamageButtonList[1].SetUp()
- else:
- self.showDamageButtonList[0].SetUp()
- self.showDamageButtonList[1].Down()
- def RefreshShowSalesText(self):
- if systemSetting.IsShowSalesText():
- self.showsalesTextButtonList[0].Down()
- self.showsalesTextButtonList[1].SetUp()
- else:
- self.showsalesTextButtonList[0].SetUp()
- self.showsalesTextButtonList[1].Down()
- def __OnClickTilingModeCPUButton(self):
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_CPU_TILING_1)
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_CPU_TILING_2)
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_CPU_TILING_3)
- self.__SetTilingMode(0)
- def __OnClickTilingModeGPUButton(self):
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_GPU_TILING_1)
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_GPU_TILING_2)
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_GPU_TILING_3)
- self.__SetTilingMode(1)
- def __OnClickTilingApplyButton(self):
- self.__NotifyChatLine(localemg.SYSTEM_OPTION_TILING_EXIT)
- if 0==self.tilingMode:
- background.EnableSoftwareTiling(1)
- else:
- background.EnableSoftwareTiling(0)
- net.ExitGame()
- def __NotifyChatLine(self, text):
- chat.AppendChat(chat.CHAT_TYPE_INFO, text)
- def __OnClickChangeMusicButton(self):
- if not self.musicListDlg:
- self.musicListDlg=uiSelectMusic.FileListDialog()
- self.musicListDlg.SAFE_SetSelectEvent(self.__OnChangeMusic)
- self.musicListDlg.Open()
- def __SetTilingMode(self, index):
- self.__ClickRadioButton(self.tilingModeButtonList, index)
- self.tilingMode=index
- def __SetCameraMode(self, index):
- constInfo.SET_CAMERA_MAX_DISTANCE_INDEX(index)
- self.__ClickRadioButton(self.cameraModeButtonList, index)
- def __SetFogLevel(self, index):
- constInfo.SET_FOG_LEVEL_INDEX(index)
- self.__ClickRadioButton(self.fogModeButtonList, index)
- def __OnClickCameraModeShortButton(self):
- self.__SetCameraMode(0)
- def __OnClickCameraModeLongButton(self):
- self.__SetCameraMode(1)
- def __OnClickFogModeLevel0Button(self):
- self.__SetFogLevel(0)
- def __OnClickFogModeLevel1Button(self):
- self.__SetFogLevel(1)
- def __OnClickFogModeLevel2Button(self):
- self.__SetFogLevel(2)
- def __OnChangeMusic(self, fileName):
- self.selectMusicFile.SetText("|cffa08784" + fileName[:MUSIC_FILENAME_MAX_LEN])
- if musicInfo.fieldMusic != "":
- snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
- if fileName==uiSelectMusic.DEFAULT_THEMA:
- musicInfo.fieldMusic=musicInfo.METIN2THEMA
- else:
- musicInfo.fieldMusic=fileName
- musicInfo.SaveLastPlayFieldMusic()
- if musicInfo.fieldMusic != "":
- snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
- def OnChangeMusicVolume(self):
- pos = self.ctrlMusicVolume.GetSliderPos()
- snd.SetMusicVolume(pos * net.GetFieldMusicVolume())
- systemSetting.SetMusicVolume(pos)
- def OnChangeSoundVolume(self):
- pos = self.ctrlSoundVolume.GetSliderPos()
- snd.SetSoundVolumef(pos)
- systemSetting.SetSoundVolumef(pos)
- def OnChangeShadowQuality(self):
- pos = self.ctrlShadowQuality.GetSliderPos()
- systemSetting.SetShadowLevel(int(pos / 0.2))
- def OnCloseInputDialog(self):
- self.inputDialog.Close()
- self.inputDialog = None
- return True
- def OnCloseQuestionDialog(self):
- self.questionDialog.Close()
- self.questionDialog = None
- return True
- def OnBlockMode(self, mode):
- global blockMode
- blockMode = mode
- self.RefreshBlock()
- def __SetCurTilingMode(self):
- if background.IsSoftwareTiling():
- self.__SetTilingMode(0)
- else:
- self.__SetTilingMode(1)
- def Show(self):
- self.RefreshMobile()
- self.RefreshBlock()
- uimg.ScriptWindow.Show(self)
- def Close(self):
- self.Hide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement