def enter(self): BookPage.enter(self) self.show() # Let's add our tasks base.taskMgr.add(self.__updateDistrictPopTask, 'SB.updateDistrictPopTask')
def __init__(self, book): BookPage.__init__(self, book, 'Options', wantHeader=True) self.fsm = ClassicFSM('OptionPage', [ State('off', self.enterOff, self.exitOff), State('basePage', self.enterBasePage, self.exitBasePage), State('displayPage', self.enterDisplayPage, self.exitDisplayPage) ], 'off', 'off') self.fsm.enterInitialState()
def __init__(self, book): BookPage.__init__(self, book, 'Districts') DirectFrame.__init__(self, parent=book) self.initialiseoptions(DistrictsPage) # GUI elements self.infoLbl = None self.populationLbl = None self.shardButtons = [] self.districtList = None self.hide()
def __init__(self, book): BookPage.__init__(self, book, 'Map', wantHeader=False) DirectFrame.__init__(self, parent=book, relief=None, pos=(0, 0, 0.0775), image_scale=(1.8, 1, 1.35), scale=0.97) self['image'] = loader.loadModel( 'phase_3.5/models/gui/toontown_map.bam') self.initialiseoptions(MapPage) self.hide() self.cloudPos = [[(-0.61, 0, 0.18), (0.55, 0.25, 0.37), (180, 0, 0)], [(-0.54, 0, 0.34), (0.76, 0.4, 0.55), (180, 0, 0)], [(-0.55, 0, -0.09), (0.72, 0.4, 0.55), (0, 0, 0)], [(-0.67, 0, -0.51), (0.5, 0.29, 0.38), (180, 0, 0)], [(-0.67, 0, 0.51), (0.50, 0.29, 0.38), (0, 0, 0)], [(0.67, 0, 0.51), (0.5, 0.29, 0.38), (0, 0, 0)], [(0.35, 0, -0.46), (0.63, 0.35, 0.45), (0, 0, 0)], [(0.18, 0, -0.45), (0.52, 0.27, 0.32), (0, 0, 0)], [(0.67, 0, -0.44), (0.63, 0.35, 0.48), (180, 0, 0)]] self.hoodClouds = [ #[(0.02, 0, -0.17), (0.63, 0.35, 0.48), (180, 0, 0), ZoneUtil.ToontownCentral], [(0.63, 0, -0.13), (0.63, 0.35, 0.40), (0, 0, 0), ZoneUtil.DonaldsDock], [(0.51, 0, 0.25), (0.57, 0.35, 0.40), (0, 0, 0), ZoneUtil.TheBrrrgh], [(0.03, 0, 0.19), (0.63, 0.35, 0.40), (180, 0, 0), ZoneUtil.MinniesMelodyland], [(-0.08, 0, 0.46), (0.54, 0.35, 0.40), (0, 0, 0), ZoneUtil.DonaldsDreamland], [(-0.28, 0, -0.49), (0.60, 0.35, 0.45), (0, 0, 0), ZoneUtil.DaisyGardens] ] self.labelData = [[(0, 0, -0.2), ZoneUtil.ToontownCentral], [(0.65, 0, -0.125), ZoneUtil.DonaldsDock], [(0.07, 0, 0.18), ZoneUtil.MinniesMelodyland], [(-0.1, 0, 0.45), ZoneUtil.DonaldsDreamland], [(0.5, 0, 0.25), ZoneUtil.TheBrrrgh], [(-0.37, 0, -0.525), ZoneUtil.DaisyGardens]] # The buttons self.infoLabel = None self.BTPButton = None self.clouds = [] self.labels = []
def __init__(self, book): BookPage.__init__(self, book, 'Admin Panel') self.fsm = ClassicFSM( 'AdminPage', [ State('off', self.enterOff, self.exitOff), State('basePage', self.enterBasePage, self.exitBasePage), State('kickSection', self.enterKickSection, self.exitKickSection), #State('clickOnToon', self.enterClickOnToon, self.exitClickOnToon), State('sysMsgSection', self.enterSysMsgSection, self.exitSysMsgSection) ], 'off', 'off') self.fsm.enterInitialState()
def unload(self): BookPage.unload(self) # Delete GUI elements. for btn in self.shardButtons: btn.destroy() self.shardButtons.remove(btn) self.districtList.destroy() self.infoLbl.destroy() self.populationLbl.destroy() self.destroy() del self.shardButtons del self.districtList del self.infoLbl del self.populationLbl del textDisabledColor del textDownColor del textRolloverColor
def unload(self): BookPage.unload(self) # Destroy the GUI elements. self.infoLabel.destroy() self.BTPButton.destroy() self.destroy() # Destroy the labels. for label in self.labels: label.destroy() # Destroy the clouds. for cloud in self.clouds: cloud.removeNode() self.clouds.remove(cloud) del self.labels del self.clouds del self.infoLabel del self.BTPButton
def load(self): BookPage.load(self) icons = loader.loadModel('phase_3.5/models/gui/sos_textures.bam') self.icon = icons.find('**/district') icons.detachNode() currDistrictName = base.cr.myDistrict.getDistrictName() self.infoLbl = OnscreenText( text='Each District is a copy of the Cog Invasion world.\n' '\n\nYou are currently in the "%s" District' % currDistrictName, pos=(0.05, 0.3), parent=self, align=TextNode.ALeft, wordwrap=12) self.populationLbl = OnscreenText(text="Population: %d" % base.cr.myDistrict.getPopulation(), pos=(0.44, -0.3), parent=self, align=TextNode.ACenter) self.shardButtons = [] for shard in base.cr.activeDistricts.values(): shardName = shard.getDistrictName() shardId = shard.doId btn = CIGlobals.makeDefaultScrolledListBtn( text=shardName, parent=self, command=self.__handleShardButton, extraArgs=[shardId]) if shardId == base.localAvatar.parentId: btn['state'] = DGG.DISABLED else: btn['state'] = DGG.NORMAL self.shardButtons.append(btn) self.districtList = CIGlobals.makeDefaultScrolledList( items=self.shardButtons, parent=self, pos=(-0.54, 0, 0.08))
def load(self): BookPage.load(self) invIcons = loader.loadModel("phase_3.5/models/gui/inventory_icons.bam") self.icon = invIcons.find('**/inventory_tart') self.iconScale = 7.0 invIcons.detachNode()
def exit(self): self.fsm.requestFinalState() BookPage.exit(self)
def exit(self): BookPage.exit(self) base.taskMgr.remove('SB.updateDistrictPopTask') self.hide()
def load(self): BookPage.load(self) icons = loader.loadModel('phase_3.5/models/gui/sos_textures.bam') self.icon = icons.find('**/switch') icons.detachNode()
def unload(self): del self.book del self.fsm BookPage.unload(self)
def load(self): BookPage.load(self) icons = loader.loadModel('phase_4/models/gui/tfa_images.bam') self.icon = icons.find('**/hq-dialog-image') icons.detachNode()
def exit(self): BookPage.exit(self) self.hide()
def enter(self): BookPage.enter(self) self.fsm.request('basePage')
def __init__(self, book): BookPage.__init__(self, book, 'Gags') self.gui = None
def exit(self): self.fsm.request('off') BookPage.exit(self)
def enter(self): BookPage.enter(self) self.show()
def enter(self): BookPage.enter(self) self.gui = BackpackGUI() self.gui.createGUI()
def load(self): BookPage.load(self) # Let's load up the clouds. for pos, scale, hpr in self.cloudPos: cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) for pos, scale, hpr, hood in self.hoodClouds: if not base.localAvatar.hasDiscoveredHood( ZoneUtil.getZoneId(hood)): cloud = loader.loadModel('phase_3.5/models/gui/cloud.bam') cloud.reparentTo(self) cloud.setPos(pos) cloud.setScale(scale) cloud.setHpr(hpr) self.clouds.append(cloud) for pos, name in self.labelData: if base.localAvatar.hasDiscoveredHood(ZoneUtil.getZoneId(name)): text = name if base.localAvatar.hasTeleportAccess( ZoneUtil.getZoneId(name)): text = 'Go To\n' + text label = DirectButton( parent=self, relief=None, pos=pos, pad=(0.2, 0.16), text=('', text, text, ''), text_bg=Vec4(1, 1, 1, 0.4), text_scale=0.055, text_wordwrap=8, rolloverSound=CIGlobals.getRolloverSound(), clickSound=None, pressEffect=0, sortOrder=1, text_font=CIGlobals.getToonFont()) if base.localAvatar.hasTeleportAccess( ZoneUtil.getZoneId(name)): label['command'] = self.book.finished label['extraArgs'] = [ZoneUtil.getZoneId(name)] label.resetFrameSize() self.labels.append(label) currHoodName = base.cr.playGame.hood.id currLocation = '' if base.localAvatar.zoneId == ZoneUtil.MinigameAreaId or base.localAvatar.getBattleZone( ) is not None: currLocation = '' elif ZoneUtil.getWhereName(base.localAvatar.zoneId) == 'playground': currLocation = 'Playground' elif ZoneUtil.getWhereName( base.localAvatar.zoneId) in ['street', 'interior']: currLocation = ZoneUtil.BranchZone2StreetName[ ZoneUtil.getBranchZone(base.localAvatar.zoneId)] self.infoLabel = DirectLabel(relief=None, text='You are in: {0}\n{1}'.format( currHoodName, currLocation), scale=0.06, pos=(-0.4, 0, -0.74), parent=self, text_align=TextNode.ACenter) if currHoodName in [ZoneUtil.MinigameArea, ZoneUtil.BattleTTC]: currHoodName = base.cr.playGame.lastHood btpText = 'Back to Playground' btpEA = [ZoneUtil.getZoneId(currHoodName)] self.BTPButton = DirectButton(relief=None, text=btpText, geom=CIGlobals.getDefaultBtnGeom(), text_pos=(0, -0.018), geom_scale=(1.3, 1.11, 1.11), text_scale=0.06, parent=self, text_font=CIGlobals.getToonFont(), pos=(0.25, 0, -0.75), command=self.book.finished, extraArgs=btpEA, scale=0.7) icons = loader.loadModel('phase_3.5/models/gui/sos_textures.bam') self.icon = icons.find('**/teleportIcon') icons.detachNode()
def exit(self): if self.gui: self.gui.deleteGUI() self.gui = None BookPage.exit(self)