def __manageCamera(self):
     isCameraRotationEnabled = True
     if self.visible:
         formattedNumber = formatPersonalNumber(self._currentNumber,
                                                self._digitsCount)
         isCameraRotationEnabled = isPersonalNumberAllowed(formattedNumber)
     self.__ctx.c11nCameraManager.enableMovementByMouse(
         enableRotation=isCameraRotationEnabled)
Ejemplo n.º 2
0
 def __configurePersonalNumberComponent(self, component, item):
     if not component.number:
         return
     if not self.__editModeEnabled and item.digitsCount != len(component.number):
         number = fitPersonalNumber(component.number, item.digitsCount)
         number = formatPersonalNumber(number, item.digitsCount)
         if isPersonalNumberAllowed(number):
             component.number = number
         else:
             component.number = EMPTY_PERSONAL_NUMBER
             BigWorld.callback(0.0, lambda : self._events.onPersonalNumberCleared(number))
 def __showPromptHint(self, showImmediately=False):
     message = _ms(
         VEHICLE_CUSTOMIZATION.PROPERTYSHEET_INSCRIPTIONCONTROLLER_PROMPT,
         start=formatPersonalNumber('1', self._digitsCount),
         end='9' * self._digitsCount)
     if showImmediately:
         delay, duration = 0, _DEFAULT_HINT_DURATION
     else:
         delay, duration = self.__calcHintTimings(
             _ENTER_NUMBER_HINT_SHOWN_FIELD)
     hintVO = self.__getHintVO(message, duration=duration, delay=delay)
     self.as_showHintS(hintVO)
 def stop(self):
     if not self.visible:
         return
     else:
         newNumber = formatPersonalNumber(self._currentNumber,
                                          self._digitsCount)
         if isPersonalNumberAllowed(newNumber):
             self._currentNumber = newNumber
             self.hide()
             return
         if self.__storedNumber is not None:
             newNumber = formatPersonalNumber(self.__storedNumber,
                                              self._digitsCount)
             if isPersonalNumberAllowed(newNumber):
                 self._currentNumber = newNumber
                 self.hide()
                 return
         item = self.__ctx.mode.getItemFromSlot(self.__slotId)
         if item is not None:
             self.__showProhibitedNumberSystemMsg(item, newNumber)
         self.hide()
         self.__ctx.mode.removeItem(self.__slotId)
         return
 def cancel(self):
     if not self.visible:
         return
     else:
         if self.__storedNumber is None:
             self.hide()
             self.__ctx.mode.removeItem(self.__slotId)
         else:
             newNumber = fitPersonalNumber(self.__storedNumber,
                                           self._digitsCount)
             newNumber = formatPersonalNumber(newNumber, self._digitsCount)
             if isPersonalNumberAllowed(newNumber):
                 self._currentNumber = newNumber
                 self.hide()
             else:
                 self.__showProhibitedHint(newNumber)
                 self.__storedNumber = None
         SoundGroups.g_instance.playSound2D(SOUNDS.CUST_CHOICE_ESC)
         return
 def finish(self, cancelIfEmpty=False):
     if not self.visible:
         return
     if self._currentNumber == EMPTY_PERSONAL_NUMBER:
         if cancelIfEmpty:
             self.cancel()
         else:
             self.__showPromptHint(showImmediately=True)
         return
     newNumber = formatPersonalNumber(self._currentNumber,
                                      self._digitsCount)
     if isPersonalNumberAllowed(newNumber):
         SoundGroups.g_instance.playSound2D(SOUNDS.CUST_CHOICE_ENTER)
         self._currentNumber = newNumber
         self.hide()
     elif not self.__isProhibitedHintShown:
         self.__prohibitedHintShown(True)
         self.__showProhibitedHint(newNumber)
         self.delayCallback(_DEFAULT_HINT_DURATION * 0.001,
                            lambda: self.__prohibitedHintShown(False))
 def update(self, slotId):
     item = self.__ctx.mode.getItemFromSlot(slotId)
     if item is not None and item.itemTypeID == GUI_ITEM_TYPE.PERSONAL_NUMBER:
         self._digitsCount = item.digitsCount
     else:
         self.hide()
         return
     if self.visible:
         if item.digitsCount <= len(self.__currentNumber):
             newNumber = fitPersonalNumber(self._currentNumber,
                                           item.digitsCount)
             newNumber = formatPersonalNumber(newNumber, item.digitsCount)
             if isPersonalNumberAllowed(newNumber):
                 self._currentNumber = newNumber
             else:
                 self._currentNumber = EMPTY_PERSONAL_NUMBER
                 self.__showProhibitedHint(newNumber)
         return
     else:
         component = self.__ctx.mode.getComponentFromSlot(slotId)
         if component is not None and not component.isFilled():
             self.start(slotId)
         return