2017-07-24 20:56:59 +00:00
|
|
|
var slideshow, slideSelect;
|
|
|
|
window.onload = function(){
|
|
|
|
|
|
|
|
// PRELOADER
|
|
|
|
Q.all([
|
|
|
|
Loader.loadAssets(Loader.manifestPreload),
|
2017-07-25 18:52:06 +00:00
|
|
|
Words.convert("words.html")
|
2017-07-24 20:56:59 +00:00
|
|
|
]).then(function(){
|
|
|
|
|
|
|
|
// CHANGE DOM
|
|
|
|
document.body.removeChild($("#preloader"));
|
|
|
|
$("#main").style.display = "block";
|
|
|
|
$("#footer").style.display = "block";
|
|
|
|
|
|
|
|
// Slideshow
|
|
|
|
slideshow = new Slideshow({
|
|
|
|
dom: $("#slideshow"),
|
|
|
|
slides: SLIDES
|
|
|
|
});
|
|
|
|
|
|
|
|
// Slide Select
|
|
|
|
slideSelect = new SlideSelect({
|
|
|
|
dom: $("#select"),
|
|
|
|
slides: SLIDES
|
|
|
|
});
|
|
|
|
slideSelect.dom.style.display = "none";
|
|
|
|
subscribe("start/game", function(){
|
|
|
|
slideSelect.dom.style.display = "block";
|
|
|
|
|
|
|
|
// [FOR DEBUGGING]
|
|
|
|
publish("slideshow/next");
|
2017-07-25 18:52:06 +00:00
|
|
|
//publish("slideshow/scratch", ["credits"]);
|
2017-07-24 20:56:59 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// SOUND
|
|
|
|
var _soundIsOn = true;
|
|
|
|
$("#sound").onclick = function(){
|
|
|
|
_soundIsOn = !_soundIsOn;
|
|
|
|
Howler.mute(!_soundIsOn);
|
|
|
|
$("#sound").setAttribute("sound", _soundIsOn?"on":"off");
|
|
|
|
};
|
|
|
|
|
|
|
|
// LOAD REAL THINGS
|
|
|
|
Loader.loadAssets(
|
|
|
|
Loader.manifest,
|
|
|
|
function(){
|
|
|
|
publish("preloader/done");
|
|
|
|
},
|
|
|
|
function(ratio){
|
|
|
|
publish("preloader/progress", [ratio]);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// First slide!
|
|
|
|
slideshow.nextSlide();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|