def __init__(self, parent, leaderId, leaderName, shardName, category, memberIds, memberNames, **kw): self.leaderId = leaderId self.leaderName = leaderName self.shardName = shardName self.category = category self.memberIds = memberIds self.memberNames = memberNames self.playerCount = None if parent is None: parent = aspect2d text = TTLocalizer.GroupTrackerCategoryToText[self.category] optiondefs = ( ('text', text, None), ('text_fg', (0.0, 0.0, 0.0, 1.0), None), ('text_align', TextNode.ALeft, None), ('text_pos', (0.0, 0.0, 0.0), None), ('text_scale', 0.05, None), ('relief', None, None) ) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(GroupTrackerGroup) self.playerCount = DirectLabel(parent=self, pos=(0.6, 0, 0), relief=None, text='', text_align=TextNode.ARight, text_scale=0.05, text_fg=(0, 0, 0, 1)) self.updatePlayerCount()
def __init__(self, page, text, extraArgs, pos=(0, 0, 0), text_pos_x=0.07): self.page = page gui = loader.loadModel('phase_3.5/models/gui/fishingBook.bam') DirectButton.__init__(self, parent=page.tabsFrame, relief=None, extraArgs=extraArgs, text=text, text_scale=0.07, text_align=TextNode.ALeft, text_pos=(text_pos_x, 0.0, 0.0), image=gui.find('**/tabs/polySurface1'), image_pos=(0.6, 1, -0.91), image_hpr=(0, 0, -90), image_scale=(0.033, 0.033, 0.035), image_color=self.normalColor, image1_color=self.clickColor, image2_color=self.rolloverColor, image3_color=self.disabledColor, text_fg=Vec4(0.2, 0.1, 0, 1), command=self.page.pickCategory, pos=pos, rolloverSound=CIGlobals.getRolloverSound(), clickSound=CIGlobals.getClickSound()) self.initialiseoptions(CategoryTab)
def __init__(self, name, parent, leakscale, **kw): self.name = name pitchingGui = loader.loadModel( 'models/gui/pir_m_gui_srp_pitching_main') self.hole = pitchingGui.find('**/hole') if random.random() > 0.5: self.holeFilled = pitchingGui.find('**/pitch1') else: self.holeFilled = pitchingGui.find('**/pitch2') optiondefs = (('relief', None, None), ('geom', (self.hole, self.hole, self.hole, self.holeFilled), None), ('rolloverSound', None, None), ('clickSound', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent=parent, **kw) self.initialiseoptions(RepairLeak) FSM.FSM.__init__(self, 'leak_%sFSM' % self.name) self.onCleanup = None self.leakScale = leakscale self.pitchingGame = parent self._initVars() self._initVisuals() self._initIntervals() self.fadeSequence = None self.request('Idle') return
def __init__(self, parent=None, wantLabel=False, z=buttonbase_ycoord, labelZ=None, labelOrientation='left', labelPos=None, labelText='', image_scale=(0.7, 1, 1), text='', **kw): loadModels() if parent is None: parent = aspect2d pos = (buttonbase_xcoord, 0, z) if not kw.get('pos') else kw['pos'] optiondefs = (('relief', None, None), ('image', (Preloaded['button1'], Preloaded['button2'], Preloaded['button3']), None), ('image_scale', image_scale, None), ('text', text, None), ('text_scale', 0.052, None), ('text_pos', (0, -0.02), None), ('pos', pos, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(OptionButton) if wantLabel: self.label = OptionLabel(parent=self, z=labelZ, pos=labelPos, orientation=labelOrientation, text=labelText)
def __init__(self, parent, leaderId, leaderName, shardName, category, memberIds, memberNames, **kw): self.leaderId = leaderId self.leaderName = leaderName self.shardName = shardName self.category = category self.memberIds = memberIds self.memberNames = memberNames self.playerCount = None if parent is None: parent = aspect2d text = TTLocalizer.GroupTrackerCategoryToText[self.category] optiondefs = (('text', text, None), ('text_fg', (0.0, 0.0, 0.0, 1.0), None), ('text_align', TextNode.ALeft, None), ('text_pos', (0.0, 0.0, 0.0), None), ('text_scale', 0.05, None), ('relief', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(GroupTrackerGroup) self.playerCount = DirectLabel(parent=self, pos=(0.6, 0, 0), relief=None, text='', text_align=TextNode.ARight, text_scale=0.05, text_fg=(0, 0, 0, 1)) self.updatePlayerCount()
def __init__(self, track, gagId): self.track = track self.gagId = gagId self.gagName = base.cr.attackMgr.getAttackName(gagId) self.lastScale = 1.0 self.goalScale = 1.0 self.scaleLerpTask = taskMgr.add(self.__scaleLerp, "scaleLerp") self.locked = False DirectButton.__init__(self, scale = 1, relief = None, pressEffect = False, rolloverSound = None, clickSound = None, command = self.track.gsg.selectCurrentGag) self['image'] = 'phase_14/maps/gag_box.png' self['image_scale'] = (0.115, 0, 0.114) self.bind(DGG.ENTER, self.mouseEnter) self.bind(DGG.EXIT, self.mouseExit) self.lockedImg = OnscreenImage(image = 'phase_14/maps/lock.png', scale = (0.061, 0, 0.089), parent = self, color = (1, 1, 1, 0.5)) invIcons = loader.loadModel("phase_3.5/models/gui/inventory_icons.bam") self.gagImg = OnscreenGeom(geom = invIcons.find(GagGlobals.InventoryIconByName[self.gagName]), scale = 0.85, parent = self) invIcons.removeNode() del invIcons self.initialiseoptions(GagWidget)
def __init__(self, name, parent, allWoodSquaresGeom, selectedOutlineGeom, command, location, **kw): optiondefs = () self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(RepairGridPiece) FSM.FSM.__init__(self, 'RepairGridPiece_%sFSM' % name) self.name = name self.allWoodSquaresGeom = allWoodSquaresGeom self.selectedOutlineGeom = selectedOutlineGeom self.command = command self.location = location self._initVars() self._initGUI() self._initIntervals() self.accept(self.guiItem.getEnterEvent(), self.onMouseEnter) self.accept(self.guiItem.getExitEvent(), self.onMouseExit) self.bind(DGG.B1PRESS, self.onMouseDown) self.bind(DGG.B1RELEASE, self.onMouseUp) self.bind(DGG.B2PRESS, self.onMouseUp) self.bind(DGG.B2RELEASE, self.onMouseUp) self.bind(DGG.B3PRESS, self.onMouseUp) self.bind(DGG.B3RELEASE, self.onMouseUp) self.idleGeom = NodePath('idleGeom') self.highlightedGeom = NodePath('highlightedGeom') self.haveMoved = False self.grabPoint = None self.setType(GOAL_NONE)
def __init__(self, parent, avId, name, isLeader, **kw): self.avId = avId self.name = name self.isLeader = isLeader self.leaderImage = None if parent is None: parent = aspect2d text=self.getName() optiondefs = ( ('text', text, None), ('text_fg', (0.0, 0.0, 0.0, 1.0), None), ('text_align', TextNode.ALeft, None), ('text_pos', (-0.2, 0.0, 0.0), None), ('relief', None, None), ('text_scale', 0.05, None), ('command', self.loadPlayerDetails, None) ) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(GroupTrackerPlayer) boardingGroupIcons = loader.loadModel('phase_9/models/gui/tt_m_gui_brd_status') self.leaderButtonImage = boardingGroupIcons.find('**/tt_t_gui_brd_statusLeader') self.leaderImage = DirectButton(parent=self, relief=None, state=DGG.DISABLED, image=(self.leaderButtonImage), image_scale=(0.06, 1.0, 0.06), pos=(-0.26, 0, 0.02), command=None) self.setLeaderStatus(self.isLeader) boardingGroupIcons.removeNode()
def __init__(self, tabType=2, parent=None, **kw): loadModels() if parent is None: parent = aspect2d if tabType == 1: image = Preloaded['tab1'] elif tabType == 2: image = Preloaded['tab2'] else: image = None optiondefs = ( ('relief', None, None), ('text_align', TextNode.ALeft, None), ('text_fg', Vec4(0.2, 0.1, 0, 1), None), ('image', image, None), ('image_color', normalColor, None), ('image1_color', clickColor, None), ('image2_color', rolloverColor, None), ('image3_color', diabledColor, None), ('image_scale', (0.033, 0.033, 0.035), None), ('image_hpr', (0, 0, -90), None) ) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(OptionTab)
def __init__(self, name, parent, allWoodSquaresGeom, selectedOutlineGeom, command, location, **kw): optiondefs = () self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent, **None) self.initialiseoptions(RepairGridPiece) FSM.FSM.__init__(self, 'RepairGridPiece_%sFSM' % name) self.name = name self.allWoodSquaresGeom = allWoodSquaresGeom self.selectedOutlineGeom = selectedOutlineGeom self.command = command self.location = location self._initVars() self._initGUI() self._initIntervals() self.accept(self.guiItem.getEnterEvent(), self.onMouseEnter) self.accept(self.guiItem.getExitEvent(), self.onMouseExit) self.bind(DGG.B1PRESS, self.onMouseDown) self.bind(DGG.B1RELEASE, self.onMouseUp) self.bind(DGG.B2PRESS, self.onMouseUp) self.bind(DGG.B2RELEASE, self.onMouseUp) self.bind(DGG.B3PRESS, self.onMouseUp) self.bind(DGG.B3RELEASE, self.onMouseUp) self.idleGeom = NodePath('idleGeom') self.highlightedGeom = NodePath('highlightedGeom') self.haveMoved = False self.grabPoint = None self.setType(GOAL_NONE)
def __init__(self, partyEditor, id, isDecoration, checkSoldOutAndPaidStatusAndAffordability, **kw): self.partyEditor = partyEditor self.id = id self.isDecoration = isDecoration self.checkSoldOutAndPaidStatusAndAffordability = checkSoldOutAndPaidStatusAndAffordability if self.isDecoration: self.name = TTLocalizer.PartyDecorationNameDict[self.id]['editor'] colorList = ((1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find('**/%s' % PartyGlobals.DecorationInformationDict[self.id]['gridAsset']) else: self.name = TTLocalizer.PartyActivityNameDict[self.id]['editor'] colorList = ((1.0, 1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find('**/%s' % PartyGlobals.ActivityInformationDict[self.id]['gridAsset']) optiondefs = ( ( 'geom', self.geom, None), ('geom_scale', 1.0, None), ( 'geom_color', colorList[0], None), ( 'geom1_color', colorList[0], None), ( 'geom2_color', colorList[0], None), ( 'geom3_color', colorList[0], None), ('relief', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, self.partyEditor.parent) self.initialiseoptions(PartyEditorGridElement) self.setName('%sGridElement' % self.name) self.bind(DirectGuiGlobals.B1PRESS, self.clicked) self.bind(DirectGuiGlobals.B1RELEASE, self.released) self.bind(DirectGuiGlobals.ENTER, self.mouseEnter) self.bind(DirectGuiGlobals.EXIT, self.mouseExit) self.uprightNodePath = NodePath('%sUpright' % self.name) self.uprightNodePath.reparentTo(self) rollOverZOffset = self.getGridSize()[1] / 30.0 self.rolloverTitle = DirectLabel(relief=None, parent=self.uprightNodePath, pos=Point3(0.0, 0.0, rollOverZOffset), text=self.name, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_scale=0.075) self.rolloverTitle.stash() self.stash() self.overValidSquare = False self.lastValidPosition = None self.setColorScale(0.9, 0.9, 0.9, 0.7) self.setTransparency(True) self.mouseOverTrash = False self.centerGridSquare = None return
def __init__(self, partyEditor, id, isDecoration, checkSoldOutAndPaidStatusAndAffordability, **kw): self.partyEditor = partyEditor self.id = id self.isDecoration = isDecoration self.checkSoldOutAndPaidStatusAndAffordability = checkSoldOutAndPaidStatusAndAffordability if self.isDecoration: self.name = TTLocalizer.PartyDecorationNameDict[self.id]["editor"] colorList = ((1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find( "**/%s" % PartyGlobals.DecorationInformationDict[self.id]["gridAsset"] ) else: self.name = TTLocalizer.PartyActivityNameDict[self.id]["editor"] colorList = ((1.0, 1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find( "**/%s" % PartyGlobals.ActivityInformationDict[self.id]["gridAsset"] ) optiondefs = ( ("geom", self.geom, None), ("geom_scale", 1.0, None), ("geom_color", colorList[0], None), ("geom1_color", colorList[0], None), ("geom2_color", colorList[0], None), ("geom3_color", colorList[0], None), ("relief", None, None), ) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, self.partyEditor.parent) self.initialiseoptions(PartyEditorGridElement) self.setName("%sGridElement" % self.name) self.bind(DirectGuiGlobals.B1PRESS, self.clicked) self.bind(DirectGuiGlobals.B1RELEASE, self.released) self.bind(DirectGuiGlobals.ENTER, self.mouseEnter) self.bind(DirectGuiGlobals.EXIT, self.mouseExit) self.uprightNodePath = NodePath("%sUpright" % self.name) self.uprightNodePath.reparentTo(self) rollOverZOffset = self.getGridSize()[1] / 30.0 self.rolloverTitle = DirectLabel( relief=None, parent=self.uprightNodePath, pos=Point3(0.0, 0.0, rollOverZOffset), text=self.name, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_scale=0.075, ) self.rolloverTitle.stash() self.stash() self.overValidSquare = False self.lastValidPosition = None self.setColorScale(0.9, 0.9, 0.9, 0.7) self.setTransparency(True) self.mouseOverTrash = False self.centerGridSquare = None return
def __init__(self, parent, **kw): optiondefs = (('clickDownCommand', None, None), ('clickUpCommand', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(RepairSaw) self.sawingGame = parent self._initVars() self._initGUI() self._initIntervals() self.accept(self.guiItem.getEnterEvent(), self.onMouseEnter) self.accept(self.guiItem.getExitEvent(), self.onMouseExit) self.guiItem.addClickButton(MouseButton.one()) self.bind(DGG.B1PRESS, self.onMouseDown) self.bind(DGG.B1RELEASE, self.onMouseUp)
def __init__(self, parent, **kw): optiondefs = (('clickDownCommand', None, None), ('clickUpCommand', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent, **kw) self.initialiseoptions(RepairSaw) self.sawingGame = parent self._initVars() self._initGUI() self._initIntervals() self.accept(self.guiItem.getEnterEvent(), self.onMouseEnter) self.accept(self.guiItem.getExitEvent(), self.onMouseExit) self.guiItem.addClickButton(MouseButton.one()) self.bind(DGG.B1PRESS, self.onMouseDown) self.bind(DGG.B1RELEASE, self.onMouseUp) return
def __init__(self, page, pos): DirectButton.__init__(self, parent=page, relief=None, command=self.handleClick, pos=pos) self.window = page self.item = None self.values = None self.label = DirectLabel(text='', relief=None, parent=self, text_scale=0.05) self.label.initialiseoptions(DirectLabel) self.label.hide() self.hide()
def __init__(self, name, parent, leakscale, **kw): self.name = name pitchingGui = loader.loadModel('models/gui/pir_m_gui_srp_pitching_main') self.hole = pitchingGui.find('**/hole') if random.random() > 0.5: self.holeFilled = pitchingGui.find('**/pitch1') else: self.holeFilled = pitchingGui.find('**/pitch2') optiondefs = (('relief', None, None), ('geom', (self.hole, self.hole, self.hole, self.holeFilled), None), ('rolloverSound', None, None), ('clickSound', None, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent = parent) self.initialiseoptions(RepairLeak) FSM.FSM.__init__(self, 'leak_%sFSM' % self.name) self.onCleanup = None self.leakScale = leakscale self.pitchingGame = parent self._initVars() self._initVisuals() self._initIntervals() self.fadeSequence = None self.request('Idle')
def __init__(self, parent, avId, name, isLeader, **kw): self.avId = avId self.name = name self.isLeader = isLeader self.leaderImage = None if parent is None: parent = aspect2d text = self.getName() optiondefs = (('text', text, None), ('text_fg', (0.0, 0.0, 0.0, 1.0), None), ('text_align', TextNode.ALeft, None), ('text_pos', (-0.2, 0.0, 0.0), None), ('relief', None, None), ('text_scale', 0.05, None), ('command', self.loadPlayerDetails, None)) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(GroupTrackerPlayer) boardingGroupIcons = loader.loadModel( 'phase_9/models/gui/tt_m_gui_brd_status') self.leaderButtonImage = boardingGroupIcons.find( '**/tt_t_gui_brd_statusLeader') self.leaderImage = DirectButton(parent=self, relief=None, state=DGG.DISABLED, image=(self.leaderButtonImage), image_scale=(0.06, 1.0, 0.06), pos=(-0.26, 0, 0.02), command=None) self.setLeaderStatus(self.isLeader) boardingGroupIcons.removeNode()
def __init__(self, parent=None, wantLabel=False, z=buttonbase_ycoord, labelZ=None, labelOrientation='left', labelPos=None, labelText='', image_scale=(0.7, 1, 1), text='', **kw): loadModels() if parent is None: parent = aspect2d pos = (buttonbase_xcoord, 0, z) if not kw.get('pos') else kw['pos'] optiondefs = ( ('relief', None, None), ('image', (Preloaded['button1'], Preloaded['button2'], Preloaded['button3']), None), ('image_scale', image_scale, None), ('text', text, None), ('text_scale', 0.052, None), ('text_pos', (0, -0.02), None), ('pos', pos, None), ) self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.initialiseoptions(OptionButton) if wantLabel: self.label=OptionLabel(parent=self, z=labelZ, pos=labelPos, orientation=labelOrientation, text=labelText)
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, checkSoldOutAndPaidStatusAndAffordability, **kw): self.partyEditor = partyEditor self.id = id self.isDecoration = isDecoration self.checkSoldOutAndPaidStatusAndAffordability = checkSoldOutAndPaidStatusAndAffordability # method # Change the name and the up, down, rollover, and disabled colors if self.isDecoration: self.name = TTLocalizer.PartyDecorationNameDict[self.id]["editor"] colorList = ((1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find( "**/%s" % PartyGlobals.DecorationInformationDict[self.id]["gridAsset"]) else: self.name = TTLocalizer.PartyActivityNameDict[self.id]["editor"] colorList = ((1.0, 1.0, 1.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)) self.geom = self.partyEditor.partyPlanner.gui.find( "**/%s" % PartyGlobals.ActivityInformationDict[self.id]["gridAsset"]) optiondefs = ( ('geom', self.geom, None), ('geom_scale', 1.0, None), ('geom_color', colorList[0], None), ('geom1_color', colorList[0], None), ('geom2_color', colorList[0], None), ('geom3_color', colorList[0], 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.parent) self.initialiseoptions(PartyEditorGridElement) self.setName("%sGridElement" % self.name) # 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.bind(DirectGuiGlobals.ENTER, self.mouseEnter) self.bind(DirectGuiGlobals.EXIT, self.mouseExit) self.uprightNodePath = NodePath("%sUpright" % self.name) self.uprightNodePath.reparentTo(self) #debugAxis = loader.loadModel("models/misc/xyzAxis") #debugAxis.reparentTo(self.uprightNodePath) #debugAxis.setScale(0.01) rollOverZOffset = self.getGridSize()[1] / 30.0 self.rolloverTitle = DirectLabel( relief=None, parent=self.uprightNodePath, pos=Point3(0.0, 0.0, rollOverZOffset), text=self.name, text_fg=(1.0, 1.0, 1.0, 1.0), text_shadow=(0.0, 0.0, 0.0, 1.0), text_scale=0.075, ) self.rolloverTitle.stash() self.stash() self.overValidSquare = False self.lastValidPosition = None self.setColorScale(0.9, 0.9, 0.9, 0.7) self.setTransparency(True) self.mouseOverTrash = False self.centerGridSquare = None
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()