Advertisement
Guest User

Cyka

a guest
Oct 27th, 2016
548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.35 KB | None | 0 0
  1. sysser:
  2. Traceback (most recent call last):
  3.   File "ui.py", line 1372, in CallEvent
  4.   File "game.py", line 1507, in <lambda>
  5.   File "game.py", line 1541, in RequestDestroyItem
  6. AttributeError: 'QuestionDialogItem2' object has no attribute 'dropType'
  7.  
  8. game.py:
  9.  
  10. on def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):               itemDropQuestionDialog = uiCommon.QuestionDialogItem()
  11.  
  12. ...
  13.                 itemDropQuestionDialog.SetText(questionText)
  14.                 itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
  15.                 itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem1(arg))
  16.                 itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  17.                 itemDropQuestionDialog.Open()
  18.                 itemDropQuestionDialog.dropType = attachedType
  19.                 itemDropQuestionDialog.dropNumber = attachedItemSlotPos
  20.                 itemDropQuestionDialog.dropCount = attachedItemCount
  21.                 self.itemDropQuestionDialog = itemDropQuestionDialog
  22.  
  23.                 constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  24. ...
  25.  
  26.     def RequestDestroyItem1(self, answer):
  27.         if answer:
  28.             dropType = self.itemDropQuestionDialog.dropType
  29.             dropNumber = self.itemDropQuestionDialog.dropNumber
  30.  
  31.             itemDropQuestionDialog = uiCommon.QuestionDialogItem2()
  32.             itemDropQuestionDialog.SetText(localeInfo.DESTROY2)
  33.             itemDropQuestionDialog.SetDestroyEvent(lambda arg=TRUE: self.RequestDestroyItem(arg))
  34.             itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
  35.             itemDropQuestionDialog.Open()
  36.             self.itemDropQuestionDialog = itemDropQuestionDialog
  37.  
  38.             constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
  39.  
  40. uicommon.py:
  41. class QuestionDialogItem2(ui.ScriptWindow):
  42.     def __init__(self):
  43.         ui.ScriptWindow.__init__(self)
  44.         self.__CreateDialog()
  45.  
  46.     def __del__(self):
  47.         ui.ScriptWindow.__del__(self)
  48.  
  49.     def __CreateDialog(self):
  50.         pyScrLoader = ui.PythonScriptLoader()
  51.         pyScrLoader.LoadScriptFile(self, "uiscript/questiondialogitem2.py")
  52.  
  53.         self.board = self.GetChild("board")
  54.         self.textLine = self.GetChild("message")
  55.         self.destroyButton = self.GetChild("destroy")
  56.         self.cancelButton = self.GetChild("cancel")
  57.  
  58.     def Open(self):
  59.         self.SetCenterPosition()
  60.         self.SetTop()
  61.         self.Show()
  62.  
  63.     def Close(self):
  64.         self.Hide()
  65.  
  66.     def SetWidth(self, width):
  67.         height = self.GetHeight()
  68.         self.SetSize(width, height)
  69.         self.board.SetSize(width, height)
  70.         self.SetCenterPosition()
  71.         self.UpdateRect()
  72.  
  73.     def SAFE_SetCancelEvent(self, event):
  74.         self.cancelButton.SAFE_SetEvent(event)
  75.  
  76.     def SetDestroyEvent(self, event):
  77.         self.destroyButton.SetEvent(event)
  78.  
  79.     def SetCancelEvent(self, event):
  80.         self.cancelButton.SetEvent(event)
  81.  
  82.     def SetText(self, text):
  83.         self.textLine.SetText(text)
  84.  
  85.     def SetCancelText(self, text):
  86.         self.cancelButton.SetText(text)
  87.  
  88.     def OnPressEscapeKey(self):
  89.         self.Close()
  90.         return TRUE
  91.  
  92. questiondialogitem2.py:
  93.  
  94. import uiScriptLocale
  95.  
  96. window = {
  97.     "name" : "QuestionDialog",
  98.     "style" : ("movable", "float",),
  99.  
  100.     "x" : SCREEN_WIDTH/2 - 125,
  101.     "y" : SCREEN_HEIGHT/2 - 52,
  102.  
  103.     "width" : 340,
  104.     "height" : 105,
  105.  
  106.     "children" :
  107.     (
  108.         {
  109.             "name" : "board",
  110.             "type" : "board",
  111.  
  112.             "x" : 0,
  113.             "y" : 0,
  114.  
  115.             "width" : 340,
  116.             "height" : 105,
  117.  
  118.             "children" :
  119.             (
  120.                 {
  121.                     "name" : "message",
  122.                     "type" : "text",
  123.  
  124.                     "x" : 0,
  125.                     "y" : 38,
  126.  
  127.                     "horizontal_align" : "center",
  128.                     "text" : uiScriptLocale.MESSAGE,
  129.  
  130.                     "text_horizontal_align" : "center",
  131.                     "text_vertical_align" : "center",
  132.                 },
  133.                 {
  134.                     "name" : "destroy",
  135.                     "type" : "button",
  136.  
  137.                     "x" : -60,
  138.                     "y" : 63,
  139.  
  140.                     "width" : 61,
  141.                     "height" : 21,
  142.  
  143.                     "horizontal_align" : "center",
  144.                     "text" : uiScriptLocale.DESTROY,
  145.  
  146.                     "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
  147.                     "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
  148.                     "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
  149.                 },
  150.                 {
  151.                     "name" : "cancel",
  152.                     "type" : "button",
  153.  
  154.                     "x" : 60,
  155.                     "y" : 63,
  156.  
  157.                     "width" : 61,
  158.                     "height" : 21,
  159.  
  160.                     "horizontal_align" : "center",
  161.                     "text" : uiScriptLocale.NO,
  162.  
  163.                     "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
  164.                     "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
  165.                     "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
  166.                 },
  167.             ),
  168.         },
  169.     ),
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement