Beispiel #1
0
    def doSpawnTitleText(self, text):
        self.titleColor = (1.0, 0.5, 0.4, 1.0)
        self.titleText = OnscreenText.OnscreenText(
            text,
            fg=self.titleColor,
            font=ToontownGlobals.getSignFont(),
            pos=(0, -0.5),
            scale=0.16,
            drawOrder=0,
            mayChange=1,
            wordwrap=16)

        self.titleText.setText(text)
        self.titleText.show()
        self.titleText.setColor(Vec4(*self.titleColor))
        self.titleText.clearColorScale()
        self.titleText.setFg(self.titleColor)
        seq = Task.sequence(
            # HACK! Let a pause go by to cover the loading pause
            # This tricks the taskMgr
            Task.pause(0.1),
            Task.pause(6.0),
            self.titleText.lerpColorScale(Vec4(1.0, 1.0, 1.0, 1.0),
                                          Vec4(1.0, 1.0, 1.0, 0.0), 0.5),
            Task(self.hideTitleTextTask))
        taskMgr.add(seq, "titleText")
Beispiel #2
0
    def undecorate(self):

        # Fixes transition related crashes
        if (self.__checkHoodValidity() or self.__checkStreetValidity()) and hasattr(base.cr.playGame.hood, "sky") \
        and base.cr.playGame.hood.sky:
            postShow = Sequence(
                Parallel(
                    LerpColorScaleInterval(base.cr.playGame.hood.sky, 1.5,
                                           Vec4(1, 1, 1, 1)),
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           2.5, Vec4(1, 1, 1, 1)),
                ),
                Func(self.__stopSpookySky),
            )
            postShow.start()

        # Replace the witch wiht the plane
        distributedEstate = base.cr.doFind("DistributedEstate")

        if distributedEstate:
            distributedEstate.unloadWitch()

        # if there are any other decoration holidays running
        holidayIds = base.cr.newsManager.getDecorationHolidayId()
        if len(holidayIds) > 0:
            self.decorate()
            return

        # Reload the regular storage file
        storageFile = base.cr.playGame.hood.storageDNAFile
        if storageFile:
            loadDNAFile(self.dnaStore, storageFile, CSDefault)
        self.swapIval = self.getSwapVisibleIval()
        if self.swapIval:
            self.swapIval.start()
Beispiel #3
0
    def decorate(self):
        # Load the specified seasonal storage file
        self.updateHoodDNAStore()
        self.swapIval = self.getSwapVisibleIval()
        if self.swapIval:
            self.swapIval.start()

        def __lightDecorationOn__():
            # import pdb; pdb.set_trace()
            place = base.cr.playGame.getPlace()
            if hasattr(place, "halloweenLights"):
                if not self.__checkStreetValidity():
                    return
                else:
                    place.halloweenLights = place.loader.geom.findAllMatches(
                        "**/*light*")
                    place.halloweenLights += place.loader.geom.findAllMatches(
                        "**/*lamp*")
                    place.halloweenLights += place.loader.geom.findAllMatches(
                        "**/prop_snow_tree*")
                    for light in place.halloweenLights:
                        light.setColorScaleOff(0)
            else:
                if not self.__checkHoodValidity():
                    return
                else:
                    place.loader.hood.halloweenLights = place.loader.hood.loader.geom.findAllMatches(
                        "**/*light*")
                    place.loader.hood.halloweenLights += place.loader.hood.loader.geom.findAllMatches(
                        "**/*lamp*")
                    place.loader.hood.halloweenLights += place.loader.hood.loader.geom.findAllMatches(
                        "**/prop_snow_tree*")
                    for light in place.loader.hood.halloweenLights:
                        light.setColorScaleOff(0)

        holidayIds = base.cr.newsManager.getDecorationHolidayId()
        if ToontownGlobals.HALLOWEEN_COSTUMES not in holidayIds:
            return
        # Fixes transition related crashes
        if (self.__checkHoodValidity() or self.__checkStreetValidity()) and hasattr(base.cr.playGame, "hood") \
        and base.cr.playGame.hood and hasattr(base.cr.playGame.hood, "sky")\
        and base.cr.playGame.hood.sky:
            preShow = Sequence(
                Parallel(
                    LerpColorScaleInterval(base.cr.playGame.hood.sky, 1.5,
                                           Vec4(1, 1, 1, 0.25)),
                    LerpColorScaleInterval(base.cr.playGame.hood.loader.geom,
                                           2.5, Vec4(0.55, 0.55, 0.65, 1)),
                    Func(__lightDecorationOn__),
                ),
                Func(self.__startSpookySky),
            )

            preShow.start()

        # Replace the plane with the witch in the estate
        distributedEstate = base.cr.doFind("DistributedEstate")

        if distributedEstate:
            distributedEstate.loadWitch()
Beispiel #4
0
 def setupSignText(self):
     """Attach text to the left and right signs"""
     loader = self.cr.playGame.hood.loader
     partyGate = loader.geom.find('**/partyGateSignGroup')
     if partyGate.isEmpty():
         self.notify.warning('Could not find partyGate_grp in loader.geom')
         return
     gateFont = ToontownGlobals.getMinnieFont()
     leftSign = partyGate.find("**/signTextL_locatorBack")
     signScale = 0.35
     wordWrap = 8
     leftText = DirectLabel.DirectLabel(
         parent=leftSign,
         pos=(0, 0.0, 0.0),
         relief=None,
         text=TTLocalizer.PartyGateLeftSign,
         text_align=TextNode.ACenter,
         text_font=gateFont,
         text_wordwrap=wordWrap,
         text_fg=Vec4(0.7, 0.3, 0.3, 1.0),
         scale=signScale,
     )
     rightSign = partyGate.find("**/signTextR_locatorFront")
     rightText = DirectLabel.DirectLabel(
         parent=rightSign,
         pos=(0, 0.0, 0.0),
         relief=None,
         text=TTLocalizer.PartyGateRightSign,
         text_align=TextNode.ACenter,
         text_font=gateFont,
         text_wordwrap=wordWrap,
         text_fg=Vec4(0.7, 0.3, 0.3, 1.0),
         scale=signScale,
     )
Beispiel #5
0
 def __init__(self,
              parent,
              gui,
              clickCallback=None,
              makeItemsCheckBoxes=False):
     """
     Creates the ScrolledFriendList on the parent with the given title.
     """
     self.makeItemsCheckBoxes = makeItemsCheckBoxes
     self.clickCallback = clickCallback
     self.parent = parent
     self.gui = gui
     self.scrollSpeed = 1
     DirectScrolledList.__init__(
         self,
         parent=parent,
         relief=None,
         incButton_image=(
             self.gui.find("**/inviteButtonDown_up"),
             self.gui.find("**/inviteButtonDown_down"),
             self.gui.find("**/inviteButtonDown_rollover"),
         ),
         incButton_relief=None,
         incButton_pos=(0.0, 0.0, -0.03),
         incButton_image3_color=Vec4(
             0.6, 0.6, 0.6, 0.6),  # Make the disabled button darker
         decButton_image=(
             self.gui.find("**/inviteButtonUp_up"),
             self.gui.find("**/inviteButtonUp_down"),
             self.gui.find("**/inviteButtonUp_rollover"),
         ),
         decButton_relief=None,
         decButton_pos=(0.0, 0.0, 0.02),
         decButton_image3_color=Vec4(
             0.6, 0.6, 0.6, 0.6),  # Make the disabled button darker
         # itemFrame is a DirectFrame
         itemFrame_relief=None,
         forceHeight=0.084,
         # each item is a button with text on it
         numItemsVisible=8,
         items=[],
         incButtonCallback=self.scrollButtonPressed,
         decButtonCallback=self.scrollButtonPressed,
         itemFrame_pos=(0.0, 0.0, -0.01),
     )
     self.incButtonCallback = None
     self.decButtonCallback = None
     self.setForceHeight()
Beispiel #6
0
    def enterEatFruit(self, fruitModel, handNode):
        """ fruit model is placed under handNode in this state;
        this function takes ownership of the fruit model """
        self.notify.debug('enterEatFruit')
        if self.isLocal:
            self.activity.orthoWalk.start()
        self.setAnimState('CatchEating', 1.0)

        self.fruitModel = fruitModel
        # make sure the scale stays the same wrt render
        renderScale = fruitModel.getScale(render)
        fruitModel.reparentTo(handNode)
        fruitModel.setScale(render, renderScale)
        fruitModel.setTransparency(1)

        duration = self.toon.getDuration('catch-eatneutral')
        self.eatIval = Sequence(
            Parallel(WaitInterval(duration),
                     # toon eats the fruit halfway through animation
                     Sequence(LerpScaleInterval(fruitModel, duration/2.,
                                                #fruitModel.getScale()*.5,
                                                #blendType='easeInOut'),
                                                Vec4(1.0, 1.0, 1.0, 0.0))))
                              Func(fruitModel.hide),
                              ),
                     ),
Beispiel #7
0
 def announceGenerate(self):
     #need to wait to do this until ownerindex  and plot come in from the ai
     self.plotType = GardenGlobals.whatCanBePlanted(self.ownerIndex,
                                                    self.plot)
     #differentiate the plot types here
     self.stickUp = 0.0
     if self.getOwnerId() != localAvatar.doId:
         self.defaultModel = None
     elif self.plotType == GardenGlobals.FLOWER_TYPE:
         self.collSphereRadius = 2.0
         self.collSphereOffset = 0.0
         self.plotScale = .70
         self.stickUp = 1.1
     # self.defaultModel = "phase_5.5/models/estate/planterA"
     elif self.plotType == GardenGlobals.GAG_TREE_TYPE:
         self.collSphereRadius = 3.0
         self.plotScale = 1.5
         self.colorScaler = Vec4(1.0, 1.0, 1.0, 1)
         #self.defaultModel = "phase_5.5/models/estate/planterB"
     elif self.plotType == GardenGlobals.STATUARY_TYPE:
         self.collSphereRadius = 3.0
         self.plotScale = 0.075
         self.stickUp = -0.0
         #self.defaultModel = "phase_5.5/models/estate/dirt_mound"
         self.defaultModel = "phase_5.5/models/estate/garden_slab"
     else:
         self.collSphereOffset = 0.0
     self.notify.debug('announceGenerate')
     DistributedLawnDecor.DistributedLawnDecor.announceGenerate(self)
Beispiel #8
0
    def __init__(self, doneEvent):
        DirectFrame.__init__(self)
        self.doneEvent = doneEvent

        # Public party gui
        self.gui = loader.loadModel("phase_4/models/parties/publicPartyGUI")
        self.setPos(0.1, 0.0, 0.1)
        self.doneStatus = None
        self.activityIconsModel = loader.loadModel(
            "phase_4/models/parties/eventSignIcons")

        self.normalFrameColor = Vec4(130 / 255.0, 174 / 255.0, 249 / 255.0,
                                     1.0)
        self.selectedFrameColor = Vec4(1.0, 1.0, 0.0, 1.0)
        self.load()
        self.gui.removeNode()
        self.accept("stoppedAsleep", self._close)
Beispiel #9
0
 def getSwapVisibleIval(self, wait=5.0, tFadeOut=3.0, tFadeIn=3.0):
     loader = base.cr.playGame.hood.loader
     # Update all visible holiday props
     npl = render.findAllMatches('**/=DNARoot=holiday_prop;+s')
     p = Parallel()
     for i in range(npl.getNumPaths()):
         np = npl.getPath(i)
         np.setTransparency(TransparencyAttrib.MDual, 1)
         if not np.hasTag('DNACode'):
             continue
         dnaCode = np.getTag('DNACode')
         dnaNode = self.dnaStore.findNode(dnaCode)
         if dnaNode.isEmpty():
             continue
         # Add new
         newNP = dnaNode.copyTo(np.getParent())
         newNP.setTag('DNARoot', 'holiday_prop')
         newNP.setTag('DNACode', dnaCode)
         newNP.setColorScale(1, 1, 1, 0)
         newNP.setTransparency(TransparencyAttrib.MDual, 1)
         # Set transform to match old node paths transform
         if np.hasTag('transformIndex'):
             index = int(np.getTag('transformIndex'))
             transform = loader.holidayPropTransforms.get(
                 index, TransformState.makeIdentity())
             # Position relative to empty node path *just in case* render not top of scene graph
             newNP.setTransform(NodePath(), transform)
             newNP.setTag('transformIndex', repr(index))
         s = Sequence(
             Wait(wait),
             np.colorScaleInterval(tFadeOut,
                                   Vec4(1, 1, 1, 0),
                                   startColorScale=Vec4(1, 1, 1, 1),
                                   blendType='easeInOut'),
             Func(np.detachNode),
             Func(np.clearTransparency),
             newNP.colorScaleInterval(tFadeOut,
                                      Vec4(1, 1, 1, 1),
                                      startColorScale=Vec4(1, 1, 1, 0),
                                      blendType='easeInOut'),
             Func(newNP.clearTransparency),
             Func(newNP.clearColorScale),
         )
         p.append(s)
     return p
Beispiel #10
0
 def generateNestPowerups(self, gatherableModel, parent):
     nests = gatherableModel.findAllMatches('**/%s;+s' % Globals.Level.LegalEagleNestName)
     for nest in nests:
         offset = Globals.Level.LaffPowerupNestOffset
         pickup = self._level.gatherableFactory.createPowerup(Globals.Level.GatherableTypes.LaffPowerup)
         pickup.reparentTo(parent)
         pickup.setPos(parent, nest.getPos(parent) + offset)
         if Globals.Level.AddSparkleToPowerups:
             sparkles = self._level.gatherableFactory.createSparkles(Vec4(1, 1, 1, 1), Vec4(1, 1, 0, 1), 10.0)
             sparkles.reparentTo(pickup)
             sparkles.setPos(0, 0, 1)
             sparkles.start()
         self.gatherables.append(pickup)
Beispiel #11
0
    def __init__(self, cr):
        DistributedLawnDecor.DistributedLawnDecor.__init__(self, cr)
        #self.defaultModel = "phase_8/models/props/flower_treasure.bam"

        self.plantPath = NodePath('plantPath')
        self.plantPath.reparentTo(self)
        self.plotScale = 1.0

        self.plantingGuiDoneEvent = "plantingGuiDone"
        self.toonStatueSelectionDoneEvent = "toonStatueSelectionDone"
        self.defaultModel = "phase_5.5/models/estate/dirt_mound"
        self.colorScaler = Vec4(1, 1, 1, 1)

        self.plantingGui = None
Beispiel #12
0
 def initStreamers():
     obstacles = self._model.findAllMatches('**/%s' % Globals.Level.StreamerName)
     for obstacleLoc in obstacles:
         obstacle = self._level.obstacleFactory.createFan()
         obstacle.model.reparentTo(parent)
         obstacle.model.setPos(parent, obstacleLoc.getPos(parent))
         obstacle.model.setHpr(parent, obstacleLoc.getHpr(parent))
         obstacle.model.setScale(parent, obstacleLoc.getScale(parent))
         obstacle.setBlowDirection()
         if Globals.Level.AddParticlesToStreamers:
             particles = self._level.obstacleFactory.createStreamerParticles(Vec4(1, 1, 1, 1), Vec4(1, 1, 1, 1), 10.0)
             particles.reparentTo(obstacle.model)
             particles.start()
         self.obstacles.append(obstacle)
         obstacleLoc.removeNode()
Beispiel #13
0
    def doSpawnTitleText(self, text):
        self.titleColor = (1.0, 0.5, 0.4, 1.0)
        self.titleText = OnscreenText.OnscreenText(
            text,
            fg=self.titleColor,
            font=ToontownGlobals.getSignFont(),
            pos=(0, -0.5),
            scale=0.16,
            drawOrder=0,
            mayChange=1,
            wordwrap=16)

        self.titleText.setText(text)
        self.titleText.show()
        self.titleText.setColor(Vec4(*self.titleColor))
        self.titleText.clearColorScale()
        self.titleText.setFg(self.titleColor)
        seq = Sequence(
            Wait(0.1), Wait(6.0),
            self.titleText.colorScaleInterval(
                startColorScale=Vec4(1.0, 1.0, 1.0, 1.0),
                colorScale=Vec4(1.0, 1.0, 1.0, 0.0),
                duration=0.5), Func(self.hideTitleText))
        seq.start()
Beispiel #14
0
 def generatePowerUps():
     for powerupType, locName in Globals.Level.PowerupType2Loc.items():
         if powerupType == Globals.Level.GatherableTypes.LaffPowerup and Globals.Level.IgnoreLaffPowerups:
             continue
         gatherables = gatherableModel.findAllMatches('**/%s' % locName)
         for gatherable in gatherables:
             pickup = self._level.gatherableFactory.createPowerup(powerupType)
             pickup.reparentTo(parent)
             pickup.setPos(parent, gatherable.getPos(parent))
             if Globals.Level.AddSparkleToPowerups:
                 sparkles = self._level.gatherableFactory.createSparkles(Vec4(1, 1, 1, 1), Vec4(1, 1, 0, 1), 10.0)
                 sparkles.reparentTo(pickup)
                 sparkles.setPos(0, 0, 1)
                 sparkles.start()
             self.gatherables.append(pickup)
             gatherable.removeNode()
Beispiel #15
0
    def showHitScore(self, number, scale=1):
        """
        Shows the hit score.
        Borrowed from otp.avatar.DistributedAvatar.showHpText
        """
        if number <= 0:
            return

        # Get rid of the number if it is already there.
        if self.hpText:
            self.hideHitScore()

        # Set the font
        self.HpTextGenerator.setFont(ToontownGlobals.getSignFont())

        # Show both negative and positive signs
        if number < 0:
            self.HpTextGenerator.setText(str(number))
        else:
            self.HpTextGenerator.setText("+" + str(number))

        # No shadow
        self.HpTextGenerator.clearShadow()

        # Center the number
        self.HpTextGenerator.setAlign(TextNode.ACenter)

        # Red, always
        #if number < 0:
        r = 1  #0.9
        g = 1  #0
        b = 0
        a = 1

        self.HpTextGenerator.setTextColor(r, g, b, a)

        self.hpTextNode = self.HpTextGenerator.generate()

        # Put the hpText over the head of the avatar
        self.hpText = render.attachNewNode(self.hpTextNode)
        self.hpText.setScale(scale)
        # Make sure it is a billboard
        self.hpText.setBillboardPointEye()
        # Render it after other things in the scene.
        self.hpText.setBin('fixed', 100)

        # Initial position ... Center of the body... the "tan tien"
        self.hpText.setPos(self.root, 0, 0, self.height / 2)

        # Black magic from the early days of Panda3D, later replaced by a Sequence
        seq = Task.sequence(
            # Fly the number out of the character
            self.hpText.lerpPos(Point3(
                self.root.getX(render), self.root.getY(render),
                self.root.getZ(render) + self.height + 1.0),
                                0.25,
                                blendType='easeOut'),
            Task.pause(0.25),
            # Fade the number
            self.hpText.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.1),
            # Get rid of the number
            Task.Task(self.__hideHitScoreTask))

        taskMgr.add(seq, "PartyCogHpText" + str(self.id))
Beispiel #16
0
# 13 - 25 = DIAMONDS  2,3,4...q,k,a
# 26 - 38 = CLUBS  2,3,4...q,k,a
# 39 - 51 = SPADES  2,3,4...q,k,a
# 255 is face down/unknown

# Suits
Hearts = 0
Diamonds = 1
Clubs = 2
Spades = 3

Suits = [Hearts, Diamonds, Clubs, Spades]

Unknown = 255

UpColor = Vec4(1, 1, 1, 1)
RolloverColor = Vec4(1, 1, 0.5, 1)
DownColor = Vec4(1, 0.9, 0.9, 1)
DisabledColor = Vec4(1, 1, 1, 0.5)

CardColors = (UpColor, DownColor, RolloverColor, DisabledColor)


def getCardName(value):
    if value == Unknown:
        return TTLocalizer.PlayingCardUnknown
    else:
        rank = value % MaxRank
        suit = value / MaxRank
        return TTLocalizer.getPlayingCardName(suit, rank)
Beispiel #17
0
    def setupSimulation(self):
        """Setup the ice game specific parameters."""
        DistributedMinigamePhysicsWorld.DistributedMinigamePhysicsWorld.setupSimulation(
            self)
        # toontown uses feet, 1 meter = 3.2808399 feet
        # for this game lets express mass in kilograms
        # so gravity at 9.8 meters per seconds squared becomes
        self.world.setGravity(0, 0, -32.174)

        # ODE's default is meter, kilograms, seconds, let's change the defaults
        # do we need to change global ERP value,
        # that controls how much error correction is performed in each time step
        # default is 0.2
        self.world.setAutoDisableFlag(1)  # lets try auto disable
        self.world.setAutoDisableLinearThreshold(0.5 * MetersToFeet)
        # skipping AutoDisableAngularThreshold as that is radians per second
        # self.world.setAutoDisableAngularThreshold(0.01)
        # don't consider rotation for auto disable
        self.world.setAutoDisableAngularThreshold(OdeUtil.getInfinity())
        self.world.setAutoDisableSteps(10)

        # Set and the global CFM (constraint force mixing) value.
        # Typical values are in the range 10-9 -- 1.
        # The default is 10-5 if single precision is being used
        self.world.setCfm(1E-5 * MetersToFeet)

        # Our surfaces
        # 0 = tire
        # 1 = ice
        # 2 = fence
        self.world.initSurfaceTable(3)  # 3 types of surfaces

        # PN_uint8 pos1, PN_uint8 pos2,  - surface0, surface1
        #            dReal mu, - 0 frictionless, 1 infinite friction
        #            dReal bounce, # Restitution parameter 0 not bouncy, 1 max bouncy
        #            dReal bounce_vel, #The minimum incoming velocity necessary for bounce.
        #                              Incoming velocities below this will
        #                              effectively have a bounce parameter of 0.
        #            dReal soft_erp, # Contact normal "softness" parameter.
        #            dReal soft_cfm, # Contact normal "softness" paramete
        #            dReal slip,     # The coefficients of force-dependent-slip (FDS)
        #            dReal dampen)   # dampening constant

        # the most usual collision, tire against ice
        self.world.setSurfaceEntry(
            0,
            1,
            0.2,  # near frictionless
            0,  # not bouncy
            0,  # bounce_vel
            0,  # soft_erp
            0,  # soft_cfm
            0,  # slip
            0.1,  # dampen
        )
        # tire against tire
        self.world.setSurfaceEntry(
            0,
            0,
            0.1,  # friction
            0.9,  # bounciness
            0.1,  # bounce_vel
            0,  # soft_erp
            0,  # soft_cfm
            0,  # slip
            0,  # dampen
        )

        # tire against fence
        self.world.setSurfaceEntry(
            0,
            2,
            0.9,  # friction
            0.9,  # bounciness
            0.1,  # bounce_vel
            0,  # soft_erp
            0,  # soft_cfm
            0,  # slip
            0,  # dampen
        )

        # Create a plane geom which prevent the objects from falling forever
        self.floor = OdePlaneGeom(self.space, Vec4(0.0, 0.0, 1.0, -20.0))
        self.floor.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.floor.setCategoryBits(self.floorMask)

        # normal pointing towards +x axis
        self.westWall = OdePlaneGeom(
            self.space, Vec4(1.0, 0.0, 0.0, IceGameGlobals.MinWall[0]))
        self.westWall.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.westWall.setCategoryBits(self.wallMask)
        self.space.setSurfaceType(self.westWall, self.fenceSurfaceType)
        self.space.setCollideId(self.westWall, self.wallCollideId)

        # normal pointing towards -x axis
        self.eastWall = OdePlaneGeom(
            self.space, Vec4(-1.0, 0.0, 0.0, -IceGameGlobals.MaxWall[0]))
        self.eastWall.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.eastWall.setCategoryBits(self.wallMask)
        self.space.setSurfaceType(self.eastWall, self.fenceSurfaceType)
        self.space.setCollideId(self.eastWall, self.wallCollideId)

        # normal pointing toward the +y axis
        self.southWall = OdePlaneGeom(
            self.space, Vec4(0.0, 1.0, 0.0, IceGameGlobals.MinWall[1]))
        self.southWall.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.southWall.setCategoryBits(self.wallMask)
        self.space.setSurfaceType(self.southWall, self.fenceSurfaceType)
        self.space.setCollideId(self.southWall, self.wallCollideId)

        # normal pointing toward the -y axis
        self.northWall = OdePlaneGeom(
            self.space, Vec4(0.0, -1.0, 0.0, -IceGameGlobals.MaxWall[1]))
        self.northWall.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.northWall.setCategoryBits(self.wallMask)
        self.space.setSurfaceType(self.northWall, self.fenceSurfaceType)
        self.space.setCollideId(self.northWall, self.wallCollideId)

        # a temporary floor at z=0, until we implement ice with holes
        self.floorTemp = OdePlaneGeom(self.space, Vec4(0.0, 0.0, 1.0, 0.0))
        self.floorTemp.setCollideBits(
            self.allTiresMask)  # we only collide against tires
        self.floorTemp.setCategoryBits(self.floorMask)
        self.space.setSurfaceType(self.floorTemp, self.iceSurfaceType)
        self.space.setCollideId(self.floorTemp, self.floorCollideId)

        self.space.setAutoCollideWorld(self.world)
        self.space.setAutoCollideJointGroup(self.contactgroup)

        self.totalPhysicsSteps = 0
Beispiel #18
0
    def __init__(self, numPlayers, avIdList, votes, directions, namesList,
                 disconnectedList, directionToGo, directionReason,
                 directionTotals, *args, **kwargs):
        opts = {
            'relief': None,
            'geom': DGG.getDefaultDialogGeom(),
            'geom_color': ToontownGlobals.GlobalDialogColor[:3] + (0.80, ),
            'geom_scale': (1.75, 1, 0.25),
            'pos': (0, 0, 0.825)
        }
        opts.update(kwargs)
        DirectFrame.__init__(self, *args, **opts)
        self.initialiseoptions(VoteResultsTrolleyPanel)

        listMultiplier = 1
        if TravelGameGlobals.SpoofFour:
            listMultiplier = 4

        self.avIdList = avIdList * listMultiplier
        self.numPlayers = numPlayers * listMultiplier
        self.votes = votes * listMultiplier
        self.directions = directions * listMultiplier
        self.namesList = namesList * listMultiplier
        self.disconnectedList = disconnectedList * listMultiplier
        self.directionToGo = directionToGo
        self.directionReason = directionReason
        self.directionTotals = directionTotals

        self.entryList = []
        self.rowFrame = []

        self.upDownFrame = DirectFrame(
            parent=self,
            relief=None,
            pos=self.getRowPos(-1),
        )

        self.upLabel = DirectLabel(parent=self,
                                   relief=None,
                                   pos=(-0.5, 0, 0.06),
                                   text=TTLocalizer.TravelGameDirections[0] +
                                   ':',
                                   text_fg=(0.0, 0.0, 1.0, 1.0),
                                   text_scale=0.05,
                                   text_align=TextNode.ARight)

        self.downLabel = DirectLabel(parent=self,
                                     relief=None,
                                     pos=(0.5, 0, 0.06),
                                     text=TTLocalizer.TravelGameDirections[1] +
                                     ':',
                                     text_fg=(1.0, 0.0, 0.0, 1.0),
                                     text_scale=0.05,
                                     text_align=TextNode.ARight)

        self.totalVotesUpLabel = DirectLabel(parent=self.upLabel,
                                             relief=None,
                                             pos=(0.2, 0, 0.0),
                                             text='0',
                                             text_fg=(0.0, 0.0, 1.0, 1.0),
                                             text_scale=0.05,
                                             text_align=TextNode.ARight)

        self.totalVotesDownLabel = DirectLabel(parent=self.downLabel,
                                               relief=None,
                                               pos=(0.2, 0, 0.0),
                                               text='0',
                                               text_fg=(1.0, 0.0, 0.0, 1.0),
                                               text_scale=0.05,
                                               text_align=TextNode.ARight)

        self.totalFrame = DirectFrame(
            parent=self,
            relief=None,
            pos=self.getRowPos(self.numPlayers),
        )

        self.totalVotesLabels = [
            self.totalVotesUpLabel, self.totalVotesDownLabel
        ]

        self.resultFrame = DirectFrame(
            parent=self,
            relief=None,
            #pos = self.getRowPos(self.numPlayers+1),
            pos=self.getRowPos(0.5),
        )

        self.resultLabel = DirectLabel(parent=self.resultFrame,
                                       text='',
                                       text_scale=0.06,
                                       pos=(0.7, 0, 0.0),
                                       text_align=TextNode.ACenter)
        self.setupResultLabel()

        for index in range(self.numPlayers):
            frame = DirectFrame(
                parent=self,
                relief=None,
                pos=self.getRowPos(index),
            )
            self.rowFrame.append(frame)

            nameLabel = DirectFrame(
                parent=frame,
                relief=None,
                pos=(0.46, 0.0, 0.0),
                text=self.namesList[index],
                text_fg=(0.0, 0.0, 0.0, 1.0),
                text_scale=0.05,
                text_align=TextNode.ACenter,
                text_font=DGG.getDefaultFont()  #ToontownGlobals.getSignFont(),
            )

            votesUpLabel = DirectLabel(
                parent=frame,
                relief=None,
                pos=(1.2, 0.0, 0.0),
                text='',
                text_fg=(0, 0, 1, 1),
                text_scale=0.05,
                text_align=TextNode.ARight,
                text_font=DGG.getDefaultFont(),
            )

            votesDownLabel = DirectLabel(
                parent=frame,
                relief=None,
                pos=(1.43, 0.0, 0.0),
                text='',
                text_fg=(1, 0, 0, 1),
                text_scale=0.05,
                text_align=TextNode.ARight,
                text_font=DGG.getDefaultFont(),
            )
            nameLabel.hide()
            self.entryList.append((nameLabel, votesUpLabel, votesDownLabel))

        self.avVotesLabel = {}
        self.avArrows = {}

        matchingGameGui = loader.loadModel(
            'phase_3.5/models/gui/matching_game_gui')
        minnieArrow = matchingGameGui.find("**/minnieArrow")

        from toontown.minigame.DistributedTravelGame import map3dToAspect2d
        for index in range(self.numPlayers):
            avId = self.avIdList[index]
            av = base.cr.doId2do.get(avId)
            if av:
                height = av.getHeight()
                avPos = av.getPos(render)
                avPos.setZ(av.getZ() + 5)  # height)
                labelPos = map3dToAspect2d(render, avPos)
                if not labelPos:
                    continue
                labelPos.setZ(labelPos.getZ() + 0.3)

                arrow = None
                if self.votes[index] > 0:
                    arrow = aspect2d.attachNewNode('avArrow')
                    minnieArrow.copyTo(arrow)
                    arrow.setScale(1.1, 1, 1.15)
                    arrow.setPos(labelPos)
                    if self.directions[index] == 0:
                        arrow.setR(-90)
                        arrow.setColorScale(0, 0, 1, 1)
                    else:
                        arrow.setR(90)
                        arrow.setColorScale(1, 0, 0, 1)
                    arrow.wrtReparentTo(self.resultFrame)
                    arrow.hide()
                    self.avArrows[index] = arrow

                fgColor = Vec4(0, 0, 0, 1)
                if self.votes[index] > 0:
                    if self.directions[index] == 0:
                        fgColor = Vec4(0, 0, 1, 1)
                    else:
                        fgColor = Vec4(1, 0, 0, 1)
                if self.votes[index] > 0:
                    newLabel = DirectLabel(
                        parent=aspect2d,
                        #geom = DGG.getDefaultDialogGeom(),
                        #geom_color =ToontownGlobals.GlobalDialogColor[:3]+(0.80,),
                        #geom_scale = (0.1,1,0.1),
                        relief=None,
                        pos=labelPos,
                        text='test',
                        text_fg=(1, 1, 1, 1),  #fgColor,
                        text_scale=0.1,
                        text_align=TextNode.ACenter,
                        text_font=ToontownGlobals.getSignFont(),
                        text_pos=(0, -0.01, 0))
                else:
                    newLabel = DirectLabel(
                        parent=aspect2d,
                        geom=DGG.getDefaultDialogGeom(),
                        #geom_color =ToontownGlobals.GlobalDialogColor[:3]+(0.80,),
                        geom_scale=(0.2, 1, 0.2),
                        relief=None,
                        pos=labelPos,
                        text='test',
                        text_fg=(0.5, 0.5, 0.5, 1),  #fgColor,
                        text_scale=0.1,
                        text_align=TextNode.ACenter,
                        text_font=ToontownGlobals.getSignFont(),
                        text_pos=(0, -0.035, 0))
                newLabel.wrtReparentTo(self.resultFrame)
                newLabel.hide()
                self.avVotesLabel[index] = newLabel

        matchingGameGui.removeNode()

        self.curArrowSfxIndex = 0
        self.upArrowSfx = []
        self.downArrowSfx = []
        for i in range(5):
            self.upArrowSfx.append(
                base.loadSfx(
                    "phase_4/audio/sfx/MG_sfx_travel_game_blue_arrow.mp3"))
            self.downArrowSfx.append(
                base.loadSfx(
                    "phase_4/audio/sfx/MG_sfx_travel_game_red_arrow.mp3"))
        self.winVoteSfx = base.loadSfx(
            "phase_4/audio/sfx/MG_sfx_travel_game_win_vote.mp3")
        self.noVoteSfx = base.loadSfx(
            "phase_4/audio/sfx/MG_sfx_travel_game_square_no_vote_1.mp3")
        self.loseVoteSfx = base.loadSfx(
            "phase_4/audio/sfx/MG_sfx_travel_game_lose_vote.mp3")

        self.localAvatarWon = False
        self.localAvatarLost = False

        localIndex = self.avIdList.index(base.localAvatar.doId)
        localDirection = self.directions[localIndex]
        localVotes = self.votes[localIndex]
        if localVotes:
            if localDirection == self.directionToGo:
                if not TravelGameGlobals.ReverseWin:
                    self.localAvatarWon = True
                else:
                    self.localAvatarLost = True
            else:
                if not TravelGameGlobals.ReverseWin:
                    self.localAvatarLost = True
                else:
                    self.localAvatarWon = True
Beispiel #19
0
from toontown.toonbase.ToontownModules import Vec4

# pg hat colors
PG_COLORS = [
    Vec4(0.95, 0.0, 0.0, 1.0),
    Vec4(0.75, 0.35, 0.1, 1.0),
]
SG_COLORS = [
    Vec4(0.0, 0.0, 0.95, 1.0),
    Vec4(0.35, 0.0, 0.75, 1.0),
]

GOON_FORWARD = 1
GOON_REVERSE = -1

GOON_MOVIE_WALK = 0
GOON_MOVIE_STUNNED = 1
GOON_MOVIE_BATTLE = 2
GOON_MOVIE_RECOVERY = 3
GOON_MOVIE_SYNC = 4

T_TURN = 3.0
ANIM_WALK_RATE = 2.8

ANIM_TURN_RATE = 20  # degrees per second
DEFAULT_WALK_RATE = 4  # feet per second
Beispiel #20
0
    def getDropIval(self):
        shadow = self.shadow
        drop = self.drop
        id = self.id
        hangTime = Globals.ShadowTime
        dropTime = Globals.DropTime
        dropHeight = Globals.DropHeight
        targetShadowScale = 0.5
        targetShadowAlpha = 0.4
        shadowScaleIval = LerpScaleInterval(shadow, dropTime, targetShadowScale, startScale=0)
        shadowAlphaIval = LerpColorScaleInterval(shadow, hangTime, Point4(1, 1, 1, targetShadowAlpha), startColorScale=Point4(1, 1, 1, 0))
        shadowIval = Parallel(shadowScaleIval, shadowAlphaIval)
        startPos = Point3(0, 0, dropHeight)
        drop.setPos(startPos)
        dropIval = LerpPosInterval(drop, dropTime, Point3(0, 0, 0), startPos=startPos, blendType='easeIn')
        dropSoundIval = self._dropSfx
        dropSoundIval.node = self
        self.drop.setTransparency(1)

        def _setRandScale(t):
            self.drop.setScale(self, 1 - random.random() / 16, 1 - random.random() / 16, 1 - random.random() / 4)

        scaleChange = 0.4 + random.random() / 4
        dropShakeSeq = Sequence(LerpScaleInterval(self.drop, 0.25, Vec3(1.0 + scaleChange, 1.0 + scaleChange / 2, 1.0 - scaleChange), blendType='easeInOut'), LerpScaleInterval(self.drop, 0.25, Vec3(1.0, 1.0, 1.0), blendType='easeInOut'), Func(self.disableCollisionDamage), LerpScaleInterval(self.drop, 0.2, Vec3(1.0 + scaleChange / 8, 1.0 + scaleChange / 8, 1.0 - scaleChange / 8), blendType='easeInOut'), LerpScaleInterval(self.drop, 0.2, Vec3(1.0, 1.0, 1.0), blendType='easeInOut'), LerpScaleInterval(self.drop, 0.15, Vec3(1.0 + scaleChange / 16, 1.0 + scaleChange / 16, 1.0 - scaleChange / 16), blendType='easeInOut'), LerpScaleInterval(self.drop, 0.15, Vec3(1.0, 1.0, 1.0), blendType='easeInOut'), LerpScaleInterval(self.drop, 0.1, Vec3(1.0 + scaleChange / 16, 1.0 + scaleChange / 8, 1.0 - scaleChange / 16), blendType='easeInOut'), LerpColorScaleInterval(self.drop, Globals.DropFadeTime, Vec4(1.0, 1.0, 1.0, 0.0)))
        ival = Sequence(Func(self.reparentTo, render), Parallel(Sequence(WaitInterval(hangTime), dropIval), shadowIval), Parallel(Func(self.game.dropHit, self, id), dropSoundIval, dropShakeSeq), Func(self.game.cleanupDrop, id), name='drop%s' % id)
        self.ival = ival
        return ival
Beispiel #21
0
    def createGuiObjects(self):
        """Create the other gui objects in the month, assumes we have proper locators."""
        # we create an invisible button so the day can be clicked on
        self.dayButton = DirectButton(
            parent=self.dayButtonLocator,
            image=self.selectedFrame,
            relief=None,
            command=self.__clickedOnDay,
            # next three settings are for debug
            pressEffect=1,
            rolloverSound=None,
            clickSound=None)

        self.numberWidget = DirectLabel(
            parent=self.numberLocator,
            relief=None,
            text=str(self.myDate.day),
            text_scale=0.04,
            text_align=TextNode.ACenter,
            text_font=ToontownGlobals.getInterfaceFont(),
            text_fg=Vec4(110 / 255.0, 126 / 255.0, 255 / 255.0, 1),
        )

        self.attachMarker(self.numberLocator)

        self.listXorigin = 0
        self.listFrameSizeX = self.scrollBottomRightLocator.getX(
        ) - self.scrollLocator.getX()
        self.scrollHeight = self.scrollLocator.getZ(
        ) - self.scrollBottomRightLocator.getZ()
        self.listZorigin = self.scrollBottomRightLocator.getZ()
        self.listFrameSizeZ = self.scrollLocator.getZ(
        ) - self.scrollBottomRightLocator.getZ()
        self.arrowButtonXScale = 1
        self.arrowButtonZScale = 1
        self.itemFrameXorigin = 0
        self.itemFrameZorigin = 0
        self.buttonXstart = self.itemFrameXorigin + 0.21
        self.gui = loader.loadModel("phase_3.5/models/gui/friendslist_gui")
        buttonOffSet = -0.01

        # these settings put the arrow buttons on the top
        incButtonPos = (0.0, 0, 0)
        decButtonPos = (0.0, 0, 0)

        # these settings put the arrow buttons on the right side
        # incButtonPos = (self.buttonXstart,0,self.listZorigin - buttonOffSet)
        # decButtonPos = (self.buttonXstart, 0, self.listZorigin + self.listFrameSizeZ + buttonOffSet)
        itemFrameMinZ = self.listZorigin
        itemFrameMaxZ = self.listZorigin + self.listFrameSizeZ

        arrowUp = self.find("**/downScroll_up")
        arrowDown = self.find("**/downScroll_down")
        arrowHover = self.find("**/downScroll_hover")

        self.scrollList = DirectScrolledList(
            parent=self.scrollLocator,
            relief=None,
            pos=(0, 0, 0),
            # inc and dec are DirectButtons
            # incButton is on the bottom of page, decButton is on the top!
            incButton_image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            incButton_relief=None,
            incButton_scale=(self.arrowButtonXScale, 1,
                             self.arrowButtonZScale),
            incButton_pos=incButtonPos,

            # Make the disabled button fade out
            incButton_image3_color=Vec4(1, 1, 1, 0.2),
            decButton_image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            decButton_relief=None,
            decButton_scale=(self.arrowButtonXScale, 1,
                             -self.arrowButtonZScale),
            decButton_pos=decButtonPos,
            # Make the disabled button fade out
            decButton_image3_color=Vec4(1, 1, 1, 0.2),

            # itemFrame is a DirectFrame, shift it down a bit to match top left scroll
            itemFrame_pos=(self.itemFrameXorigin, 0, -0.03),

            # each item is a button with text on it
            numItemsVisible=4,

            # so we select the day when we click on a scroll button
            incButtonCallback=self.scrollButtonPressed,
            decButtonCallback=self.scrollButtonPressed,
        )
        # make sure the arrow buttons appear over item frame
        itemFrameParent = self.scrollList.itemFrame.getParent()
        self.scrollList.incButton.reparentTo(self.scrollDownLocator)
        self.scrollList.decButton.reparentTo(self.scrollUpLocator)

        arrowUp.removeNode()
        arrowDown.removeNode()
        arrowHover.removeNode()

        # Set up a clipping plane to truncate names that would extend
        # off the right end of the scrolled list.
        clipper = PlaneNode('clipper')
        clipper.setPlane(Plane(Vec3(-1, 0, 0), Point3(0.23, 0, 0)))
        clipNP = self.scrollList.component('itemFrame').attachNewNode(clipper)
        self.scrollList.component('itemFrame').setClipPlane(clipNP)
Beispiel #22
0
    def refresh(self, partyInfoTupleList):
        """
        Called when the public party gui is shown.  partyInfoTupleList is a list
        of tuples of the form:
        ( shardId, zoneId, numberOfGuests, hostName, activityIds, lane )
        """
        PublicPartyGui.notify.debug("refresh : partyInfoTupleList = %s" %
                                    partyInfoTupleList)
        self.selectedItem = None
        self.partyList.removeAndDestroyAllItems()
        self.activityList.removeAndDestroyAllItems()
        self.partyStartButton["state"] = DirectGuiGlobals.DISABLED
        # put parties with most toons at the top
        sortedList = partyInfoTupleList[:]

        #for i in range(20):
        #    sortedList.append((202000000, 61000, i+2, "Good ol' Knuckles CrunchenGrooven", [0, 1, 2, 4, 5, 7], 30-i))

        def cmp(left, right):
            if left[2] < right[2]:
                return -1
            elif left[2] == right[2]:
                if len(left[4]) < len(right[4]):
                    return -1
                elif len(left[4]) == len(right[4]):
                    return 0
                else:
                    return 1
            else:
                return 1

        sortedList.sort(key=functools.cmp_to_key(cmp), reverse=True)

        # put parties with 20 or more toons on the bottom
        indexToCut = -1
        for index, partyTuple in enumerate(sortedList):
            numberOfGuests = partyTuple[2]
            if numberOfGuests < PartyGlobals.MaxToonsAtAParty:
                indexToCut = index
                break
        if indexToCut > 0:
            sortedList = sortedList[indexToCut:] + sortedList[:indexToCut]

        for index, partyTuple in enumerate(sortedList):
            shardId = partyTuple[0]
            zoneId = partyTuple[1]
            numberOfGuests = partyTuple[2]
            hostName = partyTuple[3]
            if GMUtils.testGMIdentity(hostName):
                hostName = GMUtils.handleGMName(hostName)
            activityIds = partyTuple[4]
            minLeft = partyTuple[5]
            item = DirectButton(
                relief=DGG.RIDGE,
                borderWidth=(0.01, 0.01),
                frameSize=(-0.01, 0.45, -0.015, 0.04),
                frameColor=self.normalFrameColor,
                text=hostName,
                text_align=TextNode.ALeft,
                text_bg=Vec4(0.0, 0.0, 0.0, 0.0),
                text_scale=0.045,
                command=self.partyClicked,
            )
            otherInfoWidth = 0.08
            numActivities = len(activityIds)
            PartyUtils.truncateTextOfLabelBasedOnWidth(
                item, hostName, PartyGlobals.EventsPageGuestNameMaxWidth)
            num = DirectLabel(
                relief=DGG.RIDGE,
                borderWidth=(0.01, 0.01),
                frameSize=(0., otherInfoWidth, -0.015, 0.04),
                frameColor=self.normalFrameColor,
                text="%d" % numberOfGuests,
                text_align=TextNode.ALeft,
                text_scale=0.045,
                text_pos=(0.01, 0, 0),
                pos=(0.45, 0.0, 0.0),
            )
            num.reparentTo(item)
            item.numLabel = num

            actLabelPos = num.getPos()
            actLabelPos.setX(actLabelPos.getX() + otherInfoWidth)
            actLabel = DirectLabel(
                relief=DGG.RIDGE,
                borderWidth=(0.01, 0.01),
                frameSize=(0.0, otherInfoWidth, -0.015, 0.04),
                frameColor=self.normalFrameColor,
                text="%d" % numActivities,
                text_align=TextNode.ALeft,
                text_scale=0.045,
                text_pos=(0.01, 0, 0),
                pos=actLabelPos,
            )
            actLabel.reparentTo(item)
            item.actLabel = actLabel

            minLabelPos = actLabel.getPos()
            minLabelPos.setX(minLabelPos.getX() + otherInfoWidth)
            minLabel = DirectLabel(
                relief=DGG.RIDGE,
                borderWidth=(0.01, 0.01),
                frameSize=(0.0, otherInfoWidth, -0.015, 0.04),
                frameColor=self.normalFrameColor,
                text="%d" % minLeft,
                text_align=TextNode.ALeft,
                text_scale=0.045,
                text_pos=(0.01, 0, 0),
                pos=minLabelPos,
            )
            minLabel.reparentTo(item)
            item.minLabel = minLabel

            item["extraArgs"] = [item]
            item.setPythonTag("shardId", shardId)
            item.setPythonTag("zoneId", zoneId)
            item.setPythonTag("activityIds", activityIds)
            self.partyList.addItem(item)
Beispiel #23
0
    def createGuiObjects(self):
        """Create the other gui objects in the month, assumes we have proper locators."""
        self.monthLabel = DirectLabel(
            parent=self.monthLocator,
            relief=None,
            text=TTLocalizer.Months[self.startDate.month],
            text_scale=0.075,
            text_font=ToontownGlobals.getMinnieFont(),
            text_fg=(40 / 255.0, 140 / 255.0, 246 / 255.0, 1.0),
        )
        self.yearLabel = DirectLabel(
            parent=self.yearLocator,
            relief=None,
            text=str(self.startDate.year),
            text_scale=0.03,
            text_font=ToontownGlobals.getMinnieFont(),
            #text_fg = (40/255.0, 140/255.0, 246/255.0, 1.0),
            text_fg=(140 / 255.0, 140 / 255.0, 246 / 255.0, 1.0),
        )

        self.weekdayLabels = []
        for posIndex in range(7):
            # Sunday is the usual first day of the week, but
            # self.startDate.weekDay() reports 0 for Monday
            adjustedNameIndex = (posIndex - 1) % 7
            self.weekdayLabels.append(
                DirectLabel(parent=self.weekDayLocators[posIndex],
                            relief=None,
                            text=TTLocalizer.DayNamesAbbrev[adjustedNameIndex],
                            text_font=ToontownGlobals.getInterfaceFont(),
                            text_fg=(255 / 255.0, 146 / 255.0, 113 / 255.0,
                                     1.0),
                            text_scale=0.05))
        self.createGuiDays()

        arrowUp = self.find("**/month_arrowR_up")
        arrowDown = self.find("**/month_arrowR_down")
        arrowHover = self.find("**/month_arrowR_hover")
        self.monthLeftArrow = DirectButton(
            parent=self.monthLeftLocator,
            relief=None,
            image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            # make the disabled color more transparent
            image3_color=Vec4(1, 1, 1, 0.5),
            scale=(-1.0, 1.0, 1.0),  # make the arrow point left
            #pos = (0.25, 0, buttonbase_ycoord - textRowHeight * 4),
            command=self.__doMonthLeft,
        )
        if self.onlyFutureDaysClickable:
            self.monthLeftArrow.hide()
        self.monthRightArrow = DirectButton(
            parent=self.monthRightLocator,
            relief=None,
            image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            # make the disabled color more transparent
            image3_color=Vec4(1, 1, 1, 0.5),
            #pos = (0.65, 0, buttonbase_ycoord - textRowHeight * 4),
            command=self.__doMonthRight,
        )

        def makeLabel(itemName, itemNum, *extraArgs):

            return DirectLabel(
                text=itemName,
                frameColor=(0, 0, 0, 0),
                #scale = 0.1,
                #relief = DGG.RAISED,
                #frameSize = (-3.5, 3.5, -0.2, 0.8),
                text_scale=0.04)

        gui = loader.loadModel(
            'phase_4/models/parties/tt_m_gui_sbk_calendar_box')
        arrowUp = gui.find("**/downScroll_up")
        arrowDown = gui.find("**/downScroll_down")
        arrowHover = gui.find("**/downScroll_hover")

        filterLocatorUpPos = self.filterLocatorArrowUp.getPos(
            self.filterLocator)
        filterLocatorDownPos = self.filterLocatorArrowDown.getPos(
            self.filterLocator)
        self.filterList = DirectScrolledList(
            parent=self.filterLocator,
            relief=None,
            pos=(0, 0, 0),  #(0.65, 0, 0.7),
            image=None,  #DGG.getDefaultDialogGeom(),
            text_scale=0.025,
            incButton_image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            incButton_relief=None,
            incButton_pos=filterLocatorDownPos,  #(0.0, 0.0, -0.035),
            # Make the disabled button fade out
            incButton_image3_color=Vec4(1, 1, 1, 0.2),
            incButtonCallback=self.filterChanged,
            # Same for the decrement button
            decButton_image=(
                arrowUp,
                arrowDown,
                arrowHover,
                arrowUp,
            ),
            decButton_relief=None,
            decButton_pos=filterLocatorUpPos,  #(0.0, 0.0, 0.07),
            decButton_scale=(1, 1, -1),
            # Make the disabled button fade out
            decButton_image3_color=Vec4(1, 1, 1, 0.2),
            decButtonCallback=self.filterChanged,
            # each item is a button with text on it
            numItemsVisible=1,
            itemMakeFunction=makeLabel,
            # note ordering is very important, should match ToontownGlobals
            items=[
                TTLocalizer.CalendarShowAll,
                TTLocalizer.CalendarShowOnlyHolidays,
                TTLocalizer.CalendarShowOnlyParties,
            ],
            # itemFrame is a DirectFrame
            itemFrame_frameSize=(-.2, .2, -.02, .05),
            itemFrame_frameColor=(0, 0, 0, 0),
        )
        gui.removeNode()
Beispiel #24
0
    PartyHood : 2,
    }

# Number of buildings you must have in your name to earn stars.
# Note - these have gone up since the credit is based on the size of the building now
TrophyStarLevels = (
    10,  # A bronze star
    20,  # A spinning bronze star
    30,  # A silver star
    50,  # A spinning silver star
    75,  # A gold star
    100, # A spinning gold star
    )

TrophyStarColors = (
    Vec4(0.9,0.6,0.2,1),  # A bronze star
    Vec4(0.9,0.6,0.2,1),  # A bronze star
    Vec4(0.8,0.8,0.8,1),  # A silver star
    Vec4(0.8,0.8,0.8,1),  # A silver star
    Vec4(1,1,0,1),        # A gold star
    Vec4(1,1,0,1),        # A gold star
    )

# OTPGlobals
"""
ToonStandableGround = 0.707 # if ToonStandableGround > angle: toon is on ground.

ToonForwardSpeed = 16.0 # feet per second
ToonJumpForce = 24.0 # feet per second
ToonReverseSpeed = 8.0 # feet per second
ToonRotateSpeed = 80.0