Add opcodes for new looks reporters with menu for costume number/name

This commit is contained in:
Paul Kaplan 2018-01-04 10:04:54 -05:00
parent 4fd7ba896a
commit d6f1c48c08

View file

@ -236,9 +236,8 @@ class Scratch3LooksBlocks {
looks_gotofrontback: this.goToFrontBack,
looks_goforwardbackwardlayers: this.goForwardBackwardLayers,
looks_size: this.getSize,
looks_costumeorder: this.getCostumeIndex,
looks_backdroporder: this.getBackdropIndex,
looks_backdropname: this.getBackdropName
looks_costumenumbername: this.getCostumeNumberName,
looks_backdropnumbername: this.getBackdropNumberName
};
}
@ -433,18 +432,21 @@ class Scratch3LooksBlocks {
return Math.round(util.target.size);
}
getBackdropIndex () {
const stage = this.runtime.getTargetForStage();
return stage.currentCostume + 1;
}
getBackdropName () {
getBackdropNumberName (args) {
const stage = this.runtime.getTargetForStage();
if (args.NUMBER_NAME === 'number') {
return stage.currentCostume + 1;
}
// Else return name
return stage.sprite.costumes[stage.currentCostume].name;
}
getCostumeIndex (args, util) {
return util.target.currentCostume + 1;
getCostumeNumberName (args, util) {
if (args.NUMBER_NAME === 'number') {
return util.target.currentCostume + 1;
}
// Else return name
return util.target.sprite.costumes[util.target.currentCostume].name;
}
}