Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoemBot][HOC] Validation Code #42243

Merged
merged 5 commits into from Aug 31, 2021
Merged

[PoemBot][HOC] Validation Code #42243

merged 5 commits into from Aug 31, 2021

Conversation

ajpal
Copy link
Contributor

@ajpal ajpal commented Aug 29, 2021

First few levels of validation code. Technically the level validation code could be written directly on Levelbuilder, but I did it on localhost so that I could add translation strings and library hooks at the same time.
I added screenshots of the validation code for each level since the string diff is hard to review.

With editing levels on localhost, there's potential for merge conflicts with the DTL, but if they come up, they should be easy to resolve since Amy is not editing the validation_code field on these levels.

@ajpal ajpal requested a review from a team as a code owner August 29, 2021 05:03
@@ -36,7 +36,8 @@
"hide_pause_button": "false",
"instructions_icon": "poet",
"callout_json": "[\r\n {\r\n \"localization_key\": \"poetry_background\",\r\n \"callout_text\": \"Find code blocks here. \",\r\n \"element_id\": \"[id=':1.label']\",\r\n \"on\": \"\",\r\n \"qtip_config\": {\r\n \"codeStudio\": {\r\n \"canReappear\": false,\r\n \"dropletPaletteCategory\": \"\"\r\n },\r\n \"style\": {\r\n \"classes\": \"\"\r\n },\r\n \"position\": {\r\n \"my\": \"left center\",\r\n \"at\": \"right center\",\r\n \"adjust\": {\r\n \"x\": 0,\r\n \"y\": 0\r\n }\r\n }\r\n }\r\n }\r\n]",
"preload_asset_list": null
"preload_asset_list": null,
"validation_code": "var validationInfo = getValidationInfo();\r\nif (validationInfo.backgroundEffect) {\r\n setSuccessFrame();\r\n}\r\ndrawProgressBar();\r\nif (World.frameCount == validationInfo.endTime) {\r\n if (validationInfo.successFrame) {\r\n levelFailure(0, 'genericSuccess');\r\n } else {\r\n levelFailure(3, 'poemBotMakeBackground');\r\n }\r\n}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@@ -36,7 +36,8 @@
"instructions_icon": "poet",
"callout_json": "[]",
"parent_level_id": 29611,
"preload_asset_list": null
"preload_asset_list": null,
"validation_code": "var validationInfo = getValidationInfo();\r\nif (validationInfo.foregroundEffect) {\r\n setSuccessFrame();\r\n}\r\ndrawProgressBar();\r\nif (World.frameCount == validationInfo.endTime) {\r\n if (validationInfo.successFrame) {\r\n levelFailure(0, 'genericSuccess');\r\n } else {\r\n levelFailure(3, 'poemBotMakeForeground');\r\n }\r\n}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@@ -40,6 +40,7 @@
"encrypted_examples": [

],
"validation_code": "var validationInfo = getValidationInfo();\r\nvar spriteIds = getSpriteIdsInUse();\r\n\r\nif (spriteIds.length > 0) {\r\n setSuccessFrame();\r\n}\r\ndrawProgressBar();\r\nif (World.frameCount == validationInfo.endTime) {\r\n if (validationInfo.successFrame) {\r\n levelFailure(0, 'genericSuccess');\r\n } else {\r\n levelFailure(3, 'noSprites');\r\n }\r\n}",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@@ -39,7 +39,8 @@
"preload_asset_list": null,
"encrypted_examples": [

]
],
"validation_code": "var validationInfo = getValidationInfo();\r\nvar spriteIds = getSpriteIdsInUse();\r\n\r\nfor (var i = 0; i < spriteIds.length; i++) {\r\n if (getProp({id: spriteIds[i]}, \"scale\") !== 100) {\r\n setSuccessFrame();\r\n }\r\n}\r\n\r\ndrawProgressBar();\r\nif (World.frameCount == validationInfo.endTime) {\r\n if (validationInfo.successFrame) {\r\n levelFailure(0, 'genericSuccess');\r\n } else if (spriteIds.length == 0) {\r\n levelFailure(3, 'poemBotRemovedSprite');\r\n } else {\r\n levelFailure(3, 'poemBotSetSize');\r\n }\r\n}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@ajpal ajpal requested a review from a team August 31, 2021 16:08
Copy link

@epeach epeach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - thanks for adding the screenshots - made it a lot easier to review!

@ajpal ajpal merged commit 4544a05 into staging Aug 31, 2021
@ajpal ajpal deleted the aug28-validation branch August 31, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants