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 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 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 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 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.checkSoldOutAndPaidStatusAndAffordability)) else: for i in xrange(PartyGlobals.ActivityInformationDict[self.id]['limitPerParty']): self.partyEditorGridElements.append(PartyEditorGridElement(self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability)) self.activeGridElementIndex = -1 self.adjustForUnreleased() return
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 range(PartyGlobals.DecorationInformationDict[self.id] ['limitPerParty']): self.partyEditorGridElements.append( PartyEditorGridElement( self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability)) else: for i in range(PartyGlobals.ActivityInformationDict[self.id] ['limitPerParty']): self.partyEditorGridElements.append( PartyEditorGridElement( self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability)) self.activeGridElementIndex = -1 self.adjustForUnreleased() return
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 # Change the name and the up, down, rollover, and disabled colors 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: # we give to much away as the icon looks exactly like the decr 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) # coming soon text scale is higly dependent on the icon scale 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) # Give these tall icons a bit more head room. 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) # coming soon text scale is higly dependent on the icon scale self.comingSoonTextScale = 0.25 #self.icon.setPos(self.partyEditor.partyPlanner.gui.find("**/step_05_activitiesIcon_locator").getPos()) #self.icon.reparentTo(self.partyEditor.parent) #self.icon.stash() optiondefs = ( ('geom', geom, None), ('geom3_color', geom3_color, None), ('geom_pos', geom_pos, None), ('relief', None, None), ) # Merge keyword options with default options, plus, this call makes # DirectButton work... that and the initializeoptions below... without # those two calls, strange... and I mean hard to debug, stuff happens. self.defineoptions(kw, optiondefs) DirectButton.__init__(self, self.partyEditor.elementList) self.initialiseoptions(PartyEditorListElement) self.setName("%sListElement" % self.name) self.setScale(scale) # Since normal buttons only call their command methods upon release # of the mouse button, we will not specify a command method and # instead bind our own methods to press and release. self.bind(DirectGuiGlobals.B1PRESS, self.clicked) self.bind(DirectGuiGlobals.B1RELEASE, self.released) self.partyEditorGridElements = [] if self.isDecoration: for i in range(PartyGlobals.DecorationInformationDict[self.id] ["limitPerParty"]): self.partyEditorGridElements.append( PartyEditorGridElement( self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability)) else: for i in range(PartyGlobals.ActivityInformationDict[self.id] ["limitPerParty"]): self.partyEditorGridElements.append( PartyEditorGridElement( self.partyEditor, self.id, self.isDecoration, self.checkSoldOutAndPaidStatusAndAffordability)) self.activeGridElementIndex = -1 self.adjustForUnreleased()