def unload(self):
     self.exitFLM()
     if self.avatarPanel:
         del self.avatarPanel
     FriendInviter.unloadFriendInviter()
     ToonAvatarDetailPanel.unloadAvatarDetail()
     ToonTeleportPanel.unloadTeleportPanel()
 def exitFLM(self):
     self.notify.debug("FriendsListManager: exitFLM()")
     if self._preserveFriendsList:
         return
     if not self._entered:
         return
     self._entered = False
     self.ignore("openFriendsList")
     self.ignore("clickedNametag")
     base.localAvatar.setFriendsListButtonActive(0)
     NametagGlobals.setMasterNametagsActive(0)
     if self.avatarPanel:
         self.avatarPanel.cleanup()
         self.avatarPanel = None
     self.ignore("gotoAvatar")
     self.ignore("friendAvatar")
     self.ignore("avatarDetails")
     FriendsListPanel.hideFriendsList()
     ToontownFriendSecret.hideFriendSecret()
     if base.cr.friendManager:
         base.cr.friendManager.setAvailable(0)
     self.ignore("friendInvitation")
     FriendInviter.hideFriendInviter()
     ToonAvatarDetailPanel.hideAvatarDetail()
     ToonTeleportPanel.hideTeleportPanel()
     return
Beispiel #3
0
 def exitFLM(self):
     self.notify.debug('FriendsListManager: exitFLM()')
     if self._preserveFriendsList:
         return
     if not self._entered:
         return
     self._entered = False
     self.ignore('openFriendsList')
     self.ignore('clickedNametag')
     self.ignore('clickedNametagPlayer')
     base.localAvatar.setFriendsListButtonActive(0)
     NametagGlobals.setMasterNametagsActive(0)
     if self.avatarPanel:
         self.avatarPanel.cleanup()
         self.avatarPanel = None
     self.ignore('gotoAvatar')
     self.ignore('friendAvatar')
     self.ignore('avatarDetails')
     self.ignore('playerDetails')
     FriendsListPanel.hideFriendsList()
     ToontownFriendSecret.hideFriendSecret()
     if base.cr.friendManager:
         base.cr.friendManager.setAvailable(0)
     self.ignore('friendInvitation')
     FriendInviter.hideFriendInviter()
     ToonAvatarDetailPanel.hideAvatarDetail()
     ToonTeleportPanel.hideTeleportPanel()
     return
Beispiel #4
0
 def exitFLM(self):
     self.notify.debug('FriendsListManager: exitFLM()')
     if self._preserveFriendsList:
         return
     if not self._entered:
         return
     self._entered = False
     self.ignore('openFriendsList')
     self.ignore('clickedNametag')
     self.ignore('clickedNametagPlayer')
     base.localAvatar.setFriendsListButtonActive(0)
     NametagGlobals.setWantActiveNametags(False)
     if self.avatarPanel:
         self.avatarPanel.cleanup()
         self.avatarPanel = None
     self.ignore('gotoAvatar')
     self.ignore('friendAvatar')
     self.ignore('avatarDetails')
     self.ignore('playerDetails')
     FriendsListPanel.hideFriendsList()
     ToontownFriendSecret.hideFriendSecret()
     if base.cr.friendManager:
         base.cr.friendManager.setAvailable(0)
     self.ignore('friendInvitation')
     FriendInviter.hideFriendInviter()
     ToonAvatarDetailPanel.hideAvatarDetail()
     ToonTeleportPanel.hideTeleportPanel()
     return
 def unload(self):
     self.exitFLM()
     if self.avatarPanel:
         del self.avatarPanel
     FriendInviter.unloadFriendInviter()
     ToonAvatarDetailPanel.unloadAvatarDetail()
     ToonTeleportPanel.unloadTeleportPanel()
     return
Beispiel #6
0
 def unload(self):
     #base.cr.friendManager.setGameSpecificFunction(None)
     self.exitFLM()
     if self.avatarPanel:
         del self.avatarPanel
     FriendInviter.unloadFriendInviter()
     ToonAvatarDetailPanel.unloadAvatarDetail()
     ToonTeleportPanel.unloadTeleportPanel()
 def __init__(self, avId, avName, avDisableName):
     DirectFrame.__init__(self, pos=(-1.033, 0.1, -0.35), parent=base.a2dTopRight, image_color=GlobalDialogColor, image_scale=(1.0, 1.0, 0.6), text='', text_wordwrap=TTLocalizer.FIdirectFrameWordwrap, text_scale=TTLocalizer.FIdirectFrame, text_pos=TTLocalizer.FIdirectFramePos)
     self['image'] = DGG.getDefaultDialogGeom()
     self.avId = avId
     self.toonName = avName
     avatar = base.cr.doId2do.get(self.avId)
     self.avDisableName = avDisableName
     self.fsm = ClassicFSM.ClassicFSM('FriendInviter', [State.State('off', self.enterOff, self.exitOff),
      State.State('getNewFriend', self.enterGetNewFriend, self.exitGetNewFriend),
      State.State('begin', self.enterBegin, self.exitBegin),
      State.State('check', self.enterCheck, self.exitCheck),
      State.State('tooMany', self.enterTooMany, self.exitTooMany),
      State.State('checkAvailability', self.enterCheckAvailability, self.exitCheckAvailability),
      State.State('notAvailable', self.enterNotAvailable, self.exitNotAvailable),
      State.State('notAcceptingFriends', self.enterNotAcceptingFriends, self.exitNotAcceptingFriends),
      State.State('wentAway', self.enterWentAway, self.exitWentAway),
      State.State('already', self.enterAlready, self.exitAlready),
      State.State('askingCog', self.enterAskingCog, self.exitAskingCog),
      State.State('askingPet', self.enterAskingPet, self.exitAskingPet),
      State.State('endFriendship', self.enterEndFriendship, self.exitEndFriendship),
      State.State('friendsNoMore', self.enterFriendsNoMore, self.exitFriendsNoMore),
      State.State('self', self.enterSelf, self.exitSelf),
      State.State('ignored', self.enterIgnored, self.exitIgnored),
      State.State('asking', self.enterAsking, self.exitAsking),
      State.State('yes', self.enterYes, self.exitYes),
      State.State('no', self.enterNo, self.exitNo),
      State.State('otherTooMany', self.enterOtherTooMany, self.exitOtherTooMany),
      State.State('maybe', self.enterMaybe, self.exitMaybe),
      State.State('down', self.enterDown, self.exitDown),
      State.State('cancel', self.enterCancel, self.exitCancel)], 'off', 'off')
     self.context = None
     from toontown.toon import ToonAvatarDetailPanel
     ToonTeleportPanel.hideTeleportPanel()
     ToonAvatarDetailPanel.hideAvatarDetail()
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
     self.bOk = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=OTPLocalizer.FriendInviterOK, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, 0.0, -0.1), command=self.__handleOk)
     self.bOk.hide()
     self.bCancel = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), relief=None, text=OTPLocalizer.FriendInviterCancel, text_scale=0.05, text_pos=(0.0, -0.1), pos=TTLocalizer.FIbCancelPos, command=self.__handleCancel)
     self.bCancel.hide()
     self.bStop = DirectButton(self, image=(gui.find('**/Ignore_Btn_UP'), gui.find('**/Ignore_Btn_DN'), gui.find('**/Ignore_Btn_RLVR')), relief=None, text=OTPLocalizer.FriendInviterStopBeingFriends, text_align=TextNode.ALeft, text_scale=TTLocalizer.FIbStop, text_pos=TTLocalizer.FIbStopTextPos, pos=TTLocalizer.FIbStopPos, command=self.__handleStop)
     self.bStop.hide()
     self.bYes = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=OTPLocalizer.FriendInviterYes, text_scale=0.05, text_pos=(0.0, -0.1), pos=TTLocalizer.FIbYesPos, command=self.__handleYes)
     self.bYes.hide()
     self.bNo = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), relief=None, text=OTPLocalizer.FriendInviterNo, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.15, 0.0, -0.1), command=self.__handleNo)
     self.bNo.hide()
     self.bToon = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.FriendInviterToon, text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.35, 0.0, -0.05), command=self.__handleToon)
     toonText = DirectLabel(parent=self, relief=None, pos=Vec3(0.35, 0, -0.2), text='Hello niggers', text_fg=(0, 0, 0, 1), text_pos=(0, 0), text_scale=0.045, text_align=TextNode.ACenter)
     toonText.reparentTo(self.bToon.stateNodePath[2])
     self.bToon.hide()
     buttons.removeNode()
     gui.removeNode()
     self.fsm.enterInitialState()
     if self.avId == None:
         self.fsm.request('getNewFriend')
     else:
         self.fsm.request('begin')
     return
Beispiel #8
0
 def unload(self):
     #base.cr.friendManager.setGameSpecificFunction(None)
     self.exitFLM()
     if self.avatarPanel:
         del self.avatarPanel
     FriendInviter.unloadFriendInviter()
     ToonAvatarDetailPanel.unloadAvatarDetail()
     ToonTeleportPanel.unloadTeleportPanel()
     return
Beispiel #9
0
    def exitFLM(self):
        self.notify.debug("FriendsListManager: exitFLM()")
        # check to see if we're staying active over a Place state transition

        if self._preserveFriendsList:
            return

        if not self._entered:
            return

        self._entered = False
        
        # Put away the friends list
        self.ignore("openFriendsList")
        self.ignore("clickedNametag")
        self.ignore("clickedNametagPlayer")
        base.localAvatar.setFriendsListButtonActive(0)

        # Since we're no longer listening for the click event, make the
        # nametags not be clickable.
        NametagGlobals.setMasterNametagsActive(0)

        # Put away the avatar panel
        if self.avatarPanel:
            self.avatarPanel.cleanup()
            self.avatarPanel = None
        self.ignore("gotoAvatar")
        self.ignore("friendAvatar")
        self.ignore("avatarDetails")
        self.ignore("playerDetails")

        # And the friends list panel
        FriendsListPanel.hideFriendsList()

        # Put away the Secrets panel
        ToontownFriendSecret.hideFriendSecret()

        # No longer interested in invitations from friends
        if base.cr.friendManager:
            base.cr.friendManager.setAvailable(0)
        self.ignore("friendInvitation")

        # Close these auxiliary panels, if they are open.
        FriendInviter.hideFriendInviter()
        ToonAvatarDetailPanel.hideAvatarDetail()
        ToonTeleportPanel.hideTeleportPanel()
Beispiel #10
0
    def cleanup(self):
        if not hasattr(self, 'frame') or self.frame == None:
            return
        self.notify.debug('Clean up toon panel, avId=%d' % self.avId)
        if self.frame:
            self.frame.destroy()
            del self.frame
        self.frame = None
        ToonAvatarDetailPanel.unloadAvatarDetail()
        if self.groupButton:
            self.groupButton.destroy()
            del self.groupButton
        self.groupButton = None
        if self.boardingInfoButton:
            self.boardingInfoButton.destroy()
            del self.boardingInfoButton
        self.boardingInfoButton = None
        if self.boardingInfoText:
            self.boardingInfoText.destroy()
            del self.boardingInfoText
        self.boardingInfoText = None
        if self.groupFrame:
            self.groupFrame.destroy()
            del self.groupFrame
        self.groupFrame = None
        self.head.removeNode()
        del self.head
        self.headModel.stopBlink()
        self.headModel.stopLookAroundNow()
        self.headModel.delete()
        del self.headModel
        base.localAvatar.obscureFriendsListButton(-1)
        self.laffMeter = None
        self.ignore('updateLaffMeter')
        self.ignoreAll()
        if hasattr(self.avatar, 'bFake') and self.avatar.bFake:
            self.avatar.delete()

        base.setCellsActive([base.rightCells[0]], 1)
        AvatarPanelBase.AvatarPanelBase.cleanup(self)
 def __init__(self, avId, avName, avDisableName):
     DirectFrame.__init__(self, pos=(-1.01, 0.1, -0.35), parent=base.a2dTopRight, image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.0, 1.0, 0.6), text='', text_wordwrap=13.5, text_scale=0.06, text_pos=(0.0, 0.18))
     messenger.send('releaseDirector')
     self['image'] = DGG.getDefaultDialogGeom()
     self.avId = avId
     self.avName = avName
     self.avDisableName = avDisableName
     self.fsm = ClassicFSM.ClassicFSM('ToonTeleportPanel', [State.State('off', self.enterOff, self.exitOff),
      State.State('begin', self.enterBegin, self.exitBegin),
      State.State('checkAvailability', self.enterCheckAvailability, self.exitCheckAvailability),
      State.State('notAvailable', self.enterNotAvailable, self.exitNotAvailable),
      State.State('ignored', self.enterIgnored, self.exitIgnored),
      State.State('notOnline', self.enterNotOnline, self.exitNotOnline),
      State.State('wentAway', self.enterWentAway, self.exitWentAway),
      State.State('self', self.enterSelf, self.exitSelf),
      State.State('unknownHood', self.enterUnknownHood, self.exitUnknownHood),
      State.State('unavailableHood', self.enterUnavailableHood, self.exitUnavailableHood),
      State.State('otherShard', self.enterOtherShard, self.exitOtherShard),
      State.State('teleport', self.enterTeleport, self.exitTeleport)], 'off', 'off')
     from toontown.friends import FriendInviter
     FriendInviter.hideFriendInviter()
     from toontown.toon import ToonAvatarDetailPanel
     ToonAvatarDetailPanel.hideAvatarDetail()
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     self.bOk = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.TeleportPanelOK, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, 0.0, -0.1), command=self.__handleOk)
     self.bOk.hide()
     self.bCancel = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), relief=None, text=TTLocalizer.TeleportPanelCancel, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.0, 0.0, -0.1), command=self.__handleCancel)
     self.bCancel.hide()
     self.bYes = DirectButton(self, image=(buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')), relief=None, text=TTLocalizer.TeleportPanelYes, text_scale=0.05, text_pos=(0.0, -0.1), pos=(-0.15, 0.0, -0.15), command=self.__handleYes)
     self.bYes.hide()
     self.bNo = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), relief=None, text=TTLocalizer.TeleportPanelNo, text_scale=0.05, text_pos=(0.0, -0.1), pos=(0.15, 0.0, -0.15), command=self.__handleNo)
     self.bNo.hide()
     buttons.removeNode()
     self.accept(self.avDisableName, self.__handleDisableAvatar)
     self.show()
     self.fsm.enterInitialState()
     self.fsm.request('begin')
Beispiel #12
0
 def __handleAvatarDetails(self, avId, avName, playerId=None):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName, playerId)
Beispiel #13
0
 def __handleAvatarDetails(self, avId, avName, playerId = None):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName, playerId)
Beispiel #14
0
 def __init__(self, avId, avName, avDisableName):
     self.wantPlayerFriends = base.config.GetBool('want-player-friends', 0)
     DirectFrame.__init__(self,
                          pos=(-1.033, 0.1, -0.35),
                          parent=base.a2dTopRight,
                          image_color=GlobalDialogColor,
                          image_scale=(1.0, 1.0, 0.6),
                          text='',
                          text_wordwrap=TTLocalizer.FIdirectFrameWordwrap,
                          text_scale=TTLocalizer.FIdirectFrame,
                          text_pos=TTLocalizer.FIdirectFramePos)
     self['image'] = DGG.getDefaultDialogGeom()
     self.avId = avId
     self.toonName = avName
     avatar = base.cr.doId2do.get(self.avId)
     self.playerId = None
     self.playerName = None
     if avatar:
         self.playerId = avatar.DISLid
         self.playerName = avatar.DISLname + ' ' + str(avatar.DISLid)
     self.avDisableName = avDisableName
     self.playerFriend = 0
     self.fsm = ClassicFSM.ClassicFSM('FriendInviter', [
         State.State('off', self.enterOff, self.exitOff),
         State.State('getNewFriend', self.enterGetNewFriend,
                     self.exitGetNewFriend),
         State.State('begin', self.enterBegin, self.exitBegin),
         State.State('check', self.enterCheck, self.exitCheck),
         State.State('tooMany', self.enterTooMany, self.exitTooMany),
         State.State('checkAvailability', self.enterCheckAvailability,
                     self.exitCheckAvailability),
         State.State('notAvailable', self.enterNotAvailable,
                     self.exitNotAvailable),
         State.State('notAcceptingFriends', self.enterNotAcceptingFriends,
                     self.exitNotAcceptingFriends),
         State.State('wentAway', self.enterWentAway, self.exitWentAway),
         State.State('already', self.enterAlready, self.exitAlready),
         State.State('askingCog', self.enterAskingCog, self.exitAskingCog),
         State.State('askingPet', self.enterAskingPet, self.exitAskingPet),
         State.State('endFriendship', self.enterEndFriendship,
                     self.exitEndFriendship),
         State.State('friendsNoMore', self.enterFriendsNoMore,
                     self.exitFriendsNoMore),
         State.State('self', self.enterSelf, self.exitSelf),
         State.State('ignored', self.enterIgnored, self.exitIgnored),
         State.State('asking', self.enterAsking, self.exitAsking),
         State.State('yes', self.enterYes, self.exitYes),
         State.State('no', self.enterNo, self.exitNo),
         State.State('otherTooMany', self.enterOtherTooMany,
                     self.exitOtherTooMany),
         State.State('maybe', self.enterMaybe, self.exitMaybe),
         State.State('down', self.enterDown, self.exitDown),
         State.State('cancel', self.enterCancel, self.exitCancel)
     ], 'off', 'off')
     self.context = None
     from toontown.toon import ToonAvatarDetailPanel
     ToonTeleportPanel.hideTeleportPanel()
     ToonAvatarDetailPanel.hideAvatarDetail()
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
     self.bOk = DirectButton(self,
                             image=(buttons.find('**/ChtBx_OKBtn_UP'),
                                    buttons.find('**/ChtBx_OKBtn_DN'),
                                    buttons.find('**/ChtBx_OKBtn_Rllvr')),
                             relief=None,
                             text=OTPLocalizer.FriendInviterOK,
                             text_scale=0.05,
                             text_pos=(0.0, -0.1),
                             pos=(0.0, 0.0, -0.1),
                             command=self.__handleOk)
     self.bOk.hide()
     self.bCancel = DirectButton(self,
                                 image=(buttons.find('**/CloseBtn_UP'),
                                        buttons.find('**/CloseBtn_DN'),
                                        buttons.find('**/CloseBtn_Rllvr')),
                                 relief=None,
                                 text=OTPLocalizer.FriendInviterCancel,
                                 text_scale=0.05,
                                 text_pos=(0.0, -0.1),
                                 pos=TTLocalizer.FIbCancelPos,
                                 command=self.__handleCancel)
     self.bCancel.hide()
     self.bStop = DirectButton(
         self,
         image=(gui.find('**/Ignore_Btn_UP'), gui.find('**/Ignore_Btn_DN'),
                gui.find('**/Ignore_Btn_RLVR')),
         relief=None,
         text=OTPLocalizer.FriendInviterStopBeingFriends,
         text_align=TextNode.ALeft,
         text_scale=TTLocalizer.FIbStop,
         text_pos=TTLocalizer.FIbStopTextPos,
         pos=TTLocalizer.FIbStopPos,
         command=self.__handleStop)
     self.bStop.hide()
     self.bYes = DirectButton(self,
                              image=(buttons.find('**/ChtBx_OKBtn_UP'),
                                     buttons.find('**/ChtBx_OKBtn_DN'),
                                     buttons.find('**/ChtBx_OKBtn_Rllvr')),
                              relief=None,
                              text=OTPLocalizer.FriendInviterYes,
                              text_scale=0.05,
                              text_pos=(0.0, -0.1),
                              pos=TTLocalizer.FIbYesPos,
                              command=self.__handleYes)
     self.bYes.hide()
     self.bNo = DirectButton(self,
                             image=(buttons.find('**/CloseBtn_UP'),
                                    buttons.find('**/CloseBtn_DN'),
                                    buttons.find('**/CloseBtn_Rllvr')),
                             relief=None,
                             text=OTPLocalizer.FriendInviterNo,
                             text_scale=0.05,
                             text_pos=(0.0, -0.1),
                             pos=(0.15, 0.0, -0.1),
                             command=self.__handleNo)
     self.bNo.hide()
     self.bToon = DirectButton(self,
                               image=(buttons.find('**/ChtBx_OKBtn_UP'),
                                      buttons.find('**/ChtBx_OKBtn_DN'),
                                      buttons.find('**/ChtBx_OKBtn_Rllvr')),
                               relief=None,
                               text=TTLocalizer.FriendInviterToon,
                               text_scale=0.05,
                               text_pos=(0.0, -0.1),
                               pos=(-0.35, 0.0, -0.05),
                               command=self.__handleToon)
     toonText = DirectLabel(parent=self,
                            relief=None,
                            pos=Vec3(0.35, 0, -0.2),
                            text=TTLocalizer.FriendInviterToonFriendInfo,
                            text_fg=(0, 0, 0, 1),
                            text_pos=(0, 0),
                            text_scale=0.045,
                            text_align=TextNode.ACenter)
     toonText.reparentTo(self.bToon.stateNodePath[2])
     self.bToon.hide()
     self.bPlayer = DirectButton(
         self,
         image=(buttons.find('**/ChtBx_OKBtn_UP'),
                buttons.find('**/ChtBx_OKBtn_DN'),
                buttons.find('**/ChtBx_OKBtn_Rllvr')),
         relief=None,
         text=TTLocalizer.FriendInviterPlayer,
         text_scale=0.05,
         text_pos=(0.0, -0.1),
         pos=(0.0, 0.0, -0.05),
         command=self.__handlePlayer)
     playerText = DirectLabel(
         parent=self,
         relief=None,
         pos=Vec3(0, 0, -0.2),
         text=TTLocalizer.FriendInviterPlayerFriendInfo,
         text_fg=(0, 0, 0, 1),
         text_pos=(0, 0),
         text_scale=0.045,
         text_align=TextNode.ACenter)
     playerText.reparentTo(self.bPlayer.stateNodePath[2])
     self.bPlayer.hide()
     buttons.removeNode()
     gui.removeNode()
     self.fsm.enterInitialState()
     if self.avId == None:
         self.fsm.request('getNewFriend')
     else:
         self.fsm.request('begin')
Beispiel #15
0
    def __init__(self, avId, avName, avDisableName):

        # config player friends off until PAM templates integrate with the website
        self.wantPlayerFriends = base.config.GetBool('want-player-friends', 0)

        # initialize our base class.
        DirectFrame.__init__(
            self,
            pos = (0.3, 0.1, 0.65),
            image_color = GlobalDialogColor,
            image_scale = (1.0, 1.0, 0.6),
            text = '',
            text_wordwrap = TTLocalizer.FIdirectFrameTextWorkWrap,
            text_scale = TTLocalizer.FIdialog,
            text_pos = (0.0, TTLocalizer.FIdirectFrameTextPosZ),
            )

        # For some reason, we need to set this after construction to
        # get it to work properly.
        self['image'] = DGG.getDefaultDialogGeom()

        self.avId = avId
        self.toonName = avName
        avatar = base.cr.doId2do.get(self.avId)
        self.playerId = None
        self.playerName = None

        if avatar:
            # todo: what if these aren't defined?
            self.playerId = avatar.DISLid
            # todo: why do we need to do this?
            self.playerName = avatar.DISLname + " " + str(avatar.DISLid)
        self.avDisableName = avDisableName

        # set this if we want to make a player/account friend
        self.playerFriend = 0

        self.fsm = ClassicFSM.ClassicFSM('FriendInviter',
                           [State.State('off',
                                        self.enterOff,
                                        self.exitOff),
                            State.State('getNewFriend',
                                        self.enterGetNewFriend,
                                        self.exitGetNewFriend),
                            State.State('begin',
                                        self.enterBegin,
                                        self.exitBegin),
                            State.State('check',
                                        self.enterCheck,
                                        self.exitCheck),
                            State.State('tooMany',
                                        self.enterTooMany,
                                        self.exitTooMany),
                            State.State('checkAvailability',
                                        self.enterCheckAvailability,
                                        self.exitCheckAvailability),
                            State.State('notAvailable',
                                        self.enterNotAvailable,
                                        self.exitNotAvailable),
                            State.State('notAcceptingFriends',
                                        self.enterNotAcceptingFriends,
                                        self.exitNotAcceptingFriends),
                            State.State('wentAway',
                                        self.enterWentAway,
                                        self.exitWentAway),
                            State.State('already',
                                        self.enterAlready,
                                        self.exitAlready),
                            State.State('askingCog',
                                        self.enterAskingCog,
                                        self.exitAskingCog),
                            State.State('askingPet',
                                        self.enterAskingPet,
                                        self.exitAskingPet),
                            State.State('endFriendship',
                                        self.enterEndFriendship,
                                        self.exitEndFriendship),
                            State.State('friendsNoMore',
                                        self.enterFriendsNoMore,
                                        self.exitFriendsNoMore),
                            State.State('self',
                                        self.enterSelf,
                                        self.exitSelf),
                            State.State('ignored',
                                        self.enterIgnored,
                                        self.exitIgnored),
                            State.State('asking',
                                        self.enterAsking,
                                        self.exitAsking),
                            State.State('yes',
                                        self.enterYes,
                                        self.exitYes),
                            State.State('no',
                                        self.enterNo,
                                        self.exitNo),
                            State.State('otherTooMany',
                                        self.enterOtherTooMany,
                                        self.exitOtherTooMany),
                            State.State('maybe',
                                        self.enterMaybe,
                                        self.exitMaybe),
                            State.State('down',
                                        self.enterDown,
                                        self.exitDown),
                            State.State('cancel',
                                        self.enterCancel,
                                        self.exitCancel),
                            ],
                           # Initial State
                           'off',
                           # Final State
                           'off',
                           )

        # This will be filled in with the active context, when we are
        # in states that have a context.
        self.context = None

        # This is imported here instead of at the top of the file to
        # protect against circular imports.
        from toontown.toon import ToonAvatarDetailPanel

        # Now set up the panel.
        ToonTeleportPanel.hideTeleportPanel()
        ToonAvatarDetailPanel.hideAvatarDetail()

        # Create some buttons.
        buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
        gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')

        self.bOk = DirectButton(
            self,
            image = (buttons.find('**/ChtBx_OKBtn_UP'),
                     buttons.find('**/ChtBx_OKBtn_DN'),
                     buttons.find('**/ChtBx_OKBtn_Rllvr')),
            relief = None,
            text = OTPLocalizer.FriendInviterOK,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (0.0, 0.0, -0.1),
            command = self.__handleOk
            )
        self.bOk.hide()

        self.bCancel = DirectButton(
            self,
            image = (buttons.find('**/CloseBtn_UP'),
                     buttons.find('**/CloseBtn_DN'),
                     buttons.find('**/CloseBtn_Rllvr')),
            relief = None,
            text = OTPLocalizer.FriendInviterCancel,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (TTLocalizer.FIcancelButtonPositionX, 0.0, -0.1),
            command = self.__handleCancel
            )
        self.bCancel.hide()

        self.bStop = DirectButton(
            self,
            image = (gui.find('**/Ignore_Btn_UP'),
                     gui.find('**/Ignore_Btn_DN'),
                     gui.find('**/Ignore_Btn_RLVR')),
            relief = None,
            text = OTPLocalizer.FriendInviterStopBeingFriends,
            text_align = TextNode.ALeft,
            text_scale = TTLocalizer.FIstopButton,
            text_pos = (0.075, TTLocalizer.FIstopTextPositionY),
            pos = (TTLocalizer.FIstopButtonPositionX, 0.0, 0.05),
            command = self.__handleStop
            )
        self.bStop.hide()

        self.bYes = DirectButton(
            self,
            image = (buttons.find('**/ChtBx_OKBtn_UP'),
                     buttons.find('**/ChtBx_OKBtn_DN'),
                     buttons.find('**/ChtBx_OKBtn_Rllvr')),
            relief = None,
            text = OTPLocalizer.FriendInviterYes,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (TTLocalizer.FIyesButtonPositionX, 0.0, -0.1),
            command = self.__handleYes
            )
        self.bYes.hide()

        self.bNo = DirectButton(
            self,
            image = (buttons.find('**/CloseBtn_UP'),
                     buttons.find('**/CloseBtn_DN'),
                     buttons.find('**/CloseBtn_Rllvr')),
            relief = None,
            text = OTPLocalizer.FriendInviterNo,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (0.15, 0.0, -0.1),
            command = self.__handleNo
            )
        self.bNo.hide()

        # make an avatar friend
        self.bToon = DirectButton(
            self,
            image = (buttons.find('**/ChtBx_OKBtn_UP'),
                     buttons.find('**/ChtBx_OKBtn_DN'),
                     buttons.find('**/ChtBx_OKBtn_Rllvr')),
            relief = None,
            text = TTLocalizer.FriendInviterToon,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (-0.35, 0.0, -0.05),
            command = self.__handleToon
            )

        # make a label to show feature desc on rollover
        toonText = DirectLabel(
            parent = self,
            relief = None,
            pos = Vec3(0.35, 0, -0.2),
            text = TTLocalizer.FriendInviterToonFriendInfo,
            text_fg = (0, 0, 0, 1),
            text_pos = (0, 0),
            text_scale = 0.045,
            text_align = TextNode.ACenter,
            )
        toonText.reparentTo(self.bToon.stateNodePath[2])

        self.bToon.hide()

        # make an account friend
        self.bPlayer = DirectButton(
            self,
            image = (buttons.find('**/ChtBx_OKBtn_UP'),
                     buttons.find('**/ChtBx_OKBtn_DN'),
                     buttons.find('**/ChtBx_OKBtn_Rllvr')),
            relief = None,
            text = TTLocalizer.FriendInviterPlayer,
            text_scale = 0.05,
            text_pos = (0.0, -0.1),
            pos = (0.0, 0.0, -0.05),
            command = self.__handlePlayer
            )

        # make a label to show feature desc on rollover
        playerText = DirectLabel(
            parent = self,
            relief = None,
            pos = Vec3(0, 0, -0.2),
            text = TTLocalizer.FriendInviterPlayerFriendInfo,
            text_fg = (0, 0, 0, 1),
            text_pos = (0, 0),
            text_scale = 0.045,
            text_align = TextNode.ACenter,
            )
        playerText.reparentTo(self.bPlayer.stateNodePath[2])

        self.bPlayer.hide()

        buttons.removeNode()
        gui.removeNode()

        self.fsm.enterInitialState()

        if self.avId == None:
            # If we don't have an initial avatar ID, make the user
            # indicate one.
            self.fsm.request('getNewFriend')
        else:
            self.fsm.request('begin')
Beispiel #16
0
 def _FriendsListManager__handleAvatarDetails(self,
                                              avId,
                                              avName,
                                              playerId=None):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName, playerId)
    def __init__(self, avId, avName, avDisableName):
        DirectFrame.__init__(
            self,
            pos=(-1.033, 0.1, -0.35),
            parent=base.a2dTopRight,
            image_color=GlobalDialogColor,
            image_scale=(1.0, 1.0, 0.6),
            text="",
            text_wordwrap=TTLocalizer.FIdirectFrameWordwrap,
            text_scale=TTLocalizer.FIdirectFrame,
            text_pos=TTLocalizer.FIdirectFramePos,
        )
        self["image"] = DGG.getDefaultDialogGeom()
        self.avId = avId
        self.toonName = avName
        avatar = base.cr.doId2do.get(self.avId)
        self.avDisableName = avDisableName
        self.fsm = ClassicFSM.ClassicFSM(
            "FriendInviter",
            [
                State.State("off", self.enterOff, self.exitOff),
                State.State("getNewFriend", self.enterGetNewFriend, self.exitGetNewFriend),
                State.State("check", self.enterCheck, self.exitCheck),
                State.State("tooMany", self.enterTooMany, self.exitTooMany),
                State.State("checkAvailability", self.enterCheckAvailability, self.exitCheckAvailability),
                State.State("notAvailable", self.enterNotAvailable, self.exitNotAvailable),
                State.State("notAcceptingFriends", self.enterNotAcceptingFriends, self.exitNotAcceptingFriends),
                State.State("wentAway", self.enterWentAway, self.exitWentAway),
                State.State("already", self.enterAlready, self.exitAlready),
                State.State("askingCog", self.enterAskingCog, self.exitAskingCog),
                State.State("askingPet", self.enterAskingPet, self.exitAskingPet),
                State.State("endFriendship", self.enterEndFriendship, self.exitEndFriendship),
                State.State("friendsNoMore", self.enterFriendsNoMore, self.exitFriendsNoMore),
                State.State("self", self.enterSelf, self.exitSelf),
                State.State("ignored", self.enterIgnored, self.exitIgnored),
                State.State("asking", self.enterAsking, self.exitAsking),
                State.State("yes", self.enterYes, self.exitYes),
                State.State("no", self.enterNo, self.exitNo),
                State.State("otherTooMany", self.enterOtherTooMany, self.exitOtherTooMany),
                State.State("maybe", self.enterMaybe, self.exitMaybe),
                State.State("down", self.enterDown, self.exitDown),
                State.State("cancel", self.enterCancel, self.exitCancel),
            ],
            "off",
            "off",
        )
        self.context = None
        from toontown.toon import ToonAvatarDetailPanel

        ToonTeleportPanel.hideTeleportPanel()
        ToonAvatarDetailPanel.hideAvatarDetail()
        buttons = loader.loadModel("phase_3/models/gui/dialog_box_buttons_gui")
        gui = loader.loadModel("phase_3.5/models/gui/avatar_panel_gui")
        self.bOk = DirectButton(
            self,
            image=(
                buttons.find("**/ChtBx_OKBtn_UP"),
                buttons.find("**/ChtBx_OKBtn_DN"),
                buttons.find("**/ChtBx_OKBtn_Rllvr"),
            ),
            relief=None,
            text=OTPLocalizer.FriendInviterOK,
            text_scale=0.05,
            text_pos=(0.0, -0.1),
            pos=(0.0, 0.0, -0.1),
            command=self.__handleOk,
        )
        self.bOk.hide()
        self.bCancel = DirectButton(
            self,
            image=(buttons.find("**/CloseBtn_UP"), buttons.find("**/CloseBtn_DN"), buttons.find("**/CloseBtn_Rllvr")),
            relief=None,
            text=OTPLocalizer.FriendInviterCancel,
            text_scale=0.05,
            text_pos=(0.0, -0.1),
            pos=TTLocalizer.FIbCancelPos,
            command=self.__handleCancel,
        )
        self.bCancel.hide()
        self.bStop = DirectButton(
            self,
            image=(gui.find("**/Ignore_Btn_UP"), gui.find("**/Ignore_Btn_DN"), gui.find("**/Ignore_Btn_RLVR")),
            relief=None,
            text=OTPLocalizer.FriendInviterStopBeingFriends,
            text_align=TextNode.ALeft,
            text_scale=TTLocalizer.FIbStop,
            text_pos=TTLocalizer.FIbStopTextPos,
            pos=TTLocalizer.FIbStopPos,
            command=self.__handleStop,
        )
        self.bStop.hide()
        self.bYes = DirectButton(
            self,
            image=(
                buttons.find("**/ChtBx_OKBtn_UP"),
                buttons.find("**/ChtBx_OKBtn_DN"),
                buttons.find("**/ChtBx_OKBtn_Rllvr"),
            ),
            relief=None,
            text=OTPLocalizer.FriendInviterYes,
            text_scale=0.05,
            text_pos=(0.0, -0.1),
            pos=TTLocalizer.FIbYesPos,
            command=self.__handleYes,
        )
        self.bYes.hide()
        self.bNo = DirectButton(
            self,
            image=(buttons.find("**/CloseBtn_UP"), buttons.find("**/CloseBtn_DN"), buttons.find("**/CloseBtn_Rllvr")),
            relief=None,
            text=OTPLocalizer.FriendInviterNo,
            text_scale=0.05,
            text_pos=(0.0, -0.1),
            pos=(0.15, 0.0, -0.1),
            command=self.__handleNo,
        )
        self.bNo.hide()
        buttons.removeNode()
        gui.removeNode()
        self.fsm.enterInitialState()
        if self.avId == None:
            self.fsm.request("getNewFriend")
        else:
            self.fsm.request("check")
        return
 def __handleAvatarDetails(self, avId, avName):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName)
Beispiel #19
0
    def __handleAvatarDetails(self, avId, avName, playerId = None):
        """__handleAvatarDetails(self, int avId, string avName)

        Bring up a detail panel on a particular avatar.
        """
        ToonAvatarDetailPanel.showAvatarDetail(avId, avName, playerId)
 def __handleAvatarDetails(self, avId, avName):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName)
 def _FriendsListManager__handleAvatarDetails(self, avId, avName, playerId = None):
     ToonAvatarDetailPanel.showAvatarDetail(avId, avName, playerId)