Created
January 14, 2014 12:40
-
-
Save Rukia3d/8417692 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function loadScene(event){ | |
event.preventDefault(); | |
currentScene = sceneId; | |
var element = $(event.target); | |
var sceneId = element.data('targetScene'); | |
var scene_html = JST['views/'+sceneId+'.hbs'](); | |
var menu_html = JST['views/mainQmenu.hbs'](); | |
$('body').html(scene_html); | |
$('body').prepend(menu_html); | |
initWidgets($('#mainQmenu')); | |
showDirectionFromScene(scenes[sceneId].directions); | |
showSceneName(scenes[sceneId].name); | |
} | |
function showDirectionFromScene(array){ | |
var name; | |
for(var i=0; i<array.length; i++){ | |
name = "direction"+"_"+i; | |
var element = $("#"+name); | |
if(array[i]!=0){ | |
element.show(); | |
element.data('targetScene', array[i]); | |
element.on('click', loadScene); | |
} | |
else{ | |
element.hide(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment