Exemplo n.º 1
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
Exemplo n.º 2
0
 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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()
Exemplo n.º 10
0
    def __handleGotoAvatar(self, avId, avName, avDisableName):
        """__handleGotoAvatar(self, int avId, string avName, string avDisableName)

        Called when the user clicks the "goto" button from the Avatar
        panel, this should initiate the teleport-to-avatar process.
        """
        # This whole process is a little circuitous.  We can't go
        # directly to the avatar, since we're not sure which shard,
        # hood, and zone the avatar is in.  We have to ask these
        # questions of the avatar, which involves a round-trip
        # peer-to-peer message.

        # The TeleportPanel will manage this communication, and will
        # tell the place fsm to enter the teleportOut state when it's got
        # the information for us.  Of course, the TeleportPanel might
        # fail or be canceled by the user, in which case nothing
        # happens.
        ToonTeleportPanel.showTeleportPanel(avId, avName, avDisableName)
Exemplo n.º 11
0
 def __init__(self, avId, avName, playerId = None, parent = base.a2dTopRight, **kw):
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
     detailPanel = gui.find('**/avatarInfoPanel')
     self.playerId = playerId
     textScale = 0.095
     textWrap = 16.4
     self.playerInfo = None
     if self.playerId:
         self.playerInfo = base.cr.playerFriendsManager.playerId2Info.get(playerId)
     optiondefs = (('pos', (-0.79, 0.0, -0.47), None),
      ('scale', 0.5, None),
      ('relief', None, None),
      ('image', detailPanel, None),
      ('image_color', GlobalDialogColor, None),
      ('text', '', None),
      ('text_wordwrap', textWrap, None),
      ('text_scale', textScale, None),
      ('text_pos', (-0.125, 0.775), None))
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, parent)
     self.dataText = DirectLabel(self, text='', text_scale=0.09, text_align=TextNode.ALeft, text_wordwrap=15, relief=None, pos=(-0.85, 0.0, 0.645))
     self.avId = avId
     self.avName = avName
     self.avatar = None
     self.createdAvatar = None
     self.fsm = ClassicFSM.ClassicFSM('ToonAvatarDetailPanel', [State.State('off', self.enterOff, self.exitOff, ['begin']),
      State.State('begin', self.enterBegin, self.exitBegin, ['query', 'data', 'off']),
      State.State('query', self.enterQuery, self.exitQuery, ['data', 'invalid', 'off']),
      State.State('data', self.enterData, self.exitData, ['off']),
      State.State('invalid', self.enterInvalid, self.exitInvalid, ['off'])], 'off', 'off')
     from toontown.toon import ToonTeleportPanel
     ToonTeleportPanel.hideTeleportPanel()
     FriendInviter.hideFriendInviter()
     self.bCancel = DirectButton(self, image=(buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')), image_scale=1.1, relief=None, text=TTLocalizer.AvatarDetailPanelCancel, text_scale=TTLocalizer.TADPbCancel, text_pos=(0.12, -0.01), pos=TTLocalizer.TADPbCancelPos, scale=2.0, command=self.__handleCancel)
     self.bCancel.hide()
     self.initialiseoptions(ToonAvatarDetailPanel)
     self.fsm.enterInitialState()
     self.fsm.request('begin')
     buttons.removeNode()
     gui.removeNode()
Exemplo n.º 12
0
 def __init__(self, avId, avName, playerId=None, parent=aspect2dp, **kw):
     self.playerId = playerId
     self.isPlayer = 0
     self.playerInfo = None
     if playerId:
         self.isPlayer = 1
         if playerId in base.cr.playerFriendsManager.playerId2Info:
             self.playerInfo = base.cr.playerFriendsManager.playerId2Info[
                 playerId]
             if not self.playerInfo.onlineYesNo:
                 avId = None
         else:
             avId = None
     self.avId = avId
     self.avName = avName
     self.avatar = None
     self.createdAvatar = None
     buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
     gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui')
     detailPanel = gui.find('**/avatarInfoPanel')
     textScale = 0.132
     textWrap = 10.4
     if self.playerId:
         textScale = 0.1
         textWrap = 18.0
     optiondefs = (('pos', (0.525, 0.0, 0.525), None), ('scale', 0.5, None),
                   ('relief', None, None), ('image', detailPanel, None),
                   ('image_color', GlobalDialogColor, None),
                   ('text', '', None), ('text_wordwrap', textWrap, None),
                   ('text_scale', textScale, None), ('text_pos',
                                                     (-0.125, 0.75), None))
     self.defineoptions(kw, optiondefs)
     DirectFrame.__init__(self, parent)
     self.dataText = DirectLabel(self,
                                 text='',
                                 text_scale=0.085,
                                 text_align=TextNode.ALeft,
                                 text_wordwrap=15,
                                 relief=None,
                                 pos=(-0.85, 0.0, 0.725))
     if self.avId:
         self.avText = DirectLabel(self,
                                   text=TTLocalizer.PlayerToonName %
                                   {'toonname': self.avName},
                                   text_scale=0.09,
                                   text_align=TextNode.ALeft,
                                   text_wordwrap=15,
                                   relief=None,
                                   pos=(-0.85, 0.0, 0.56))
         guiButton = loader.loadModel('phase_3/models/gui/quit_button')
         self.gotoToonButton = DirectButton(
             parent=self,
             relief=None,
             image=(guiButton.find('**/QuitBtn_UP'),
                    guiButton.find('**/QuitBtn_DN'),
                    guiButton.find('**/QuitBtn_RLVR')),
             image_scale=1.15,
             text=TTLocalizer.PlayerShowToon,
             text_scale=0.08,
             text_pos=(0.0, -0.02),
             textMayChange=0,
             pos=(0.43, 0, 0.415),
             command=self.__showToon)
     ToonTeleportPanel.hideTeleportPanel()
     FriendInviter.hideFriendInviter()
     self.bCancel = DirectButton(self,
                                 image=(buttons.find('**/CloseBtn_UP'),
                                        buttons.find('**/CloseBtn_DN'),
                                        buttons.find('**/CloseBtn_Rllvr')),
                                 relief=None,
                                 text=TTLocalizer.AvatarDetailPanelCancel,
                                 text_scale=0.05,
                                 text_pos=(0.12, -0.01),
                                 pos=(-0.865, 0.0, -0.765),
                                 scale=2.0,
                                 command=self.__handleCancel)
     self.bCancel.show()
     self.initialiseoptions(PlayerDetailPanel)
     self.__showData()
     buttons.removeNode()
     gui.removeNode()
Exemplo n.º 13
0
 def __handleGotoAvatar(self, avId, avName, avDisableName):
     ToonTeleportPanel.showTeleportPanel(avId, avName, avDisableName)
Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 16
0
 def _FriendsListManager__handleGotoAvatar(self, avId, avName,
                                           avDisableName):
     ToonTeleportPanel.showTeleportPanel(avId, avName, avDisableName)
Exemplo n.º 17
0
    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
Exemplo n.º 18
0
 def __handleGotoAvatar(self, avId, avName, avDisableName):
     ToonTeleportPanel.showTeleportPanel(avId, avName, avDisableName)
 def _FriendsListManager__handleGotoAvatar(self, avId, avName, avDisableName):
     ToonTeleportPanel.showTeleportPanel(avId, avName, avDisableName)