-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35089 from code-dot-org/playlab-edit
Levelbuilder Clean Up: Playlab edit
- Loading branch information
Showing
6 changed files
with
66 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
//CS in A stuff | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :use_contract_editor, description: "Use MSM contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :default_num_example_blocks, description: "Default # of example blocks in contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :disable_examples, description: "Hide examples section in contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :examples_required, description: "Each function must have at least 1 example, and examples will be checked when hitting run"} | ||
%table.contract-editor-config | ||
%tr | ||
%th Section | ||
%th Highlight | ||
%th Collapse | ||
-%w(contract examples definition).each_with_index do |section, i| | ||
%tr | ||
%td #{i + 1}. #{section.titleize} | ||
%td= boolean_check_box f, "#{section}_highlight".to_sym | ||
%td= boolean_check_box f, "#{section}_collapse".to_sym | ||
%div.collapsed_area_header{data: {toggle: "collapse", target: "#cs_in_a"}} | ||
CS in A Options | ||
.collapse{id: "cs_in_a"} | ||
- if @level.respond_to? :coordinate_grid_background | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :coordinate_grid_background, description: "Coordinate grid background"} | ||
|
||
-if @level.respond_to? :input_output_table | ||
.field | ||
= f.label :input_output_table, 'Input/Output Table' | ||
%p An array of tuples where each tuple is [input, output]. | ||
%p i.e. The table for f(x) = x - 5 might look like: [ [15, 10], [10, 5], [25, 20] ] | ||
= f.text_area :input_output_table, placeholder: 'Input/Output', rows: 4, value: @level.input_output_table | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :use_contract_editor, description: "Use MSM contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :default_num_example_blocks, description: "Default # of example blocks in contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :disable_examples, description: "Hide examples section in contract editor"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :examples_required, description: "Each function must have at least 1 example, and examples will be checked when hitting run"} | ||
%table.contract-editor-config | ||
%tr | ||
%th Section | ||
%th Highlight | ||
%th Collapse | ||
-%w(contract examples definition).each_with_index do |section, i| | ||
%tr | ||
%td #{i + 1}. #{section.titleize} | ||
%td= boolean_check_box f, "#{section}_highlight".to_sym | ||
%td= boolean_check_box f, "#{section}_collapse".to_sym | ||
|
||
-if @level.respond_to? :input_output_table | ||
.field | ||
= f.label :input_output_table, 'Input/Output Table' | ||
%p An array of tuples where each tuple is [input, output]. | ||
%p i.e. The table for f(x) = x - 5 might look like: [ [15, 10], [10, 5], [25, 20] ] | ||
= f.text_area :input_output_table, placeholder: 'Input/Output', rows: 4, value: @level.input_output_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,33 @@ | ||
- content_for(:head) do | ||
%script{src: webpack_asset_path('js/levels/editors/_studio.js')} | ||
|
||
.field | ||
= render partial: 'levels/editors/fields/encrypted_examples', locals: {f: f, level_type: 'playlab'} | ||
= render partial: 'levels/editors/fields/control_buttons', locals: {f: f} | ||
|
||
.field | ||
= f.label :custom_game_type, 'Custom game type' | ||
%p Used to tell playlab we want to run some of our custom onTick logic. | ||
= f.select :custom_game_type, options_for_select(["", "Big Game", "Rocket Height", "Sam the Bat", "Ninja Cat"], @level.custom_game_type) | ||
.field | ||
= f.label :background, 'Default background' | ||
= f.text_field :background | ||
|
||
%legend.control-legend.collapsed{data: {toggle: "collapse", target: "#sprites-and-collisions"}} | ||
Sprites and Collisions | ||
#sprites-and-collisions.in.collapse | ||
= f.label :first_sprite_index, 'First sprite index' | ||
%p Integer representing which sprite to use for the first character. Default is 0. | ||
= f.number_field :first_sprite_index | ||
.field | ||
= f.label :protaganist_sprite_index, 'Protaganist sprite index' | ||
%p Integer of the protaganist character (zero indexed, counting from the top left of the grid). This character must touch all the waypoint flags to complete the level. If no value is set, all sprites can collect flags. | ||
= f.number_field :protaganist_sprite_index | ||
.field | ||
= f.label :timeout_failure_tick, 'Timeout failure tick' | ||
%p Number of 'ticks' to simulate before marking the level as failed. Default is unlimited. Step speed (above) controls the length of a tick. | ||
= f.number_field :timeout_failure_tick | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :timeout_after_when_run, description: "Timeout after all blocks run"} | ||
%p When set, if the only event block that had children is when_run, and those commands are finished executing, don't wait for the timeout. If we have additional event blocks that DO have children, we keeping running until timeoutFailureTick or a success/failure condition is met | ||
.field | ||
= f.label :custom_game_type, 'Custom game type' | ||
%p Used to tell playlab we want to run some of our custom onTick logic. | ||
= f.select :custom_game_type, options_for_select(["", "Big Game", "Rocket Height", "Sam the Bat", "Ninja Cat"], @level.custom_game_type) | ||
.field | ||
= f.label :success_condition, 'Success condition' | ||
%p Optional JavaScript function to run every tick. If the function ever return true, the level immediately succeeds. | ||
= f.text_area :success_condition, rows: 4 | ||
.field | ||
= f.label :failure_condition, 'Failure condition' | ||
%p Optional JavaScript function to run every tick. If the function ever return true, the level immediately fails. | ||
= f.text_area :failure_condition, rows: 4 | ||
.field | ||
= f.label :soft_buttons, 'Controls buttons' | ||
%p | ||
Select | ||
%a.select_all{href: '#'} all | ||
\/ | ||
%a.select_none{href: '#'} none | ||
(shift-click or cmd-click to select multiple). Arrow buttons to display below the game canvas. | ||
= f.collection_select :soft_buttons, soft_button_options, :value, :name, {selected: @level.soft_buttons}, {multiple: true} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :edge_collisions, description: "Edge collisions"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :projectile_collisions, description: "Projectile collisions"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :allow_sprites_outside_playspace, description: "Allow sprites outside playspace"} | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :sprites_hidden_to_start, description: "Sprites hidden to start"} | ||
.field | ||
= f.label :remove_items_when_actor_collides, 'Remove an item (e.g. a stormtrooper) when the actor collides with it' | ||
= boolean_check_box f, :remove_items_when_actor_collides | ||
.field | ||
= f.label :background, 'Default background' | ||
= f.text_field :background | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :remove_items_when_actor_collides, description: "Remove an item (e.g. a stormtrooper) when the actor collides with it"} | ||
%div.collapsed_area_header{data: {toggle: "collapse", target: "#cs_in_a"}} | ||
CS in A Options | ||
.collapse{id: "cs_in_a"} | ||
= render partial: 'levels/editors/cs_in_a', locals: {f: f} | ||
= render partial: 'levels/editors/cs_in_a', locals: {f: f} |
15 changes: 15 additions & 0 deletions
15
dashboard/app/views/levels/editors/fields/_studio_validations.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.field | ||
= f.label :timeout_failure_tick, 'Timeout failure tick' | ||
%p Number of 'ticks' to simulate before marking the level as failed. Default is unlimited. Step speed (above) controls the length of a tick. | ||
= f.number_field :timeout_failure_tick | ||
.field | ||
= render partial: 'levels/editors/fields/checkboxes', locals: {f: f, field_name: :timeout_after_when_run, description: "Timeout after all blocks run"} | ||
%p When set, if the only event block that had children is when_run, and those commands are finished executing, don't wait for the timeout. If we have additional event blocks that DO have children, we keeping running until timeoutFailureTick or a success/failure condition is met | ||
.field | ||
= f.label :success_condition, 'Success condition' | ||
%p Optional JavaScript function to run every tick. If the function ever return true, the level immediately succeeds. | ||
= f.text_area :success_condition, rows: 4 | ||
.field | ||
= f.label :failure_condition, 'Failure condition' | ||
%p Optional JavaScript function to run every tick. If the function ever return true, the level immediately fails. | ||
= f.text_area :failure_condition, rows: 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters