本文整理汇总了Python中toontown.shtiker.KartPage.KartViewer类的典型用法代码示例。如果您正苦于以下问题:Python KartViewer类的具体用法?Python KartViewer怎么用?Python KartViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KartViewer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, doneEvent, kartNum):
self.kartNum = kartNum
self.modelScale = 1
model = loader.loadModel('phase_6/models/gui/ConfirmBuyKartPanel')
kartInfo = getKartTypeInfo(kartNum)
name = kartInfo[KartInfo.name]
cost = kartInfo[KartInfo.cost]
DirectFrame.__init__(
self,
relief=None,
state='normal',
geom=model,
geom_scale=self.modelScale,
frameSize=(-1, 1, -1, 1),
pos=(0, 0, -0.01),
text=TTLocalizer.KartShop_ConfirmBuy % (name, cost),
text_wordwrap=11,
text_scale=KS_TEXT_SIZE_SMALL,
text_pos=(0, -0.26))
self.initialiseoptions(KartShopGuiMgr.ConfirmBuyKartDlg)
self.ticketDisplay = DirectLabel(
parent=self,
relief=None,
text=str(base.localAvatar.getTickets()),
text_scale=KS_TEXT_SIZE_SMALL,
text_fg=(0.95, 0.95, 0.0, 1.0),
text_shadow=(0, 0, 0, 1),
text_pos=(0.43, -0.5),
text_font=ToontownGlobals.getSignFont())
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, [CBK_OPTIONS.Cancel]))
self.okButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/CheckButtonUp'), model.find('**/CheckButtonDown'), model.find('**/CheckButtonRollover')),
geom=model.find('**/CheckIcon'),
scale=self.modelScale,
pressEffect=False,
command=lambda : messenger.send(doneEvent, [CBK_OPTIONS.BuyKart]))
self.kartView = KartViewer([self.kartNum, -1, -1, -1, -1, -1, -1, -1, -1], parent=self)
self.kartView.setPos(model.find('**/KartViewerFrame').getPos())
self.kartView.load(model, 'KartViewerFrame', [], [], None)
self.kartView.setBounds(-0.38, 0.38, -.0425, 0.49)
self.kartView.setBgColor(1.0, 1.0, 0.8, 1.0)
self.initialize = True
self.kartView.show()
model.removeNode()
return
示例2: BuyKartDlg
class BuyKartDlg(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('KartShopGuiMgr.BuyKartDlg')
def __init__(self, doneEvent):
self.modelScale = 1
model = loader.loadModel('phase_6/models/gui/BuyKartPanel')
self.unownedKartList = KartDict.keys()
if base.localAvatar.hasKart():
k = base.localAvatar.getKartBodyType()
if k in self.unownedKartList:
self.unownedKartList.remove(k)
self.numKarts = len(self.unownedKartList)
self.curKart = 0
DirectFrame.__init__(
self,
relief=None,
state='normal',
geom=model,
geom_scale=self.modelScale,
frameSize=(-1, 1, -1, 1),
pos=(0, 0, -0.01),
text_wordwrap=26,
text_scale=KS_TEXT_SIZE_BIG,
text_pos=(0, 0))
self.initialiseoptions(KartShopGuiMgr.BuyKartDlg)
self.ticketDisplay = DirectLabel(
parent=self,
relief=None,
text=str(base.localAvatar.getTickets()),
text_scale=KS_TEXT_SIZE_SMALL,
text_fg=(0.95, 0.95, 0.0, 1.0),
text_shadow=(0, 0, 0, 1),
text_pos=(0.44, -0.55),
text_font=ToontownGlobals.getSignFont())
self.buyKartButton = DirectButton(
parent=self,
relief=None,
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,
#.........这里部分代码省略.........
示例3: BuyAccessoryDlg
#.........这里部分代码省略.........
KartDNA.ebType: self.eBlockAccButton,
KartDNA.spType: self.spoilerAccButton,
KartDNA.fwwType: self.frontAccButton,
KartDNA.bwwType: self.rearAccButton,
KartDNA.rimsType: self.rimAccButton,
KartDNA.decalType: self.decalAccButton,
KartDNA.bodyColor: self.paintAccButton}
self.buyAccessoryButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/BuyAccessoryButtonUp'), model.find('**/BuyAccessoryButtonDown'), model.find('**/BuyAccessoryButtonRollover'), model.find('**/BuyAccessoryButtonDisabled')),
scale=self.modelScale,
text=TTLocalizer.KartShop_BuyAccessory,
text_pos=(0, -.57),
text_scale=KS_TEXT_SIZE_SMALL,
pressEffect=False,
command=self.__handleBuyAccessory)
if not base.cr.isPaid():
def showTeaserPanel():
TeaserPanel(pageName='kartingAccessories')
self.buyAccessoryButton['command'] = showTeaserPanel
self.ownedAccList = base.localAvatar.getKartAccessoriesOwned()
while -1 in self.ownedAccList:
self.ownedAccList.remove(-1)
self.unownedAccDict = getAccessoryDictFromOwned(self.ownedAccList)
self.curAccType = KartDNA.ebType
self.curAccIndex = {}
for type in self.unownedAccDict:
self.curAccIndex[type] = 0
self.kartView = KartViewer(list(base.localAvatar.getKartDNA()), 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, 0)], ['rotate_left_up',
'rotate_left_down',
'rotate_left_roll',
'rotate_left_down',
(-.24, 0)], (0, 0))
self.kartView.setBounds(-0.38, 0.38, 0.044, 0.58)
self.kartView.setBgColor(1.0, 1.0, 0.87, 1.0)
self.initialize = True
self.showAccessory()
model.removeNode()
return
def __handleBuyAccessory(self):
accessoryID = self.unownedAccDict[self.curAccType][self.curAccIndex[self.curAccType]]
self.ownedAccList.append(accessoryID)
self.unownedAccDict = getAccessoryDictFromOwned(self.ownedAccList)
self.__handleAccessoryChange(0)
messenger.send(self.doneEvent, [accessoryID])
def __handleAccessoryChange(self, nDir):
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()
示例4: BoughtKartDlg
class BoughtKartDlg(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('KartShopGuiMgr.BoughtKartDlg')
def __init__(self, doneEvent, kartID):
self.modelScale = 1
model = loader.loadModel('phase_6/models/gui/BoughtKartPanel')
kartInfo = getKartTypeInfo(kartID)
name = kartInfo[KartInfo.name]
DirectFrame.__init__(
self,
relief=None,
state='normal',
geom=model,
geom_scale=self.modelScale,
frameSize=(-1, 1, -1, 1),
pos=(0, 0, -0.01),
text=TTLocalizer.KartShop_ConfirmBoughtTitle,
text_wordwrap=26,
text_scale=KS_TEXT_SIZE_SMALL,
text_pos=(0, -0.26))
self.initialiseoptions(KartShopGuiMgr.BoughtKartDlg)
self.ticketDisplay = DirectLabel(
parent=self,
relief=None,
text=str(base.localAvatar.getTickets()),
text_scale=KS_TEXT_SIZE_SMALL,
text_fg=(0.95, 0.95, 0.0, 1.0),
text_shadow=(0, 0, 0, 1),
text_pos=(0.43, -0.5),
text_font=ToontownGlobals.getSignFont())
self.okButton = DirectButton(
parent=self,
relief=None,
image=(model.find('**/CheckButtonUp'), model.find('**/CheckButtonDown'), model.find('**/CheckButtonRollover')),
geom=model.find('**/CheckIcon'),
scale=self.modelScale,
pressEffect=False,
command=lambda : messenger.send(doneEvent, [BTK_OPTIONS.Ok]))
self.kartView = KartViewer([kartID, -1, -1, -1, -1, -1, -1, -1, -1], parent=self)
self.kartView.setPos(model.find('**/KartViewerFrame').getPos())
self.kartView.load(model, 'KartViewerFrame', [], [])
self.kartView.setBounds(-0.38, 0.38, -.0425, 0.49)
self.kartView.setBgColor(1.0, 1.0, 0.8, 1.0)
self.kartView.show()
model.removeNode()
self.initialize = True
return
def destroy(self):
if self.initialize:
self.kartView.destroy()
DirectFrame.destroy(self)