本文整理汇总了Python中toontown.parties.PartyUtils类的典型用法代码示例。如果您正苦于以下问题:Python PartyUtils类的具体用法?Python PartyUtils怎么用?Python PartyUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PartyUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadInvitations
def loadInvitations(self):
EventsPage.notify.debug('loadInvitations')
self.selectedInvitationItem = None
self.invitationPartyList.removeAndDestroyAllItems()
self.invitationActivityList.removeAndDestroyAllItems()
self.invitePartyGoButton['state'] = DirectGuiGlobals.DISABLED
for partyInfo in base.localAvatar.partiesInvitedTo:
if partyInfo.status == PartyGlobals.PartyStatus.Cancelled or partyInfo.status == PartyGlobals.PartyStatus.Finished:
continue
inviteInfo = None
for inviteInfo in base.localAvatar.invites:
if partyInfo.partyId == inviteInfo.partyId:
break
if inviteInfo is None:
EventsPage.notify.error('No invitation info for party id %d' % partyInfo.partyId)
return
if inviteInfo.status == PartyGlobals.InviteStatus.NotRead:
continue
hostName = self.getToonNameFromAvId(partyInfo.hostId)
item = DirectButton(relief=None, text=hostName, text_align=TextNode.ALeft, text_bg=Vec4(0.0, 0.0, 0.0, 0.0), text_scale=0.045, textMayChange=True, command=self.invitePartyClicked)
PartyUtils.truncateTextOfLabelBasedOnWidth(item, hostName, PartyGlobals.EventsPageHostNameMaxWidth)
item['extraArgs'] = [item]
item.setPythonTag('activityIds', partyInfo.getActivityIds())
item.setPythonTag('partyStatus', partyInfo.status)
item.setPythonTag('hostId', partyInfo.hostId)
item.setPythonTag('startTime', partyInfo.startTime)
self.invitationPartyList.addItem(item)
return
示例2: __init__
def __init__(self, air, parent, activityTuple):
DistributedObjectAI.__init__(self, air)
self.parent = parent
x, y, h = activityTuple[1:] # ignore activity ID
self.x = PartyUtils.convertDistanceFromPartyGrid(x, 0)
self.y = PartyUtils.convertDistanceFromPartyGrid(y, 1)
self.h = h * PartyGlobals.PartyGridHeadingConverter
self.toonsPlaying = []
示例3: getCorrectRotation
def getCorrectRotation(self):
r = self.getR()
if r == 90.0:
r = 270.0
elif r == 270.0:
r = 90.0
if self.id == PartyGlobals.ActivityIds.PartyCannon:
return PartyUtils.convertDegreesToPartyGrid(r + 180.0)
return PartyUtils.convertDegreesToPartyGrid(r)
示例4: getGuestItem
def getGuestItem(self, name, inviteStatus):
label = DirectLabel(relief=None, text=name, text_scale=0.045, text_align=TextNode.ALeft, textMayChange=True)
dot = DirectFrame(relief=None, geom=self.hostingGui.find('**/questionMark'), pos=(0.5, 0.0, 0.01))
if inviteStatus == PartyGlobals.InviteStatus.Accepted:
dot['geom'] = (self.hostingGui.find('**/checkmark'),)
elif inviteStatus == PartyGlobals.InviteStatus.Rejected:
dot['geom'] = (self.hostingGui.find('**/x'),)
PartyUtils.truncateTextOfLabelBasedOnWidth(label, name, PartyGlobals.EventsPageGuestNameMaxWidth)
dot.reparentTo(label)
return label
示例5: enterTime
def enterTime(self, *args):
self.prevButton.show()
self.prevButton['state'] = DirectGuiGlobals.NORMAL
self.nextButton.show()
self.timePage.show()
self.timePageRecapToontownTimeLabel2['text'] = '%s' % PartyUtils.formatDateTime(self.partyTime)
self.timePageRecapLocalTimeLabel['text'] = '%s%s' % (TTLocalizer.PartyPlannerTimeLocalTime, PartyUtils.formatDateTime(self.partyTime, inLocalTime=True))
示例6: changeValue
def changeValue(self, amount):
if type == 'ampm':
self.alterPartyTime(hour=(self.partyTime.hour + 12) % 24)
newAmount = self.getCurrentAmPm()
label['text'] = newAmount
else:
if type == 'hour':
newAmount = getattr(self.partyTime, type) + amount
newAmount = newAmount % 12
if self.timeInputAmPmLabel['text'] == TTLocalizer.PartyTimeFormatMeridiemPM:
newAmount = newAmount % 12 + 12
self.alterPartyTime(hour=newAmount)
elif type == 'minute':
newAmount = getattr(self.partyTime, type) + amount
self.alterPartyTime(minute=newAmount)
else:
PartyPlanner.notify.error('Invalid type for changeValue in PartyPlanner: %s' % type)
newAmount = getattr(self.partyTime, type)
if newAmount < 10 and type == 'minute':
label['text'] = '0%d' % newAmount
else:
if type == 'hour':
newAmount = newAmount % 12
if newAmount == 0:
newAmount = 12
label['text'] = '%d' % newAmount
self.timePageRecapToontownTimeLabel2['text'] = '%s' % PartyUtils.formatDateTime(self.partyTime)
self.timePageRecapLocalTimeLabel['text'] = '%s%s' % (TTLocalizer.PartyPlannerTimeLocalTime, PartyUtils.formatDateTime(self.partyTime, inLocalTime=True))
示例7: load
def load(self):
if self.__loaded:
return
self.__timerPad = PartyUtils.getNewToontownTimer()
guiModel = 'phase_4/models/gui/cannon_game_gui'
guiNode = loader.loadModel(guiModel)
self.__aimPad = DirectFrame(image=guiNode.find('**/CannonFire_PAD'), relief=None, pos=(0.7, 0, -0.553333), scale=0.8)
guiNode.removeNode()
self.fireButton = DirectButton(parent=self.__aimPad, image=((guiModel, '**/Fire_Btn_UP'), (guiModel, '**/Fire_Btn_DN'), (guiModel, '**/Fire_Btn_RLVR')), relief=None, pos=(0.0115741, 0, 0.00505051), scale=1.0, command=self.__firePressed)
self.upButton = DirectButton(parent=self.__aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.0115741, 0, 0.221717))
self.downButton = DirectButton(parent=self.__aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.0136112, 0, -0.210101), image_hpr=(0, 0, 180))
self.leftButton = DirectButton(parent=self.__aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(-0.199352, 0, -0.000505269), image_hpr=(0, 0, -90))
self.rightButton = DirectButton(parent=self.__aimPad, image=((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief=None, pos=(0.219167, 0, -0.00101024), image_hpr=(0, 0, 90))
self.__aimPad.setColor(1, 1, 1, 0.9)
def bindButton(button, upHandler, downHandler):
button.bind(DGG.B1PRESS, lambda x, handler = upHandler: handler())
button.bind(DGG.B1RELEASE, lambda x, handler = downHandler: handler())
bindButton(self.upButton, self.__upPressed, self.__upReleased)
bindButton(self.downButton, self.__downPressed, self.__downReleased)
bindButton(self.leftButton, self.__leftPressed, self.__leftReleased)
bindButton(self.rightButton, self.__rightPressed, self.__rightReleased)
self.__loaded = True
return
示例8: loadGUI
def loadGUI(self):
self.gui = loader.loadModel('phase_13/models/parties/trampolineGUI')
self.gui.reparentTo(base.a2dTopLeft)
self.gui.setPos(0.115, 0, -1)
self.gui.hide()
self.toonIndicator = self.gui.find('**/trampolineGUI_MovingBar')
jumpLineLocator = self.gui.find('**/jumpLine_locator')
guiBean = self.gui.find('**/trampolineGUI_GreenJellyBean')
self.gui.find('**/trampolineGUI_GreenJellyBean').stash()
self.guiBeans = [ guiBean.instanceUnderNode(jumpLineLocator, self.uniqueName('guiBean%d' % i)) for i in xrange(self.numJellyBeans) ]
self.guiBeans[-1].setScale(1.5)
heightTextNode = TextNode(self.uniqueName('TrampolineActivity.heightTextNode'))
heightTextNode.setFont(ToontownGlobals.getSignFont())
heightTextNode.setAlign(TextNode.ALeft)
heightTextNode.setText('0.0')
heightTextNode.setShadow(0.05, 0.05)
heightTextNode.setShadowColor(0.0, 0.0, 0.0, 1.0)
heightTextNode.setTextColor(1.0, 1.0, 1.0, 1.0)
self.heightText = jumpLineLocator.attachNewNode(heightTextNode)
self.heightText.setX(0.15)
self.heightText.setScale(0.1)
self.heightText.setAlphaScale(0.0)
self.quitEarlyButtonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
quitEarlyUp = self.quitEarlyButtonModels.find('**//InventoryButtonUp')
quitEarlyDown = self.quitEarlyButtonModels.find('**/InventoryButtonDown')
quitEarlyRollover = self.quitEarlyButtonModels.find('**/InventoryButtonRollover')
self.quitEarlyButton = DirectButton(parent=base.a2dTopRight, relief=None, text=TTLocalizer.PartyTrampolineQuitEarlyButton, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.7, image=(quitEarlyUp, quitEarlyDown, quitEarlyRollover), image_color=(1, 0, 0, 1), image_scale=(20, 1, 11), pos=(-0.183, 0, -0.4), scale=0.09, command=self.leaveTrampoline)
self.quitEarlyButton.stash()
self.flashText = OnscreenText(text='', pos=(0.0, -0.45), scale=0.2, fg=(1.0, 1.0, 0.65, 1.0), align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
self.timer = PartyUtils.getNewToontownTimer()
self.timer.posInTopRightCorner()
return
示例9: releaseToon
def releaseToon(self):
self._hideFlashMessage()
self.ignore("arrow_left")
self.ignore("arrow_left-up")
self.ignore("arrow_right")
self.ignore("arrow_right-up")
taskMgr.remove(self.uniqueName("TrampolineActivity.updateTask"))
self.hopOffAnim = Sequence(
self.toon.hprInterval(0.5, VBase3(-90.0, 0.0, 0.0), other=self.tramp),
Func(self.toon.b_setAnimState, "jump", 1.0),
Func(self.toon.dropShadow.reparentTo, hidden),
Wait(0.4),
PartyUtils.arcPosInterval(0.75, self.toon, self.hopOffPos, 5.0, self.tramp),
Func(self.postHopOff),
)
self.hopOffAnim.start()
示例10: acquireToon
def acquireToon(self):
self.toon.disableSmartCameraViews()
self.toon.stopUpdateSmartCamera()
camera.wrtReparentTo(render)
self.toon.dropShadow.reparentTo(hidden)
self.toon.startPosHprBroadcast(period=0.2)
self.toonAcceleration = 0.0
self.toonVelocity = 0.0
self.topHeight = 0.0
self.trampB = self.normalTrampB
self.leavingTrampoline = False
self.hopOnAnim = Sequence(
Func(self.toon.b_setAnimState, "jump", 1.0),
Wait(0.4),
PartyUtils.arcPosInterval(0.75, self.toon, Point3(0.0, 0.0, self.trampHeight), 5.0, self.tramp),
Func(self.postHopOn),
)
self.hopOnAnim.start()
示例11: load
def load(self):
if self.isLoaded():
return
guiNode = loader.loadModel('phase_13/models/parties/jukeboxGUI')
self._timerGui = PartyUtils.getNewToontownTimer()
self._windowFrame = DirectFrame(image=guiNode.find('**/background'), relief=None, pos=(0, 0, 0), scale=0.7)
self._songFrame = DirectFrame(image=guiNode.find('**/songTitle_background'), parent=self._windowFrame, relief=None)
self._currentlyPlayingLabel = self.__createLabel(guiNode, 'currentlyPlaying', parent=self._windowFrame, text=TTLocalizer.JukeboxCurrentlyPlayingNothing, scale=TTLocalizer.JGcurrentlyPlayingLabel)
self._songNameLabel = self.__createLabel(guiNode, 'songName', parent=self._windowFrame, text=TTLocalizer.JukeboxCurrentSongNothing, scale=TTLocalizer.JGsongNameLabel)
self._queueList, self._queueLabel = self.__createLabeledScrolledList(guiNode, 'queue', label=TTLocalizer.JukeboxQueueLabel, parent=self._windowFrame)
self._songsList, self._songsLabel = self.__createLabeledScrolledList(guiNode, 'songs', label=TTLocalizer.JukeboxSongsLabel, parent=self._windowFrame)
pos = guiNode.find('**/addButton_text_locator').getPos()
self._addSongButton = self.__createButton(guiNode, 'addSongButton', parent=self._windowFrame, command=self.__handleAddSongButtonClick, image3_color=Vec4(0.6, 0.6, 0.6, 0.6), text=TTLocalizer.JukeboxAddSong, text_align=TextNode.ACenter, text_pos=(pos[0], pos[2]), text_scale=TTLocalizer.JGaddSongButton)
self._closeButton = self.__createButton(guiNode, 'can_cancelButton', parent=self._windowFrame, command=self.__handleCloseButtonClick)
pos = guiNode.find('**/close_text_locator').getPos()
self._closeButton = self.__createButton(guiNode, 'close', parent=self._windowFrame, command=self.__handleCloseButtonClick, text=TTLocalizer.JukeboxClose, text_align=TextNode.ACenter, text_pos=(pos[0], pos[2]), text_scale=0.08)
self._moveToTopButton = self.__createButton(guiNode, 'moveToTop', command=self.__handleMoveToTopButtonClick)
guiNode.removeNode()
self._loaded = True
示例12: load
def load(self):
buttonModels = loader.loadModel('phase_3.5/models/gui/inventory_gui')
upButton = buttonModels.find('**//InventoryButtonUp')
downButton = buttonModels.find('**/InventoryButtonDown')
rolloverButton = buttonModels.find('**/InventoryButtonRollover')
self.exitButton = DirectButton(relief=None, text=TTLocalizer.PartyTeamActivityExitButton, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.15), text_scale=0.5, image=(upButton, downButton, rolloverButton), image_color=(1, 0, 0, 1), image_scale=(14.5, 1, 9), pos=(0, 0, 0.8), scale=0.15, command=self.handleExitButtonClick)
self.exitButton.hide()
if self.activity.toonsCanSwitchTeams():
self.switchButton = DirectButton(relief=None, text=TTLocalizer.PartyTeamActivitySwitchTeamsButton, text_fg=(1, 1, 1, 1), text_pos=(0, 0.1), text_scale=0.5, image=(upButton, downButton, rolloverButton), image_color=(0, 1, 0, 1), image_scale=(15, 1, 15), pos=(0, 0, 0.5), scale=0.15, command=self.handleSwitchButtonClick)
self.switchButton.hide()
else:
self.switchButton = None
buttonModels.removeNode()
self.countdownText = OnscreenText(text='', pos=(0.0, -0.2), scale=PartyGlobals.TeamActivityTextScale * 1.2, fg=(1.0, 1.0, 0.65, 1.0), align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
self.countdownText.hide()
self.statusText = OnscreenText(text='', pos=(0.0, 0.0), scale=PartyGlobals.TeamActivityTextScale, fg=PartyGlobals.TeamActivityStatusColor, align=TextNode.ACenter, font=ToontownGlobals.getSignFont(), mayChange=True)
self.statusText.hide()
self.timer = PartyUtils.getNewToontownTimer()
self.timer.hide()
return
示例13: releaseToon
def releaseToon(self):
self._hideFlashMessage()
self.ignore(base.Move_Left)
self.ignore(base.Move_Left + '-up')
self.ignore(base.Move_Right)
self.ignore(base.Move_Right + '-up')
taskMgr.remove(self.uniqueName('TrampolineActivity.updateTask'))
self.hopOffAnim = Sequence(self.toon.hprInterval(0.5, VBase3(-90.0, 0.0, 0.0), other=self.tramp), Func(self.toon.b_setAnimState, 'jump', 1.0), Func(self.toon.dropShadow.reparentTo, hidden), Wait(0.4), PartyUtils.arcPosInterval(0.75, self.toon, self.hopOffPos, 5.0, self.tramp), Func(self.postHopOff))
self.hopOffAnim.start()
示例14: updateInvitation
def updateInvitation(self, hostsName, partyInfo):
self.partyInfo = partyInfo
hostsName = TTLocalizer.GetPossesive(hostsName)
self.whosePartyLabel['text'] = TTLocalizer.PartyPlannerInvitationWhoseSentence % hostsName
if self.partyInfo.isPrivate:
publicPrivateText = TTLocalizer.PartyPlannerPrivate.lower()
else:
publicPrivateText = TTLocalizer.PartyPlannerPublic.lower()
activities = self.getActivitiesFormattedCorrectly()
if self.noFriends:
self.activityTextLabel['text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentenceNoFriends % (publicPrivateText, activities)
else:
self.activityTextLabel['text'] = TTLocalizer.PartyPlannerInvitationThemeWhatSentence % (publicPrivateText, activities)
if self.noFriends:
self.whenTextLabel['text'] = TTLocalizer.PartyPlannerInvitationWhenSentenceNoFriends % (PartyUtils.formatDate(self.partyInfo.startTime.year, self.partyInfo.startTime.month, self.partyInfo.startTime.day), PartyUtils.formatTime(self.partyInfo.startTime.hour, self.partyInfo.startTime.minute))
else:
self.whenTextLabel['text'] = TTLocalizer.PartyPlannerInvitationWhenSentence % (PartyUtils.formatDate(self.partyInfo.startTime.year, self.partyInfo.startTime.month, self.partyInfo.startTime.day), PartyUtils.formatTime(self.partyInfo.startTime.hour, self.partyInfo.startTime.minute))
self.changeTheme(partyInfo.inviteTheme)
示例15: invitePartyClicked
def invitePartyClicked(self, item):
if item.getPythonTag('partyStatus') == PartyGlobals.PartyStatus.Started:
self.invitePartyGoButton['state'] = DirectGuiGlobals.NORMAL
else:
self.invitePartyGoButton['state'] = DirectGuiGlobals.DISABLED
if self.selectedInvitationItem is not None:
self.selectedInvitationItem['state'] = DirectGuiGlobals.NORMAL
self.selectedInvitationItem['text_bg'] = Vec4(0.0, 0.0, 0.0, 0.0)
self.selectedInvitationItem = item
self.selectedInvitationItem['state'] = DirectGuiGlobals.DISABLED
self.selectedInvitationItem['text_bg'] = Vec4(1.0, 1.0, 0.0, 1.0)
self.fillInviteActivityList(item.getPythonTag('activityIds'))
startTime = item.getPythonTag('startTime')
self.invitationDateTimeLabel['text'] = TTLocalizer.EventsPageInvitedTabTime % (PartyUtils.formatDate(startTime.year, startTime.month, startTime.day), PartyUtils.formatTime(startTime.hour, startTime.minute))
return