!function(){var t=["create","destroy","outofscene","outofview","inscene","inview","collision","collisionend","enterobject","leaveobject","pathstart","pathend","pathpoint","movestart","moveend","timelinestart","timelinestop","keyframestart","keyframeend","animationstart","animationend","alarm","wakeup","sleep","message"];qyengine.EventsOnQyObj=t}();var QyObject=window.QyObject=cc.Class.extend({ctor:function(t){t||(t={});this._qyscene=t.sceneId?window[t.sceneId]:window.current_scene;this._qyscene.addInstance(this);t.sprite&&"no-sprite"!==t.sprite&&this.changeSprite(t.sprite,t)},changeSprite:function(t,e){t.classId&&(t=t.classId);if(this.spriteName===t)return this;this.spriteName=t;var i=qyengine.guardType(t);if(!i||this.insideChangeSprite)return this;this.insideChangeSprite=!0;if(this.currentSprite)this.currentSprite.fromJson(qyengine.merge(i.defaultOpt,e));else{e||(e={});e.bindObj=this;this.currentSprite=new i(e);this.currentSprite.bindObj=this}return this},initCollisionShape:function(t,e){for(var i=[],n=0;n<t[0].points.length;n++){i.push(t[0].points[n].x);i.push(t[0].points[n].y)}var s=this.body=new cp.Body(1,cp.momentForPoly(1,i,cc.p(0,0)));e.y=qyengine.winSize.height-e.y;s.setPos(e);current_game.space.addBody(s);var o=new cp.PolyShape(s,i,cc.p(0,0));o.setElasticity(.5);o.setFriction(.5);current_game.space.addShape(o);cc.director.getScheduler().scheduleCallbackForTarget(this,this.updateByBodyPos.bind(this),0,cc.REPEAT_FOREVER,1/60)},updateByBodyPos:function(){this.body.setPos(this.currentSprite.getPosition())},moveTo:function(t,e,i){i||(i=300);this.moveAction&&this.currentSprite.stopAction(this.moveAction);this.moveAction=cc.moveTo(cc.pDistance(this.getPosition(),cc.p(t,e))/i,cc.p(t,e));this.currentSprite.runAction(this.moveAction);return this},setPosition:function(t,e){this.currentSprite.setPosition(t,e)},getPosition:function(){return this.currentSprite.getPosition()},setSpeed:function(t,e){this.currentSprite.setSpeed(t,e)}});QyObject.prototype.setHidden=function(t){this.currentSprite&&this.currentSprite.setVisible(!t);this.setActive(!t);this.isHidden_=t;return this};QyObject.prototype.toggleHidden=function(){this.setHidden(!this.isHidden_)};QyObject.prototype.show=function(){this.setHidden(!1);return this};QyObject.prototype.hide=function(){this.setHidden(!0);return this};QyObject.prototype.selfListen=QyScene.prototype.selfListen;QyObject.prototype.objListen=QyScene.prototype.objListen;QyObject.prototype.spriteListen=QyScene.prototype.spriteListen;QyObject.prototype.dispatchEvent=QyScene.prototype.dispatchEvent;