Beispiel #1
0
    def fillInviteActivityList(self, activityIds):
        self.invitationActivityList.removeAndDestroyAllItems()
        countDict = {}
        for actId in activityIds:
            if actId not in countDict:
                countDict[actId] = 1
            else:
                countDict[actId] += 1

        for activityId in countDict:
            if countDict[activityId] == 1:
                textOfActivity = TTLocalizer.PartyActivityNameDict[activityId][
                    'generic']
            else:
                textOfActivity = TTLocalizer.PartyActivityNameDict[activityId][
                    'generic'] + ' x ' + str(countDict[activityId])
            geom = getPartyActivityIcon(
                self.activityIconsModel,
                PartyGlobals.ActivityIds.getString(activityId))
            item = DirectLabel(relief=None,
                               text=textOfActivity,
                               text_align=TextNode.ACenter,
                               text_scale=0.05,
                               text_pos=(0.0, -0.15),
                               geom_scale=0.3,
                               geom_pos=Vec3(0.0, 0.0, 0.07),
                               geom=geom)
            self.invitationActivityList.addItem(item)

        return
 def loadSign(self):
     actNameForSign = self.activityName
     if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
     elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
         actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
     self.sign = self.root.attachNewNode('%sSign' % self.activityName)
     self.signModel = self.party.defaultSignModel.copyTo(self.sign)
     self.signFlat = self.signModel.find('**/sign_flat')
     self.signFlatWithNote = self.signModel.find('**/sign_withNote')
     self.signTextLocator = self.signModel.find('**/signText_locator')
     textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign)
     textureNodePath.setPos(0.0, -0.02, 2.2)
     textureNodePath.setScale(2.35)
     textureNodePath.copyTo(self.signFlat)
     textureNodePath.copyTo(self.signFlatWithNote)
     text = TextNode('noteText')
     text.setTextColor(0.2, 0.1, 0.7, 1.0)
     text.setAlign(TextNode.ACenter)
     text.setFont(OTPGlobals.getInterfaceFont())
     text.setWordwrap(10.0)
     text.setText('')
     self.noteText = self.signFlatWithNote.attachNewNode(text)
     self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0)
     self.noteText.setScale(0.2)
     self.signFlatWithNote.stash()
     self.signTextLocator.stash()
    def fillInviteActivityList(self, activityIds):
        self.invitationActivityList.removeAndDestroyAllItems()
        countDict = {}
        for actId in activityIds:
            if actId not in countDict:
                countDict[actId] = 1
            else:
                countDict[actId] += 1

        for activityId in countDict:
            if countDict[activityId] == 1:
                textOfActivity = TTLocalizer.PartyActivityNameDict[activityId]["generic"]
            else:
                textOfActivity = (
                    TTLocalizer.PartyActivityNameDict[activityId]["generic"] + " x " + str(countDict[activityId])
                )
            geom = getPartyActivityIcon(self.activityIconsModel, PartyGlobals.ActivityIds.getString(activityId))
            item = DirectLabel(
                relief=None,
                text=textOfActivity,
                text_align=TextNode.ACenter,
                text_scale=0.05,
                text_pos=(0.0, -0.15),
                geom_scale=0.3,
                geom_pos=Vec3(0.0, 0.0, 0.07),
                geom=geom,
            )
            self.invitationActivityList.addItem(item)

        return
 def loadSign(self):
     actNameForSign = self.activityName
     if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
         actNameForSign = PartyGlobals.ActivityIds.getString(
             PartyGlobals.ActivityIds.PartyJukebox)
     elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
         actNameForSign = PartyGlobals.ActivityIds.getString(
             PartyGlobals.ActivityIds.PartyDance)
     self.sign = self.root.attachNewNode('%sSign' % self.activityName)
     self.signModel = self.party.defaultSignModel.copyTo(self.sign)
     self.signFlat = self.signModel.find('**/sign_flat')
     self.signFlatWithNote = self.signModel.find('**/sign_withNote')
     self.signTextLocator = self.signModel.find('**/signText_locator')
     textureNodePath = getPartyActivityIcon(self.party.activityIconsModel,
                                            actNameForSign)
     textureNodePath.setPos(0.0, -0.02, 2.2)
     textureNodePath.setScale(2.35)
     textureNodePath.copyTo(self.signFlat)
     textureNodePath.copyTo(self.signFlatWithNote)
     text = TextNode('noteText')
     text.setTextColor(0.2, 0.1, 0.7, 1.0)
     text.setAlign(TextNode.ACenter)
     text.setFont(OTPGlobals.getInterfaceFont())
     text.setWordwrap(10.0)
     text.setText('')
     self.noteText = self.signFlatWithNote.attachNewNode(text)
     self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0,
                             0.0)
     self.noteText.setScale(0.2)
     self.signFlatWithNote.stash()
     self.signTextLocator.stash()
Beispiel #5
0
 def getActivityItem(self, activityBase, count=1):
     activityName = TTLocalizer.PartyActivityNameDict[
         activityBase.activityId]['generic']
     if count == 1:
         textForActivity = activityName
     else:
         textForActivity = '%s x %d' % (activityName, count)
     iconString = PartyGlobals.ActivityIds.getString(
         activityBase.activityId)
     geom = getPartyActivityIcon(self.activityIconsModel, iconString)
     label = DirectLabel(relief=None,
                         geom=geom,
                         geom_scale=0.38,
                         geom_pos=Vec3(0.0, 0.0, -0.17),
                         text=textForActivity,
                         text_scale=TTLocalizer.EPactivityItemLabel,
                         text_align=TextNode.ACenter,
                         text_pos=(-0.01, -0.43),
                         text_wordwrap=7.0)
     return label
 def getActivityItem(self, activityBase, count=1):
     activityName = TTLocalizer.PartyActivityNameDict[activityBase.activityId]["generic"]
     if count == 1:
         textForActivity = activityName
     else:
         textForActivity = "%s x %d" % (activityName, count)
     iconString = PartyGlobals.ActivityIds.getString(activityBase.activityId)
     geom = getPartyActivityIcon(self.activityIconsModel, iconString)
     label = DirectLabel(
         relief=None,
         geom=geom,
         geom_scale=0.38,
         geom_pos=Vec3(0.0, 0.0, -0.17),
         text=textForActivity,
         text_scale=TTLocalizer.EPactivityItemLabel,
         text_align=TextNode.ACenter,
         text_pos=(-0.01, -0.43),
         text_wordwrap=7.0,
     )
     return label
    def __init__(self, partyEditor, id, isDecoration = False, **kw):
        self.partyEditor = partyEditor
        self.id = id
        self.isDecoration = isDecoration
        self.unreleased = self.calcUnreleased(id)
        self.comingSoonTextScale = 1.0
        if self.isDecoration:
            self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor']
            colorList = ((1.0, 0.0, 1.0, 1.0),
             (0.0, 0.0, 1.0, 1.0),
             (0.0, 1.0, 1.0, 1.0),
             (0.5, 0.5, 0.5, 1.0))
            assetName = PartyGlobals.DecorationIds.getString(self.id)
            if assetName == 'Hydra':
                assetName = 'StageSummer'
            geom = self.partyEditor.decorationModels.find('**/partyDecoration_%s' % assetName)
            if geom.isEmpty() or self.unreleased:
                helpGui = loader.loadModel('phase_3.5/models/gui/tt_m_gui_brd_help')
                helpImageList = (helpGui.find('**/tt_t_gui_brd_helpUp'),
                 helpGui.find('**/tt_t_gui_brd_helpDown'),
                 helpGui.find('**/tt_t_gui_brd_helpHover'),
                 helpGui.find('**/tt_t_gui_brd_helpDown'))
                geom = helpImageList[2]
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(2.5, 2.5, 2.5)
                geom_pos = (0.0, 0.0, 0.0)
                self.comingSoonTextScale = 0.035
            else:
                geom_pos = (0.0, 0.0, -3.0)
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(0.06, 0.0001, 0.06)
                if self.id in [PartyGlobals.DecorationIds.CogStatueVictory, PartyGlobals.DecorationIds.TubeCogVictory, PartyGlobals.DecorationIds.CogIceCreamVictory]:
                    geom_pos = (0.0, 0.0, -3.9)
                    scale = Vec3(0.05, 0.0001, 0.05)
        else:
            self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor']
            colorList = ((0.0, 0.0, 0.0, 1.0),
             (0.0, 1.0, 0.0, 1.0),
             (1.0, 1.0, 0.0, 1.0),
             (0.5, 0.5, 0.5, 1.0))
            iconString = PartyGlobals.ActivityIds.getString(self.id)
            if self.id == PartyGlobals.ActivityIds.PartyJukebox40:
                iconString = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
            elif self.id == PartyGlobals.ActivityIds.PartyDance20:
                iconString = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
            geom = getPartyActivityIcon(self.partyEditor.activityIconsModel, iconString)
            scale = 0.35
            geom3_color = (0.5, 0.5, 0.5, 1.0)
            geom_pos = (0.0, 0.0, 0.0)
            self.comingSoonTextScale = 0.25
        optiondefs = (('geom', geom, None),
         ('geom3_color', geom3_color, None),
         ('geom_pos', geom_pos, None),
         ('relief', None, None))
        self.defineoptions(kw, optiondefs)
        DirectButton.__init__(self, self.partyEditor.elementList)
        self.initialiseoptions(PartyEditorListElement)
        self.setName('%sListElement' % self.name)
        self.setScale(scale)
        self.bind(DirectGuiGlobals.B1PRESS, self.clicked)
        self.bind(DirectGuiGlobals.B1RELEASE, self.released)
        self.partyEditorGridElements = []
        if self.isDecoration:
            for i in xrange(PartyGlobals.DecorationInformationDict[self.id]['limitPerParty']):
                self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndAffordability))

        else:
            for i in xrange(PartyGlobals.ActivityInformationDict[self.id]['limitPerParty']):
                self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndAffordability))

        self.activeGridElementIndex = -1
        self.adjustForUnreleased()
        return
Beispiel #8
0
    def __init__(self, partyEditor, id, isDecoration=False, **kw):
        self.partyEditor = partyEditor
        self.id = id
        self.isDecoration = isDecoration
        self.unreleased = self.calcUnreleased(id)
        self.comingSoonTextScale = 1.0
        if self.isDecoration:
            self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor']
            colorList = ((1.0, 0.0, 1.0, 1.0), (0.0, 0.0, 1.0, 1.0),
                         (0.0, 1.0, 1.0, 1.0), (0.5, 0.5, 0.5, 1.0))
            assetName = PartyGlobals.DecorationIds.getString(self.id)
            if assetName == 'Hydra':
                assetName = 'StageSummer'
            geom = self.partyEditor.decorationModels.find(
                '**/partyDecoration_%s' % assetName)
            if geom.isEmpty() or self.unreleased:
                helpGui = loader.loadModel(
                    'phase_3.5/models/gui/tt_m_gui_brd_help')
                helpImageList = (helpGui.find('**/tt_t_gui_brd_helpUp'),
                                 helpGui.find('**/tt_t_gui_brd_helpDown'),
                                 helpGui.find('**/tt_t_gui_brd_helpHover'),
                                 helpGui.find('**/tt_t_gui_brd_helpDown'))
                geom = helpImageList[2]
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(2.5, 2.5, 2.5)
                geom_pos = (0.0, 0.0, 0.0)
                self.comingSoonTextScale = 0.035
            else:
                geom_pos = (0.0, 0.0, -3.0)
                geom3_color = (0.5, 0.5, 0.5, 1.0)
                scale = Vec3(0.06, 0.0001, 0.06)
                if self.id in [
                        PartyGlobals.DecorationIds.CogStatueVictory,
                        PartyGlobals.DecorationIds.TubeCogVictory,
                        PartyGlobals.DecorationIds.CogIceCreamVictory
                ]:
                    geom_pos = (0.0, 0.0, -3.9)
                    scale = Vec3(0.05, 0.0001, 0.05)
        else:
            self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor']
            colorList = ((0.0, 0.0, 0.0, 1.0), (0.0, 1.0, 0.0, 1.0),
                         (1.0, 1.0, 0.0, 1.0), (0.5, 0.5, 0.5, 1.0))
            iconString = PartyGlobals.ActivityIds.getString(self.id)
            if self.id == PartyGlobals.ActivityIds.PartyJukebox40:
                iconString = PartyGlobals.ActivityIds.getString(
                    PartyGlobals.ActivityIds.PartyJukebox)
            elif self.id == PartyGlobals.ActivityIds.PartyDance20:
                iconString = PartyGlobals.ActivityIds.getString(
                    PartyGlobals.ActivityIds.PartyDance)
            geom = getPartyActivityIcon(self.partyEditor.activityIconsModel,
                                        iconString)
            scale = 0.35
            geom3_color = (0.5, 0.5, 0.5, 1.0)
            geom_pos = (0.0, 0.0, 0.0)
            self.comingSoonTextScale = 0.25
        optiondefs = (('geom', geom, None), ('geom3_color', geom3_color, None),
                      ('geom_pos', geom_pos, None), ('relief', None, None))
        self.defineoptions(kw, optiondefs)
        DirectButton.__init__(self, self.partyEditor.elementList)
        self.initialiseoptions(PartyEditorListElement)
        self.setName('%sListElement' % self.name)
        self.setScale(scale)
        self.bind(DirectGuiGlobals.B1PRESS, self.clicked)
        self.bind(DirectGuiGlobals.B1RELEASE, self.released)
        self.partyEditorGridElements = []
        if self.isDecoration:
            for i in xrange(PartyGlobals.DecorationInformationDict[self.id]
                            ['limitPerParty']):
                self.partyEditorGridElements.append(
                    PartyEditorGridElement(self.partyEditor, self.id,
                                           self.isDecoration,
                                           self.checkSoldOutAndAffordability))

        else:
            for i in xrange(PartyGlobals.ActivityInformationDict[self.id]
                            ['limitPerParty']):
                self.partyEditorGridElements.append(
                    PartyEditorGridElement(self.partyEditor, self.id,
                                           self.isDecoration,
                                           self.checkSoldOutAndAffordability))

        self.activeGridElementIndex = -1
        self.adjustForUnreleased()
        return