Color shop crash fix

This commit is contained in:
John 2015-08-07 23:27:54 +03:00
parent 4a0ac70835
commit d696338f5d

View file

@ -28,6 +28,7 @@ class ColorShop(StateData.StateData):
self.allParts = (TTLocalizer.ColorAll, TTLocalizer.ColorShopHead, TTLocalizer.ColorShopBody, TTLocalizer.ColorShopGloves, TTLocalizer.ColorShopLegs) self.allParts = (TTLocalizer.ColorAll, TTLocalizer.ColorShopHead, TTLocalizer.ColorShopBody, TTLocalizer.ColorShopGloves, TTLocalizer.ColorShopLegs)
if not hasattr(self, 'headChoice'): if not hasattr(self, 'headChoice'):
self.headChoice = colorList.index(self.dna.headColor) self.headChoice = colorList.index(self.dna.headColor)
self.allChoice = self.headChoice
self.armChoice = colorList.index(self.dna.armColor) self.armChoice = colorList.index(self.dna.armColor)
self.gloveChoice = colorList.index(self.dna.gloveColor) self.gloveChoice = colorList.index(self.dna.gloveColor)
self.legChoice = colorList.index(self.dna.legColor) self.legChoice = colorList.index(self.dna.legColor)
@ -217,15 +218,14 @@ class ColorShop(StateData.StateData):
def __swapAllColor(self, offset): def __swapAllColor(self, offset):
colorList = self.getColorList() colorList = self.getColorList()
length = len(colorList) length = len(colorList)
choice = (self.headChoice + offset) % length self.allChoice = (self.allChoice + offset) % length
self.__updateScrollButtons(choice, length, self.allLButton, self.allRButton) self.__updateScrollButtons(self.allChoice, length, self.allLButton, self.allRButton)
self.__swapHeadColor(offset) newColor = colorList[self.allChoice]
oldArmColorIndex = colorList.index(self.toon.style.armColor) self.dna.headColor = newColor
oldGloveColorIndex = colorList.index(self.toon.style.gloveColor) self.dna.armColor = newColor
oldLegColorIndex = colorList.index(self.toon.style.legColor) self.dna.gloveColor = newColor
self.__swapArmColor(choice - oldArmColorIndex) self.dna.legColor = newColor
self.__swapGloveColor(choice - oldGloveColorIndex) self.toon.swapToonColor(self.dna)
self.__swapLegColor(choice - oldLegColorIndex)
def __swapHeadColor(self, offset): def __swapHeadColor(self, offset):
colorList = self.getColorList() colorList = self.getColorList()