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
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 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
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
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()
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')
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')
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')
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