Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sysser:
- Traceback (most recent call last):
- File "ui.py", line 1372, in CallEvent
- File "game.py", line 1507, in <lambda>
- File "game.py", line 1541, in RequestDestroyItem
- AttributeError: 'QuestionDialogItem2' object has no attribute 'dropType'
- game.py:
- on def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount): itemDropQuestionDialog = uiCommon.QuestionDialogItem()
- ...
- itemDropQuestionDialog.SetText(questionText)
- itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
- itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem1(arg))
- itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
- itemDropQuestionDialog.Open()
- itemDropQuestionDialog.dropType = attachedType
- itemDropQuestionDialog.dropNumber = attachedItemSlotPos
- itemDropQuestionDialog.dropCount = attachedItemCount
- self.itemDropQuestionDialog = itemDropQuestionDialog
- constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
- ...
- def RequestDestroyItem1(self, answer):
- if answer:
- dropType = self.itemDropQuestionDialog.dropType
- dropNumber = self.itemDropQuestionDialog.dropNumber
- itemDropQuestionDialog = uiCommon.QuestionDialogItem2()
- itemDropQuestionDialog.SetText(localeInfo.DESTROY2)
- itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
- itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
- itemDropQuestionDialog.Open()
- self.itemDropQuestionDialog = itemDropQuestionDialog
- constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
- uicommon.py:
- class QuestionDialogItem2(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.__CreateDialog()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __CreateDialog(self):
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, "uiscript/questiondialogitem2.py")
- self.board = self.GetChild("board")
- self.textLine = self.GetChild("message")
- self.destroyButton = self.GetChild("destroy")
- self.cancelButton = self.GetChild("cancel")
- def Open(self):
- self.SetCenterPosition()
- self.SetTop()
- self.Show()
- def Close(self):
- self.Hide()
- def SetWidth(self, width):
- height = self.GetHeight()
- self.SetSize(width, height)
- self.board.SetSize(width, height)
- self.SetCenterPosition()
- self.UpdateRect()
- def SAFE_SetCancelEvent(self, event):
- self.cancelButton.SAFE_SetEvent(event)
- def SetDestroyEvent(self, event):
- self.destroyButton.SetEvent(event)
- def SetCancelEvent(self, event):
- self.cancelButton.SetEvent(event)
- def SetText(self, text):
- self.textLine.SetText(text)
- def SetCancelText(self, text):
- self.cancelButton.SetText(text)
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- questiondialogitem2.py:
- import uiScriptLocale
- window = {
- "name" : "QuestionDialog",
- "style" : ("movable", "float",),
- "x" : SCREEN_WIDTH/2 - 125,
- "y" : SCREEN_HEIGHT/2 - 52,
- "width" : 340,
- "height" : 105,
- "children" :
- (
- {
- "name" : "board",
- "type" : "board",
- "x" : 0,
- "y" : 0,
- "width" : 340,
- "height" : 105,
- "children" :
- (
- {
- "name" : "message",
- "type" : "text",
- "x" : 0,
- "y" : 38,
- "horizontal_align" : "center",
- "text" : uiScriptLocale.MESSAGE,
- "text_horizontal_align" : "center",
- "text_vertical_align" : "center",
- },
- {
- "name" : "destroy",
- "type" : "button",
- "x" : -60,
- "y" : 63,
- "width" : 61,
- "height" : 21,
- "horizontal_align" : "center",
- "text" : uiScriptLocale.DESTROY,
- "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
- "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
- "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
- },
- {
- "name" : "cancel",
- "type" : "button",
- "x" : 60,
- "y" : 63,
- "width" : 61,
- "height" : 21,
- "horizontal_align" : "center",
- "text" : uiScriptLocale.NO,
- "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
- "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
- "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
- },
- ),
- },
- ),
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement