本文整理汇总了Python中toontown.shtiker.KartPage.KartViewer.refresh方法的典型用法代码示例。如果您正苦于以下问题:Python KartViewer.refresh方法的具体用法?Python KartViewer.refresh怎么用?Python KartViewer.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.shtiker.KartPage.KartViewer
的用法示例。
在下文中一共展示了KartViewer.refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BuyKartDlg
# 需要导入模块: from toontown.shtiker.KartPage import KartViewer [as 别名]
# 或者: from toontown.shtiker.KartPage.KartViewer import refresh [as 别名]
#.........这里部分代码省略.........
image=(model.find('**/BuyKartButtonUp'), model.find('**/BuyKartButtonDown'), model.find('**/BuyKartButtonRollover'), model.find('**/BuyKartButtonDisabled')),
scale=self.modelScale,
text=TTLocalizer.KartShop_BuyKart,
text_scale=KS_TEXT_SIZE_BIG,
text_pos=(0, -.534),
pressEffect=False,
command=lambda : messenger.send(doneEvent, [self.unownedKartList[self.curKart]]))
self.cancelButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/CancelButtonUp'), model.find('**/CancelButtonDown'), model.find('**/CancelButtonRollover')),
geom=model.find('**/CancelIcon'),
scale=self.modelScale,
pressEffect=False,
command=lambda : messenger.send(doneEvent, [BK_OPTIONS.Cancel]))
self.arrowLeftButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/ArrowLeftButtonUp'), model.find('**/ArrowLeftButtonDown'), model.find('**/ArrowLeftButtonRollover'), model.find('**/ArrowLeftButtonInactive')),
scale=self.modelScale,
pressEffect=False,
command=self.__handleKartChange,
extraArgs=[-1])
self.arrowRightButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/ArrowRightButtonUp'), model.find('**/ArrowRightButtonDown'), model.find('**/ArrowRightButtonRollover'), model.find('**/ArrowRightButtonInactive')),
scale=self.modelScale,
pressEffect=False,
command=self.__handleKartChange,
extraArgs=[1])
self.kartView = KartViewer([self.curKart, -1, -1, -1, -1, -1, -1, -1, -1], parent=self)
self.kartView.setPos(model.find('**/KartViewerFrame').getPos())
self.kartView.load(model, 'KartViewerFrame', ['rotate_right_up',
'rotate_right_down',
'rotate_right_roll',
'rotate_right_down',
(0.255, -.054)], ['rotate_left_up',
'rotate_left_down',
'rotate_left_roll',
'rotate_left_down',
(-.24, -.054)], (0, -.055))
self.kartView.setBounds(-0.38, 0.38, 0.0035, 0.53)
self.kartView.setBgColor(1.0, 1.0, 0.8, 1.0)
self.showKart()
self.initialize = True
model.removeNode()
return
def showKart(self):
self.buyKartButton.configure(text=TTLocalizer.KartShop_BuyKart)
self.buyKartButton.configure(text_scale=KS_TEXT_SIZE_BIG)
if self.numKarts > 0:
info = getKartTypeInfo(self.unownedKartList[self.curKart])
description = info[KartInfo.name]
cost = TTLocalizer.KartShop_Cost % info[KartInfo.cost]
self.kartDescription = DirectButton(
parent=self,
relief=None,
scale=self.modelScale,
text=description,
text_pos=(0, -.29),
text_scale=KS_TEXT_SIZE_SMALL,
pressEffect=False,
textMayChange=True)
self.kartCost = DirectButton(
parent=self,
relief=None,
scale=self.modelScale,
text=cost,
text_pos=(0, -.365),
text_scale=KS_TEXT_SIZE_SMALL,
pressEffect=False,
textMayChange=True)
self.buyKartButton['state'] = DGG.NORMAL
self.arrowRightButton['state'] = DGG.DISABLED
self.arrowLeftButton['state'] = DGG.DISABLED
if self.numKarts > self.curKart + 1:
self.arrowRightButton['state'] = DGG.NORMAL
if self.curKart > 0:
self.arrowLeftButton['state'] = DGG.NORMAL
if info[KartInfo.cost] > base.localAvatar.getTickets():
self.buyKartButton['state'] = DGG.DISABLED
self.buyKartButton.configure(text_scale=KS_TEXT_SIZE_SMALL * 0.75)
self.buyKartButton.configure(text=TTLocalizer.KartShop_NotEnoughTickets)
self.kartCost.configure(text_fg=(0.95, 0, 0.0, 1.0))
self.kartView.refresh([self.unownedKartList[self.curKart], -1, -1, -1, -1, -1, -1, -1, -1])
self.kartView.show()
return
def __handleKartChange(self, nDir):
self.curKart = (self.curKart + nDir) % self.numKarts
self.kartDescription.destroy()
self.kartCost.destroy()
self.showKart()
def destroy(self):
if self.initialize:
self.kartView.destroy()
DirectFrame.destroy(self)
示例2: BuyAccessoryDlg
# 需要导入模块: from toontown.shtiker.KartPage import KartViewer [as 别名]
# 或者: from toontown.shtiker.KartPage.KartViewer import refresh [as 别名]
#.........这里部分代码省略.........
if len(self.unownedAccDict[self.curAccType]) < 1:
self.curAccIndex[self.curAccType] = -1
else:
self.curAccIndex[self.curAccType] = (self.curAccIndex[self.curAccType] + nDir) % len(self.unownedAccDict[self.curAccType])
if hasattr(self, 'accDescription'):
self.accDescription.destroy()
self.accCost.destroy()
self.showAccessory()
def __handleAccessoryTypeChange(self, type):
self.curAccType = type
try:
self.accDescription.destroy()
self.accCost.destroy()
except:
pass
for b in self.accButtonsDict:
self.accButtonsDict[b]['state'] = DGG.NORMAL
self.accButtonsDict[self.curAccType]['state'] = DGG.DISABLED
self.showAccessory()
def showAccessory(self):
self.arrowRightButton['state'] = DGG.DISABLED
self.arrowLeftButton['state'] = DGG.DISABLED
self.buyAccessoryButton['state'] = DGG.DISABLED
self.accDescription = DirectButton(
parent=self,
relief=None,
scale=self.modelScale,
text='',
text_pos=(0, -.33),
text_scale=KS_TEXT_SIZE_SMALL,
pressEffect=False,
text_wordwrap=TTLocalizer.KSGaccDescriptionWordwrap,
textMayChange=True)
self.buyAccessoryButton.configure(text_fg=(0, 0, 0.0, 1.0))
self.buyAccessoryButton.configure(text=TTLocalizer.KartShop_BuyAccessory)
self.buyAccessoryButton.configure(text_scale=KS_TEXT_SIZE_SMALL)
self.buyAccessoryButton['state'] = DGG.NORMAL
if len(self.unownedAccDict[self.curAccType]) < 1:
self.kartView.setDNA(None)
self.kartView.hide()
self.accDescription.configure(text=TTLocalizer.KartShop_NoAvailableAcc)
self.buyAccessoryButton['state'] = DGG.DISABLED
else:
if self.curAccIndex[self.curAccType] + 1 < len(self.unownedAccDict[self.curAccType]):
self.arrowRightButton['state'] = DGG.NORMAL
if self.curAccIndex[self.curAccType] > 0:
self.arrowLeftButton['state'] = DGG.NORMAL
curDNA = None
curDNA = list(base.localAvatar.getKartDNA())
for d in xrange(len(curDNA)):
if d == KartDNA.bodyType or d == KartDNA.accColor or d == KartDNA.bodyColor:
continue
else:
curDNA[d] = -1
curAcc = self.unownedAccDict[self.curAccType][self.curAccIndex[self.curAccType]]
curDNA[self.curAccType] = curAcc
self.kartView.refresh(curDNA)
self.accDescription.configure(text=AccessoryDict[curAcc][KartInfo.name])
cost = TTLocalizer.KartShop_Cost % AccessoryDict[curAcc][KartInfo.cost]
self.accCost = DirectButton(
parent=self,
relief=None,
scale=self.modelScale,
text=cost,
text_pos=(0, -.4),
text_scale=KS_TEXT_SIZE_SMALL,
text_fg=(0, 0, 0.0, 1.0),
pressEffect=False,
textMayChange=True)
if AccessoryDict[curAcc][KartInfo.cost] > base.localAvatar.getTickets():
self.buyAccessoryButton['state'] = DGG.DISABLED
self.buyAccessoryButton.configure(text_scale=KS_TEXT_SIZE_SMALL * 0.75)
self.buyAccessoryButton.configure(text=TTLocalizer.KartShop_NotEnoughTickets)
self.accCost.configure(text_fg=(0.95, 0, 0.0, 1.0))
if len(base.localAvatar.getKartAccessoriesOwned()) >= KartShopGlobals.MAX_KART_ACC:
self.buyAccessoryButton['state'] = DGG.DISABLED
self.buyAccessoryButton.configure(text_fg=(0.95, 0, 0.0, 1.0))
self.buyAccessoryButton.configure(text_scale=KS_TEXT_SIZE_SMALL * 0.8)
self.buyAccessoryButton.configure(text=TTLocalizer.KartShop_FullTrunk)
self.kartView.show()
return
def destroy(self):
if self.initialize:
try:
self.accDescription.destroy()
except:
pass
try:
self.kartView.destroy()
except:
pass
DirectFrame.destroy(self)