コード例 #1
0
    def __onStatsChanged(self, stats):
        newValues = Money.extractMoneyDict(stats)
        if newValues:
            for currency, value in newValues.iteritems():
                if value < self.__currentMoney.get(currency, 0):
                    self.__spendCurrencies.append(currency)
                if value > self.__currentMoney.get(currency, 0):
                    self.__earnCurrencies.append(currency)

            if not self.__isLocked:
                self.__playAllSounds()
            self.__currentMoney = self.__currentMoney.replaceAll(newValues)
コード例 #2
0
    def __onStatsChanged(self, stats):
        newValues = Money.extractMoneyDict(stats)
        if newValues:
            spendCurrencies = []
            earnCurrencies = []
            for currency, value in newValues.iteritems():
                if value < self.__currentMoney.get(currency, 0):
                    spendCurrencies.append(currency)
                if value > self.__currentMoney.get(currency, 0):
                    earnCurrencies.append(currency)

            if spendCurrencies:
                self.__playSound(self.__getSoundID(spendCurrencies, _SPEND_SINGLE_SOUNDS, _SPEND_MULTI_SOUNDS, SoundEffectsId.SPEND_DEFAULT_SOUND))
            elif earnCurrencies:
                self.__playSound(self.__getSoundID(earnCurrencies, _EARN_SINGLE_SOUNDS, _EARN_MULTI_SOUNDS, SoundEffectsId.EARN_DEFAULT_SOUND))
            self.__currentMoney = self.__currentMoney.replaceAll(newValues)
コード例 #3
0
 def __onStatsChanged(self, stats):
     newValues = Money.extractMoneyDict(stats)
     if newValues:
         self.__balance = self.__balance.replaceAll(newValues)
         self.onInvalidate()