Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CostumeWindow(ui.ScriptWindow):
- def __init__(self, wndInventory):
- import exception
- if not app.ENABLE_COSTUME_SYSTEM:
- exception.Abort("What do you do?")
- return
- if not wndInventory:
- exception.Abort("wndInventory parameter must be set to InventoryWindow")
- return
- ui.ScriptWindow.__init__(self)
- self.isLoaded = 0
- self.wndInventory = wndInventory;
- self.wndCostumeWindowLayer = None
- self.expandBtn = None
- self.minBtn = None
- self.__LoadWindow()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def Show(self, openCostumeWindow = False):
- self.__LoadWindow()
- self.AdjustPositionAndSize()
- self.RefreshCostumeSlot()
- ui.ScriptWindow.Show(self)
- if openCostumeWindow:
- self.OpenCostume()
- else:
- self.CloseCostume()
- def Close(self):
- self.Hide()
- def IsOpeningInventory(self):
- return self.wndCostumeWindowLayer.IsShow()
- def GetBasePosition(self):
- x, y = self.wndInventory.GetGlobalPosition()
- return x - 147, y
- def AdjustPositionAndSize(self):
- bx, by = self.GetBasePosition()
- if self.IsOpeningInventory():
- self.SetPosition(bx, by)
- self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
- else:
- self.SetPosition(bx + 137, by);
- self.SetSize(15, self.GetHeight())
- def OpenCostume(self):
- self.wndCostumeWindowLayer.Show()
- self.expandBtn.Hide()
- if localeInfo.IsARABIC() == 0:
- self.AdjustPositionAndSize()
- def CloseCostume(self):
- self.wndCostumeWindowLayer.Hide()
- self.expandBtn.Show()
- if localeInfo.IsARABIC() == 0:
- self.AdjustPositionAndSize()
- def __LoadWindow(self):
- if self.isLoaded == 1:
- return
- self.isLoaded = 1
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
- except:
- import exception
- exception.Abort("CostumeWindow.LoadWindow.LoadObject")
- try:
- self.ORIGINAL_WIDTH = self.GetWidth()
- wndEquip = self.GetChild("CostumeSlot")
- self.wndCostumeWindowLayer = self.GetChild("CostumeWindowLayer")
- self.expandBtn = self.GetChild("ExpandBtn")
- self.minBtn = self.GetChild("MinimizeBtn")
- except:
- import exception
- exception.Abort("CostumeWindow.LoadWindow.BindObject")
- ## Equipment
- wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
- wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
- wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
- wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
- wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
- wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
- self.expandBtn.SetEvent(ui.__mem_func__(self.OpenCostume))
- self.minBtn.SetEvent(ui.__mem_func__(self.CloseCostume))
- self.wndEquip = wndEquip
- def RefreshCostumeSlot(self):
- getItemVNum=player.GetItemIndex
- for i in xrange(item.COSTUME_SLOT_COUNT):
- slotNumber = item.COSTUME_SLOT_START + i
- self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
- self.wndEquip.RefreshSlot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement