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