[Pkg] The Trunk: EToys-ul.470.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 31 15:03:00 UTC 2022
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.470.mcz
==================== Summary ====================
Name: EToys-ul.470
Author: ul
Time: 31 March 2022, 5:02:53.124672 pm
UUID: d3d57031-36b6-418b-8621-6e5802429be6
Ancestors: EToys-ct.469
- use Symbol class >> #lookup: instead of #hasInterned:ifTrue:
- use #includesSubstring: instead of the deprecated #includesSubString:
=============== Diff against EToys-ct.469 ===============
Item was changed:
----- Method: Player>>changeScript:toStatus: (in category 'scripts-standard') -----
changeScript: scriptName toStatus: statusSymbol
"Change the script of the given name to have the given status, and get all relevant script-status controls updated"
scriptName ifNil: [^ self].
+ (Symbol lookup: scriptName) ifNotNil:
- Symbol hasInterned: scriptName ifTrue:
[:sym | self instantiatedUserScriptsDo:
[:aScriptInstantiation | aScriptInstantiation selector == sym
ifTrue:
[aScriptInstantiation status: statusSymbol.
aScriptInstantiation updateAllStatusMorphs]]]!
Item was changed:
----- Method: Player>>doScript: (in category 'scripts-standard') -----
doScript: scriptNameString
"On the next tick of the clock, run the given script once"
+ (Symbol lookup: scriptNameString) ifNotNil:
- Symbol hasInterned: scriptNameString ifTrue:
[:sym | (self class includesSelector: sym) ifTrue:
[costume addAlarm: #triggerScript: with: sym after: 1]]!
Item was changed:
----- Method: Player>>existingScriptInstantiationForSelector: (in category 'customevents-scripts-kernel') -----
existingScriptInstantiationForSelector: scriptName
"Answer the existing script instantiation for the given selector, or nil if none"
scriptName ifNil: [^ nil].
+ ^(Symbol lookup: scriptName) ifNotNil: [ :sym |
+ self costume actorStateOrNil ifNotNil: [ :actorState |
+ actorState instantiatedUserScriptsDictionary at: sym ifAbsent: [nil]]]!
- Symbol hasInterned: scriptName
- ifTrue: [ :sym |
- self costume actorStateOrNil ifNotNil: [ :actorState |
- ^actorState instantiatedUserScriptsDictionary at: sym ifAbsent: [nil]]].
- ^ nil!
Item was changed:
----- Method: Player>>performScriptIfCan: (in category 'scripts-standard') -----
performScriptIfCan: scriptNameString
"If I understand the given script name, perform it now"
+
+ (Symbol lookup: scriptNameString)
+ ifNotNil: [:sym | (self class includesSelector: sym)
- ^Symbol
- hasInterned: scriptNameString
- ifTrue: [:sym | (self class includesSelector: sym)
ifTrue: [self triggerScript: sym]]!
Item was changed:
----- Method: Player>>tellAllSiblings: (in category 'scripts-standard') -----
tellAllSiblings: aMessageSelector
"Send the given message selector to all my sibling instances, but not to myself"
+ (Symbol lookup: aMessageSelector)
+ ifNotNil: [ :sel |
+ self belongsToUniClass
+ ifTrue: [self class allSubInstancesDo:
+ [:anInstance |
+ anInstance isInTrash ifFalse: [
+ anInstance ~~ self ifTrue: [ anInstance triggerScript: sel ]]]]
+ ifFalse: [(sel ~~ #emptyScript) ifTrue:
+ [ScriptingSystem reportToUser: ('Cannot "tell " ' translated, aMessageSelector, ' to ' translated, self externalName) ]]]!
- Symbol hasInterned: aMessageSelector
- ifTrue: [ :sel |
- self belongsToUniClass
- ifTrue: [self class allSubInstancesDo:
- [:anInstance |
- anInstance isInTrash ifFalse: [
- anInstance ~~ self ifTrue: [ anInstance triggerScript: sel ]]]]
- ifFalse: [(sel ~~ #emptyScript) ifTrue:
- [ScriptingSystem reportToUser: ('Cannot "tell " ' translated, aMessageSelector, ' to ' translated, self externalName) ]]]!
Item was changed:
----- Method: Player>>tellSelfAndAllSiblings: (in category 'scripts-standard') -----
tellSelfAndAllSiblings: aMessageSelector
"Send the given message selector to all my sibling instances, including myself"
+ (Symbol lookup: aMessageSelector) ifNotNil: [ :selectorSymbol |
+ self belongsToUniClass
+ ifTrue: [self class allSubInstancesDo:
+ [:anInstance |
+ anInstance isInTrash ifFalse: [
+ (anInstance respondsTo: selectorSymbol) ifTrue:
+ [anInstance triggerScript: selectorSymbol ]]]]
+ ifFalse: [(selectorSymbol ~~ #emptyScript) ifTrue:
- Symbol hasInterned: aMessageSelector
- ifTrue: [ :sel |
- self belongsToUniClass
- ifTrue: [self class allSubInstancesDo:
- [:anInstance |
- anInstance isInTrash ifFalse: [
- (anInstance respondsTo: sel) ifTrue:
- [anInstance triggerScript: sel ]]]]
- ifFalse: [(sel ~~ #emptyScript) ifTrue:
[ScriptingSystem reportToUser: ('Cannot "tell " ' translated, aMessageSelector, ' to ' translated, self externalName) ]]]!
Item was changed:
----- Method: SoundLibraryTool>>listing (in category 'initialization') -----
listing
| list newList format soundData selectorList formatList |
list := SampledSound soundLibrary keys sort.
selectorList := OrderedCollection new.
formatList := OrderedCollection new.
list
do: [:each |
soundData := (SampledSound soundLibrary at: each) second.
soundData isNumber
ifTrue: [format := 'uncompressed']
+ ifFalse: [(soundData includesSubstring: 'Vorbis')
- ifFalse: [(soundData includesSubString: 'Vorbis')
ifTrue: [format := 'Vorbis']
+ ifFalse: [(soundData includesSubstring: 'Speex')
- ifFalse: [(soundData includesSubString: 'Speex')
ifTrue: [format := 'Speex']
ifFalse: [(soundData includesSubstring: 'GSM')
ifTrue: [format := 'GSM']]]].
selectorList add: each.
formatList add: format].
newList := OrderedCollection new.
newList add: selectorList asArray.
showCompression
ifTrue:[newList add: formatList asArray]
ifFalse:[newList add: (Array new: (formatList size) withAll:' ')].
^newList!
More information about the Packages
mailing list