!function(){var t={fast:.01,quickly:.06,general:.02,slower:.16,slow:.18};window.QyText=function(t){t||(t={});t.font||(t.font={});t.text||(t.text={});this.textSpeed=t.check?t.speed:void 0;delete t.speed;try{t.anchorPoint={x:0,y:0};QyObject.call(this,t);this.currentSprite=new PIXI.Text("");this.currentSprite.setAnchorPoint(t.anchorPoint.x,t.anchorPoint.y);var e=t.font;this.currentSprite.setStyle(getStyleFromFont(e));this.setupHammer();this.currentSprite.qyobj=this;var i=qyboot.getDefaultLocaleName();this.text=void 0===t.text[i]?"":t.text[i];t.position&&this.currentSprite.setPosition(t.position.x,t.position.y);t.size&&this.currentSprite.setSize(t.size.width,t.size.height);t.rotation&&this.currentSprite.setRotation(t.rotation);var r=t.position;t.position=null;this.origSize=t.size;t.position=r;t.hiddenAtStart&&this.hide()}catch(n){console.log(n)}};inherits(QyText,QyObject);QyText.prototype.setText=function(t){void 0===t&&(t="");"string"!=typeof t&&(t=JSON.stringify(t));this.currentSprite&&(this.currentSprite.text="");this._text=t+"";this.delays=this.getDelay();this.playing=!1;this.clearAllToCall();this.showTextBySpeed()};QyText.prototype.getText=function(){return this._text};QyText.prototype.addText=function(t){this._text+=t;this.delays=this.getDelay();this.showTextBySpeed()};QyText.prototype.setFontColor=function(t){if(this.currentSprite){var e=this.currentSprite.style;e.fill=t;this.currentSprite.setStyle(e)}};QyText.prototype.setFontSize=function(t){if(this.currentSprite){for(var e=this.currentSprite.style,i=e.font,r=i.split(" "),n=0,s=r.length;s>n;n++)(r[n].indexOf("px")>-1||r[n].indexOf("pt")>-1)&&(r[n]=t+"px");e.font=r.join(" ");this.currentSprite.setStyle(e)}};QyText.prototype.setFontFamily=function(t){if(this.currentSprite){var e=this.currentSprite.style,i=e.font,r=i.split(" ");r.pop();r.push(t);e.font=r.join(" ");this.currentSprite.setStyle(e)}};QyText.prototype.setStyle=function(t){this.currentSprite&&this.currentSprite.setStyle(t)};QyText.prototype.showTextBySpeed=function(){if(this.currentSprite&&!this.playing){var t=this.getFullText();if(void 0!==this.textSpeed){var e=this.currentSprite.getText()||"";if(t.indexOf(e)<0){this.currentSprite&&(this.currentSprite.text="");e=""}if(e!==t){this.playing=!0;var i=this.delays||this.getDelay(),r=0,n=e.length,s=i[n];r+=s;this.toCall=qyengine.callAfter(function(){if(this.currentSprite){var t=this.currentSprite.getText()||"",e=this.getFullText();t+=e[t.length];this.currentSprite.setText(t);this.playing=!1;t!==e&&this.showTextBySpeed()}}.bind(this),this,1e3*s)}else{this.playing=!1;this.currentSprite.setText(t)}}else this.currentSprite.setText(t)}};QyText.prototype.getFullText=function(){return this._text&&this._text.replace(/[<][p][\d+\.?\d*$]{1,}[>]/g,"")||""};QyText.prototype.getDelay=function(e){e=e||this._text;for(var i,r,n=t[this.textSpeed||"general"],s=[],o=0;e.length>0;o++){void 0===s[o]&&(s[o]=n);i=e.match(/^[<][p][\d+\.?\d*$]{1,}[>]/);if(i&&i.length){r=i[0].match(/[\d+\.?\d*$]{1,}/)[0]-0;s[o]+=r;e=e.replace(i[0],"");o--}else e=e.replace(e[0],"")}return s};QyText.prototype.clearAllToCall=function(){void 0!==this.toCall&&qyengine.unscheduleTask(this.toCall);delete this.toCall};QyText.prototype.isTextPlaying=function(){return!!this.playing}}();