// validateAssets.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Game.prototype;
/**
* Validate all assets in world.
* @method adventurejs.Game#validateAssets
* @memberOf adventurejs.Game
*/
p.validateAssets = function Game_validateAssets() {
for (var prop in this.world) {
if ("_" === prop.charAt(0)) {
// we use _underscore to store vars in the world object for save/restore
continue;
}
// explicitly testing for false here because some
// asset classes may return undefined and that's ok
if (false === this.world[prop].validate(this)) {
return false;
} else {
this.world[prop].is.validated = true;
var msg =
"Validated " +
this.world[prop].constructor.name +
" " +
this.world[prop].name;
this.game.log("log", 3, msg, "Game");
}
}
return true;
};
})();