mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Merge branch 'master' of https://gitlab.com/toontown-created/src
This commit is contained in:
commit
5358614551
18 changed files with 106 additions and 1540 deletions
|
@ -4,8 +4,6 @@ from direct.fsm import State
|
|||
from direct.gui.DirectGui import *
|
||||
from direct.showbase import DirectObject
|
||||
from pandac.PandaModules import *
|
||||
from otp.login import PrivacyPolicyPanel
|
||||
from otp.login import SecretFriendsInfoPanel
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from toontown.chat.ChatGlobals import *
|
||||
|
||||
|
@ -52,8 +50,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
self.noSecretChatAtAllAndNoWhitelist = None
|
||||
self.noSecretChatWarning = None
|
||||
self.activateChatGui = None
|
||||
self.chatMoreInfo = None
|
||||
self.chatPrivacyPolicy = None
|
||||
self.secretChatActivated = None
|
||||
self.problemActivatingChat = None
|
||||
self.fsm = ClassicFSM.ClassicFSM('chatManager', [State.State('off', self.enterOff, self.exitOff),
|
||||
|
@ -73,8 +69,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
State.State('noFriendsWarning', self.enterNoFriendsWarning, self.exitNoFriendsWarning),
|
||||
State.State('otherDialog', self.enterOtherDialog, self.exitOtherDialog),
|
||||
State.State('activateChat', self.enterActivateChat, self.exitActivateChat),
|
||||
State.State('chatMoreInfo', self.enterChatMoreInfo, self.exitChatMoreInfo),
|
||||
State.State('chatPrivacyPolicy', self.enterChatPrivacyPolicy, self.exitChatPrivacyPolicy),
|
||||
State.State('secretChatActivated', self.enterSecretChatActivated, self.exitSecretChatActivated),
|
||||
State.State('problemActivatingChat', self.enterProblemActivatingChat, self.exitProblemActivatingChat),
|
||||
State.State('whiteListOpenChat', self.enterWhiteListOpenChat, self.exitWhiteListOpenChat),
|
||||
|
@ -111,12 +105,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
if self.activateChatGui:
|
||||
self.activateChatGui.destroy()
|
||||
self.activateChatGui = None
|
||||
if self.chatMoreInfo:
|
||||
self.chatMoreInfo.destroy()
|
||||
self.chatMoreInfo = None
|
||||
if self.chatPrivacyPolicy:
|
||||
self.chatPrivacyPolicy.destroy()
|
||||
self.chatPrivacyPolicy = None
|
||||
if self.secretChatActivated:
|
||||
self.secretChatActivated.destroy()
|
||||
self.secretChatActivated = None
|
||||
|
@ -441,30 +429,6 @@ class ChatManager(DirectObject.DirectObject):
|
|||
def exitOtherDialog(self):
|
||||
pass
|
||||
|
||||
def enterChatMoreInfo(self):
|
||||
if self.chatMoreInfo == None:
|
||||
self.chatMoreInfo = SecretFriendsInfoPanel.SecretFriendsInfoPanel('secretFriendsInfoDone')
|
||||
self.chatMoreInfo.show()
|
||||
self.accept('secretFriendsInfoDone', self.__secretFriendsInfoDone)
|
||||
return
|
||||
|
||||
def exitChatMoreInfo(self):
|
||||
self.chatMoreInfo.hide()
|
||||
self.ignore('secretFriendsInfoDone')
|
||||
|
||||
def enterChatPrivacyPolicy(self):
|
||||
if self.chatPrivacyPolicy == None:
|
||||
self.chatPrivacyPolicy = PrivacyPolicyPanel.PrivacyPolicyPanel('privacyPolicyDone')
|
||||
self.chatPrivacyPolicy.show()
|
||||
self.accept('privacyPolicyDone', self.__privacyPolicyDone)
|
||||
return
|
||||
|
||||
def exitChatPrivacyPolicy(self):
|
||||
cleanupDialog('privacyPolicyDialog')
|
||||
self.chatPrivacyPolicy = None
|
||||
self.ignore('privacyPolicyDone')
|
||||
return
|
||||
|
||||
def enterSecretChatActivated(self):
|
||||
self.notify.error('called enterSecretChatActivated() on parent class')
|
||||
|
||||
|
@ -476,9 +440,3 @@ class ChatManager(DirectObject.DirectObject):
|
|||
|
||||
def exitProblemActivatingChat(self):
|
||||
self.notify.error('called exitProblemActivatingChat() on parent class')
|
||||
|
||||
def __secretFriendsInfoDone(self):
|
||||
self.fsm.request('activateChat')
|
||||
|
||||
def __privacyPolicyDone(self):
|
||||
self.fsm.request('activateChat')
|
||||
|
|
|
@ -33,7 +33,6 @@ from otp.distributed.OtpDoGlobals import *
|
|||
from otp.distributed.TelemetryLimiter import TelemetryLimiter
|
||||
from otp.login import HTTPUtil
|
||||
from otp.login import LoginTTUAccount
|
||||
from otp.login.CreateAccountScreen import CreateAccountScreen
|
||||
from otp.otpbase import OTPGlobals
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
@ -257,16 +256,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.exitLogin, [
|
||||
'noConnection',
|
||||
'waitForGameList',
|
||||
'createAccount',
|
||||
'reject',
|
||||
'failedToConnect',
|
||||
'shutdown']),
|
||||
State('createAccount',
|
||||
self.enterCreateAccount,
|
||||
self.exitCreateAccount, [
|
||||
'noConnection',
|
||||
'waitForGameList',
|
||||
'login',
|
||||
'reject',
|
||||
'failedToConnect',
|
||||
'shutdown']),
|
||||
|
@ -596,9 +585,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.loginFSM.request('parentPassword')
|
||||
elif mode == 'freeTimeExpired':
|
||||
self.loginFSM.request('freeTimeInform')
|
||||
elif mode == 'createAccount':
|
||||
self.loginFSM.request('createAccount', [{'back': 'login',
|
||||
'backArgs': []}])
|
||||
elif mode == 'reject':
|
||||
self.loginFSM.request('reject')
|
||||
elif mode == 'quit':
|
||||
|
@ -616,47 +602,6 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.handler = None
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def enterCreateAccount(self, createAccountDoneData = {'back': 'login',
|
||||
'backArgs': []}):
|
||||
self.createAccountDoneData = createAccountDoneData
|
||||
self.createAccountDoneEvent = 'createAccountDone'
|
||||
self.createAccountScreen = None
|
||||
self.createAccountScreen = CreateAccountScreen(self, self.createAccountDoneEvent)
|
||||
self.accept(self.createAccountDoneEvent, self.__handleCreateAccountDone)
|
||||
self.createAccountScreen.load()
|
||||
self.createAccountScreen.enter()
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def __handleCreateAccountDone(self, doneStatus):
|
||||
mode = doneStatus['mode']
|
||||
if mode == 'success':
|
||||
self.setIsNotNewInstallation()
|
||||
self.loginFSM.request('waitForGameList')
|
||||
elif mode == 'reject':
|
||||
self.loginFSM.request('reject')
|
||||
elif mode == 'cancel':
|
||||
self.loginFSM.request(self.createAccountDoneData['back'], self.createAccountDoneData['backArgs'])
|
||||
elif mode == 'failure':
|
||||
self.loginFSM.request(self.createAccountDoneData['back'], self.createAccountDoneData['backArgs'])
|
||||
elif mode == 'quit':
|
||||
self.loginFSM.request('shutdown')
|
||||
else:
|
||||
self.notify.error('Invalid doneStatus mode from CreateAccountScreen: ' + str(mode))
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def exitCreateAccount(self):
|
||||
if self.createAccountScreen:
|
||||
self.createAccountScreen.exit()
|
||||
self.createAccountScreen.unload()
|
||||
self.createAccountScreen = None
|
||||
self.renderFrame()
|
||||
self.ignore(self.createAccountDoneEvent)
|
||||
del self.createAccountDoneEvent
|
||||
self.handler = None
|
||||
return
|
||||
|
||||
@report(types=['args', 'deltaStamp'], dConfigParam='teleport')
|
||||
def enterFailedToConnect(self, statusCode, statusString):
|
||||
self.handler = self.handleMessageType
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from RemoteValueSet import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
import TTAccount
|
||||
import HTTPUtil
|
||||
|
||||
class AccountServerConstants(RemoteValueSet):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('AccountServerConstants')
|
||||
|
||||
def __init__(self, cr):
|
||||
self.expectedConstants = ['minNameLength',
|
||||
'minPwLength',
|
||||
'allowNewAccounts',
|
||||
'freeTrialPeriodInDays',
|
||||
'priceFirstMonth',
|
||||
'pricePerMonth',
|
||||
'customerServicePhoneNumber',
|
||||
'creditCardUpFront']
|
||||
self.defaults = {'minNameLength': '1',
|
||||
'minPwLength': '1',
|
||||
'allowNewAccounts': '1',
|
||||
'creditCardUpFront': '0',
|
||||
'priceFirstMonth': '9.95',
|
||||
'pricePerMonth': '9.95'}
|
||||
noquery = 1
|
||||
if cr.productName == 'DisneyOnline-US':
|
||||
if base.config.GetBool('tt-specific-login', 0):
|
||||
pass
|
||||
else:
|
||||
noquery = 0
|
||||
if cr.accountOldAuth or base.config.GetBool('default-server-constants', noquery):
|
||||
self.notify.debug('setting defaults, not using account server constants')
|
||||
self.dict = {}
|
||||
for constantName in self.expectedConstants:
|
||||
self.dict[constantName] = 'DEFAULT'
|
||||
|
||||
self.dict.update(self.defaults)
|
||||
return
|
||||
url = URLSpec(AccountServerConstants.getServer())
|
||||
url.setPath('/constants.php')
|
||||
self.notify.debug('grabbing account server constants from %s' % url.cStr())
|
||||
RemoteValueSet.__init__(self, url, cr.http, expectedHeader='ACCOUNT SERVER CONSTANTS', expectedFields=self.expectedConstants)
|
||||
|
||||
def getBool(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getBool)
|
||||
|
||||
def getInt(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getInt)
|
||||
|
||||
def getFloat(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getFloat)
|
||||
|
||||
def getString(self, name):
|
||||
return self.__getConstant(name, RemoteValueSet.getString)
|
||||
|
||||
def __getConstant(self, constantName, accessor):
|
||||
if constantName not in self.expectedConstants:
|
||||
self.notify.warning("requested constant '%s' not in expected constant list; if it's a new constant, add it to the list" % constantName)
|
||||
return accessor(self, constantName)
|
||||
|
||||
@staticmethod
|
||||
def getServer():
|
||||
return TTAccount.getAccountServer().cStr()
|
||||
|
||||
@staticmethod
|
||||
def getServerURL():
|
||||
return TTAccount.getAccountServer()
|
|
@ -1,247 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.gui.DirectGui import *
|
||||
from pandac.PandaModules import *
|
||||
from direct.fsm import StateData
|
||||
from otp.otpgui import OTPDialog
|
||||
from direct.fsm import ClassicFSM
|
||||
from direct.fsm import State
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
import GuiScreen
|
||||
from otp.otpbase import OTPGlobals
|
||||
from direct.distributed.MsgTypes import *
|
||||
|
||||
class CreateAccountScreen(StateData.StateData, GuiScreen.GuiScreen):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CreateAccountScreen')
|
||||
ActiveEntryColor = Vec4(1, 1, 1, 1)
|
||||
InactiveEntryColor = Vec4(0.8, 0.8, 0.8, 1)
|
||||
labelFg = (1, 1, 1, 1)
|
||||
labelFgActive = (1, 1, 0, 1)
|
||||
|
||||
def __init__(self, cr, doneEvent):
|
||||
StateData.StateData.__init__(self, doneEvent)
|
||||
GuiScreen.GuiScreen.__init__(self)
|
||||
self.cr = cr
|
||||
self.loginInterface = self.cr.loginInterface
|
||||
self.fsm = ClassicFSM.ClassicFSM('CreateAccountScreen', [State.State('off', self.enterOff, self.exitOff, ['create']), State.State('create', self.enterCreate, self.exitCreate, ['waitForLoginResponse', 'create']), State.State('waitForLoginResponse', self.enterWaitForLoginResponse, self.exitWaitForLoginResponse, ['create'])], 'off', 'off')
|
||||
self.fsm.enterInitialState()
|
||||
|
||||
def load(self):
|
||||
self.notify.debug('load')
|
||||
masterScale = 0.8
|
||||
textScale = 0.1 * masterScale
|
||||
entryScale = 0.08 * masterScale
|
||||
lineHeight = 0.21 * masterScale
|
||||
buttonScale = 1.3 * masterScale
|
||||
buttonLineHeight = 0.16 * masterScale
|
||||
self.frame = DirectFrame(parent=aspect2d, relief=None)
|
||||
self.frame.hide()
|
||||
linePos = 0.5
|
||||
linePos -= lineHeight
|
||||
self.nameLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenUserName, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.nameEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1)
|
||||
self.nameEntry.label = self.nameLabel
|
||||
linePos -= lineHeight
|
||||
self.passwordLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.passwordEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1)
|
||||
self.passwordEntry.label = self.passwordLabel
|
||||
linePos -= lineHeight
|
||||
self.passwordConfirmLabel = DirectLabel(parent=self.frame, relief=None, pos=(-0.21, 0, linePos), text=OTPLocalizer.CreateAccountScreenConfirmPassword, text_scale=textScale, text_align=TextNode.ARight, text_fg=self.labelFg, text_shadow=(0, 0, 0, 1), text_shadowOffset=(0.08, 0.08))
|
||||
self.passwordConfirmEntry = DirectEntry(parent=self.frame, relief=DGG.SUNKEN, borderWidth=(0.1, 0.1), scale=entryScale, pos=(-0.125, 0.0, linePos), width=OTPGlobals.maxLoginWidth, numLines=1, focus=0, cursorKeys=1, obscured=1)
|
||||
self.passwordConfirmEntry.label = self.passwordConfirmLabel
|
||||
linePos -= lineHeight
|
||||
linePos -= lineHeight
|
||||
self.submitButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenSubmit, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleSubmit)
|
||||
linePos -= buttonLineHeight
|
||||
self.cancelButton = DirectButton(parent=self.frame, relief=DGG.RAISED, borderWidth=(0.01, 0.01), pos=(0, 0, linePos), scale=buttonScale, text=OTPLocalizer.CreateAccountScreenCancel, text_scale=0.06, text_pos=(0, -0.02), command=self.__handleCancel)
|
||||
linePos -= buttonLineHeight
|
||||
self.dialogDoneEvent = 'createAccountDialogAck'
|
||||
dialogClass = OTPGlobals.getGlobalDialogClass()
|
||||
self.dialog = dialogClass(dialogName='createAccountDialog', doneEvent=self.dialogDoneEvent, message='', style=OTPDialog.Acknowledge, sortOrder=NO_FADE_SORT_INDEX + 100)
|
||||
self.dialog.hide()
|
||||
return
|
||||
|
||||
def unload(self):
|
||||
self.notify.debug('unload')
|
||||
self.dialog.cleanup()
|
||||
del self.dialog
|
||||
self.frame.destroy()
|
||||
del self.fsm
|
||||
del self.loginInterface
|
||||
del self.cr
|
||||
|
||||
def enter(self):
|
||||
self.__firstTime = 1
|
||||
self.frame.show()
|
||||
self.fsm.request('create')
|
||||
|
||||
def exit(self):
|
||||
self.ignore(self.dialogDoneEvent)
|
||||
self.fsm.requestFinalState()
|
||||
self.frame.hide()
|
||||
|
||||
def enterOff(self):
|
||||
pass
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
||||
|
||||
def enterCreate(self):
|
||||
self.password = ''
|
||||
self.passwordEntry.set('')
|
||||
self.passwordConfirmEntry.set('')
|
||||
if self.__firstTime:
|
||||
self.userName = ''
|
||||
self.nameEntry.set(self.userName)
|
||||
self.__firstTime = 0
|
||||
self.focusList = [self.nameEntry, self.passwordEntry, self.passwordConfirmEntry]
|
||||
self.startFocusMgmt(overrides={}, globalFocusHandler=self.__handleFocusChange)
|
||||
|
||||
def exitCreate(self):
|
||||
self.stopFocusMgmt()
|
||||
|
||||
def __handleFocusChange(self, focusItem):
|
||||
for item in self.focusList:
|
||||
item.label.component('text0').setFg(self.labelFg)
|
||||
|
||||
if focusItem is not None:
|
||||
focusItem.label.component('text0').setFg(self.labelFgActive)
|
||||
return
|
||||
|
||||
def __handleSubmit(self):
|
||||
self.removeFocus()
|
||||
self.userName = self.nameEntry.get()
|
||||
self.password = self.passwordEntry.get()
|
||||
passwordConfirm = self.passwordConfirmEntry.get()
|
||||
minNameLength = self.cr.accountServerConstants.getInt('minNameLength')
|
||||
minPwdLength = self.cr.accountServerConstants.getInt('minPwLength')
|
||||
if self.userName == '':
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenNoAccountName)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleUsernameAck)
|
||||
elif len(self.userName) < minNameLength:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenAccountNameTooShort % minNameLength)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleUsernameAck)
|
||||
elif len(self.password) < minPwdLength:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenPasswordTooShort % minPwdLength)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handlePasswordAck)
|
||||
elif self.password != passwordConfirm:
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenPasswordMismatch)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handlePasswordAck)
|
||||
else:
|
||||
self.fsm.request('waitForLoginResponse')
|
||||
|
||||
def __handleCancel(self):
|
||||
messenger.send(self.doneEvent, [{'mode': 'cancel'}])
|
||||
|
||||
def __handleUsernameAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
self.setFocus(self.nameEntry)
|
||||
|
||||
def __handlePasswordAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
self.setFocus(self.passwordEntry)
|
||||
|
||||
def enterWaitForLoginResponse(self):
|
||||
self.cr.handler = self.handleWaitForLoginResponse
|
||||
self.cr.userName = self.userName
|
||||
self.cr.password = self.password
|
||||
data = {}
|
||||
referrer = launcher.getReferrerCode()
|
||||
if referrer is not None:
|
||||
data['referrer'] = referrer
|
||||
error = self.loginInterface.createAccount(self.userName, self.password, data)
|
||||
|
||||
if error:
|
||||
self.notify.info(error)
|
||||
self.dialog.setMessage(error)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadAccountAck)
|
||||
else:
|
||||
self.cr.logAccountInfo()
|
||||
self.loginInterface.sendLoginMsg()
|
||||
self.waitForDatabaseTimeout(requestName='CreateAccountWaitForLoginResponse')
|
||||
return
|
||||
|
||||
def exitWaitForLoginResponse(self):
|
||||
self.cleanupWaitingForDatabase()
|
||||
self.cr.handler = None
|
||||
return
|
||||
|
||||
def handleWaitForLoginResponse(self, msgType, di):
|
||||
if msgType == CLIENT_LOGIN_2_RESP:
|
||||
self.handleLoginResponseMsg2(di)
|
||||
elif msgType == CLIENT_LOGIN_RESP:
|
||||
self.handleLoginResponseMsg(di)
|
||||
else:
|
||||
self.cr.handleMessageType(msgType, di)
|
||||
|
||||
def handleLoginResponseMsg2(self, di):
|
||||
returnCode = di.getUint8()
|
||||
self.notify.info('Login response return code: ' + str(returnCode))
|
||||
if returnCode == 0:
|
||||
self.__handleLoginSuccess()
|
||||
else:
|
||||
errorString = di.getString()
|
||||
self.notify.warning(errorString)
|
||||
messenger.send(self.doneEvent, [{'mode': 'reject'}])
|
||||
|
||||
def __handleLoginSuccess(self):
|
||||
self.notify.info('Logged in with username: %s' % self.userName)
|
||||
launcher.setGoUserName(self.userName)
|
||||
launcher.setLastLogin(self.userName)
|
||||
launcher.setUserLoggedIn()
|
||||
messenger.send(self.doneEvent, [{'mode': 'success'}])
|
||||
|
||||
def handleLoginResponseMsg(self, di):
|
||||
returnCode = di.getUint8()
|
||||
self.notify.info('Login response return code: ' + str(returnCode))
|
||||
if returnCode == 0:
|
||||
accountCode = di.getUint32()
|
||||
commentString = di.getString()
|
||||
sec = di.getUint32()
|
||||
usec = di.getUint32()
|
||||
self.__handleLoginSuccess()
|
||||
elif returnCode == 12:
|
||||
self.notify.info('Bad password')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenUserNameTaken)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadPasswordAck)
|
||||
elif returnCode == 14:
|
||||
self.notify.info('Bad word in user name')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenInvalidUserName)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadWordInUserName)
|
||||
elif returnCode == 129:
|
||||
self.notify.info('Username not found')
|
||||
self.dialog.setMessage(OTPLocalizer.CreateAccountScreenUserNameNotFound)
|
||||
self.dialog.show()
|
||||
self.acceptOnce(self.dialogDoneEvent, self.__handleBadAccountAck)
|
||||
else:
|
||||
accountCode = di.getUint32()
|
||||
errorString = di.getString()
|
||||
self.notify.warning(errorString)
|
||||
messenger.send(self.doneEvent, [{'mode': 'reject'}])
|
||||
|
||||
def __handleConnectionErrorAck(self):
|
||||
self.dialog.hide()
|
||||
messenger.send(self.doneEvent, [{'mode': 'failure'}])
|
||||
|
||||
def __handleBadPasswordAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
|
||||
def __handleBadAccountAck(self):
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
||||
|
||||
def __handleBadWordInUserName(self):
|
||||
self.userName = ''
|
||||
self.nameEntry.set('')
|
||||
self.dialog.hide()
|
||||
self.fsm.request('create')
|
|
@ -1,276 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase import OTPGlobals
|
||||
from direct.gui.DirectGui import *
|
||||
from otp.otpgui import OTPDialog
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from direct.task.Task import Task
|
||||
|
||||
class GuiScreen:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('GuiScreen')
|
||||
DGG.ENTERPRESS_ADVANCE = 0
|
||||
DGG.ENTERPRESS_ADVANCE_IFNOTEMPTY = 1
|
||||
DGG.ENTERPRESS_DONT_ADVANCE = 2
|
||||
DGG.ENTERPRESS_REMOVE_FOCUS = 3
|
||||
ENTRY_WIDTH = 20
|
||||
|
||||
def __init__(self):
|
||||
self.waitingForDatabase = None
|
||||
self.focusIndex = None
|
||||
self.suppressClickSound = 0
|
||||
return
|
||||
|
||||
def startFocusMgmt(self, startFocus = 0, enterPressBehavior = DGG.ENTERPRESS_ADVANCE_IFNOTEMPTY, overrides = {}, globalFocusHandler = None):
|
||||
GuiScreen.notify.debug('startFocusMgmt:\nstartFocus=%s,\nenterPressBehavior=%s\noverrides=%s' % (startFocus, enterPressBehavior, overrides))
|
||||
self.accept('tab', self.__handleTab)
|
||||
self.accept('shift-tab', self.__handleShiftTab)
|
||||
self.accept('enter', self.__handleEnter)
|
||||
self.__startFrameStartTask()
|
||||
self.userGlobalFocusHandler = globalFocusHandler
|
||||
self.focusHandlerAbsorbCounts = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
if isinstance(item, DirectEntry):
|
||||
self.focusHandlerAbsorbCounts[item] = 0
|
||||
|
||||
self.userFocusHandlers = {}
|
||||
self.userCommandHandlers = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
if isinstance(item, DirectEntry):
|
||||
self.userFocusHandlers[item] = (item['focusInCommand'], item['focusInExtraArgs'])
|
||||
item['focusInCommand'] = self.__handleFocusChangeAbsorb
|
||||
item['focusInExtraArgs'] = [i]
|
||||
self.userCommandHandlers[item] = (item['command'], item['extraArgs'])
|
||||
item['command'] = None
|
||||
item['extraArgs'] = []
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
self.userCommandHandlers[item] = (item['command'], item['extraArgs'])
|
||||
item['command'] = self.__handleDirectScrolledListCommand
|
||||
item['extraArgs'] = [i]
|
||||
|
||||
self.enterPressHandlers = {}
|
||||
for i in xrange(len(self.focusList)):
|
||||
item = self.focusList[i]
|
||||
behavior = enterPressBehavior
|
||||
if item in overrides:
|
||||
behavior = overrides[item]
|
||||
if callable(behavior):
|
||||
self.enterPressHandlers[item] = behavior
|
||||
else:
|
||||
if not isinstance(item, DirectEntry) and behavior == GuiScreen_ENTERPRESS_ADVANCE_IFNOTEMPTY:
|
||||
behavior = GuiScreen_ENTERPRESS_ADVANCE
|
||||
commandHandlers = (self.__alwaysAdvanceFocus,
|
||||
self.__advanceFocusIfNotEmpty,
|
||||
self.__neverAdvanceFocus,
|
||||
self.__ignoreEnterPress)
|
||||
self.enterPressHandlers[item] = commandHandlers[behavior]
|
||||
|
||||
self.setFocus(startFocus)
|
||||
return
|
||||
|
||||
def focusMgmtActive(self):
|
||||
return self.focusIndex != None
|
||||
|
||||
def stopFocusMgmt(self):
|
||||
GuiScreen.notify.debug('stopFocusMgmt')
|
||||
if not self.focusMgmtActive():
|
||||
return
|
||||
self.ignore('tab')
|
||||
self.ignore('shift-tab')
|
||||
self.ignore('enter')
|
||||
self.__stopFrameStartTask()
|
||||
self.userGlobalFocusHandler = None
|
||||
self.focusIndex = None
|
||||
self.focusHandlerAbsorbCounts = {}
|
||||
for item in self.focusList:
|
||||
if isinstance(item, DirectEntry):
|
||||
userHandler, userHandlerArgs = self.userFocusHandlers[item]
|
||||
item['focusInCommand'] = userHandler
|
||||
item['focusInExtraArgs'] = userHandlerArgs
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
item['command'] = userHandler
|
||||
item['extraArgs'] = userHandlerArgs
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
item['command'] = userHandler
|
||||
item['extraArgs'] = userHandlerArgs
|
||||
|
||||
self.userFocusHandlers = {}
|
||||
self.userCommandHandlers = {}
|
||||
self.enterPressHandlers = {}
|
||||
return
|
||||
|
||||
def setFocus(self, arg, suppressSound = 1):
|
||||
if type(arg) == type(0):
|
||||
index = arg
|
||||
else:
|
||||
index = self.focusList.index(arg)
|
||||
if suppressSound:
|
||||
self.suppressClickSound += 1
|
||||
self.__setFocusIndex(index)
|
||||
|
||||
def advanceFocus(self, condition = 1):
|
||||
index = self.getFocusIndex()
|
||||
if condition:
|
||||
index += 1
|
||||
self.setFocus(index, suppressSound=0)
|
||||
|
||||
def getFocusIndex(self):
|
||||
if not self.focusMgmtActive():
|
||||
return None
|
||||
return self.focusIndex
|
||||
|
||||
def getFocusItem(self):
|
||||
if not self.focusMgmtActive():
|
||||
return None
|
||||
return self.focusList[self.focusIndex]
|
||||
|
||||
def removeFocus(self):
|
||||
focusItem = self.getFocusItem()
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
focusItem['focus'] = 0
|
||||
if self.userGlobalFocusHandler:
|
||||
self.userGlobalFocusHandler(None)
|
||||
return
|
||||
|
||||
def restoreFocus(self):
|
||||
self.setFocus(self.getFocusItem())
|
||||
|
||||
def __setFocusIndex(self, index):
|
||||
focusIndex = index % len(self.focusList)
|
||||
focusItem = self.focusList[focusIndex]
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
focusItem['focus'] = 1
|
||||
self.focusHandlerAbsorbCounts[focusItem] += 1
|
||||
self.__handleFocusChange(focusIndex)
|
||||
|
||||
def __chainToUserCommandHandler(self, item):
|
||||
userHandler, userHandlerArgs = self.userCommandHandlers[item]
|
||||
if userHandler:
|
||||
if isinstance(item, DirectEntry):
|
||||
enteredText = item.get()
|
||||
apply(userHandler, [enteredText] + userHandlerArgs)
|
||||
elif isinstance(item, DirectScrolledList):
|
||||
apply(userHandler, userHandlerArgs)
|
||||
|
||||
def __chainToUserFocusHandler(self, item):
|
||||
if isinstance(item, DirectEntry):
|
||||
userHandler, userHandlerArgs = self.userFocusHandlers[item]
|
||||
if userHandler:
|
||||
apply(userHandler, userHandlerArgs)
|
||||
|
||||
def __handleTab(self):
|
||||
self.tabPressed = 1
|
||||
self.focusDirection = 1
|
||||
self.__setFocusIndex(self.getFocusIndex() + self.focusDirection)
|
||||
|
||||
def __handleShiftTab(self):
|
||||
self.tabPressed = 1
|
||||
self.focusDirection = -1
|
||||
self.__setFocusIndex(self.getFocusIndex() + self.focusDirection)
|
||||
|
||||
def __handleFocusChangeAbsorb(self, index):
|
||||
item = self.focusList[index]
|
||||
if self.focusHandlerAbsorbCounts[item] > 0:
|
||||
self.focusHandlerAbsorbCounts[item] -= 1
|
||||
else:
|
||||
self.__handleFocusChange(index)
|
||||
|
||||
def playFocusChangeSound(self):
|
||||
base.playSfx(DGG.getDefaultClickSound())
|
||||
|
||||
def __handleFocusChange(self, index):
|
||||
if index != self.focusIndex:
|
||||
self.removeFocus()
|
||||
self.__focusChangedThisFrame = 1
|
||||
if hasattr(self, 'tabPressed'):
|
||||
del self.tabPressed
|
||||
else:
|
||||
self.focusDirection = 1
|
||||
self.focusIndex = index
|
||||
if self.suppressClickSound > 0:
|
||||
self.suppressClickSound -= 1
|
||||
else:
|
||||
self.playFocusChangeSound()
|
||||
focusItem = self.getFocusItem()
|
||||
if self.userGlobalFocusHandler:
|
||||
self.userGlobalFocusHandler(focusItem)
|
||||
if self.getFocusItem() != focusItem:
|
||||
GuiScreen.notify.debug('focus changed by global focus handler')
|
||||
if self.focusMgmtActive():
|
||||
self.__chainToUserFocusHandler(focusItem)
|
||||
|
||||
def __startFrameStartTask(self):
|
||||
self.__focusChangedThisFrame = 0
|
||||
self.frameStartTaskName = 'GuiScreenFrameStart'
|
||||
taskMgr.add(self.__handleFrameStart, self.frameStartTaskName, -100)
|
||||
|
||||
def __stopFrameStartTask(self):
|
||||
taskMgr.remove(self.frameStartTaskName)
|
||||
del self.frameStartTaskName
|
||||
del self.__focusChangedThisFrame
|
||||
|
||||
def __handleFrameStart(self, task):
|
||||
self.__focusChangedThisFrame = 0
|
||||
return Task.cont
|
||||
|
||||
def __handleDirectScrolledListCommand(self, index):
|
||||
self.__chainToUserCommandHandler(self.focusList[index])
|
||||
self.setFocus(index, suppressSound=self.getFocusIndex() == index)
|
||||
|
||||
def __handleEnter(self):
|
||||
if self.__focusChangedThisFrame:
|
||||
return
|
||||
focusItem = self.getFocusItem()
|
||||
if isinstance(focusItem, DirectEntry):
|
||||
self.__chainToUserCommandHandler(focusItem)
|
||||
if self.focusMgmtActive() and focusItem == self.getFocusItem():
|
||||
self.enterPressHandlers[focusItem]()
|
||||
|
||||
def __alwaysAdvanceFocus(self):
|
||||
self.advanceFocus()
|
||||
|
||||
def __advanceFocusIfNotEmpty(self):
|
||||
focusItem = self.getFocusItem()
|
||||
enteredText = focusItem.get()
|
||||
if enteredText != '':
|
||||
self.advanceFocus()
|
||||
else:
|
||||
self.setFocus(self.getFocusIndex())
|
||||
|
||||
def __neverAdvanceFocus(self):
|
||||
self.setFocus(self.getFocusIndex())
|
||||
|
||||
def __ignoreEnterPress(self):
|
||||
pass
|
||||
|
||||
def waitForDatabaseTimeout(self, requestName = 'unknown'):
|
||||
GuiScreen.notify.debug('waiting for database timeout %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
globalClock.tick()
|
||||
taskMgr.doMethodLater(OTPGlobals.DatabaseDialogTimeout, self.__showWaitingForDatabase, 'waitingForDatabase', extraArgs=[requestName])
|
||||
|
||||
def __showWaitingForDatabase(self, requestName):
|
||||
GuiScreen.notify.info('timed out waiting for %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
dialogClass = OTPGlobals.getDialogClass()
|
||||
self.waitingForDatabase = dialogClass(text=OTPLocalizer.GuiScreenToontownUnavailable, dialogName='WaitingForDatabase', buttonTextList=[OTPLocalizer.GuiScreenCancel], style=OTPDialog.Acknowledge, command=self.__handleCancelWaiting)
|
||||
self.waitingForDatabase.show()
|
||||
taskMgr.doMethodLater(OTPGlobals.DatabaseGiveupTimeout, self.__giveUpWaitingForDatabase, 'waitingForDatabase', extraArgs=[requestName])
|
||||
return Task.done
|
||||
|
||||
def __giveUpWaitingForDatabase(self, requestName):
|
||||
GuiScreen.notify.info('giving up waiting for %s at %s' % (requestName, globalClock.getFrameTime()))
|
||||
self.cleanupWaitingForDatabase()
|
||||
messenger.send(self.doneEvent, [{'mode': 'failure'}])
|
||||
return Task.done
|
||||
|
||||
def cleanupWaitingForDatabase(self):
|
||||
if self.waitingForDatabase != None:
|
||||
self.waitingForDatabase.cleanup()
|
||||
self.waitingForDatabase = None
|
||||
taskMgr.remove('waitingForDatabase')
|
||||
return
|
||||
|
||||
def __handleCancelWaiting(self, value):
|
||||
self.cleanupWaitingForDatabase()
|
||||
messenger.send(self.doneEvent, [{'mode': 'quit'}])
|
|
@ -1,80 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from direct.gui.DirectGui import *
|
||||
from otp.otpbase import OTPLocalizer
|
||||
|
||||
class MultiPageTextFrame(DirectFrame):
|
||||
defWidth = 1.8
|
||||
defHeight = 0.9
|
||||
|
||||
def __init__(self, textList, width = defWidth, height = defHeight, wordWrap = None, hidePageNum = 0, pageChangeCallback = None, parent = aspect2d, **kw):
|
||||
self.textList = textList
|
||||
self.numPages = len(self.textList)
|
||||
self.pageChangeCallback = pageChangeCallback
|
||||
if not wordWrap:
|
||||
wordWrap = round(18.8 * width)
|
||||
hWidth = width / 2.0
|
||||
hHeight = height / 2.0
|
||||
optiondefs = (('relief', DGG.SUNKEN, None),
|
||||
('frameSize', (-hWidth,
|
||||
hWidth,
|
||||
-hHeight,
|
||||
hHeight), None),
|
||||
('frameColor', (0.85, 0.85, 0.6, 1), None),
|
||||
('borderWidth', (0.01, 0.01), None),
|
||||
('text', '', None),
|
||||
('text_pos', (-hWidth * 0.95, hHeight * 0.93), None),
|
||||
('text_scale', 0.05, None),
|
||||
('text_align', TextNode.ALeft, None),
|
||||
('text_wordwrap', wordWrap, None))
|
||||
self.defineoptions(kw, optiondefs)
|
||||
DirectFrame.__init__(self, parent)
|
||||
self.initialiseoptions(MultiPageTextFrame)
|
||||
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
||||
buttonScale = 0.7 * (float(height) / self.defHeight)
|
||||
buttonZ = -hHeight * 0.83
|
||||
self.nextButton = DirectButton(parent=self, relief=None, scale=buttonScale, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.75, 1, 1), pos=(hWidth * 0.35, 0, buttonZ), text=OTPLocalizer.MultiPageTextFrameNext, text_scale=0.05, text_pos=(0, -0.02), command=self.turnPage, extraArgs=[1])
|
||||
self.prevButton = DirectButton(parent=self, relief=None, scale=buttonScale, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=(0.75, 1, 1), pos=(-hWidth * 0.35, 0, buttonZ), text=OTPLocalizer.MultiPageTextFramePrev, text_scale=0.05, text_pos=(0, -0.02), command=self.turnPage, extraArgs=[-1])
|
||||
self.pageNum = DirectLabel(relief=None, parent=self, pos=(0, 0, -hHeight * 0.86), text='', text_scale=0.05, text_pos=(0, 0))
|
||||
if hidePageNum:
|
||||
self.pageNum.hide()
|
||||
self.setPage(0)
|
||||
guiButton.removeNode()
|
||||
return
|
||||
|
||||
def setPageChangeCallback(self, callback):
|
||||
self.pageChangeCallback = callback
|
||||
self.setPage(self.curPage)
|
||||
|
||||
def setPage(self, pageNum):
|
||||
self.curPage = max(0, min(self.numPages - 1, pageNum))
|
||||
if self.numPages == 1:
|
||||
self.nextButton.hide()
|
||||
self.prevButton.hide()
|
||||
self.curPage = 0
|
||||
elif self.curPage == self.numPages - 1:
|
||||
self.nextButton.hide()
|
||||
self.prevButton.show()
|
||||
elif self.curPage == 0:
|
||||
self.nextButton.show()
|
||||
self.prevButton.hide()
|
||||
else:
|
||||
self.nextButton.show()
|
||||
self.prevButton.show()
|
||||
self.pageNum['text'] = OTPLocalizer.MultiPageTextFramePage % (self.curPage + 1, self.numPages)
|
||||
self['text'] = self.textList[self.curPage]
|
||||
if self.pageChangeCallback:
|
||||
self.pageChangeCallback(self.getCurPage())
|
||||
|
||||
def getCurPage(self):
|
||||
return self.curPage
|
||||
|
||||
def turnPage(self, delta):
|
||||
self.setPage(self.curPage + delta)
|
||||
|
||||
def acceptAgreementKeypresses(self):
|
||||
self.accept('page_down-up', self.turnPage, extraArgs=[1])
|
||||
self.accept('page_up-up', self.turnPage, extraArgs=[-1])
|
||||
|
||||
def ignoreAgreementKeypresses(self):
|
||||
self.ignore('page_down-up')
|
||||
self.ignore('page_up-up')
|
|
@ -1,97 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase.OTPGlobals import *
|
||||
from direct.gui.DirectGui import *
|
||||
from MultiPageTextFrame import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
||||
class PrivacyPolicyTextPanel(getGlobalDialogClass()):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PrivacyPolicyTextPanel')
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None, textList = []):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='privacyPolicyTextDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.PrivacyPolicyClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, -.55), scale=0.9)
|
||||
self.privacyPolicyText = MultiPageTextFrame(parent=self, textList=textList, hidePageNum=hidePageNum, pageChangeCallback=pageChangeCallback, pos=(0, 0, 0.7), width=2.4, height=1.5)
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, 0.65)
|
||||
self['image_scale'] = (2.7, 1, 1.9)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.13)
|
||||
|
||||
|
||||
class PrivacyPolicyPanel(getGlobalDialogClass()):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('PrivacyPolicyPanel')
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None, textList = 1):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='privacyPolicyDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.PrivacyPolicyClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, -.15), scale=0.6)
|
||||
self.chatPrivacyPolicy = None
|
||||
self.fsm = ClassicFSM.ClassicFSM('privacyPolicyPanel', [State.State('off', self.enterOff, self.exitOff),
|
||||
State.State('version1Adult', self.enterVersion1Adult, self.exitPrivacyPolicy),
|
||||
State.State('version1Kids', self.enterVersion1Kids, self.exitPrivacyPolicy),
|
||||
State.State('version2Adult', self.enterVersion2Adult, self.exitPrivacyPolicy),
|
||||
State.State('version2Kids', self.enterVersion2Kids, self.exitPrivacyPolicy)], 'off', 'off')
|
||||
self.fsm.enterInitialState()
|
||||
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
||||
moreButtonImage = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
|
||||
DirectFrame(self, pos=(-0.4, 0.1, 0.4), relief=None, text=OTPLocalizer.PrivacyPolicyText_Intro, text_align=TextNode.ALeft, text_wordwrap=28, text_scale=0.09, text_pos=(-0.82, 1.0), textMayChange=0)
|
||||
textScale = 0.05
|
||||
buttonFrame = DirectFrame(self, pos=(0.0, 0.1, 0.0), scale=1.4, relief=None)
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button1A, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(-0.45, 0.0, 0.4), command=self.__handlePrivacyPolicy, extraArgs=['version1Adult'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button1K, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(-0.45, 0.0, 0.2), command=self.__handlePrivacyPolicy, extraArgs=['version1Kids'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button2A, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(0.45, 0.0, 0.4), command=self.__handlePrivacyPolicy, extraArgs=['version2Adult'])
|
||||
DirectButton(buttonFrame, image=moreButtonImage, image_scale=(1.75, 1.0, 1.0), relief=None, text=OTPLocalizer.ActivateChatPrivacyPolicy_Button2K, text_scale=textScale, text_pos=(0, -0.01), textMayChange=0, pos=(0.45, 0.0, 0.2), command=self.__handlePrivacyPolicy, extraArgs=['version2Kids'])
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, 0.65)
|
||||
self['image_scale'] = (2.7, 1, 1.9)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.13)
|
||||
return
|
||||
|
||||
def delete(self):
|
||||
self.ignoreAll()
|
||||
del self.fsm
|
||||
if self.chatPrivacyPolicy:
|
||||
self.chatPrivacyPolicy.destroy()
|
||||
self.chatPrivacyPolicy = None
|
||||
return
|
||||
|
||||
def __handlePrivacyPolicy(self, state, *oooo):
|
||||
self.fsm.request(state)
|
||||
|
||||
def __privacyPolicyTextDone(self):
|
||||
self.exitPrivacyPolicy()
|
||||
|
||||
def enterPrivacyPolicy(self, textList):
|
||||
if self.chatPrivacyPolicy == None:
|
||||
self.chatPrivacyPolicy = PrivacyPolicyTextPanel('privacyPolicyTextDone', textList=textList)
|
||||
self.chatPrivacyPolicy.show()
|
||||
self.acceptOnce('privacyPolicyTextDone', self.__privacyPolicyTextDone)
|
||||
return
|
||||
|
||||
def exitPrivacyPolicy(self):
|
||||
self.ignore('privacyPolicyTextDone')
|
||||
if self.chatPrivacyPolicy:
|
||||
cleanupDialog('privacyPolicyTextDialog')
|
||||
self.chatPrivacyPolicy = None
|
||||
return
|
||||
|
||||
def enterVersion1Adult(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_1A)
|
||||
|
||||
def enterVersion1Kids(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_1K)
|
||||
|
||||
def enterVersion2Adult(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_2A)
|
||||
|
||||
def enterVersion2Kids(self):
|
||||
self.enterPrivacyPolicy(OTPLocalizer.PrivacyPolicyText_2K)
|
||||
|
||||
def enterOff(self):
|
||||
self.ignoreAll()
|
||||
self.exitPrivacyPolicy()
|
||||
|
||||
def exitOff(self):
|
||||
pass
|
|
@ -1,71 +0,0 @@
|
|||
from direct.directnotify import DirectNotifyGlobal
|
||||
import TTAccount
|
||||
import HTTPUtil
|
||||
|
||||
class RemoteValueSet:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('RemoteValueSet')
|
||||
|
||||
def __init__(self, url, http, body = '', expectedHeader = None, expectedFields = [], onUnexpectedResponse = None):
|
||||
if onUnexpectedResponse is None:
|
||||
onUnexpectedResponse = self.__onUnexpectedResponse
|
||||
response = HTTPUtil.getHTTPResponse(url, http, body)
|
||||
if expectedHeader is not None:
|
||||
if response[0] != expectedHeader:
|
||||
errMsg = 'unexpected response: %s' % response
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
response = response[1:]
|
||||
self.dict = {}
|
||||
for line in response:
|
||||
if not len(line):
|
||||
continue
|
||||
try:
|
||||
name, value = line.split('=', 1)
|
||||
except ValueError, e:
|
||||
errMsg = 'unexpected response: %s' % response
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
|
||||
if len(expectedFields):
|
||||
if name not in expectedFields:
|
||||
self.notify.warning("received field '%s' that is not in expected field list" % name)
|
||||
self.dict[name] = value
|
||||
|
||||
for name in expectedFields:
|
||||
if name not in self.dict:
|
||||
errMsg = "missing expected field '%s'" % name
|
||||
self.notify.warning(errMsg)
|
||||
onUnexpectedResponse(errMsg)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def __repr__(self):
|
||||
return 'RemoteValueSet:%s' % str(self.dict)
|
||||
|
||||
def hasKey(self, key):
|
||||
return key in self.dict
|
||||
|
||||
def getBool(self, name, default = None):
|
||||
return self.__getValue(name, lambda x: int(x) != 0, default)
|
||||
|
||||
def getInt(self, name, default = None):
|
||||
return self.__getValue(name, int, default)
|
||||
|
||||
def getFloat(self, name, default = None):
|
||||
return self.__getValue(name, float, default)
|
||||
|
||||
def getString(self, name, default = None):
|
||||
return self.__getValue(name, str, default)
|
||||
|
||||
def __getValue(self, name, convOp, default):
|
||||
if default is None:
|
||||
return convOp(self.dict[name])
|
||||
else:
|
||||
return convOp(self.dict.get(name, default))
|
||||
return
|
||||
|
||||
def __onUnexpectedResponse(self, errStr):
|
||||
raise HTTPUtil.UnexpectedResponse(errStr)
|
|
@ -1,18 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.otpbase.OTPGlobals import *
|
||||
from direct.gui.DirectGui import *
|
||||
from MultiPageTextFrame import *
|
||||
from otp.otpbase import OTPLocalizer
|
||||
from otp.otpgui import OTPDialog
|
||||
|
||||
class SecretFriendsInfoPanel(getGlobalDialogClass()):
|
||||
|
||||
def __init__(self, doneEvent, hidePageNum = 0, pageChangeCallback = None):
|
||||
dialogClass = getGlobalDialogClass()
|
||||
dialogClass.__init__(self, parent=aspect2d, dialogName='secretFriendsInfoDialog', doneEvent=doneEvent, okButtonText=OTPLocalizer.SecretFriendsInfoPanelClose, style=OTPDialog.Acknowledge, text='', topPad=1.5, sidePad=1.2, pos=(0, 0, 0.1), scale=0.9)
|
||||
self.textPanel = MultiPageTextFrame(parent=self, textList=OTPLocalizer.SecretFriendsInfoPanelText, hidePageNum=hidePageNum, pageChangeCallback=pageChangeCallback)
|
||||
self['image'] = self['image']
|
||||
self['image_pos'] = (0, 0, -.1)
|
||||
self['image_scale'] = (2, 1, 1.3)
|
||||
closeButton = self.getChild(0)
|
||||
closeButton.setZ(-.56)
|
|
@ -1,280 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from pandac.PandaModules import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from direct.showbase import PythonUtil
|
||||
from otp.otpbase import OTPLocalizer
|
||||
import HTTPUtil
|
||||
import RemoteValueSet
|
||||
import copy
|
||||
accountServer = ''
|
||||
accountServer = launcher.getAccountServer()
|
||||
print 'TTAccount: accountServer from launcher: ', accountServer
|
||||
configAccountServer = base.config.GetString('account-server', '')
|
||||
if configAccountServer:
|
||||
accountServer = configAccountServer
|
||||
print 'TTAccount: overriding accountServer from config: ', accountServer
|
||||
if not accountServer:
|
||||
accountServer = 'https://toontown.go.com'
|
||||
print 'TTAccount: default accountServer: ', accountServer
|
||||
accountServer = URLSpec(accountServer, 1)
|
||||
|
||||
def getAccountServer():
|
||||
return accountServer
|
||||
|
||||
|
||||
TTAccountException = HTTPUtil.HTTPUtilException
|
||||
|
||||
class TTAccount:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('TTAccount')
|
||||
|
||||
def __init__(self, cr):
|
||||
self.cr = cr
|
||||
self.response = None
|
||||
return
|
||||
|
||||
def createAccount(self, loginName, password, data):
|
||||
return self.talk('create', data=self.__makeLoginDict(loginName, password, data))
|
||||
|
||||
def authorize(self, loginName, password):
|
||||
return self.talk('play', data=self.__makeLoginDict(loginName, password))
|
||||
|
||||
def createBilling(self, loginName, password, data):
|
||||
return self.talk('purchase', data=self.__makeLoginDict(loginName, password, data))
|
||||
|
||||
def setParentPassword(self, loginName, password, parentPassword):
|
||||
return self.talk('setParentPassword', data=self.__makeLoginDict(loginName, password, {'parentPassword': parentPassword}))
|
||||
|
||||
def supportsParentPassword(self):
|
||||
return 1
|
||||
|
||||
def authenticateParentPassword(self, loginName, password, parentPassword):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateParentPassword', data=self.__makeLoginDict(loginName, parentPassword))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def supportsAuthenticateDelete(self):
|
||||
return 1
|
||||
|
||||
def authenticateDelete(self, loginName, password):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateDelete', data=self.__makeLoginDict(loginName, password))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def enableSecretFriends(self, loginName, password, parentPassword, enable = 1):
|
||||
try:
|
||||
errorMsg = self.talk('setSecretChat', data=self.__makeLoginDict(loginName, parentPassword, {'chat': base.cr.secretChatAllowed,
|
||||
'secretsNeedParentPassword': base.cr.secretChatNeedsParentPassword}))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
||||
|
||||
def changePassword(self, loginName, password, newPassword):
|
||||
return self.talk('purchase', data=self.__makeLoginDict(loginName, password, {'newPassword': newPassword}))
|
||||
|
||||
def requestPwdReminder(self, email = None, acctName = None):
|
||||
data = {}
|
||||
if email is not None:
|
||||
data['email'] = email
|
||||
else:
|
||||
data['accountName'] = acctName
|
||||
return self.talk('forgotPassword', data)
|
||||
|
||||
def cancelAccount(self, loginName, password):
|
||||
return self.talk('cancel', data=self.__makeLoginDict(loginName, password))
|
||||
|
||||
def getAccountData(self, loginName, password):
|
||||
errorMsg = self.talk('get', data=self.__makeLoginDict(loginName, password))
|
||||
if errorMsg:
|
||||
self.notify.warning('getAccountData error: %s' % errorMsg)
|
||||
return errorMsg
|
||||
if self.response.hasKey('errorMsg'):
|
||||
self.notify.warning("error field is: '%s'" % self.response.getString('errorMsg'))
|
||||
self.accountData = copy.deepcopy(self.response)
|
||||
fieldNameMap = {'em': 'email',
|
||||
'l1': 'addr1',
|
||||
'l2': 'addr2',
|
||||
'l3': 'addr3'}
|
||||
dict = self.accountData.dict
|
||||
for fieldName in dict.keys():
|
||||
if fieldName in fieldNameMap:
|
||||
dict[fieldNameMap[fieldName]] = dict[fieldName]
|
||||
del dict[fieldName]
|
||||
|
||||
return None
|
||||
|
||||
def getLastErrorMsg(self, forceCustServNum = 0):
|
||||
errCode = self.response.getInt('errorCode')
|
||||
if errCode < 100:
|
||||
msg = self.response.getString('errorMsg')
|
||||
if forceCustServNum:
|
||||
msg += ' ' + OTPLocalizer.TTAccountCustomerServiceHelp % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
elif errCode < 200:
|
||||
msg = self.response.getString('errorMsg')
|
||||
msg += ' ' + OTPLocalizer.TTAccountCustomerServiceHelp % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
elif errCode >= 500:
|
||||
msg = OTPLocalizer.TTAccountIntractibleError
|
||||
msg += ' ' + OTPLocalizer.TTAccountCallCustomerService % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
else:
|
||||
self.notify.warning('unknown error code class: %s: %s' % (self.response.getInt('errorCode'), self.response.getString('errorMsg')))
|
||||
msg = self.response.getString('errorMsg')
|
||||
msg += ' ' + OTPLocalizer.TTAccountCallCustomerService % self.cr.accountServerConstants.getString('customerServicePhoneNumber')
|
||||
return msg
|
||||
|
||||
def __makeLoginDict(self, loginName, password, data = None):
|
||||
dict = {'accountName': loginName,
|
||||
'password': password}
|
||||
if data:
|
||||
dict.update(data)
|
||||
return dict
|
||||
|
||||
def makeLoginDict(self, loginName, password, data = None):
|
||||
return self.__makeLoginDict(loginName, password, data)
|
||||
|
||||
def talk(self, operation, data = {}):
|
||||
self.notify.debug('TTAccount.talk()')
|
||||
for key in data.keys():
|
||||
data[key] = str(data[key])
|
||||
|
||||
if operation in ('play', 'get', 'cancel', 'authenticateParentPassword', 'authenticateDelete', 'authenticateParentPasswordNewStyle', 'authenticateDeleteNewStyle'):
|
||||
pass
|
||||
elif operation == 'authenticateParentUsernameAndPassword':
|
||||
pass
|
||||
elif operation == 'forgotPassword':
|
||||
pass
|
||||
elif operation == 'setParentPassword':
|
||||
pass
|
||||
elif operation == 'setSecretChat':
|
||||
pass
|
||||
elif operation == 'create':
|
||||
pass
|
||||
elif operation == 'purchase':
|
||||
if 'newPassword' in data:
|
||||
pass
|
||||
else:
|
||||
self.notify.error("Internal TTAccount error: need to add 'required data' checking for %s operation" % operation)
|
||||
op2Php = {'play': 'play',
|
||||
'get': 'get',
|
||||
'cancel': 'cancel',
|
||||
'create': 'create',
|
||||
'purchase': 'purchase',
|
||||
'setParentPassword': 'setSecrets',
|
||||
'authenticateParentPassword': 'authenticateChat',
|
||||
'authenticateDelete': 'authDelete',
|
||||
'setSecretChat': 'setChat',
|
||||
'forgotPassword': 'forgotPw',
|
||||
'authenticateParentPasswordNewStyle': 'api/authChat',
|
||||
'authenticateParentUsernameAndPassword': 'api/authParentChat',
|
||||
'authenticateDeleteNewStyle': 'api/authDelete'}
|
||||
newWebOperations = ('authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle')
|
||||
url = URLSpec(getAccountServer())
|
||||
if operation in newWebOperations:
|
||||
url.setPath('/%s' % op2Php[operation])
|
||||
else:
|
||||
url.setPath('/%s.php' % op2Php[operation])
|
||||
body = ''
|
||||
if 'accountName' in data:
|
||||
if operation not in newWebOperations:
|
||||
url.setQuery('n=%s' % URLSpec.quote(data['accountName']))
|
||||
serverFields = {'accountName': 'n',
|
||||
'password': 'p',
|
||||
'parentPassword': 'sp',
|
||||
'newPassword': 'np',
|
||||
'chat': 'chat',
|
||||
'email': 'em',
|
||||
'dobYear': 'doby',
|
||||
'dobMonth': 'dobm',
|
||||
'dobDay': 'dobd',
|
||||
'ccNumber': 'ccn',
|
||||
'ccMonth': 'ccm',
|
||||
'ccYear': 'ccy',
|
||||
'nameOnCard': 'noc',
|
||||
'addr1': 'l1',
|
||||
'addr2': 'l2',
|
||||
'addr3': 'l3',
|
||||
'city': 'city',
|
||||
'state': 'state',
|
||||
'country': 'country',
|
||||
'zip': 'zip',
|
||||
'referrer': 'ref',
|
||||
'secretsNeedParentPassword': 'secretsNeedsParentPassword',
|
||||
'parentPasswordNewStyle': 'pp',
|
||||
'parentUsername': 'pu',
|
||||
'userid': 'userid'}
|
||||
ignoredFields = ('ccType',)
|
||||
outBoundFields = {}
|
||||
for fieldName in data.keys():
|
||||
if fieldName not in serverFields:
|
||||
if fieldName not in ignoredFields:
|
||||
self.notify.error('unknown data field: %s' % fieldName)
|
||||
else:
|
||||
outBoundFields[serverFields[fieldName]] = data[fieldName]
|
||||
|
||||
orderedFields = outBoundFields.keys()
|
||||
orderedFields.sort()
|
||||
for fieldName in orderedFields:
|
||||
if len(body):
|
||||
body += '&'
|
||||
body += '%s=%s' % (fieldName, URLSpec.quotePlus(outBoundFields[fieldName]))
|
||||
|
||||
self.notify.debug('url=' + url.cStr())
|
||||
self.notify.debug('body=' + body)
|
||||
if operation in ('get',):
|
||||
expectedHeader = 'ACCOUNT INFO'
|
||||
elif operation in ('play', 'cancel', 'create', 'purchase', 'setParentPassword', 'setSecretChat', 'authenticateParentPassword', 'authenticateDelete', 'forgotPassword', 'authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle'):
|
||||
expectedHeader = 'ACCOUNT SERVER RESPONSE'
|
||||
else:
|
||||
self.notify.error("Internal TTAccount error: need to set expected response header for '%s' operation" % operation)
|
||||
self.response = RemoteValueSet.RemoteValueSet(url, self.cr.http, body=body, expectedHeader=expectedHeader)
|
||||
self.notify.debug(' self.response=' + str(self.response))
|
||||
if self.response.hasKey('errorCode'):
|
||||
errorCode = self.response.getInt('errorCode')
|
||||
self.notify.info('account server error code: %s' % errorCode)
|
||||
if errorCode == 10:
|
||||
self.cr.freeTimeExpiresAt = 0
|
||||
if self.response.hasKey('errorMsg'):
|
||||
return self.getLastErrorMsg()
|
||||
if operation in ('get', 'forgotPassword', 'authenticateDelete', 'play', 'cancel', 'create', 'purchase', 'setParentPassword', 'authenticateParentPassword', 'authenticateParentPasswordNewStyle', 'authenticateParentUsernameAndPassword', 'authenticateDeleteNewStyle'):
|
||||
pass
|
||||
elif operation == 'setSecretChat':
|
||||
self.playToken = self.response.getString('playToken')
|
||||
self.playTokenIsEncrypted = 1
|
||||
else:
|
||||
self.notify.error('Internal TTAccount error: need to extract useful data for %s operation' % operation)
|
||||
return None
|
||||
|
||||
def authenticateParentUsernameAndPassword(self, loginName, password, parentUsername, parentPassword):
|
||||
try:
|
||||
errorMsg = self.talk('authenticateParentUsernameAndPassword', data=self.__makeLoginDict(loginName, password, {'parentUsername': parentUsername,
|
||||
'parentPasswordNewStyle': parentPassword,
|
||||
'userid': loginName}))
|
||||
if not errorMsg:
|
||||
return (1, None)
|
||||
if self.response.getInt('errorCode') in (5, 72):
|
||||
return (0, None)
|
||||
return (0, errorMsg)
|
||||
except TTAccountException, e:
|
||||
return (0, str(e))
|
||||
|
||||
return None
|
|
@ -118,25 +118,6 @@ ActivateChat = "True Friends allows one member to chat with another member only
|
|||
ActivateChatYes = 'Update'
|
||||
ActivateChatNo = lCancel
|
||||
ActivateChatMoreInfo = 'More Info'
|
||||
ActivateChatPrivacyPolicy = 'Privacy Policy'
|
||||
ActivateChatPrivacyPolicy_Button1A = 'Version 1'
|
||||
ActivateChatPrivacyPolicy_Button1K = 'Version 1'
|
||||
ActivateChatPrivacyPolicy_Button2A = 'Version 2'
|
||||
ActivateChatPrivacyPolicy_Button2K = 'Version 2'
|
||||
PrivacyPolicyText_1A = [' ']
|
||||
PrivacyPolicyText_1K = [' ']
|
||||
PrivacyPolicyText_2A = [' ']
|
||||
PrivacyPolicyText_2K = [' ']
|
||||
PrivacyPolicyText_Intro = [' ']
|
||||
PrivacyPolicyClose = lClose
|
||||
SecretFriendsInfoPanelOk = lOK
|
||||
SecretFriendsInfoPanelClose = lClose
|
||||
SecretFriendsInfoPanelText = ['\nThe Open Chat with True Friends Feature\n\nThe Open Chat with True Friends feature enables a member to chat directly with another member within Toontown United (the "Service") once the members establish a True Friends connection. When your child attempts to use the Open Chat with True Friends feature, we will require that you indicate your consent to your child\'s use of this feature by entering your Parent Account Password. Here is a detailed description of the process of creating an Open Chat with True Friends connection between members whom we will call "Sally" and "Mike."\n1. Sally\'s parent and Mike\'s parent each enable the Open Chat with True Friends feature by entering their respective Parent Account Passwords either (a) in the Account Options areas within the Service, or (b) when prompted within the game by a Parental Controls pop-up.\n2. Sally requests a True Friend Code (described below) from within the Service.\n',
|
||||
"\n3. Sally's True Friend Code is communicated to Mike outside of the Service. (Sally's True Friend Code may be communicated to Mike either directly by Sally, or indirectly through Sally's disclosure of the True Friend Code to another person.)\n4. Mike submits Sally's True Friend Code to the Service within 48 hours of the time that Sally requested the True Friend Code from the Service.\n5. The Service then notifies Mike that Sally has become Mike's True Friend. The Service similarly notifies Sally that Mike has become Sally's True Friend.\n6. Sally and Mike can now open chat directly with each other until either one chooses to terminate the other as a True Friend, or until the Open Chat with True Friends feature is disabled for either Sally or Mike by their respective parent. The True Friends connection can thus be disabled anytime by either: (a) a member removing the True Friend from his or her friends list (as described in the Service); or, (b) the parent of that member disabling the Open Chat with ",
|
||||
"\nTrue Friends feature by going to the Account Options area within the Service and following the steps set forth there.\n\nA True Friend Code is a computer-generated random code assigned to a particular member. The True Friend Code must be used to activate a True Friend connection within 48 hours of the time that the member requests the True Friend Code; otherwise, the True Friend Code expires and cannot be used. Moreover, a single True Friend Code can only be used to establish one True Friend connection. To make additional True Friend connections, a member must request an additional True Friend Code for each additional True Friend.\n\nTrue Friendships do not transfer. For example, if Sally becomes a True Friend of Mike, and Mike becomes a True Friend of Jessica, Sally does not automatically become Jessica's True Friend. In order for Sally and Jessica to\n",
|
||||
'\nbecome True Friends, one of them must request a new True Friend Code from the Service and communicate it to the other.\n\nTrue Friends communicate with one another in a free-form interactive open chat. The content of this chat is directly entered by the participating member and is processed through the Service, which is monitored by the Toontown United team. While we advise members not to exchange personal information such as first and last names, e-mail addresses, postal addresses, or phone numbers while using Open Chat with True Friends, we cannot guarantee that such exchanges of personal information will not happen. Although the True Friends chat is automatically filtered for most bad words, Open Chat with True Friends may be moderated, and we reserve the right to moderate any part of the Service that we,\n',
|
||||
"\nin our sole and absolute discretion, deems necessary. However, because Open Chat with True Friends will not always be moderated, if the Parent Account allows a child to use his or her account with the Open Chat with True Friends feature enabled, we strongly encourage parents to supervise their child or children while they play in the Service. By enabling the Open Chat with True Friends feature, the Parent Account acknowledges that there are some risks inherent in the Open Chat with True Friends feature and that the Parent Account has been informed of, and agrees to accept, any such risks, whether foreseeable or otherwise. \n\nWDIG does not use the content of True Friends chat for any purpose other than communicating that content to the member's true friend, and does not disclose that content to any third party except: (1) if required by law, for example, to comply with a court order or subpoena; (2) to enforce the Terms of Use\n",
|
||||
"\napplicable to the Service (which may be accessed on the home page of the Service); or, (3) to protect the safety and security of Members of the Service and the Service itself. In accordance with the Children's Online Privacy Protection Act, we are prohibited from conditioning, and do not condition, a child's participation in any activity (including Open Chat with True Friends) on the child's disclosing more personal information than is reasonably necessary to participate in such activity.\n\nIn addition, as noted above, we recognize the right of a parent to refuse to permit us to continue to allow a child to use the True Friends feature. By enabling the Open Chat with True Friends feature, you acknowledge that there are some risks inherent in the ability of members to open chat with one another through the Open Chat with True Friends feature, and that you have been informed of, and agree to accept, any such risks, whether foreseeable or otherwise.\n"]
|
||||
LeaveToSetParentPassword = 'In order to set parent account password, the game will exit to the Toontown website.'
|
||||
LeaveToSetParentPasswordYes = 'Set Password'
|
||||
LeaveToSetParentPasswordNo = lCancel
|
||||
|
@ -151,24 +132,6 @@ SecretChatActivatedOK = lOK
|
|||
SecretChatActivatedChange = 'Change Options'
|
||||
ProblemActivatingChat = 'Oops! We were unable to activate the "True Friends" chat feature.\n\n%s\n\nPlease try again later.'
|
||||
ProblemActivatingChatOK = lOK
|
||||
MultiPageTextFrameNext = lNext
|
||||
MultiPageTextFramePrev = 'Previous'
|
||||
MultiPageTextFramePage = 'Page %s/%s'
|
||||
GuiScreenToontownUnavailable = 'The server appears to be temporarily unavailable, still trying...'
|
||||
GuiScreenCancel = lCancel
|
||||
CreateAccountScreenUserName = 'Account Name'
|
||||
CreateAccountScreenPassword = 'Password'
|
||||
CreateAccountScreenConfirmPassword = 'Confirm Password'
|
||||
CreateAccountScreenCancel = lCancel
|
||||
CreateAccountScreenSubmit = 'Submit'
|
||||
CreateAccountScreenConnectionErrorSuffix = '.\n\nPlease try again later.'
|
||||
CreateAccountScreenNoAccountName = 'Please enter an account name.'
|
||||
CreateAccountScreenAccountNameTooShort = 'Your account name must be at least %s characters long. Please try again.'
|
||||
CreateAccountScreenPasswordTooShort = 'Your password must be at least %s characters long. Please try again.'
|
||||
CreateAccountScreenPasswordMismatch = 'The passwords you typed did not match. Please try again.'
|
||||
CreateAccountScreenUserNameTaken = 'That user name is already taken. Please try again.'
|
||||
CreateAccountScreenInvalidUserName = 'Invalid user name.\nPlease try again.'
|
||||
CreateAccountScreenUserNameNotFound = 'User name not found.\nPlease try again or create a new account.'
|
||||
CRConnecting = 'Connecting...'
|
||||
CRNoConnectTryAgain = 'Could not connect to %s:%s. Try again?'
|
||||
CRNoConnectProxyNoPort = 'Could not connect to %s:%s.\n\nYou are communicating to the internet via a proxy, but your proxy does not permit connections on port %s.\n\nYou must open up this port, or disable your proxy, in order to play. If your proxy has been provided by your ISP, you must contact your ISP to request them to open up this port.'
|
||||
|
@ -209,7 +172,6 @@ CREnteringToontown = 'Entering...'
|
|||
LoginScreenUserName = 'Account Name'
|
||||
LoginScreenPassword = 'Password'
|
||||
LoginScreenLogin = 'Login'
|
||||
LoginScreenCreateAccount = 'Create Account'
|
||||
LoginScreenQuit = lQuit
|
||||
LoginScreenLoginPrompt = 'Please enter a user name and password.'
|
||||
LoginScreenBadPassword = 'Bad password.\nPlease try again.'
|
||||
|
@ -2896,9 +2858,6 @@ WhiteListMenu = [-1, 'WHITELIST']
|
|||
SellbotInvasionMenuSections = [-1]
|
||||
SellbotFieldOfficeMenuSections = [-1, 'STRATEGY']
|
||||
IdesOfMarchMenuSections = [-1]
|
||||
TTAccountCallCustomerService = 'Please call Customer Service at %s.'
|
||||
TTAccountCustomerServiceHelp = '\nIf you need help, please call Customer Service at %s.'
|
||||
TTAccountIntractibleError = 'An error occurred.'
|
||||
|
||||
def timeElapsedString(timeDelta):
|
||||
timeDelta = abs(timeDelta)
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
from pandac.PandaModules import Vec4
|
||||
from direct.gui.DirectGui import DirectFrame, DGG
|
||||
from direct.task import Task
|
||||
from direct.showbase.PythonUtil import bound
|
||||
from otp.otpbase import OTPGlobals
|
||||
|
||||
class OTPTimer(DirectFrame):
|
||||
ClockImage = None
|
||||
TimerId = 0
|
||||
|
||||
def __init__(self, useImage = True, highlightNearEnd = True):
|
||||
if useImage:
|
||||
image = self.getImage()
|
||||
else:
|
||||
image = None
|
||||
DirectFrame.__init__(self, state=DGG.DISABLED, relief=None, scale=0.45, image=image, image_pos=(0, 0, 0), text='0', text_fg=(0, 0, 0, 1), text_font=OTPGlobals.getInterfaceFont(), text_pos=(-0.01, -0.15), text_scale=0.35)
|
||||
self.initialiseoptions(OTPTimer)
|
||||
self.timerId = OTPTimer.TimerId
|
||||
OTPTimer.TimerId += 1
|
||||
self.highlightNearEnd = highlightNearEnd
|
||||
self.countdownTask = None
|
||||
self.currentTime = 0
|
||||
self.taskTime = 0.0
|
||||
self.setFontColor(Vec4(0, 0, 0, 1))
|
||||
return
|
||||
|
||||
def setFontColor(self, vColor):
|
||||
self.vFontColor = vColor
|
||||
|
||||
def getImage(self):
|
||||
if OTPTimer.ClockImage == None:
|
||||
model = loader.loadModel('phase_3.5/models/gui/clock_gui')
|
||||
OTPTimer.ClockImage = model.find('**/alarm_clock')
|
||||
model.removeNode()
|
||||
return OTPTimer.ClockImage
|
||||
|
||||
def posInTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.17)
|
||||
|
||||
def posBelowTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.42)
|
||||
|
||||
def posAboveShtikerBook(self):
|
||||
self.reparentTo(base.a2dBottomRight)
|
||||
self.setPos(-0.173, 0, 0.37)
|
||||
|
||||
def setTime(self, time):
|
||||
time = bound(time, 0, 999)
|
||||
if time == self.currentTime:
|
||||
return
|
||||
self.currentTime = time
|
||||
timeStr = str(time)
|
||||
timeStrLen = len(timeStr)
|
||||
if timeStrLen == 1:
|
||||
if time <= 5 and self.highlightNearEnd:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125), Vec4(1, 0, 0, 1))
|
||||
else:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125))
|
||||
elif timeStrLen == 2:
|
||||
self.setTimeStr(timeStr, 0.27, (-0.025, -0.1))
|
||||
elif timeStrLen == 3:
|
||||
self.setTimeStr(timeStr, 0.2, (-0.01, -0.08))
|
||||
|
||||
def setTimeStr(self, timeStr, scale = 0.2, pos = (-0.01, -0.08), fg = None):
|
||||
self['text'] = ''
|
||||
self['text_fg'] = fg or self.vFontColor
|
||||
self['text_scale'] = scale
|
||||
self['text_pos'] = pos
|
||||
self['text'] = timeStr
|
||||
|
||||
def getElapsedTime(self):
|
||||
return self.taskTime
|
||||
|
||||
def _timerTask(self, task):
|
||||
countdownTime = int(task.duration - task.time)
|
||||
self.setTime(countdownTime)
|
||||
self.taskTime = task.time
|
||||
if task.time >= task.duration:
|
||||
self.timerExpired()
|
||||
if task.callback:
|
||||
task.callback()
|
||||
return Task.done
|
||||
else:
|
||||
return Task.cont
|
||||
|
||||
def countdown(self, duration, callback = None):
|
||||
self.countdownTask = Task.Task(self._timerTask)
|
||||
self.countdownTask.duration = duration
|
||||
self.countdownTask.callback = callback
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
||||
|
||||
def timerExpired(self):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
if self.countdownTask:
|
||||
taskMgr.remove(self.countdownTask)
|
||||
|
||||
def reset(self):
|
||||
self.stop()
|
||||
self.setTime(0)
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
self.taskTime = 0.0
|
||||
|
||||
def destroy(self):
|
||||
self.reset()
|
||||
self.countdownTask = None
|
||||
DirectFrame.destroy(self)
|
||||
return
|
||||
|
||||
def cleanup(self):
|
||||
self.destroy()
|
||||
self.notify.warning('Call destroy, not cleanup')
|
|
@ -33,7 +33,6 @@ from toontown.distributed import DelayDelete
|
|||
from toontown.friends import FriendHandle
|
||||
from toontown.friends import FriendsListPanel
|
||||
from toontown.friends import ToontownFriendSecret
|
||||
from toontown.login import DateObject
|
||||
from toontown.login import AvatarChooser
|
||||
from toontown.makeatoon import MakeAToon
|
||||
from toontown.pets import DistributedPet, PetDetail, PetHandle
|
||||
|
@ -105,7 +104,6 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
|
|||
self.friendPendingChatSettings = {}
|
||||
self.elderFriendsMap = {}
|
||||
self.__queryAvatarMap = {}
|
||||
self.dateObject = DateObject.DateObject()
|
||||
self.hoodMgr = HoodMgr.HoodMgr(self)
|
||||
self.setZonesEmulated = 0
|
||||
self.old_setzone_interest_handle = None
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
from pandac.PandaModules import *
|
||||
from otp.login.HTTPUtil import *
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.login import TTAccount
|
||||
import DateObject
|
||||
import TTDateObject
|
||||
import time
|
||||
|
||||
class AccountServerDate:
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('AccountServerDate')
|
||||
|
||||
def __init__(self):
|
||||
self.__grabbed = 0
|
||||
|
||||
def getServer(self):
|
||||
return TTAccount.getAccountServer().cStr()
|
||||
|
||||
def grabDate(self, force = 0):
|
||||
if self.__grabbed and not force:
|
||||
self.notify.debug('using cached account server date')
|
||||
return
|
||||
if base.cr.accountOldAuth or base.config.GetBool('use-local-date', 0):
|
||||
self.__useLocalClock()
|
||||
return
|
||||
url = URLSpec(self.getServer())
|
||||
url.setPath('/getDate.php')
|
||||
self.notify.debug('grabbing account server date from %s' % url.cStr())
|
||||
response = getHTTPResponse(url, http)
|
||||
if response[0] != 'ACCOUNT SERVER DATE':
|
||||
self.notify.debug('invalid response header')
|
||||
raise UnexpectedResponse, 'unexpected response, response=%s' % response
|
||||
try:
|
||||
epoch = int(response[1])
|
||||
except ValueError, e:
|
||||
self.notify.debug(str(e))
|
||||
raise UnexpectedResponse, 'unexpected response, response=%s' % response
|
||||
|
||||
timeTuple = time.gmtime(epoch)
|
||||
self.year = timeTuple[0]
|
||||
self.month = timeTuple[1]
|
||||
self.day = timeTuple[2]
|
||||
base.cr.dateObject = TTDateObject.TTDateObject(self)
|
||||
self.__grabbed = 1
|
||||
|
||||
def __useLocalClock(self):
|
||||
self.month = base.cr.dateObject.getMonth()
|
||||
self.year = base.cr.dateObject.getYear()
|
||||
self.day = base.cr.dateObject.getDay()
|
||||
|
||||
def getMonth(self):
|
||||
return self.month
|
||||
|
||||
def getYear(self):
|
||||
return self.year
|
||||
|
||||
def getDay(self):
|
||||
return self.day
|
|
@ -1,64 +0,0 @@
|
|||
import time
|
||||
|
||||
class DateObject:
|
||||
|
||||
def getYear(self):
|
||||
return time.localtime(time.time())[0]
|
||||
|
||||
def getMonth(self):
|
||||
return time.localtime(time.time())[1]
|
||||
|
||||
def getDay(self):
|
||||
return time.localtime(time.time())[2]
|
||||
|
||||
def getDetailedAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
if curMonth is None:
|
||||
curMonth = self.getMonth()
|
||||
if curYear is None:
|
||||
curYear = self.getYear()
|
||||
if curDay is None:
|
||||
curDay = self.getDay()
|
||||
curMonths = curYear * 12 + (curMonth - 1)
|
||||
dobMonths = dobYear * 12 + (dobMonth - 1)
|
||||
if dobMonth == curMonth:
|
||||
if dobDay is not None:
|
||||
if dobDay > curDay:
|
||||
curMonths -= 1
|
||||
ageMonths = curMonths - dobMonths
|
||||
return (int(ageMonths / 12), ageMonths % 12)
|
||||
|
||||
def getAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return self.getDetailedAge(dobMonth, dobYear, dobDay=dobDay, curMonth=curMonth, curYear=curYear, curDay=curDay)[0]
|
||||
|
||||
def getNumDaysInMonth(self, month = None, year = None):
|
||||
|
||||
def isLeapYear(year):
|
||||
if year % 4 == 0:
|
||||
if year % 100 == 0:
|
||||
if year % 400 == 0:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
if month is None:
|
||||
m = self.getMonth()
|
||||
else:
|
||||
m = month
|
||||
if year is None:
|
||||
y = self.getYear()
|
||||
else:
|
||||
y = year
|
||||
if m == 2:
|
||||
if isLeapYear(y):
|
||||
return 29
|
||||
else:
|
||||
return 28
|
||||
elif m in (1, 3, 5, 7, 8, 10, 12):
|
||||
return 31
|
||||
else:
|
||||
return 30
|
||||
return
|
|
@ -1,21 +0,0 @@
|
|||
import DateObject
|
||||
|
||||
class TTDateObject(DateObject.DateObject):
|
||||
|
||||
def __init__(self, accountServerDate):
|
||||
self.accountServerDate = accountServerDate
|
||||
|
||||
def getYear(self):
|
||||
return self.accountServerDate.getYear()
|
||||
|
||||
def getMonth(self):
|
||||
return self.accountServerDate.getMonth()
|
||||
|
||||
def getDay(self):
|
||||
return self.accountServerDate.getDay()
|
||||
|
||||
def getDetailedAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return DateObject.DateObject.getDetailedAge(self, dobMonth, dobYear, dobDay, curMonth=self.getMonth(), curYear=self.getYear(), curDay=self.getDay())
|
||||
|
||||
def getAge(self, dobMonth, dobYear, dobDay = None, curMonth = None, curYear = None, curDay = None):
|
||||
return TTDateObject.getDetailedAge(self, dobMonth, dobYear, dobDay=dobDay, curMonth=curMonth, curYear=curYear, curDay=curDay)[0]
|
|
@ -1,6 +1,5 @@
|
|||
from direct.distributed import DistributedObject
|
||||
from direct.directnotify import DirectNotifyGlobal
|
||||
from otp.otpbase import OTPTimer
|
||||
from toontown.toonbase import TTLocalizer
|
||||
from toontown.racing import KartShopGlobals
|
||||
from toontown.toonbase.ToonBaseGlobal import *
|
||||
|
|
|
@ -1,11 +1,31 @@
|
|||
from otp.otpbase.OTPTimer import OTPTimer
|
||||
from pandac.PandaModules import *
|
||||
from pandac.PandaModules import Vec4
|
||||
from direct.gui.DirectGui import DirectFrame, DGG
|
||||
from direct.task import Task
|
||||
from direct.showbase.PythonUtil import bound
|
||||
from otp.otpbase import OTPGlobals
|
||||
|
||||
class ToontownTimer(OTPTimer):
|
||||
class ToontownTimer(DirectFrame):
|
||||
ClockImage = None
|
||||
TimerId = 0
|
||||
|
||||
def __init__(self, useImage = True, highlightNearEnd = True):
|
||||
OTPTimer.__init__(self, useImage, highlightNearEnd)
|
||||
if useImage:
|
||||
image = self.getImage()
|
||||
else:
|
||||
image = None
|
||||
DirectFrame.__init__(self, state=DGG.DISABLED, relief=None, scale=0.45, image=image, image_pos=(0, 0, 0), text='0', text_fg=(0, 0, 0, 1), text_font=OTPGlobals.getInterfaceFont(), text_pos=(-0.01, -0.15), text_scale=0.35)
|
||||
self.initialiseoptions(ToontownTimer)
|
||||
self.timerId = ToontownTimer.TimerId
|
||||
ToontownTimer.TimerId += 1
|
||||
self.highlightNearEnd = highlightNearEnd
|
||||
self.countdownTask = None
|
||||
self.currentTime = 0
|
||||
self.taskTime = 0.0
|
||||
self.setFontColor(Vec4(0, 0, 0, 1))
|
||||
return
|
||||
|
||||
def setFontColor(self, vColor):
|
||||
self.vFontColor = vColor
|
||||
|
||||
def getImage(self):
|
||||
if ToontownTimer.ClockImage == None:
|
||||
|
@ -13,3 +33,84 @@ class ToontownTimer(OTPTimer):
|
|||
ToontownTimer.ClockImage = model.find('**/alarm_clock')
|
||||
model.removeNode()
|
||||
return ToontownTimer.ClockImage
|
||||
|
||||
def posInTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.17)
|
||||
|
||||
def posBelowTopRightCorner(self):
|
||||
self.reparentTo(base.a2dTopRight)
|
||||
self.setPos(-0.173, 0, -0.42)
|
||||
|
||||
def posAboveShtikerBook(self):
|
||||
self.reparentTo(base.a2dBottomRight)
|
||||
self.setPos(-0.173, 0, 0.37)
|
||||
|
||||
def setTime(self, time):
|
||||
time = bound(time, 0, 999)
|
||||
if time == self.currentTime:
|
||||
return
|
||||
self.currentTime = time
|
||||
timeStr = str(time)
|
||||
timeStrLen = len(timeStr)
|
||||
if timeStrLen == 1:
|
||||
if time <= 5 and self.highlightNearEnd:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125), Vec4(1, 0, 0, 1))
|
||||
else:
|
||||
self.setTimeStr(timeStr, 0.34, (-0.025, -0.125))
|
||||
elif timeStrLen == 2:
|
||||
self.setTimeStr(timeStr, 0.27, (-0.025, -0.1))
|
||||
elif timeStrLen == 3:
|
||||
self.setTimeStr(timeStr, 0.2, (-0.01, -0.08))
|
||||
|
||||
def setTimeStr(self, timeStr, scale = 0.2, pos = (-0.01, -0.08), fg = None):
|
||||
self['text'] = ''
|
||||
self['text_fg'] = fg or self.vFontColor
|
||||
self['text_scale'] = scale
|
||||
self['text_pos'] = pos
|
||||
self['text'] = timeStr
|
||||
|
||||
def getElapsedTime(self):
|
||||
return self.taskTime
|
||||
|
||||
def _timerTask(self, task):
|
||||
countdownTime = int(task.duration - task.time)
|
||||
self.setTime(countdownTime)
|
||||
self.taskTime = task.time
|
||||
if task.time >= task.duration:
|
||||
self.timerExpired()
|
||||
if task.callback:
|
||||
task.callback()
|
||||
return Task.done
|
||||
else:
|
||||
return Task.cont
|
||||
|
||||
def countdown(self, duration, callback = None):
|
||||
self.countdownTask = Task.Task(self._timerTask)
|
||||
self.countdownTask.duration = duration
|
||||
self.countdownTask.callback = callback
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
return taskMgr.add(self.countdownTask, 'timerTask%s' % self.timerId)
|
||||
|
||||
def timerExpired(self):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
if self.countdownTask:
|
||||
taskMgr.remove(self.countdownTask)
|
||||
|
||||
def reset(self):
|
||||
self.stop()
|
||||
self.setTime(0)
|
||||
taskMgr.remove('timerTask%s' % self.timerId)
|
||||
self.taskTime = 0.0
|
||||
|
||||
def destroy(self):
|
||||
self.reset()
|
||||
self.countdownTask = None
|
||||
DirectFrame.destroy(self)
|
||||
return
|
||||
|
||||
def cleanup(self):
|
||||
self.destroy()
|
||||
self.notify.warning('Call destroy, not cleanup')
|
||||
|
|
Loading…
Reference in a new issue