Require player to type in toon's name before deleting

This commit is contained in:
John 2015-07-28 01:09:55 +03:00
parent 28331e7b0a
commit 2bd6230fd3
2 changed files with 5 additions and 9 deletions

View file

@ -165,9 +165,7 @@ class AvatarChoice(DirectButton):
self.verifyDeleteWithPassword() self.verifyDeleteWithPassword()
def verifyDeleteWithPassword(self): def verifyDeleteWithPassword(self):
deleteText = TTLocalizer.AvatarChoiceDeleteConfirmText % { deleteText = TTLocalizer.AvatarChoiceDeleteConfirmText % {'name': self.name}
'name': self.name,
'confirm': TTLocalizer.AvatarChoiceDeleteConfirmUserTypes}
if self.deleteWithPasswordFrame == None: if self.deleteWithPasswordFrame == None:
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
nameBalloon = loader.loadModel('phase_3/models/props/chatbox_input') nameBalloon = loader.loadModel('phase_3/models/props/chatbox_input')
@ -190,13 +188,12 @@ class AvatarChoice(DirectButton):
return return
def __handleDeleteWithConfirmOK(self, *args): def __handleDeleteWithConfirmOK(self, *args):
if self.passwordEntry.get().lower() == TTLocalizer.AvatarChoiceDeleteConfirmUserTypes: if self.passwordEntry.get().lower() == self.name.lower():
self.deleteWithPasswordFrame.hide() self.deleteWithPasswordFrame.hide()
base.transitions.noTransitions() base.transitions.noTransitions()
messenger.send(self.doneEvent, ['delete', self.position]) messenger.send(self.doneEvent, ['delete', self.position])
else: else:
self.deleteWithPasswordFrame['text'] = TTLocalizer.AvatarChoiceDeleteWrongConfirm % {'name': self.name, self.deleteWithPasswordFrame['text'] = TTLocalizer.AvatarChoiceDeleteWrongConfirm % {'name': self.name}
'confirm': TTLocalizer.AvatarChoiceDeleteConfirmUserTypes}
self.passwordEntry['focus'] = 1 self.passwordEntry['focus'] = 1
self.passwordEntry.enterText('') self.passwordEntry.enterText('')

View file

@ -3262,12 +3262,11 @@ AvatarChoiceNameRejected = 'Name\nRejected'
AvatarChoiceNameApproved = 'Name\nApproved!' AvatarChoiceNameApproved = 'Name\nApproved!'
AvatarChoiceNameReview = 'Under\nReview' AvatarChoiceNameReview = 'Under\nReview'
AvatarChoiceNameYourToon = 'Name\nYour Toon!' AvatarChoiceNameYourToon = 'Name\nYour Toon!'
AvatarChoiceDeleteConfirmText = 'Careful! This will delete %(name)s forever. If you are sure you want to do this, type "%(confirm)s" and click OK.' AvatarChoiceDeleteConfirmText = "Careful! This will delete %(name)s forever. If you are sure you want to do this, type your toon's name and click OK."
AvatarChoiceDeleteConfirmUserTypes = 'delete'
AvatarChoiceDeletePasswordTitle = 'Delete Toon?' AvatarChoiceDeletePasswordTitle = 'Delete Toon?'
AvatarChoiceDeletePasswordOK = lOK AvatarChoiceDeletePasswordOK = lOK
AvatarChoiceDeletePasswordCancel = lCancel AvatarChoiceDeletePasswordCancel = lCancel
AvatarChoiceDeleteWrongConfirm = 'You didn\'t type the right thing. To delete %(name)s, type "%(confirm)s" and click OK. Do not type the quotation marks. Click Cancel if you have changed your mind.' AvatarChoiceDeleteWrongConfirm = "You didn\'t type the right thing. To delete %(name)s, type your toon's name and click OK. Do not type the quotation marks. Click Cancel if you have changed your mind."
AvatarChooserPickAToon = 'Pick A Toon To Play' AvatarChooserPickAToon = 'Pick A Toon To Play'
AvatarChooserQuit = lQuit AvatarChooserQuit = lQuit
DateOfBirthEntryMonths = ['Jan', DateOfBirthEntryMonths = ['Jan',