Exemple #1
0
    def __init__(self, parentFSM, avList, doneEvent, index, isPaid):
        self.isPaid = isPaid
        StateData.StateData.__init__(self, doneEvent)
        self.phase = 3
        self.names = ['', '', '', '']
        self.dnastring = None
        self.dna = None
        self.progressing = 0
        self.toonPosition = Point3(-1.62, -3.49, 0)
        self.toonScale = Point3(1, 1, 1)
        self.toonHpr = Point3(180, 0, 0)
        self.leftTime = 1.6
        self.rightTime = 1
        self.slide = 0
        self.nameList = []
        self.warp = 0
        for av in avList:
            if av.position == index:
                self.warp = 1
                self.namelessPotAv = av
            self.nameList.append(av.name)

        self.fsm = ClassicFSM.ClassicFSM('MakeAToon', [
            State.State('Init', self.enterInit, self.exitInit,
                        ['GenderShop', 'NameShop']),
            State.State('GenderShop', self.enterGenderShop,
                        self.exitGenderShop, ['BodyShop']),
            State.State('BodyShop', self.enterBodyShop, self.exitBodyShop,
                        ['GenderShop', 'ColorShop']),
            State.State('ColorShop', self.enterColorShop, self.exitColorShop,
                        ['BodyShop', 'ClothesShop']),
            State.State('ClothesShop', self.enterClothesShop,
                        self.exitClothesShop, ['ColorShop', 'NameShop']),
            State.State('NameShop', self.enterNameShop, self.exitNameShop,
                        ['ClothesShop']),
            State.State('Done', self.enterDone, self.exitDone, [])
        ], 'Init', 'Done')
        self.parentFSM = parentFSM
        self.parentFSM.getStateNamed('createAvatar').addChild(self.fsm)
        self.gs = GenderShop.GenderShop(self, 'GenderShop-done')
        self.bs = BodyShop.BodyShop('BodyShop-done')
        self.cos = ColorShop.ColorShop('ColorShop-done')
        self.cls = MakeClothesGUI.MakeClothesGUI('ClothesShop-done')
        self.ns = NameShop.NameShop(self, 'NameShop-done', avList, index,
                                    self.isPaid)
        self.shop = GENDERSHOP
        self.shopsVisited = []
        if self.warp:
            self.shopsVisited = [GENDERSHOP, BODYSHOP, COLORSHOP, CLOTHESSHOP]
        self.music = None
        self.soundBack = None
        self.fsm.enterInitialState()
        self.hprDelta = -1
        self.dropIval = None
        self.roomSquishIval = None
        self.propSquishIval = None
        self.focusOutIval = None
        self.focusInIval = None
        self.toon = None
        return
Exemple #2
0
    def __init__(self, parentFSM, avList, doneEvent, index, isPaid):
        """
        MakeAToon constructor: create a toon and let the guest customize it
        """
        self.isPaid = isPaid
        StateData.StateData.__init__(self, doneEvent)
        # download phase
        self.phase = 3

        # names is a list of the toon's name, wantName, approvedName, and rejectedName
        #   name is distributed while the other three are specialized for makeatoon process
        self.names = ["", "", "", ""]
        self.dnastring = None
        self.dna = None
        self.progressing = 0

        self.toonPosition = Point3(-1.62, -3.49, 0)
        self.toonScale = Point3(1, 1, 1)
        self.toonHpr = Point3(180, 0, 0)
        self.leftTime = 1.6
        self.rightTime = 1
        self.slide = 0

        # keep a list of already used names so we don't repeat
        self.nameList = []
        # if self.warp gets set to 1, that means we have an avatar already,
        #   and just want to add a name
        self.warp = 0
        for av in avList:
            if av.position == index:
                self.warp = 1
                self.namelessPotAv = av
            self.nameList.append(av.name)

        self.fsm = ClassicFSM.ClassicFSM(
            'MakeAToon',
            [
                State.State('Init', self.enterInit, self.exitInit,
                            ['GenderShop', 'NameShop']),
                State.State('GenderShop', self.enterGenderShop,
                            self.exitGenderShop, ['BodyShop']),
                State.State('BodyShop', self.enterBodyShop, self.exitBodyShop,
                            ['GenderShop', 'ColorShop']),
                State.State('ColorShop', self.enterColorShop,
                            self.exitColorShop, ['BodyShop', 'ClothesShop']),
                State.State('ClothesShop', self.enterClothesShop,
                            self.exitClothesShop, ['ColorShop', 'NameShop']),
                State.State('NameShop', self.enterNameShop, self.exitNameShop,
                            ['ClothesShop']),
                State.State('Done', self.enterDone, self.exitDone, [])
            ],
            # Initial state
            'Init',
            # Final state
            'Done',
        )

        self.parentFSM = parentFSM
        self.parentFSM.getStateNamed('createAvatar').addChild(self.fsm)

        # create the shops
        self.gs = GenderShop.GenderShop(self, "GenderShop-done")
        self.bs = BodyShop.BodyShop("BodyShop-done")
        self.cos = ColorShop.ColorShop("ColorShop-done")
        self.cls = MakeClothesGUI.MakeClothesGUI("ClothesShop-done")
        self.ns = NameShop.NameShop(self, "NameShop-done", avList, index,
                                    self.isPaid)
        self.shop = GENDERSHOP
        self.shopsVisited = []

        if self.warp:
            self.shopsVisited = [GENDERSHOP, BODYSHOP, COLORSHOP, CLOTHESSHOP]

        # sound
        self.music = None
        self.soundBack = None

        self.fsm.enterInitialState()

        if __debug__:
            base.mat = self

        self.hprDelta = -1
        self.dropIval = None
        self.roomSquishIval = None
        self.propSquishIval = None
        self.focusOutIval = None
        self.focusInIval = None
        self.toon = None