import ui import snd import systemSetting try: import m2net except ImportError: import net as m2net import net import chat import app import localeInfo import constInfo import chrmgr import frozengame import player import background import uiPrivateShopBuilder # ����ȣ import uiOfflineShopBuilder import interfaceModule # ����ȣ import uiToolTip if app.ENABLE_MELEY_LAIR_DUNGEON: import background blockMode = 0 viewChatMode = 0 MOBILE = FALSE if localeInfo.IsYMIR(): MOBILE = TRUE class OptionDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.__Initialize() self.__Load() self.RefreshViewChat() self.RefreshAlwaysShowName() self.RefreshShowDamage() self.RefreshShowSalesText() self.RefreshOnlineOyuncuSayaci() if app.WJ_SHOW_MOB_INFO: self.RefreshShowMobInfo() self.RefreshShowHighlight() def __del__(self): ui.ScriptWindow.__del__(self) print " -------------------------------------- DELETE GAME OPTION DIALOG" def __Initialize(self): self.titleBar = 0 self.nameColorModeButtonList = [] self.viewTargetBoardButtonList = [] self.pvpModeButtonDict = {} self.blockButtonList = [] self.viewChatButtonList = [] self.alwaysShowNameButtonList = [] self.showDamageButtonList = [] self.showsalesTextButtonList = [] self.OnlineOyuncuSayaci = [] if app.WJ_SHOW_MOB_INFO: self.showMobInfoButtonList = [] self.showHighlightButtonList = [] def Destroy(self): self.ClearDictionary() self.__Initialize() print " -------------------------------------- DESTROY GAME OPTION DIALOG" def __Load_LoadScript(self, fileName): try: pyScriptLoader = ui.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") 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_tec_request_button")) #self.blockButtonList.append(GetObject("block_party_request_button")) #self.blockButtonList.append(GetObject("emotionblock_on_button")) 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.OnlineOyuncuSayaci.append(GetObject("online_oyuncu_goster")) self.OnlineOyuncuSayaci.append(GetObject("online_oyuncu_gizle")) if app.WJ_SHOW_MOB_INFO: self.showMobInfoButtonList.append(GetObject("show_mob_level_button")) self.showMobInfoButtonList.append(GetObject("show_mob_AI_flag_button")) global MOBILE if MOBILE: self.inputMobileButton = GetObject("input_mobile_button") self.deleteMobileButton = GetObject("delete_mobile_button") if app.ENABLE_SHOPNAMES_RANGE: self.ctrlShopNamesRange = GetObject("salestext_range_controller") self.showHighlightButtonList.append(GetObject("showhighlight_on_button")) self.showHighlightButtonList.append(GetObject("showhighlight_off_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") if app.ENABLE_SHOPNAMES_RANGE: self.__Load_LoadScript("uiscript/gameoptiondialog_rangeshop.py") else: self.__Load_LoadScript("uiscript/gameoptiondialog.py") self.__Load_BindObject() self.SetCenterPosition() self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) 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.__OnClickBlockTecButton) #self.blockButtonList[5].SetToggleUpEvent(self.__OnClickBlockPartyRequest) #self.blockButtonList[5].SetToggleUpEvent(self.__OnClickBlockEmotionButton) # toolTip # self.blockButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.blockButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.blockButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.blockButtonList[3].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.blockButtonList[4].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.blockButtonList[5].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # toolTip 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.__OnClickBlockTecButton) #self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockPartyRequest) #self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockEmotionButton) 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) # toolTip # self.showsalesTextButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GOSTER_YAZI)) # self.showsalesTextButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.MARKET_ISMI_GIZLE_YAZI)) # toolTip self.OnlineOyuncuSayaci[0].SAFE_SetEvent(self.__OnlineOyuncuGoster) self.OnlineOyuncuSayaci[1].SAFE_SetEvent(self.__OnlineOyuncuGizle) if app.WJ_SHOW_MOB_INFO: self.showMobInfoButtonList[0].SetToggleUpEvent(self.__OnClickShowMobLevelButton) self.showMobInfoButtonList[1].SetToggleUpEvent(self.__OnClickShowMobAIFlagButton) self.showMobInfoButtonList[0].SetToggleDownEvent(self.__OnClickShowMobLevelButton) self.showMobInfoButtonList[1].SetToggleDownEvent(self.__OnClickShowMobAIFlagButton) self.showHighlightButtonList[0].SAFE_SetEvent(self.__OnClickShowHighlightOnButton) self.showHighlightButtonList[1].SAFE_SetEvent(self.__OnClickShowHighlightOffButton) self.__ClickRadioButton(self.nameColorModeButtonList, constInfo.GET_CHRNAME_COLOR_INDEX()) self.__ClickRadioButton(self.viewTargetBoardButtonList, constInfo.GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD()) self.__SetPeacePKMode() #global MOBILE if MOBILE: self.inputMobileButton.SetEvent(ui.__mem_func__(self.__OnChangeMobilePhoneNumber)) self.deleteMobileButton.SetEvent(ui.__mem_func__(self.__OnDeleteMobilePhoneNumber)) if app.ENABLE_SHOPNAMES_RANGE: self.ctrlShopNamesRange.SetSliderPos(float(systemSetting.GetShopNamesRange())) self.ctrlShopNamesRange.SetEvent(ui.__mem_func__(self.OnChangeShopNamesRange)) if app.ENABLE_SHOPNAMES_RANGE: def OnChangeShopNamesRange(self): pos = self.ctrlShopNamesRange.GetSliderPos() systemSetting.SetShopNamesRange(pos) if systemSetting.IsShowSalesText(): uiPrivateShopBuilder.UpdateADBoard() uiOfflineShopBuilder.UpdateADBoard() def __ClickRadioButton(self, buttonList, buttonIndex): try: selButton=buttonList[buttonIndex] except IndexError: return for eachButton in buttonList: eachButton.SetUp() selButton.Down() def __CreateGameTypeToolTip(self, descList): toolTip = uiToolTip.ToolTip() # toolTip.SetTitle(title) toolTip.AppendSpace(5) for desc in descList: toolTip.AutoAppendTextLine(desc) toolTip.AlignHorizonalCenter() return toolTip 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 __OnClickBlockTecButton(self): self.RefreshBlock() global blockMode net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_POINT_EXP)) #def __OnClickBlockPartyRequest(self): # self.RefreshBlock() # global blockMode # net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_PARTY_REQUEST)) #def __OnClickBlockEmotionButton(self): # self.RefreshBlock() # global blockMode # net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_EMOTION_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() uiOfflineShopBuilder.UpdateADBoard() def __OnClickSalesTextOffButton(self): systemSetting.SetShowSalesTextFlag(FALSE) self.RefreshShowSalesText() def __OnClickShowMobLevelButton(self): if app.WJ_SHOW_MOB_INFO: if systemSetting.IsShowMobLevel(): systemSetting.SetShowMobLevel(False) else: systemSetting.SetShowMobLevel(True) self.RefreshShowMobInfo() def __OnClickShowMobAIFlagButton(self): if app.WJ_SHOW_MOB_INFO: if systemSetting.IsShowMobAIFlag(): systemSetting.SetShowMobAIFlag(False) else: systemSetting.SetShowMobAIFlag(True) self.RefreshShowMobInfo() def __OnlineOyuncuGoster(self): constInfo.ONLINE_BILGISI = 1 # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.ONLINE_BILGISI_GOSTERILIYOR) self.RefreshOnlineOyuncuSayaci() def __OnlineOyuncuGizle(self): constInfo.ONLINE_BILGISI = 0 # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.ONLINE_BILGISI_GIZLENIYOR) self.RefreshOnlineOyuncuSayaci() def __CheckPvPProtectedLevelPlayer(self): if player.GetStatus(player.LEVEL)