phaser3-rex-plugins
Version:
2 lines (1 loc) • 3.82 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexxorplugin=e();}(undefined,(function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(o=n.key,i=void 0,"symbol"==typeof(i=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(o,"string"))?i:String(i)),n);}var o,i;}function e(t){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},e(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}function n(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function o(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return !1}}();return function(){var o,i=e(t);if(r){var u=e(this).constructor;o=Reflect.construct(i,arguments,u);}else o=i.apply(this,arguments);return n(this,o)}}var i={Encrypt:function(t,e){return function(t,e){if(null==e||e.length<=0)return null;for(var r="",n=0;n<e.length;n++)r+=e.charCodeAt(n).toString();var o=Math.floor(r.length/5),i=parseInt(r.charAt(o)+r.charAt(2*o)+r.charAt(3*o)+r.charAt(4*o)+r.charAt(5*o)),u=Math.ceil(e.length/2),a=Math.pow(2,31)-1;if(i<2)return null;var c=Math.round(1e9*Math.random())%1e8;for(r+=c;r.length>10;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(i*r+u)%a;var f="",l="";for(n=0;n<t.length;n++)l+=(f=parseInt(t.charCodeAt(n)^Math.floor(r/a*255)))<16?"0"+f.toString(16):f.toString(16),r=(i*r+u)%a;for(c=c.toString(16);c.length<8;)c=0+c;return l+c}(t=escape(t),e=escape(e.toString()))},Decrypt:function(t,e){var r=function(t,e){if(null==t||t.length<8)return null;if(!(null==e||e.length<=0)){for(var r="",n=0;n<e.length;n++)r+=e.charCodeAt(n).toString();var o=Math.floor(r.length/5),i=parseInt(r.charAt(o)+r.charAt(2*o)+r.charAt(3*o)+r.charAt(4*o)+r.charAt(5*o)),u=Math.round(e.length/2),a=Math.pow(2,31)-1,c=parseInt(t.substring(t.length-8,t.length),16);for(t=t.substring(0,t.length-8),r+=c;r.length>10;)r=(parseInt(r.substring(0,10))+parseInt(r.substring(10,r.length))).toString();r=(i*r+u)%a;var f="",l="";for(n=0;n<t.length;n+=2)f=parseInt(parseInt(t.substring(n,n+2),16)^Math.floor(r/a*255)),l+=String.fromCharCode(f),r=(i*r+u)%a;return l}}(t,e=escape(e.toString()));return null!=r&&(r=unescape(r)),r}},u=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&r(t,e);}(c,Phaser.Plugins.BasePlugin);var n,i,a=o(c);function c(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),a.call(this,t)}return n=c,(i=[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}}])&&t(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),c}();return Object.assign(u.prototype,i),u}));