def AskBuyItem(self, slotPos): if not app.ENABLE_OFFLINE_SHOP: slotPos = self.__GetRealIndex(slotPos) itemIndex = shop.GetItemID(slotPos) itemPrice = shop.GetItemPrice(slotPos) if app.ENABLE_OFFLINE_SHOP: itemPriceTwo = shop.GetItemPrice2(slotPos) itemPriceThree = shop.GetItemPrice3(slotPos) itemPriceFour = shop.GetItemPrice4(slotPos) itemCount = shop.GetItemCount(slotPos) item.SelectItem(itemIndex) itemName = item.GetItemName() if app.ENABLE_OFFLINE_SHOP: if not itemPriceTwo and not itemPriceThree and not itemPriceFour: itemBuyQuestionDialog = uiCommon.QuestionDialog() itemBuyQuestionDialog.SetText( localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, itemPrice)) else: itemBuyQuestionDialog = uiCommon.QuestionDialog2() itemBuyQuestionDialog.SetText1( localeInfo.DO_YOU_BUY_ITEM_NEW( itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice), localeInfo.NumberToPriceString(itemPriceTwo, "Coin"), localeInfo.NumberToPriceString(itemPriceThree, "Goldbar"), localeInfo.NumberToPriceString(itemPriceFour, "Won"))[0]) itemBuyQuestionDialog.SetText2( localeInfo.DO_YOU_BUY_ITEM_NEW( itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice), localeInfo.NumberToPriceString(itemPriceTwo, "Coin"), localeInfo.NumberToPriceString(itemPriceThree, "Goldbar"), localeInfo.NumberToPriceString(itemPriceFour, "Won"))[1]) else: itemBuyQuestionDialog = uiCommon.QuestionDialog() itemBuyQuestionDialog.SetText( localeInfo.DO_YOU_BUY_ITEM( itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice))) itemBuyQuestionDialog.SetAcceptEvent( lambda arg=True: self.AnswerBuyItem(arg)) itemBuyQuestionDialog.SetCancelEvent( lambda arg=False: self.AnswerBuyItem(arg)) if app.ENABLE_OFFLINE_SHOP: if itemPriceTwo or itemPriceThree or itemPriceFour: itemBuyQuestionDialog.SetWidth(550) itemBuyQuestionDialog.Open() itemBuyQuestionDialog.pos = slotPos self.itemBuyQuestionDialog = itemBuyQuestionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
def AskBuyItem(self, slotPos): itemIndex = shop.GetOfflineShopItemID(slotPos) itemPrice = shop.GetOfflineShopItemPrice(slotPos) itemCount = shop.GetOfflineShopItemCount(slotPos) item.SelectItem(itemIndex) itemName = item.GetItemName() itemBuyQuestionDialog = uiCommon.QuestionDialog() itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice))) itemBuyQuestionDialog.SetAcceptEvent(lambda arg=True: self.AnswerBuyItem(arg)) itemBuyQuestionDialog.SetCancelEvent(lambda arg=False: self.AnswerBuyItem(arg)) itemBuyQuestionDialog.Open() itemBuyQuestionDialog.pos = slotPos self.itemBuyQuestionDialog = itemBuyQuestionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)