def Close(self): global g_isBuildingPrivateShop g_isBuildingPrivateShop = False self.title = "" self.itemStock = {} shop.ClearPrivateShopStock() self.Hide() if app.ENABLE_SLOT_MARKING_SYSTEM: if self.priceInputBoard: self.priceInputBoard.Close() self.priceInputBoard = None for privatePos, (itemInvenPage, itemSlotPos) in self.lockedItems.items(): if itemInvenPage == self.wndInventory.GetInventoryPageIndex(): self.wndInventory.wndItem.SetCanMouseEventSlot(itemSlotPos) self.lockedItems = { i: (-1, -1) for i in range(shop.SHOP_SLOT_COUNT) } self.interface.SetOnTopWindow(player.ON_TOP_WND_NONE) self.interface.RefreshMarkInventoryBag()
def Close(self): global g_isBuildingPrivateShop g_isBuildingPrivateShop = False self.title = "" self.itemStock = {} shop.ClearPrivateShopStock() self.Hide()
def Close(self): global g_isBuildingPrivateShop g_isBuildingPrivateShop = False self.title = "" if app.ENABLE_OFFLINE_SHOP: self.type = 0 self.size = 0 self.color = 0 self.itemStock = {} shop.ClearPrivateShopStock() self.Hide() if app.ENABLE_OFFLINE_SHOP: self.wndInventory.RefreshBagSlotWindow()
def Open(self, title): self.title = title if len(title) > 25: title = title[:22] + "..." self.itemStock = {} shop.ClearPrivateShopStock() self.nameLine.SetText(title) self.SetCenterPosition() self.Refresh() self.Show() global g_isBuildingPrivateShop g_isBuildingPrivateShop = True
def Open(self, title): self.title = title if len(title) > 25: title = title[:22] + "..." self.itemStock = {} shop.ClearPrivateShopStock() self.nameLine.SetText(title) self.SetCenterPosition() self.Refresh() self.Show() if app.WJ_ENABLE_TRADABLE_ICON: self.lockedItems = { i: (-1, -1) for i in range(shop.SHOP_SLOT_COUNT) } self.interface.SetOnTopWindow(player.ON_TOP_WND_PRIVATE_SHOP) self.interface.RefreshMarkInventoryBag() global g_isBuildingPrivateShop g_isBuildingPrivateShop = TRUE
def Open(self, title, type, size, color): self.title = title self.type = type self.size = size self.color = color self.SetSize(self.realWidth, self.realHeight) self.Board.SetSize(self.realBoardWidth, self.realBoardHeight) self.titleBar.SetWidth(self.realTitleBarX) self.btnOk.SetPosition(self.okBtnRealX, self.okBtnRealY) self.btnClose.SetPosition(self.closeBtnRealX, self.closeBtnRealY) self.nameSlot.SetPosition(self.realNameSlotPosX, self.realNameSlotPosY) self.nameSlot.SetSize(self.realNameSlotX, self.realNameSlotY) for i in range(40, 90 + 10, 10): if self.itemSlotList["ItemSlot_%d" % i].IsShow(): self.itemSlotList["ItemSlot_%d" % i].Hide() gridSize = self.SizeToGridSize[self.size] self.itemSlotList["ItemSlot_%d" % gridSize].Show() self.itemSlotList["ItemSlot_%d" % gridSize].SetSelectEmptySlotEvent( ui.__mem_func__(self.OnSelectEmptySlot)) self.itemSlotList["ItemSlot_%d" % gridSize].SetSelectItemSlotEvent( ui.__mem_func__(self.OnSelectItemSlot)) self.itemSlotList["ItemSlot_%d" % gridSize].SetOverInItemEvent( ui.__mem_func__(self.OnOverInItem)) self.itemSlotList["ItemSlot_%d" % gridSize].SetOverOutItemEvent( ui.__mem_func__(self.OnOverOutItem)) if len(title) > 25: title = title[:22] + "..." self.itemStock = {} shop.ClearPrivateShopStock() self.nameLine.SetText(title) self.SetCenterPosition() self.Refresh() self.Show() heightDifference = 70 widthDifferenceBase = 32 btnDifference = 20 gridSizeToWindowPos = self.size - 1 if gridSize == 50: self.SetSize(self.realWidth, self.realHeight + heightDifference) self.Board.SetSize(self.realBoardWidth, self.realBoardHeight + heightDifference) self.btnOk.SetPosition(self.okBtnRealX, self.okBtnRealY + heightDifference) self.btnClose.SetPosition( self.closeBtnRealX, self.closeBtnRealY + heightDifference) elif gridSize >= 60: self.SetSize( self.realWidth + widthDifferenceBase * gridSizeToWindowPos, self.realHeight + heightDifference) self.Board.SetSize( self.realBoardWidth + widthDifferenceBase * gridSizeToWindowPos, self.realBoardHeight + heightDifference) self.nameSlot.SetSize( self.realNameSlotX + widthDifferenceBase * gridSizeToWindowPos, self.realNameSlotY) self.titleBar.SetWidth(self.realTitleBarX + widthDifferenceBase * gridSizeToWindowPos) self.btnOk.SetPosition( self.okBtnRealX + btnDifference * gridSizeToWindowPos, self.okBtnRealY + heightDifference) self.btnClose.SetPosition( self.closeBtnRealX + btnDifference * gridSizeToWindowPos, self.closeBtnRealY + heightDifference) global g_isBuildingPrivateShop g_isBuildingPrivateShop = True
def LoadDialog(self): try: PythonScriptLoader = ui.PythonScriptLoader() PythonScriptLoader.LoadScriptFile(self, "UIScript/shopdialog.py") except: import exception exception.Abort("ShopDialog.LoadDialog.LoadObject") smallTab1 = None smallTab2 = None smallTab3 = None middleTab1 = None middleTab2 = None try: GetObject = self.GetChild if app.ENABLE_OFFLINE_SHOP: self.board = GetObject("board") for i in range(40, 90 + 10, 10): self.itemSlotList["ItemSlot_%d" % i] = GetObject( "ItemSlot_%d" % i) self.itemSlotList["ItemSlot_%d" % i].Hide() else: self.itemSlotWindow = GetObject("ItemSlot") self.btnBuy = GetObject("BuyButton") self.btnSell = GetObject("SellButton") self.btnClose = GetObject("CloseButton") if app.ENABLE_OFFLINE_SHOP: self.btnMove = GetObject("MoveButton") self.titleBar = GetObject("TitleBar") if app.ENABLE_OFFLINE_SHOP: self.wndMoney = self.GetChild("Money") self.wndMoneySlot = self.GetChild("MoneySlot") middleTab1 = GetObject("MiddleTab1") middleTab2 = GetObject("MiddleTab2") smallTab1 = GetObject("SmallTab1") smallTab2 = GetObject("SmallTab2") smallTab3 = GetObject("SmallTab3") except: import exception exception.Abort("ShopDialog.LoadDialog.BindObject") if app.ENABLE_OFFLINE_SHOP: # Store real positions self.realWidth, self.realHeight = self.GetWidth(), self.GetHeight() self.realBoardWidth, self.realBoardHeight = self.board.GetWidth( ), self.board.GetHeight() self.realTitleBarX = self.titleBar.GetWidth() (self.realBuyBtnX, self.realBuyBtnY) = self.btnBuy.GetLocalPosition() (self.realSellBtnX, self.realSellBtnY) = self.btnSell.GetLocalPosition() (self.realCloseBtnX, self.realCloseBtnY) = self.btnClose.GetLocalPosition() (self.realMoveBtnX, self.realMoveBtnY) = self.btnMove.GetLocalPosition() (self.realMoneySlotX, self.realMoneySlotY) = self.wndMoneySlot.GetLocalPosition() self.height = self.GetHeight() self.width = self.GetWidth() else: self.itemSlotWindow.SetSlotStyle(wndMgr.SLOT_STYLE_NONE) self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EMPTY", self.SelectEmptySlot) self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EXIST", self.SelectItemSlot) self.itemSlotWindow.SAFE_SetButtonEvent("RIGHT", "EXIST", self.UnselectItemSlot) self.itemSlotWindow.SetOverInItemEvent( ui.__mem_func__(self.OverInItem)) self.itemSlotWindow.SetOverOutItemEvent( ui.__mem_func__(self.OverOutItem)) self.btnBuy.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping)) self.btnBuy.SetToggleDownEvent(ui.__mem_func__(self.OnBuy)) self.btnSell.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping)) self.btnSell.SetToggleDownEvent(ui.__mem_func__(self.OnSell)) self.btnClose.SetEvent(ui.__mem_func__(self.AskClosePrivateShop)) if app.ENABLE_OFFLINE_SHOP: self.btnMove.SetEvent(ui.__mem_func__(self.MoveShop)) self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) self.smallRadioButtonGroup = ui.RadioButtonGroup.Create( [[smallTab1, lambda: self.OnClickTabButton(0), None], [smallTab2, lambda: self.OnClickTabButton(1), None], [smallTab3, lambda: self.OnClickTabButton(2), None]]) self.middleRadioButtonGroup = ui.RadioButtonGroup.Create( [[middleTab1, lambda: self.OnClickTabButton(0), None], [middleTab2, lambda: self.OnClickTabButton(1), None]]) self.__HideMiddleTabs() self.__HideSmallTabs() self.tabIdx = 0 self.coinType = shop.SHOP_COIN_TYPE_GOLD if app.ENABLE_OFFLINE_SHOP: shop.ClearPrivateShopStock() self.Refresh()