Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dbg
- import app
- import time
- import ui
- import wndMgr
- import net
- import introLogin
- import ServerStateChecker
- import musicInfo
- import snd
- import ime
- import systemSetting
- import constInfo
- import serverInfo
- stream = None
- LOGIN_DELAY_SEC = 0.0
- NEW_BINARY = TRUE
- if NEW_BINARY:
- import localeInfo
- locale = localeInfo
- else:
- import locale
- CHANNEL_ONLINE = "ch-on.tga"
- CHANNEL_OFFLINE = "ch-off.tga"
- CHANNEL_INFO = {
- 0 : {
- "KEY" : 10,
- "IP" : "",
- "NAME" : "Channel 1",
- "CONTRACTION" : "CH 1",
- "TCP_PORT" : 0,
- "UDP_PORT" : 0,
- "STATE" : CHANNEL_OFFLINE
- },
- 1 : {
- "KEY" : 11,
- "IP" : "",
- "NAME" : "Channel 2",
- "CONTRACTION" : "CH 2",
- "TCP_PORT" : 0,
- "UDP_PORT" : 0,
- "STATE" : CHANNEL_OFFLINE
- },
- 2 : {
- "KEY" : 12,
- "IP" : "",
- "NAME" : "Channel 3",
- "CONTRACTION" : "CH 3",
- "TCP_PORT" : 0,
- "UDP_PORT" : 0,
- "STATE" : CHANNEL_OFFLINE
- },
- 3 : {
- "KEY" : 13,
- "IP" : "",
- "NAME" : "Channel 4",
- "CONTRACTION" : "CH 4",
- "TCP_PORT" : 0,
- "UDP_PORT" : 0,
- "STATE" : CHANNEL_OFFLINE
- }
- }
- SERVER_INFO = {
- "NAME" : "Dronys2",
- "IP" : "",
- "PORT" : 0,
- "CHANNELS" : CHANNEL_INFO
- }
- MARKADDR_DICT = {
- "IP" : "",
- "TCP_PORT" : 13001,
- "MARK" : "10.tga",
- "SYMBOL_PATH" : "10"
- }
- SETTINGS = {
- 0 : 0,
- 1 : {
- "ID" : "",
- "PWD" : "",
- },
- 2 : "FALSE",
- 3 : -1
- }
- SETTINGS_FILE = "settings.txt"
- ACCOUNTS_FILE = "accounts.txt"
- ACCOUNTS_REWRITER = None
- ACCOUNTS_READER = None
- SETTINGS_REWRITER = None
- SET_ACCOUNT = None
- LOGIN_IS_PROCESSING = FALSE
- ACCOUNTS = {
- 0 : {
- "ID" : "",
- "PWD" : "",
- "LEVEL" : "?",
- "LOGIN_IS_PROCESSING" : FALSE
- },
- 1 : {
- "ID" : "",
- "PWD" : "",
- "LEVEL" : "?",
- "LOGIN_IS_PROCESSING" : FALSE
- },
- 2 : {
- "ID" : "",
- "PWD" : "",
- "LEVEL" : "?",
- "LOGIN_IS_PROCESSING" : FALSE
- },
- "EMPTY" : " - EMPTY - "
- }
- def IsLoginDelay():
- global LOGIN_DELAY_SEC
- if LOGIN_DELAY_SEC > 0.0:
- return TRUE
- else:
- return FALSE
- def GetLoginDelay():
- global LOGIN_DELAY_SEC
- return LOGIN_DELAY_SEC
- class SpecialBoard(ui.ImageBox):
- timeToFade = 0.0
- interval = 1.0
- fadeIn = 0
- fadeOut = 0
- currentTime = 0
- intervallEndTime = 0
- currentAlphaValue = 0
- def __init__(self):
- ui.ImageBox.__init__(self)
- def __del__(self):
- ui.ImageBox.__del__(self)
- def LoadImage(self, imageName):
- ui.ImageBox.LoadImage(self, imageName)
- self.SetAlpha(0.0)
- def SetAlpha(self, alpha):
- self.currentAlphaValue = alpha
- ui.ImageBox.SetAlpha(self, alpha)
- def OnUpdate(self):
- self.currentTime = time.clock()
- if self.fadeIn == 1 or self.fadeOut == 1:
- if self.currentAlphaValue < 1.0 and self.currentAlphaValue >= 0.0:
- if self.currentTime >= self.intervallEndTime:
- newAlphaValue = self.currentAlphaValue
- if self.fadeIn == 1:
- newAlphaValue += self.interval
- else:
- newAlphaValue -= self.interval
- self.SetAlpha(newAlphaValue)
- self.intervallEndTime = self.currentTime + self.timeToFade
- else:
- self.fadeIn = self.fadeOut = 0
- def FadeIn(self):
- self.Show()
- self.SetAlpha(0.0)
- self.fadeOut = 0
- self.intervallEndTime = self.currentTime + self.timeToFade
- self.fadeIn = 1
- def FadeOut(self):
- self.Show()
- self.SetAlpha(1.0)
- self.fadeIn = 0
- self.intervallEndTime = self.currentTime + self.timeToFade
- self.fadeOut = 1
- def fadeProgressFinished(self):
- if self.fadeIn == 0 and self.fadeOut == 0:
- return 1
- else:
- return 0
- class SpecialEditLine(ui.EditLine):
- __placeHolderFontColor = 200
- def __init__(self):
- ui.EditLine.__init__(self)
- self.placeHolder = ui.TextLine()
- self.placeHolder.SetFontColor(self.__placeHolderFontColor, self.__placeHolderFontColor, self.__placeHolderFontColor)
- self.placeHolder.Hide()
- self.__ShowPlaceHolder()
- def SetParent(self, parent):
- self.placeHolder.SetParent(parent)
- ui.EditLine.SetParent(self, parent)
- def SetSize(self, width, height):
- ui.EditLine.SetSize(self, width, height)
- self.placeHolder.SetSize(width, height)
- def SetPosition(self, x, y):
- ui.EditLine.SetPosition(self, x, y)
- self.placeHolder.SetPosition(x, y)
- def OnSetFocus(self):
- ui.EditLine.OnSetFocus(self)
- self.__HidePlaceHolder()
- def OnKillFocus(self):
- ui.EditLine.OnKillFocus(self)
- if self.GetText() == "":
- self.__ShowPlaceHolder()
- else:
- self.__HidePlaceHolder()
- def SetSecret(self, value=TRUE):
- ui.EditLine.SetSecret(self)
- self.__secret = value
- def __ShowPlaceHolder(self):
- ui.EditLine.Hide(self)
- self.placeHolder.Show()
- def __HidePlaceHolder(self):
- ui.EditLine.Show(self)
- self.placeHolder.Hide()
- def SetPlaceHolderText(self, text):
- self.placeHolder.SetText(text)
- self.__ShowPlaceHolder()
- def __del__(self):
- ui.EditLine.__del__(self)
- class PopupDialog(SpecialBoard):
- __background = "verbinden-bg.tga"
- __greyerBG = "dunklermacherbg.tga"
- __buttons = []
- __closeEvent = 0
- def __init__(self):
- SpecialBoard.__init__(self)
- self.interval = 0.3
- self.LoadImage(self.__background)
- self.SetCenterPosition()
- self.message = ui.TextLine()
- self.message.SetParent(self)
- self.message.SetPosition(0, 38)
- self.message.SetWindowHorizontalAlignCenter()
- self.message.SetHorizontalAlignCenter()
- self.message.SetVerticalAlignCenter()
- self.greyer = ui.ExpandedImageBox()
- self.greyer.Hide()
- self.greyer.OnMouseLeftButtonDown = lambda *x : self.Close()
- self.OnMouseLeftButtonDown = self.greyer.OnMouseLeftButtonDown
- def FadeIn(self):
- SpecialBoard.FadeIn(self)
- self.SetParent(self.greyer)
- self.greyer.LoadImage(self.__greyerBG)
- self.greyer.SetScale(float(wndMgr.GetScreenWidth()) / float(self.greyer.GetWidth()), float(wndMgr.GetScreenHeight()) / float(self.greyer.GetHeight()))
- self.greyer.Show()
- self.SetTop()
- def OnUpdate(self):
- SpecialBoard.OnUpdate(self)
- if self.fadeProgressFinished() == 1:
- self.message.Show()
- for i in xrange(len(self.__buttons)):
- self.__buttons[i].Show()
- if type(self.__buttons[i]) is TableLayout:
- self.__buttons[i].SetWindowHorizontalAlignCenter()
- self.__buttons[i].SetPosition(0, self.GetHeight() - self.__buttons[i].GetHeight() - 30)
- else:
- self.message.Hide()
- for i in xrange(len(self.__buttons)):
- self.__buttons[i].Hide()
- def SetButtons(self, buttons):
- for i in xrange(len(buttons)):
- self.AddButton(buttons[i])
- #self.InsertChild("button%i" % (i), self.__buttons[i])
- def AddButton(self, button):
- button.SetParent(self)
- self.__buttons.append(button)
- def RemoveButton(self, buttonIndex):
- del self.__buttons[buttonIndex]
- def SetMessage(self, message):
- self.message.SetText(message)
- def SetCloseEvent(self, closeEvent):
- self.__closeEvent = closeEvent
- def Close(self):
- if self.__closeEvent:
- self.__closeEvent()
- self.FadeOut()
- self.greyer.Hide()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- def OnIMEReturn(self):
- self.Close()
- return TRUE
- def __del__(self):
- SpecialBoard.__del__(self)
- class LoginInterface(ui.ScriptWindow):
- __background = "bg.tga"
- __currentArea = None
- def __init__(self, _stream):
- ui.ScriptWindow.__init__(self)
- global stream
- global SETTINGS_REWRITER
- global SETTINGS
- global ACCOUNTS_READER
- global ACCOUNTS_REWRITER
- stream = _stream
- self.backgroundImage = ui.ExpandedImageBox()
- self.backgroundImage.LoadImage(self.__background)
- self.backgroundImage.SetScale(float(wndMgr.GetScreenWidth()) / float(self.backgroundImage.GetWidth()), float(wndMgr.GetScreenHeight()) / float(self.backgroundImage.GetHeight()))
- self.SettingsReader()
- SETTINGS_REWRITER = self.SettingsRewriter
- ACCOUNTS_REWRITER = self.AccountSettingsRewriter
- ACCOUNTS_READER = self.AccountSettingsReader
- ACCOUNTS_READER()
- self.naviBar = NavigationBar()
- self.naviBar.SetParent(self)
- self.naviBar.SetWindowHorizontalAlignCenter()
- self.naviBar.SetWindowVerticalAlignCenter()
- def SetCurrentArea(self, area):
- if self.__currentArea == area:
- return
- try:
- self.__currentArea.Close()
- except Exception, e:
- pass
- self.__currentArea = area
- self.__currentArea.SetParent(self.backgroundImage)
- try:
- #self.__currentArea.FadeIn()
- self.__currentArea.Open()
- except Exception, e:
- pass
- def OnUpdate(self):
- self.naviBar.OnUpdate()
- if SETTINGS[3] == -1:
- self.naviBar.SetPosition(0, self.__currentArea.GetHeight() / 2 + 10)
- self.__currentArea.furtherOptionsButton.SetParent(self.backgroundImage)#SetCenterPosition()
- self.__currentArea.furtherOptionsButton.SetWindowHorizontalAlignCenter()
- self.__currentArea.furtherOptionsButton.SetPosition(0, self.naviBar.GetGlobalPosition()[1] + self.naviBar.GetHeight() + 10)
- else:
- self.naviBar.SetPosition(0, -(self.__currentArea.GetHeight() / 2 + 50))
- self.__currentArea.SetStandardPosition()
- def Open(self):
- if musicInfo.loginMusic != "":
- snd.SetMusicVolume(systemSetting.GetMusicVolume())
- snd.FadeInMusic("BGM/"+musicInfo.loginMusic)
- snd.SetSoundVolume(systemSetting.GetSoundVolume())
- ime.AddExceptKey(91)
- ime.AddExceptKey(93)
- self.Show()
- self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
- app.ShowCursor()
- self.backgroundImage.Show()
- self.naviBar.FadeIn()
- self.naviBar.SetTop()
- def Close(self):
- global stream
- self.__currentArea.Close()
- self.Hide()
- stream.popupWindow.Close()
- ime.ClearExceptKey()
- app.HideCursor()
- def SettingsReader(self):
- global SETTINGS
- global SETTINGS_FILE
- settingsStream = open(SETTINGS_FILE, "r")
- content = settingsStream.read()
- elements = content.split('\n')
- for i in xrange(len(elements)):
- item = elements[i]
- if item != "":
- if item.find(";") != -1:
- values = item.split(";")
- for j in xrange(len(values)):
- value = values[j]
- if value != "":
- SETTINGS[i][value.split(":")[0]] = value.split(":")[1]
- else:
- SETTINGS[i] = type(SETTINGS[i])(item)
- settingsStream.close()
- def SettingsRewriter(self):
- global SETTINGS
- global SETTINGS_FILE
- settingsStream = open(SETTINGS_FILE, "w")
- for i in xrange(len(SETTINGS)):
- line = ""
- if type(SETTINGS[i]) is dict:
- for name in SETTINGS[i]:
- line += name + ":" + SETTINGS[i][name] + ";"
- else:
- line += str(SETTINGS[i])
- line += "\n"
- settingsStream.write(line)
- settingsStream.close()
- def AccountSettingsReader(self):
- global ACCOUNTS
- global ACCOUNTS_FILE
- accountsStream = open(ACCOUNTS_FILE, "r")
- content = accountsStream.read()
- elements = content.split("\n")
- for i in xrange(len(elements)):
- item = elements[i]
- if item != "":
- for account in ACCOUNTS:
- index = 0
- account = ACCOUNTS[account]
- if index == i:
- if type(account) is dict:
- if item.find(";") != -1:
- values = item.split(";")
- for j in xrange(len(values)):
- value = values[j]
- if value != "":
- account[value.split(":")[0]] = value.split(":")[1]
- break
- accountsStream.close()
- def AccountSettingsRewriter(self):
- global ACCOUNTS
- global ACCOUNTS_FILE
- accountsStream = open(ACCOUNTS_FILE, "w")
- for item in ACCOUNTS:
- item = ACCOUNTS[item]
- if type(item) is dict:
- line = ""
- for name in item:
- if type(item[name]) is str:
- line += name + ":" + item[name] + ";"
- line += "\n"
- accountsStream.write(line)
- accountsStream.close()
- def OnPressExitKey(self):
- global stream
- stream.popupWindow.Close()
- stream.SetPhaseWindow(0)
- return TRUE
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- class NavigationBar(SpecialBoard):
- __navigationBarBackground = "navi-bg.tga"
- __loginButtonImages = ["login.tga", "login-hover-active.tga", "login.tga"]
- __accountManagementButtonImages = ["accverw.tga", "accverw-hover-active.tga", "accverw.tga"]
- __newsButtonImages = ["news.tga", "news-hover-active.tga", "news.tga"]
- __exitButtonImages = ["beenden.tga", "beenden-hover-active.tga", "beenden.tga"]
- __parent = None
- __buttons = []
- __closingDialogButtons = [
- [None, ["button-abbrechen.tga", "button-abbrechen-hover.tga", "button-abbrechen.tga"]],
- [None, ["button-beenden.tga", "button-beenden-hover.tga", "button-beenden.tga"]]
- ]
- __closeGameText = "Wollen sie das Spiel wirklich beenden?"
- def __init__(self):
- SpecialBoard.__init__(self)
- self.LoadImage(self.__navigationBarBackground)
- self.accountManagementArea = AccountManagementArea()
- self.loginArea = LoginArea()
- self.newsArea = NewsArea()
- self.loginButton = ui.Button()
- self.loginButton.SetParent(self)
- self.loginButton.SetPosition(100, self.GetHeight() / 2 + 5)
- self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLogin))
- self.loginButton.Show()
- self.accountManagementButton = ui.Button()
- self.accountManagementButton.SetParent(self)
- self.accountManagementButton.SetEvent(ui.__mem_func__(self.__OnClickAccountManagement))
- self.accountManagementButton.Show()
- self.newsButton = ui.Button()
- self.newsButton.SetParent(self)
- self.newsButton.SetEvent(ui.__mem_func__(self.__OnClickNews))
- self.newsButton.Show()
- self.exitButton = ui.Button()
- self.exitButton.SetParent(self)
- self.exitButton.Show()
- self.exitButton.SetEvent(lambda : self.__OnClickExit())
- self.__buttons.append([self.loginButton, self.__loginButtonImages])
- self.__buttons.append([self.accountManagementButton, self.__accountManagementButtonImages])
- self.__buttons.append([self.newsButton, self.__newsButtonImages])
- self.__buttons.append([self.exitButton, self.__exitButtonImages])
- self.__SetButtonImages()
- self.__closingDialog = PopupDialog()
- self.__buttonTableLayout = TableLayout()
- self.__closingDialogButtons[0][0] = lambda : self.__closingDialog.Close()
- self.__closingDialogButtons[1][0] = lambda : app.Exit()
- for i in xrange(len(self.__closingDialogButtons)):
- button = ui.Button()
- button.SetUpVisual(self.__closingDialogButtons[i][1][0])
- button.SetOverVisual(self.__closingDialogButtons[i][1][1])
- button.SetDownVisual(self.__closingDialogButtons[i][1][2])
- button.SetEvent(self.__closingDialogButtons[i][0])
- button.Show()
- self.__buttonTableLayout.AddItem(button)
- #self.__buttonTableLayout.SetWindowHorizontalAlignCenter()
- self.__buttonTableLayout.Show()
- self.__closingDialog.SetMessage(self.__closeGameText)
- self.__closingDialog.AddButton(self.__buttonTableLayout)
- def OnUpdate(self):
- global SETTINGS
- SpecialBoard.OnUpdate(self)
- if SETTINGS[3] == 1:
- self.accountManagementArea.SetStandardPosition()
- self.loginArea.SetStandardPosition()
- self.newsArea.SetStandardPosition()
- #else:
- # if self.__parent:
- if self.__closingDialog:
- self.__closingDialog.OnUpdate()
- def __SetButtonImages(self):
- for i in xrange(len(self.__buttons)):
- button = self.__buttons[i][0]
- button.SetUpVisual(self.__buttons[i][1][0])
- button.SetOverVisual(self.__buttons[i][1][1])
- button.SetDownVisual(self.__buttons[i][1][2])
- if i > 0:
- previousButton = self.__buttons[i - 1][0]
- x, y = previousButton.GetLocalPosition()
- button.SetPosition(x + previousButton.GetWidth() + 30, self.GetHeight() / 2 + 5)
- def __SetButton(self, button, image):
- button.SetUpVisual(image)
- button.SetOverVisual(image)
- button.SetDownVisual(image)
- def SetParent(self, parent):
- self.__parent = parent
- try:
- self.__OnClickLogin()
- SpecialBoard.SetParent(self, parent.backgroundImage)
- except Exception, e:
- pass
- def __OnClickLogin(self):
- self.__SetButtonImages()
- try:
- self.__parent.SetCurrentArea(self.loginArea)
- self.__SetButton(self.loginButton, self.__loginButtonImages[1])
- net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self.loginArea.GetCurrentAreaBoard())
- net.SetAccountConnectorHandler(0)
- net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self.loginArea.GetCurrentAreaBoard())
- net.SetAccountConnectorHandler(self.loginArea.GetCurrentAreaBoard())
- except Exception, e:
- pass
- def __OnClickAccountManagement(self):
- self.__SetButtonImages()
- try:
- self.__parent.SetCurrentArea(self.accountManagementArea)
- self.__SetButton(self.accountManagementButton, self.__accountManagementButtonImages[1])
- net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self.loginArea.GetCurrentAreaBoard())
- net.SetAccountConnectorHandler(0)
- #net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self.accountManagementArea.GetCurrentAreaBoard())
- #net.SetAccountConnectorHandler(self.accountManagementArea.GetCurrentAreaBoard())
- except Exception, e:
- pass
- def __OnClickNews(self):
- self.__SetButtonImages()
- try:
- self.__parent.SetCurrentArea(self.newsArea)
- self.__SetButton(self.newsButton, self.__newsButtonImages[1])
- net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self.loginArea.GetCurrentAreaBoard())
- net.SetAccountConnectorHandler(0)
- except Exception, e:
- pass
- def __OnClickExit(self):
- global SETTINGS
- global stream
- self.__SetButtonImages()
- if SETTINGS[2] == "TRUE":
- self.__closingDialog.FadeIn()
- net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self.loginArea.GetCurrentAreaBoard())
- net.SetAccountConnectorHandler(0)
- else:
- app.Exit()
- def __del__(self):
- SpecialBoard.__del__(self)
- class TableLayout(ui.ScriptWindow):
- __horizontalLayout = TRUE
- __placeHolder = 10
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- def OnUpdate(self):
- self.__Refresh()
- def AddItem(self, item):
- item.SetParent(self)
- self.Children.append(item)
- def RemoveItem(self, index):
- for i in xrange(len(self.Children)):
- if self.Children[i] == item:
- del self.Children[i]
- break
- def GetItemCount(self):
- return len(self.Children)
- def GetItems(self):
- return self.Children
- def GetItemAt(self, index):
- try:
- return self.Children[index]
- except Exception, e:
- pass
- def SetVerticalLayout(self):
- self.__horizontalLayout = FALSE
- def SetHorizontalLayout(self):
- self.__horizontalLayout = TRUE
- def __Refresh(self):
- if self.__horizontalLayout == TRUE:
- self.SetSize(0, 0)
- itemHeights = []
- for item in self.Children:
- itemHeights.append(item.GetHeight())
- self.SetSize(self.GetWidth() + item.GetWidth() + self.__placeHolder, max(itemHeights))
- else:
- self.SetSize(0, 0)
- itemWidths = []
- for item in self.Children:
- itemWidths.append(item.GetWidth())
- self.SetSize(max(itemWidths), self.GetHeight() + item.GetHeight() + self.__placeHolder)
- cells = len(self.Children)
- cellWidth = self.GetWidth() / cells
- cellHeight = self.GetHeight() / cells
- for i in xrange(len(self.Children)):
- if self.__horizontalLayout == TRUE:
- self.Children[i].SetWindowVerticalAlignCenter()
- self.Children[i].SetPosition(cellWidth / 2 + cellWidth * i - self.Children[i].GetWidth() / 2, 0)#-self.Children[i].GetHeight() / 2)
- else:
- self.Children[i].SetWindowHorizontalAlignCenter()
- self.Children[i].SetPosition(0, cellHeight / 2 + cellHeight * i - self.Children[i].GetHeight() / 2)
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- class FurtherOptionsBoard(SpecialBoard):
- class CheckBox(ui.Window):
- __checkBoxImages = ["tickbox-ticked.tga", "tickbox-notTicked.tga"]
- __isChecked = FALSE
- __event = None
- def __init__(self):
- ui.Window.__init__(self)
- self.__checkBox = ui.ImageBox()
- self.__checkBox.SetParent(self)
- self.__checkBox.LoadImage(self.__checkBoxImages[1])
- self.__event = lambda : self.EmptyFunc()
- self.__checkBox.OnMouseLeftButtonDown = lambda : (self.__event(), self.__ChangeState())
- self.__checkBox.Show()
- self.SetSize(self.__checkBox.GetWidth(), self.__checkBox.GetHeight())
- self.__checkBoxText = ui.TextLine()
- self.__checkBoxText.SetParent(self)
- self.__checkBox.SetWindowVerticalAlignCenter()
- self.__checkBoxText.SetPosition(self.__checkBox.GetWidth() + 10, 0)
- self.__checkBoxText.Show()
- def SetText(self, text):
- self.__checkBoxText.SetText(text)
- def OnUpdate(self):
- if self.__isChecked == TRUE:
- self.__checkBox.LoadImage(self.__checkBoxImages[0])
- else:
- self.__checkBox.LoadImage(self.__checkBoxImages[1])
- def __ChangeState(self):
- if self.__isChecked == TRUE:
- self.__isChecked = FALSE
- else:
- self.__isChecked = TRUE
- def SetState(self, state):
- if self.__isChecked == state:
- return
- self.__isChecked = state
- if self.__event:
- self.__event(self.__isChecked)
- def SetCheckEvent(self, event):
- if event:
- self.__event = event
- self.__checkBox.OnMouseLeftButtonDown = lambda : (self.__ChangeState(), self.__event(self.__isChecked))
- def IsChecked(self):
- return self.__isChecked
- def EmptyFunc(self):
- pass
- def __del__(self):
- ui.Window.__del__(self)
- class Channel(ui.Window):
- __isPressed = FALSE
- __channelButtonImages = ["channel.tga" , "channel-hover.tga", "channel-active.tga"]
- __linkedChannel = None
- def __init__(self):
- ui.Window.__init__(self)
- self.__channelState = ui.ImageBox()
- self.__channelState.SetParent(self)
- self.__channelState.Show()
- self.__channel = ui.Button()
- self.__channel.SetParent(self)
- self.__channel.Show()
- self.SetEvent(ui.__mem_func__(self.__EmptyFunc))
- self.SetChannelImages()
- def __EmptyFunc(self):
- pass
- def ExceuteEvent(self):
- self.__channel.eventFunc()
- def SetEvent(self, event):
- self.__channel.SetEvent(lambda : (event(), self.SetClicked()))
- def SetChannelName(self, text):
- self.__channel.SetText(text)
- def SetClicked(self):
- global SERVER_INFO
- global MARKADDR_DICT
- global stream
- try:
- stream.SetConnectInfo(SERVER_INFO["CHANNELS"][self.__linkedChannel]["IP"], SERVER_INFO["CHANNELS"][self.__linkedChannel]["TCP_PORT"], SERVER_INFO["CHANNELS"][self.__linkedChannel]["IP"], SERVER_INFO["PORT"])
- net.SetServerInfo("%s - %s" & (SERVER_INFO["NAME"], SERVER_INFO["CHANNELS"][self.__linkedChannel]["CONTRACTION"]))
- net.SetMarkServer(MARKADDR_DICT["IP"], MARKADDR_DICT["TCP_PORT"])
- app.SetGuildMarkPath(MARKADDR_DICT["MARK"])
- app.SetGuildSymbolPath(MARKADDR_DICT["SYMBOL_PATH"])
- except Exception, e:
- pass
- self.__isPressed = TRUE
- self.__channel.SetUpVisual(self.__channelButtonImages[2])
- self.__channel.SetOverVisual(self.__channelButtonImages[2])
- self.__channel.SetDownVisual(self.__channelButtonImages[2])
- def SetChannelImages(self):
- self.__isPressed = FALSE
- self.__channel.SetUpVisual(self.__channelButtonImages[0])
- self.__channel.SetOverVisual(self.__channelButtonImages[1])
- self.__channel.SetDownVisual(self.__channelButtonImages[2])
- def IsPressed(self):
- return self.__isPressed
- def GetLinkedChannel(self):
- return self.__linkedChannel
- def OnUpdate(self):
- global SERVER_INFO
- self.__channelState.LoadImage(SERVER_INFO["CHANNELS"][self.__linkedChannel]["STATE"])
- self.SetSize(max(self.__channel.GetWidth(), self.__channelState.GetWidth()), self.__channel.GetHeight() + self.__channelState.GetHeight())
- self.__channel.SetWindowHorizontalAlignCenter()
- self.__channel.SetPosition(0, 0)
- self.__channelState.SetWindowHorizontalAlignCenter()
- self.__channelState.SetPosition(0, self.__channel.GetHeight())
- def SetLinkedChannel(self, channel):
- self.__linkedChannel = channel
- def __del__(self):
- self.__channel.Hide()
- self.__channel = None
- self.__channelState.Hide()
- self.__channelState = None
- ui.Window.__del__(self)
- __background = "optionen-bg.tga"
- __channeksddf = 10
- __checkBoxes = [["Diesen Channel automatisch auswaehlen", None], ["Automatischer Login mit dem ersten gespeicherten Account", None], ["Meldung beim Beenden des Clients anzeigen", None]]
- def __init__(self):
- SpecialBoard.__init__(self)
- global SETTINGS
- self.LoadImage(self.__background)
- self.tableLayout = TableLayout()
- self.tableLayout.SetParent(self)
- self.tableLayout.SetPosition(0, 10)
- self.tableLayout.SetSize(self.GetWidth(), 0)
- self.tableLayout.Show()
- self.tableLayoutCheckBoxes = TableLayout()
- self.tableLayoutCheckBoxes.SetParent(self)
- self.tableLayoutCheckBoxes.SetPosition(20, 0)
- self.tableLayoutCheckBoxes.SetVerticalLayout()
- self.tableLayoutCheckBoxes.Show()
- self.__InitCheckBoxes()
- self.InitChannels()
- self.tableLayout.GetItemAt(SETTINGS[0]).ExceuteEvent()
- def __InitCheckBoxes(self):
- global SETTINGS
- self.__checkBoxes[0][1] = self.__StandardChannelChanged
- self.__checkBoxes[1][1] = self.__StandardAccountChanged
- self.__checkBoxes[2][1] = self.__ShowClosingWarningChanged
- for i in xrange(len(self.__checkBoxes)):
- checkBox = FurtherOptionsBoard.CheckBox()
- checkBox.SetText(self.__checkBoxes[i][0])
- checkBox.SetCheckEvent(self.__checkBoxes[i][1])
- if type(SETTINGS[i]) is not dict:
- if type(SETTINGS[i]) is int:
- checkBox.SetState(TRUE)
- elif type(SETTINGS[i]) is str:
- if SETTINGS[i] == "FALSE":
- checkBox.SetState(FALSE)
- elif SETTINGS[i] == "TRUE":
- checkBox.SetState(TRUE)
- else:
- for name in SETTINGS[i]:
- if SETTINGS[i][name] != "":
- checkBox.SetState(TRUE)
- else:
- checkBox.SetState(FALSE)
- checkBox.Show()
- self.tableLayoutCheckBoxes.AddItem(checkBox)
- def __StandardChannelChanged(self, state):
- if state == TRUE:
- for item in self.tableLayout.GetItems():
- if item.IsPressed():
- SETTINGS[0] = item.GetLinkedChannel()
- else:
- SETTINGS[0] = 0
- self.__RewriteSettings()
- def __StandardAccountChanged(self, state):
- if state == TRUE:
- global SET_ACCOUNT
- if SET_ACCOUNT:
- SET_ACCOUNT()
- else:
- SETTINGS[1] = { "ID" : "", "PWD" : ""}
- self.__RewriteSettings()
- def __ShowClosingWarningChanged(self, state):
- if state == TRUE:
- SETTINGS[2] = "TRUE"
- else:
- SETTINGS[2] = "FALSE"
- self.__RewriteSettings()
- def __ChannelClicked(self):
- for item in self.tableLayout.GetItems():
- item.SetChannelImages()
- def __RewriteSettings(self):
- global SETTINGS_REWRITER
- if SETTINGS_REWRITER:
- SETTINGS_REWRITER()
- def OnUpdate(self):
- SpecialBoard.OnUpdate(self)
- ServerStateChecker.Update()
- self.tableLayoutCheckBoxes.SetPosition(self.tableLayoutCheckBoxes.GetLocalPosition()[0], self.tableLayout.GetLocalPosition()[1] + self.tableLayout.GetHeight() + 10)
- self.tableLayout.SetWindowHorizontalAlignCenter()
- def NotifyChannelState(self, addrKey, state):
- global SERVER_INFO
- try:
- stateName = serverInfo.STATE_DICT[state]
- stateName = CHANNEL_ONLINE
- except:
- stateName = CHANNEL_ONLINE
- try:
- SERVER_INFO["CHANNELS"][addrKey % 10]["STATE"] = stateName
- except Exception, e:
- pass
- def InitChannels(self):
- global SERVER_INFO
- global NEW_BINARY
- ServerStateChecker.Create(self)
- if NEW_BINARY:
- ServerStateChecker.Initialize()
- for id, channelDataDict in SERVER_INFO["CHANNELS"].items():
- channel = FurtherOptionsBoard.Channel()
- channel.SetChannelName(channelDataDict["NAME"])
- channel.Show()
- channel.SetLinkedChannel(id)
- channel.SetEvent(ui.__mem_func__(self.__ChannelClicked))
- if not NEW_BINARY:
- ServerStateChecker.Request(channelDataDict["KEY"], channelDataDict["IP"], channelDataDict["UDP_PORT"])
- else:
- ServerStateChecker.AddChannel(channelDataDict["KEY"], channelDataDict["IP"], channelDataDict["UDP_PORT"])
- self.tableLayout.AddItem(channel)
- if NEW_BINARY:
- ServerStateChecker.Request()
- def __del__(self):
- if NEW_BINARY:
- ServerStateChecker.Initialize(self)
- else:
- ServerStateChecker.Destroy(self)
- self.tableLayout.Hide()
- self.tableLayout = None
- self.standardChannel.Hide()
- self.standardChannel = None
- self.standardAccount.Hide()
- self.standardAccount = None
- SpecialBoard.__del__(self)
- class Area(ui.Window):
- _currentAreaBoard = None
- _furtherOptionsButtonImages = ["weitere-ausgeklappt.tga", "weitere-eingeklappt.tga"]
- _furtherOptionsAreShown = 0
- def __init__(self):
- ui.Window.__init__(self)
- Area.furtherOptionsBoard = FurtherOptionsBoard()
- Area.furtherOptionsBoard.SetParent(self)
- Area.furtherOptionsBoard.Hide()
- self.furtherOptionsButton = ui.Button()
- self.furtherOptionsButton.SetEvent(ui.__mem_func__(self._OnClickFurtherOptions))
- self.furtherOptionsButton.Show()
- self._SetFurtherOptionsButton()
- self.SetStandardPosition()
- def Open(self):
- self.Show()
- self.furtherOptionsButton.Show()
- self.ShowBoard()
- def Close(self):
- Area.furtherOptionsBoard.Hide()
- #self.furtherOptionsBoard = None
- self._currentAreaBoard.Hide()
- #self._currentAreaBoard = None
- self.furtherOptionsButton.Hide()
- #self.furtherOptionsButton = None
- self.Hide()
- def _OnClickFurtherOptions(self):
- if self._furtherOptionsAreShown:
- Area.furtherOptionsBoard.Hide()
- self._currentAreaBoard.FadeIn()
- self._furtherOptionsAreShown = 0
- else:
- self._currentAreaBoard.Hide()
- Area.furtherOptionsBoard.FadeIn()
- self._furtherOptionsAreShown = 1
- self._SetFurtherOptionsButton()
- def _SetFurtherOptionsButton(self):
- if self._furtherOptionsAreShown == TRUE:
- self.furtherOptionsButton.SetUpVisual(self._furtherOptionsButtonImages[1])
- self.furtherOptionsButton.SetOverVisual(self._furtherOptionsButtonImages[1])
- self.furtherOptionsButton.SetDownVisual(self._furtherOptionsButtonImages[1])
- else:
- self.furtherOptionsButton.SetUpVisual(self._furtherOptionsButtonImages[0])
- self.furtherOptionsButton.SetOverVisual(self._furtherOptionsButtonImages[0])
- self.furtherOptionsButton.SetDownVisual(self._furtherOptionsButtonImages[0])
- def OnUpdate(self):
- self.SetCenterPosition()
- if self._currentAreaBoard:
- self._currentAreaBoard.SetParent(self)
- self._currentAreaBoard.SetPosition(0, 0)
- self._currentAreaBoard.SetWindowHorizontalAlignCenter()
- self._currentAreaBoard.SetPosition(0, 10)
- self._currentAreaBoard.OnUpdate()
- if Area.furtherOptionsBoard:
- Area.furtherOptionsBoard.SetPosition(0, 0)
- Area.furtherOptionsBoard.SetWindowHorizontalAlignCenter()
- Area.furtherOptionsBoard.SetPosition(0, 10)
- Area.furtherOptionsBoard.OnUpdate()
- maxHeight = 0
- if Area.furtherOptionsBoard and self._currentAreaBoard:
- maxHeight = max(Area.furtherOptionsBoard.GetHeight(), self._currentAreaBoard.GetHeight())
- else:
- maxHeight = Area.furtherOptionsBoard.GetHeight()
- self.SetSize(Area.furtherOptionsBoard.GetWidth() + 10, 10 + maxHeight + 5 + self.furtherOptionsButton.GetHeight() + 5)
- def SetStandardPosition(self):
- self.furtherOptionsButton.SetParent(self)
- self.furtherOptionsButton.SetWindowHorizontalAlignCenter()
- self.furtherOptionsButton.SetPosition(0, self.GetHeight() - self.furtherOptionsButton.GetHeight() - 5)
- def ShowBoard(self):
- if self._currentAreaBoard:
- Area.furtherOptionsBoard.Hide()
- self._currentAreaBoard.FadeIn()
- self._furtherOptionsAreShown = 0
- self._SetFurtherOptionsButton()
- self.SetStandardPosition()
- def GetCurrentAreaBoard(self):
- return self._currentAreaBoard
- def __del__(self):
- ui.Window.__del__(self)
- class LoginArea(Area):
- class LoginBoard(SpecialBoard):
- background = "login-bg.tga"
- loginButtonNormal = "login-button.tga"
- loginButtonHover = "login-button-hover.tga"
- loginButtonDown = loginButtonNormal
- loginFailureMsgDict = {}
- loginFailureFuncDict = {}
- __cancelButtonNormal = "button-abbrechen.tga"
- __cancelButtonHover = "button-abbrechen-hover.tga"
- __cancelButtonDown = __cancelButtonNormal
- __loginOldIMEUpdate = None
- __passwordOldIMEUpdate = None
- def __init__(self):
- SpecialBoard.__init__(self)
- #net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
- #net.SetAccountConnectorHandler(self)
- self.LoadImage(self.background)
- self.loginButton = ui.Button()
- self.loginButton.SetParent(self)
- self.loginButton.SetUpVisual(self.loginButtonNormal)
- self.loginButton.SetOverVisual(self.loginButtonHover)
- self.loginButton.SetDownVisual(self.loginButtonDown)
- self.loginButton.SetPosition(45, 112)
- self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
- self.loginButton.Show()
- self.loginEditLine = SpecialEditLine()
- self.loginEditLine.SetParent(self)
- self.loginEditLine.SetPlaceHolderText("Utilizador")
- self.loginEditLine.SetPosition(40, 40)
- self.loginEditLine.SetSize(210, 18)
- self.loginEditLine.SetMax(16)
- self.passwordEditLine = SpecialEditLine()
- self.passwordEditLine.SetParent(self)
- self.passwordEditLine.SetPlaceHolderText("Palavra-Senha")
- self.passwordEditLine.SetSecret()
- self.passwordEditLine.SetPosition(40, 80)
- self.passwordEditLine.SetSize(210, 18)
- self.passwordEditLine.SetMax(16)
- self.passwordEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton))
- self.passwordEditLine.SetTabEvent(ui.__mem_func__(self.loginEditLine.SetFocus))
- self.loginEditLine.SetReturnEvent(ui.__mem_func__(self.passwordEditLine.SetFocus))
- self.loginEditLine.SetTabEvent(ui.__mem_func__(self.passwordEditLine.SetFocus))
- self.__loginOldIMEUpdate = self.loginEditLine.OnIMEUpdate
- self.loginEditLine.OnIMEUpdate = lambda : (self.__loginOldIMEUpdate(), stream.SetLoginInfo(self.loginEditLine.GetText(), self.passwordEditLine.GetText()))
- self.__passwordOldIMEUpdate = self.passwordEditLine.OnIMEUpdate
- self.passwordEditLine.OnIMEUpdate = lambda : (self.__passwordOldIMEUpdate(), stream.SetLoginInfo(self.loginEditLine.GetText(), self.passwordEditLine.GetText()))
- self.popupDialog = PopupDialog()
- def PopupNotifyMessage(self, message, closeEvent = 0, buttons = []):
- if not self.popupDialog:
- self.popupDialog = PopupDialog()
- else:
- self.popupDialog.Close()
- self.popupDialog.SetCloseEvent(closeEvent)
- self.popupDialog.SetMessage(message)
- self.popupDialog.SetButtons(buttons)
- self.popupDialog.FadeIn()
- def __OnClickLoginButton(self):
- id = self.loginEditLine.GetText()
- pwd = self.passwordEditLine.GetText()
- if len(id)==0:
- self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
- return
- if len(pwd)==0:
- self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
- return
- self.Connect(id, pwd)
- def Connect(self, id, pwd):
- global stream
- if constInfo.SEQUENCE_PACKET_ENABLE:
- net.SetPacketSequenceMode()
- cancelButton = ui.Button()
- cancelButton.SetEvent(lambda *x : self.popupDialog.Close())
- cancelButton.SetUpVisual(self.__cancelButtonNormal)
- cancelButton.SetOverVisual(self.__cancelButtonHover)
- cancelButton.SetDownVisual(self.__cancelButtonDown)
- cancelButton.SetPosition(0, 20)
- cancelButton.SetWindowHorizontalAlignCenter()
- cancelButton.SetWindowVerticalAlignCenter()
- cancelButton.Show()
- self.PopupNotifyMessage(localeInfo.LOGIN_CONNETING, 0, [cancelButton])
- self.stream.SetLoginInfo(id, pwd)
- stream.Connect()
- def Open(self):
- self.loginFailureMsgDict = {
- #"DEFAULT" : localeInfo.LOGIN_FAILURE_UNKNOWN,
- "ALREADY" : localeInfo.LOGIN_FAILURE_ALREAY,
- "NOID" : localeInfo.LOGIN_FAILURE_NOT_EXIST_ID,
- "WRONGPWD" : localeInfo.LOGIN_FAILURE_WRONG_PASSWORD,
- "FULL" : localeInfo.LOGIN_FAILURE_TOO_MANY_USER,
- "SHUTDOWN" : localeInfo.LOGIN_FAILURE_SHUTDOWN,
- "REPAIR" : localeInfo.LOGIN_FAILURE_REPAIR_ID,
- "BLOCK" : localeInfo.LOGIN_FAILURE_BLOCK_ID,
- "WRONGMAT" : localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER,
- "QUIT" : localeInfo.LOGIN_FAILURE_WRONG_MATRIX_CARD_NUMBER_TRIPLE,
- "BESAMEKEY" : localeInfo.LOGIN_FAILURE_BE_SAME_KEY,
- "NOTAVAIL" : localeInfo.LOGIN_FAILURE_NOT_AVAIL,
- "NOBILL" : localeInfo.LOGIN_FAILURE_NOBILL,
- "BLKLOGIN" : localeInfo.LOGIN_FAILURE_BLOCK_LOGIN,
- "WEBBLK" : localeInfo.LOGIN_FAILURE_WEB_BLOCK,
- }
- self.loginFailureFuncDict = {
- "WRONGPWD" : self.__DisconnectAndInputPassword,
- "WRONGMAT" : self.__DisconnectAndInputMatrix,
- "QUIT" : app.Exit,
- }
- def Close(self):
- self.loginButton = None
- self.loginEditLine = None
- self.passwordEditLine = None
- self.FadeOut()
- self.loginFailureFuncDict=None
- if self.popupDialog:
- self.popupDialog.Close()
- self.popupDialog = None
- def OnUpdate(self):
- global stream
- SpecialBoard.OnUpdate(self)
- #stream.SetLoginInfo(self.loginEditLine.GetText(), self.passwordEditLine.GetText())
- if self.popupDialog:
- self.popupDialog.OnUpdate()
- if self.fadeProgressFinished() == 1:
- self.loginButton.Show()
- self.loginEditLine.Show()
- self.passwordEditLine.Show()
- else:
- self.loginButton.Hide()
- self.loginEditLine.Hide()
- self.passwordEditLine.Hide()
- def OnConnectFailure(self):
- snd.PlaySound("sound/ui/loginfail.wav")
- if self.popupDialog:
- self.popupDialog.Close()
- self.popupDialog = None
- self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.passwordEditLine.SetFocus)
- def OnHandShake(self):
- if not IsLoginDelay():
- snd.PlaySound("sound/ui/loginok.wav")
- self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
- def OnLoginStart(self):
- if not IsLoginDelay():
- self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
- def OnLoginFailure(self, error):
- if self.popupDialog:
- self.popupDialog.Close()
- self.popupDialog = None
- try:
- loginFailureMsg = self.loginFailureMsgDict[error]
- except KeyError:
- loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
- loginFailureFunc=self.loginFailureFuncDict.get(error, self.passwordEditLine.SetFocus)
- self.PopupNotifyMessage(loginFailureMsg)#, loginFailureFunc)
- snd.PlaySound("sound/ui/loginfail.wav")
- def __del__(self):
- #net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
- #net.SetAccountConnectorHandler(0)
- SpecialBoard.__del__(self)
- def __init__(self):
- Area.__init__(self)
- self._currentAreaBoard = LoginArea.LoginBoard()
- def Open(self):
- Area.furtherOptionsBoard.SetParent(self)
- Area.Open(self)
- def __del__(self):
- Area.__del__(self)
- class AccountManagementArea(Area):
- class AccountManagementSelectBoard(SpecialBoard):
- class AccountBox(ui.ImageBox):
- __background = "box.tga"
- __instanceCount = 0
- __linkedAccount = len(ACCOUNTS) - 1
- __buttonImages = ["button-acc.tga", "button-acc-hover.tga", "button-acc.tga"]
- def __init__(self):
- ui.ImageBox.__init__(self)
- global LOGIN_IS_PROCESSING
- global ACCOUNTS
- AccountManagementArea.AccountManagementSelectBoard.AccountBox.__instanceCount += 1
- self.__instanceCount = AccountManagementArea.AccountManagementSelectBoard.AccountBox.__instanceCount
- self.LoadImage(self.__background)
- self.__accountLine = ui.TextLine()
- self.__accountLine.SetParent(self)
- self.__accountLine.SetText("Conta %i: %s" % (self.__instanceCount, self.__linkedAccount))
- self.__accountLine.SetPosition(5, 10)
- self.__accountLine.Show()
- self.__loginButton = ui.Button()
- self.__loginButton.SetParent(self)
- self.__SetButtonImages(self.__loginButton, self.__buttonImages)
- self.__loginButton.SetPosition(5, 30)
- self.__loginButton.SetText("Entrar")
- self.__loginButton.Show()
- self.__editButton = ui.Button()
- self.__editButton.SetParent(self)
- self.__SetButtonImages(self.__editButton, self.__buttonImages)
- self.__editButton.SetPosition(self.__loginButton.GetLocalPosition()[0] + self.__loginButton.GetWidth() + 5, 30)
- self.__editButton.SetText("Guardar")
- self.__editButton.Show()
- self.__levelLine = ui.Button()
- self.__levelLine.SetParent(self)
- self.__levelLine.SetText("")
- self.__levelLine.SetPosition(self.GetWidth() - 50, 13)
- self.__levelLine.Show()
- def __SetButtonImages(self, button, images):
- button.SetUpVisual(images[0])
- button.SetOverVisual(images[1])
- button.SetDownVisual(images[2])
- def OnUpdate(self):
- global LOGIN_IS_PROCESSING
- global ACCOUNTS
- global stream
- userCurrent = ACCOUNTS[self.__linkedAccount]
- self.__accountLine.SetText("Conta %i: %s" % (self.__instanceCount, userCurrent["ID"]))
- #hier kommt die automatische Level-Abfrage rein; auf NyBus Wunsch vorerst wieder entfernt
- def SetLinkedAccount(self, index):
- dbg.TraceError(str(index))
- try:
- self.__linkedAccount = index
- except Exception, e:
- pass
- def __del__(self):
- ui.ImageBox.__del__(self)
- __background = "accverwaltung-bg.tga"
- __accountsCount = 3
- def __init__(self):
- SpecialBoard.__init__(self)
- self.LoadImage(self.__background)
- self.__accountBoxesLayout = TableLayout()
- self.__accountBoxesLayout.SetParent(self)
- self.__accountBoxesLayout.SetVerticalLayout()
- for i in xrange(self.__accountsCount):
- accountBox = AccountManagementArea.AccountManagementSelectBoard.AccountBox()
- accountBox.SetLinkedAccount(i)
- accountBox.Show()
- self.__accountBoxesLayout.AddItem(accountBox)
- self.__accountBoxesLayout.SetWindowHorizontalAlignCenter()
- self.__accountBoxesLayout.SetWindowVerticalAlignCenter()
- self.__accountBoxesLayout.Show()
- def OnConnectFailure(self):
- dbg.TraceError("PENIS1")
- def OnLoginStart(self):
- dbg.TraceError("PENIS2")
- def OnHandShake(self):
- global LOGIN_IS_PROCESSING
- global ACCOUNTS
- #LOGIN_IS_PROCESSING = FALSE
- level = net.GetAccountCharacterSlotDataInteger(0, net.ACCOUNT_CHARACTER_SLOT_LEVEL)
- def OnLoginFailure(self, error):
- dbg.TraceError(str(error))
- def OnUpdate(self):
- SpecialBoard.OnUpdate(self)
- for item in self.__accountBoxesLayout.GetItems():
- item.OnUpdate()
- def __del__(self):
- SpecialBoard.__del__(self)
- class AccountManagementEditBoard(SpecialBoard):
- def __init__(self):
- SpecialBoard.__init__(self)
- def __del__(self):
- SpecialBoard.__del__(self)
- def __init__(self):
- global SET_ACCOUNT
- SET_ACCOUNT = self.SetAutoAccount()
- Area.__init__(self)
- self._currentAreaBoard = AccountManagementArea.AccountManagementSelectBoard()
- global ACCOUNTS_REWRITER
- ACCOUNTS_REWRITER()
- def SetAutoAccount(self):
- pass
- def Open(self):
- Area.furtherOptionsBoard.SetParent(self)
- Area.Open(self)
- def __del__(self):
- Area.__del__(self)
- class NewsArea(Area):
- class NewsBoard(SpecialBoard):
- def __init__(self):
- SpecialBoard.__init__(self)
- def __del__(self):
- SpecialBoard.__del__(self)
- def __init__(self):
- Area.__init__(self)
- self._currentAreaBoard = NewsArea.NewsBoard()
- def Open(self):
- Area.furtherOptionsBoard.SetParent(self)
- Area.Open(self)
- def __del__(self):
- Area.__del__(self)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement