'From Squeak3.10.2 of ''5 June 2008'' [latest update: #7179] on 25 November 2009 at 8:19:39 pm'! MorphicProject subclass: #GamesProject instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Projects-Extras'! !GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:08'! initialize "Make sure games are loaded, then set things up." self install ifFalse:[^nil]. "install failed" super initialize. "default Morphic setup" "Now the good stuff. This really should be handled by MorphicGamesInfo. So check if it knows how to set up a project and if so, let it take care of things." (Smalltalk classNamed: #MorphicGamesinfo) ifNotNil:[:pkgInfo| (pkgInfo canUnderstand: #setupProject:) ifTrue:[ pkgInfo setupProject: self. ^self]]. self setupProject: self. ! ! !GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:19'! install "Ensure MorphicGames are installed" (MCWorkingCopy allManagers anySatisfy:[:mcw| mcw packageName = 'MorphicGames']) ifTrue:[^true]. (UIManager default confirm: 'Morphic Games are not present. Download and install them now? (Requires Internet access)') ifFalse:[^false]. ['Installing Morphic Games' displayProgressAt: Sensor cursorPoint from: 0 to: 1 during:[:bar| (Installer repository: 'http://www.squeaksource.com/Ladrillos') install: 'MorphicGames']. ] on: Error do:[:ex| self inform: 'Failed to load Morphic Games:\' withCRs, ex description. ^false ]. UIManager default inform: 'Morphic Games have been installed. We recommended saving the image to avoid repeated installation.'. ^true ! ! !GamesProject methodsFor: 'initialize' stamp: 'ar 11/25/2009 20:09'! setupProject: aProject "Set up a new Games Project" | top quadList button | top := 32. quadList := OrderedCollection new. #(AtomicGame ChessMorph ChineseCheckers CipherPanel CrosticPanel FreeCell Mines SameGame Tetris) do:[:each| (Smalltalk classNamed: each) ifNotNil:[:gameClass| gameClass addPartsDescriptorQuadsTo: quadList if:[:d| true]]]. quadList do:[:quad| button := IconicButton new initializeWithThumbnail: (PartsBin thumbnailForQuad: quad color: Color white) withLabel: quad third andColor: Color white andSend: quad second to: (Smalltalk at: quad first). (quad size > 3 and: [quad fourth isEmptyOrNil not]) ifTrue: [button setBalloonText: quad fourth]. button position: 40 - (button fullBounds width // 2) @ top. aProject world addMorphBack: button. top := top + button height + 20].! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! GamesProject class instanceVariableNames: ''! !GamesProject class methodsFor: 'class initialization' stamp: 'ar 11/25/2009 19:13'! initialize "We should fix this, TheMainWorldDockingBar should pick up new projects automatically" TheWorldMainDockingBar updateInstances. ! ! GamesProject initialize!