client/bin_original/uiSystem.py

195 lines
4.7 KiB
Python

import net
import app
import ui
import uiOption
import uiSystemOption
import uiGameOption
import uiScriptLocale
import networkModule
import constInfo
import locale
SYSTEM_MENU_FOR_PORTAL = FALSE
###################################################################################################
## System
class SystemDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
def __Initialize(self):
self.eventOpenHelpWindow = None
self.systemOptionDlg = None
self.gameOptionDlg = None
def LoadDialog(self):
if SYSTEM_MENU_FOR_PORTAL:
self.__LoadSystemMenu_ForPortal()
else:
self.__LoadSystemMenu_Default()
def __LoadSystemMenu_Default(self):
pyScrLoader = ui.PythonScriptLoader()
if constInfo.IN_GAME_SHOP_ENABLE:
pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "SystemDialog.py")
else:
pyScrLoader.LoadScriptFile(self, "uiscript/systemdialog.py")
self.GetChild("system_option_button").SAFE_SetEvent(self.__ClickSystemOptionButton)
self.GetChild("game_option_button").SAFE_SetEvent(self.__ClickGameOptionButton)
self.GetChild("change_button").SAFE_SetEvent(self.__ClickChangeCharacterButton)
self.GetChild("logout_button").SAFE_SetEvent(self.__ClickLogOutButton)
self.GetChild("exit_button").SAFE_SetEvent(self.__ClickExitButton)
self.GetChild("help_button").SAFE_SetEvent(self.__ClickHelpButton)
self.GetChild("cancel_button").SAFE_SetEvent(self.Close)
if constInfo.IN_GAME_SHOP_ENABLE:
self.GetChild("mall_button").SAFE_SetEvent(self.__ClickInGameShopButton)
def __LoadSystemMenu_ForPortal(self):
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/systemdialog_forportal.py")
self.GetChild("system_option_button").SAFE_SetEvent(self.__ClickSystemOptionButton)
self.GetChild("game_option_button").SAFE_SetEvent(self.__ClickGameOptionButton)
self.GetChild("change_button").SAFE_SetEvent(self.__ClickChangeCharacterButton)
self.GetChild("exit_button").SAFE_SetEvent(self.__ClickExitButton)
self.GetChild("help_button").SAFE_SetEvent(self.__ClickHelpButton)
self.GetChild("cancel_button").SAFE_SetEvent(self.Close)
def Destroy(self):
self.ClearDictionary()
if self.gameOptionDlg:
self.gameOptionDlg.Destroy()
if self.systemOptionDlg:
self.systemOptionDlg.Destroy()
self.__Initialize()
def SetOpenHelpWindowEvent(self, event):
self.eventOpenHelpWindow = event
def OpenDialog(self):
self.Show()
def __ClickChangeCharacterButton(self):
self.Close()
net.ExitGame()
def __OnClosePopupDialog(self):
self.popup = None
def __ClickLogOutButton(self):
if SYSTEM_MENU_FOR_PORTAL:
if app.loggined:
self.Close()
net.ExitApplication()
else:
self.Close()
net.LogOutGame()
else:
self.Close()
net.LogOutGame()
def __ClickExitButton(self):
self.Close()
net.ExitApplication()
def __ClickSystemOptionButton(self):
self.Close()
if not self.systemOptionDlg:
self.systemOptionDlg = uiSystemOption.OptionDialog()
self.systemOptionDlg.Show()
def __ClickGameOptionButton(self):
self.Close()
if not self.gameOptionDlg:
self.gameOptionDlg = uiGameOption.OptionDialog()
self.gameOptionDlg.Show()
def __ClickHelpButton(self):
self.Close()
if None != self.eventOpenHelpWindow:
self.eventOpenHelpWindow()
def __ClickInGameShopButton(self):
self.Close()
net.SendChatPacket("/in_game_mall")
def Close(self):
self.Hide()
return TRUE
def RefreshMobile(self):
if self.gameOptionDlg:
self.gameOptionDlg.RefreshMobile()
#self.optionDialog.RefreshMobile()
def OnMobileAuthority(self):
if self.gameOptionDlg:
self.gameOptionDlg.OnMobileAuthority()
#self.optionDialog.OnMobileAuthority()
def OnBlockMode(self, mode):
uiGameOption.blockMode = mode
if self.gameOptionDlg:
self.gameOptionDlg.OnBlockMode(mode)
#self.optionDialog.OnBlockMode(mode)
def OnChangePKMode(self):
if self.gameOptionDlg:
self.gameOptionDlg.OnChangePKMode()
#self.optionDialog.OnChangePKMode()
def OnPressExitKey(self):
self.Close()
return TRUE
def OnPressEscapeKey(self):
self.Close()
return TRUE
if __name__ == "__main__":
import app
import wndMgr
import systemSetting
import mouseModule
import grp
import ui
import chr
import background
import player
#wndMgr.SetOutlineFlag(TRUE)
app.SetMouseHandler(mouseModule.mouseController)
app.SetHairColorEnable(TRUE)
wndMgr.SetMouseHandler(mouseModule.mouseController)
wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
app.Create("METIN2 CLOSED BETA", systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
mouseModule.mouseController.Create()
wnd = SystemDialog()
wnd.LoadDialog()
wnd.Show()
app.Loop()