Esempio n. 1
0
 def enterInvitation(self, *args):
     self.prevButton['state'] = DirectGuiGlobals.NORMAL
     self.nextButton.hide()
     defaultInviteTheme = PartyGlobals.InviteTheme.GenericMale
     if base.cr.newsManager.isHolidayRunning(ToontownGlobals.VICTORY_PARTY_HOLIDAY):
         defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty
     elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.KARTING_TICKETS_HOLIDAY) or base.cr.newsManager.isHolidayRunning(ToontownGlobals.GRAND_PRIX):
         defaultInviteTheme = PartyGlobals.InviteTheme.Racing
     elif base.cr.newsManager.isHolidayRunning(ToontownGlobals.VALENTOONS_DAY):
         defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons
     if self.partyInfo is not None:
         del self.partyInfo
     activityList = self.partyEditor.partyEditorGrid.getActivitiesOnGrid()
     decorationList = self.partyEditor.partyEditorGrid.getDecorationsOnGrid()
     endTime = self.partyTime + self.partyDuration
     self.partyInfo = PartyInfo(0, 0, self.partyTime.year, self.partyTime.month, self.partyTime.day, self.partyTime.hour, self.partyTime.minute, endTime.year, endTime.month, endTime.day, endTime.hour, endTime.minute, self.isPrivate, defaultInviteTheme, activityList, decorationList, 0)
     if self.noFriends or len(self.getInvitees()) == 0:
         self.inviteVisual.setNoFriends(True)
         self.invitationTitleLabel['text'] = TTLocalizer.PartyPlannerConfirmTitleNoFriends
         self.inviteButton['text'] = TTLocalizer.PartyPlannerInviteButtonNoFriends
         self.selectedInviteThemeLabel.stash()
         self.nextThemeButton.stash()
         self.prevThemeButton.stash()
         self.setInviteTheme(defaultInviteTheme)
     else:
         self.inviteVisual.setNoFriends(False)
         self.invitationTitleLabel['text'] = TTLocalizer.PartyPlannerConfirmTitle
         self.inviteButton['text'] = TTLocalizer.PartyPlannerInviteButton
         self.selectedInviteThemeLabel.unstash()
         self.nextThemeButton.unstash()
         self.prevThemeButton.unstash()
         self.setInviteTheme(defaultInviteTheme)
     self.inviteVisual.updateInvitation(base.localAvatar.getName(), self.partyInfo)
     self.invitationPage.show()
     return
Esempio n. 2
0
 def enterInvitation(self, *args):
     self.prevButton['state'] = DirectGuiGlobals.NORMAL
     self.nextButton.hide()
     defaultInviteTheme = PartyGlobals.InviteTheme.GenericMale
     if hasattr(base.cr, 'newsManager') and base.cr.newsManager:
         if ToontownGlobals.Holidays.VictoryPartyHoliday in base.cr.newsManager.getHolidayIdList(
         ):
             defaultInviteTheme = PartyGlobals.InviteTheme.VictoryParty
         elif ToontownGlobals.Holidays.KartingTicketsHoliday in base.cr.newsManager.getHolidayIdList(
         ) or ToontownGlobals.Holidays.CircuitRacingEvent in base.cr.newsManager.getHolidayIdList(
         ):
             defaultInviteTheme = PartyGlobals.InviteTheme.Racing
         elif ToontownGlobals.Holidays.ValentinesDay in base.cr.newsManager.getHolidayIdList(
         ):
             defaultInviteTheme = PartyGlobals.InviteTheme.Valentoons
     if self.partyInfo is not None:
         del self.partyInfo
     activityList = self.partyEditor.partyEditorGrid.getActivitiesOnGrid()
     decorationList = self.partyEditor.partyEditorGrid.getDecorationsOnGrid(
     )
     endTime = self.partyTime + self.partyDuration
     self.partyInfo = PartyInfo(0, 0, self.partyTime.year,
                                self.partyTime.month, self.partyTime.day,
                                self.partyTime.hour, self.partyTime.minute,
                                endTime.year, endTime.month, endTime.day,
                                endTime.hour, endTime.minute,
                                self.isPrivate, defaultInviteTheme,
                                activityList, decorationList, 0)
     if self.noFriends or len(self.getInvitees()) == 0:
         self.inviteVisual.setNoFriends(True)
         self.invitationTitleLabel[
             'text'] = TTLocalizer.PartyPlannerConfirmTitleNoFriends
         self.inviteButton[
             'text'] = TTLocalizer.PartyPlannerInviteButtonNoFriends
         self.selectedInviteThemeLabel.stash()
         self.nextThemeButton.stash()
         self.prevThemeButton.stash()
         self.setInviteTheme(defaultInviteTheme)
     else:
         self.inviteVisual.setNoFriends(False)
         self.invitationTitleLabel[
             'text'] = TTLocalizer.PartyPlannerConfirmTitle
         self.inviteButton['text'] = TTLocalizer.PartyPlannerInviteButton
         self.selectedInviteThemeLabel.unstash()
         self.nextThemeButton.unstash()
         self.prevThemeButton.unstash()
         self.setInviteTheme(defaultInviteTheme)
     self.inviteVisual.updateInvitation(base.localAvatar.getName(),
                                        self.partyInfo)
     self.invitationPage.show()
     return
Esempio n. 3
0
    def setPartyInfoTuple(self, partyInfoTuple):
        self.partyInfo = PartyInfo(*partyInfoTuple)
        self.loadDecorations()
        allActIds = [x.activityId for x in self.partyInfo.activityList]
        base.partyHasJukebox = (PartyGlobals.ActivityIds.PartyJukebox) in allActIds  \
                               or (PartyGlobals.ActivityIds.PartyJukebox40) in allActIds

        # Fill in a grid showing if a square has an activity or decoration on it
        # Note : This grid is the reverse y of the PartyEditorGrid
        # The difference might be down to where the origin makes the most sense in screen-space vs. world-space.
        self.grid = [[False, False, False, False, False, True, True, True, True, True, True, True, True, True, True, False, False, False],
                     [False, False, False, False, True, True, True, True, True, True, True, True, True, True, True, False, False, False],
                     [False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False],
                     [False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False],
                     [False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False],
                     [False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True],
                     [False, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, False, False],
                     [False, False, False, False, True, True, True, True, True, True, True, True, True, False, False, False, False, False],
                     [False, False, False, False, False, True, True, True, True, True, True, True, False, False, False, False, False, False],
                     [False, False, False, False, False, False, True, True, True, True, True, False, False, False, False, False, False, False],
                    ]

        # This uses essentially the same functionality as computeGridYRange and computeGridXRange.
        def fillGrid(x, y, size):
            for i in range(-size[1]/2+1, size[1]/2+1):
                for j in range(-size[0]/2+1, size[0]/2+1):
                    self.grid[i+y][j+x] = False

        for activityBase in self.partyInfo.activityList:
            fillGrid(activityBase.x, activityBase.y, PartyGlobals.ActivityInformationDict[activityBase.activityId]["gridsize"])

        for decorBase in self.partyInfo.decors:
            fillGrid(decorBase.x, decorBase.y, PartyGlobals.DecorationInformationDict[decorBase.decorId]["gridsize"])

        self.loadGrass()
    def setPartyInfoTuple(self, partyInfoTuple):
        self.partyInfo = PartyInfo(*partyInfoTuple)
        self.loadDecorations()
        allActIds = [ x.activityId for x in self.partyInfo.activityList ]
        base.partyHasJukebox = PartyGlobals.ActivityIds.PartyJukebox in allActIds or PartyGlobals.ActivityIds.PartyJukebox40 in allActIds
        self.grid = [[False,
          False,
          False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False],
         [False,
          False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False],
         [False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False],
         [False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False],
         [False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False],
         [False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True],
         [False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False,
          False],
         [False,
          False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False,
          False,
          False],
         [False,
          False,
          False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False,
          False,
          False,
          False],
         [False,
          False,
          False,
          False,
          False,
          False,
          True,
          True,
          True,
          True,
          True,
          False,
          False,
          False,
          False,
          False,
          False,
          False]]

        def fillGrid(x, y, size):
            for i in xrange(-size[1] / 2 + 1, size[1] / 2 + 1):
                for j in xrange(-size[0] / 2 + 1, size[0] / 2 + 1):
                    self.grid[i + y][j + x] = False

        for activityBase in self.partyInfo.activityList:
            fillGrid(activityBase.x, activityBase.y, PartyGlobals.ActivityInformationDict[activityBase.activityId]['gridsize'])

        for decorBase in self.partyInfo.decors:
            fillGrid(decorBase.x, decorBase.y, PartyGlobals.DecorationInformationDict[decorBase.decorId]['gridsize'])

        self.loadGrass()