Skip to content

Commit ae3159e

Browse files
committed
- Hack-y tricks to support voxel.js in dashboard
- Increase default level height
1 parent 806bbe8 commit ae3159e

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

blockly/src/minecraft/levels.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
),
2929
startBlocks: '',
3030
requiredBlocks: '',
31+
minWorkspaceHeight: 1800,
3132
freePlay: false
3233
},
3334
// Level builder defaults

dashboard/app/assets/stylesheets/level.css.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@
3232
display: block;
3333
content: '';
3434
}
35+
36+
// Voxel game
37+
#container {
38+
width: 100%;
39+
height: 100%;
40+
min-width: 400px;
41+
min-height: 400px;
42+
}

dashboard/app/models/game.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def self.custom_maze
2121
ARTIST = TURTLE = 'turtle' # heh
2222
FLAPPY = 'flappy'
2323
BOUNCE = 'bounce'
24+
MINECRAFT = 'minecraft'
2425
PLAYLAB = STUDIO = 'studio'
2526

2627
def self.custom_studio
@@ -51,6 +52,10 @@ def match?
5152
app == MATCH
5253
end
5354

55+
def minecraft?
56+
app == MINECRAFT
57+
end
58+
5459
def supports_sharing?
5560
app == TURTLE || app == FLAPPY || app == BOUNCE || app == STUDIO
5661
end

dashboard/app/views/levels/_blockly.html.haml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
- embed = local[:embed] || @embed
66
- level['showFinish'] = local[:embed]
77

8+
- if @game.minecraft?
9+
#container{width:"400", height:"400"}
10+
#crosshair
11+
%img{src:"https://s3.amazonaws.com/cdo-dist/cdo-voxel/crosshair4.png"}
12+
13+
%script{type:"text/javascript", src:"https://s3.amazonaws.com/cdo-dist/cdo-voxel/bundlev2.js"}
14+
815
-if local[:embed]
916
#title
1017
%h4{style: 'margin-left: auto; margin-right: auto; max-width: 800px;'}!= level['instructions']

dashboard/config/routes.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
get 'apps', to: 'gallery_activities#index', app: Game::PLAYLAB
66
end
77
end
8+
9+
get '/s/minecraft/stage/1/puzzle/JehkobasFantasy_4.zip', to: redirect('/voxel_textures.zip')
10+
811
resources :activity_hints, only: [:update]
912
resources :callouts
1013
resources :videos do

0 commit comments

Comments
 (0)