code:
var LZString = {
  _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  _f: String.fromCharCode,
  compressToBase64: function (e) {
    if (e == null) return "";
    var t = "";
    var n, r, i, s, o, u, a;
    var f = 0;
    e = LZString.compress(e);
    while (f < e.length * 2) {
      if (f % 2 == 0) {
        n = e.charCodeAt(f / 2) >> 8;
        r = e.charCodeAt(f / 2) & 255;
        if (f / 2 + 1 < e.length) i = e.charCodeAt(f / 2 + 1) >> 8;
        else i = NaN;
      } else {
        n = e.charCodeAt((f - 1) / 2) & 255;
        if ((f + 1) / 2 < e.length) {
          r = e.charCodeAt((f + 1) / 2) >> 8;
          i = e.charCodeAt((f + 1) / 2) & 255;
        } else r = i = NaN;
      }
      f += 3;
      s = n >> 2;
      o = ((n & 3) << 4) | (r >> 4);
      u = ((r & 15) << 2) | (i >> 6);
      a = i & 63;
      if (isNaN(r)) {
        u = a = 64;
      } else if (isNaN(i)) {
        a = 64;
      }
      t =
        t +
        LZString._keyStr.charAt(s) +
        LZString._keyStr.charAt(o) +
        LZString._keyStr.charAt(u) +
        LZString._keyStr.charAt(a);
    }
    return t;
  },
  decompressFromBase64: function (e) {
    if (e == null) return "";
    var t = "",
      n = 0,
      r,
      i,
      s,
      o,
      u,
      a,
      f,
      l,
      c = 0,
      h = LZString._f;
    e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
    while (c < e.length) {
      u = LZString._keyStr.indexOf(e.charAt(c++));
      a = LZString._keyStr.indexOf(e.charAt(c++));
      f = LZString._keyStr.indexOf(e.charAt(c++));
      l = LZString._keyStr.indexOf(e.charAt(c++));
      i = (u << 2) | (a >> 4);
      s = ((a & 15) << 4) | (f >> 2);
      o = ((f & 3) << 6) | l;
      if (n % 2 == 0) {
        r = i << 8;
        if (f != 64) {
          t += h(r | s);
        }
        if (l != 64) {
          r = o << 8;
        }
      } else {
        t = t + h(r | i);
        if (f != 64) {
          r = s << 8;
        }
        if (l != 64) {
          t += h(r | o);
        }
      }
      n += 3;
    }
    return LZString.decompress(t);
  },
  compressToUTF16: function (e) {
    if (e == null) return "";
    var t = "",
      n,
      r,
      i,
      s = 0,
      o = LZString._f;
    e = LZString.compress(e);
    for (n = 0; n < e.length; n++) {
      r = e.charCodeAt(n);
      switch (s++) {
        case 0:
          t += o((r >> 1) + 32);
          i = (r & 1) << 14;
          break;
        case 1:
          t += o(i + (r >> 2) + 32);
          i = (r & 3) << 13;
          break;
        case 2:
          t += o(i + (r >> 3) + 32);
          i = (r & 7) << 12;
          break;
        case 3:
          t += o(i + (r >> 4) + 32);
          i = (r & 15) << 11;
          break;
        case 4:
          t += o(i + (r >> 5) + 32);
          i = (r & 31) << 10;
          break;
        case 5:
          t += o(i + (r >> 6) + 32);
          i = (r & 63) << 9;
          break;
        case 6:
          t += o(i + (r >> 7) + 32);
          i = (r & 127) << 8;
          break;
        case 7:
          t += o(i + (r >> 8) + 32);
          i = (r & 255) << 7;
          break;
        case 8:
          t += o(i + (r >> 9) + 32);
          i = (r & 511) << 6;
          break;
        case 9:
          t += o(i + (r >> 10) + 32);
          i = (r & 1023) << 5;
          break;
        case 10:
          t += o(i + (r >> 11) + 32);
          i = (r & 2047) << 4;
          break;
        case 11:
          t += o(i + (r >> 12) + 32);
          i = (r & 4095) << 3;
          break;
        case 12:
          t += o(i + (r >> 13) + 32);
          i = (r & 8191) << 2;
          break;
        case 13:
          t += o(i + (r >> 14) + 32);
          i = (r & 16383) << 1;
          break;
        case 14:
          t += o(i + (r >> 15) + 32, (r & 32767) + 32);
          s = 0;
          break;
      }
    }
    return t + o(i + 32);
  },
  decompressFromUTF16: function (e) {
    if (e == null) return "";
    var t = "",
      n,
      r,
      i = 0,
      s = 0,
      o = LZString._f;
    while (s < e.length) {
      r = e.charCodeAt(s) - 32;
      switch (i++) {
        case 0:
          n = r << 1;
          break;
        case 1:
          t += o(n | (r >> 14));
          n = (r & 16383) << 2;
          break;
        case 2:
          t += o(n | (r >> 13));
          n = (r & 8191) << 3;
          break;
        case 3:
          t += o(n | (r >> 12));
          n = (r & 4095) << 4;
          break;
        case 4:
          t += o(n | (r >> 11));
          n = (r & 2047) << 5;
          break;
        case 5:
          t += o(n | (r >> 10));
          n = (r & 1023) << 6;
          break;
        case 6:
          t += o(n | (r >> 9));
          n = (r & 511) << 7;
          break;
        case 7:
          t += o(n | (r >> 8));
          n = (r & 255) << 8;
          break;
        case 8:
          t += o(n | (r >> 7));
          n = (r & 127) << 9;
          break;
        case 9:
          t += o(n | (r >> 6));
          n = (r & 63) << 10;
          break;
        case 10:
          t += o(n | (r >> 5));
          n = (r & 31) << 11;
          break;
        case 11:
          t += o(n | (r >> 4));
          n = (r & 15) << 12;
          break;
        case 12:
          t += o(n | (r >> 3));
          n = (r & 7) << 13;
          break;
        case 13:
          t += o(n | (r >> 2));
          n = (r & 3) << 14;
          break;
        case 14:
          t += o(n | (r >> 1));
          n = (r & 1) << 15;
          break;
        case 15:
          t += o(n | r);
          i = 0;
          break;
      }
      s++;
    }
    return LZString.decompress(t);
  },
  compressToUint8Array: function (e) {
    var t = LZString.compress(e);
    var n = new Uint8Array(t.length * 2);
    for (var r = 0, i = t.length; r < i; r++) {
      var s = t.charCodeAt(r);
      n[r * 2] = s >>> 8;
      n[r * 2 + 1] = s % 256;
    }
    return n;
  },
  decompressFromUint8Array: function (e) {
    if (e === null || e === undefined) {
      return LZString.decompress(e);
    } else {
      var t = new Array(e.length / 2);
      for (var n = 0, r = t.length; n < r; n++) {
        t[n] = e[n * 2] * 256 + e[n * 2 + 1];
      }
      return LZString.decompress(String.fromCharCode.apply(null, t));
    }
  },
  compressToEncodedURIComponent: function (e) {
    return LZString.compressToBase64(e).replace(/=/g, "$").replace(/\//g, "-");
  },
  decompressFromEncodedURIComponent: function (e) {
    if (e) e = e.replace(/$/g, "=").replace(/-/g, "/");
    return LZString.decompressFromBase64(e);
  },
  compress: function (e) {
    if (e == null) return "";
    var t,
      n,
      r = {},
      i = {},
      s = "",
      o = "",
      u = "",
      a = 2,
      f = 3,
      l = 2,
      c = "",
      h = 0,
      p = 0,
      d,
      v = LZString._f;
    for (d = 0; d < e.length; d += 1) {
      s = e.charAt(d);
      if (!Object.prototype.hasOwnProperty.call(r, s)) {
        r[s] = f++;
        i[s] = true;
      }
      o = u + s;
      if (Object.prototype.hasOwnProperty.call(r, o)) {
        u = o;
      } else {
        if (Object.prototype.hasOwnProperty.call(i, u)) {
          if (u.charCodeAt(0) < 256) {
            for (t = 0; t < l; t++) {
              h = h << 1;
              if (p == 15) {
                p = 0;
                c += v(h);
                h = 0;
              } else {
                p++;
              }
            }
            n = u.charCodeAt(0);
            for (t = 0; t < 8; t++) {
              h = (h << 1) | (n & 1);
              if (p == 15) {
                p = 0;
                c += v(h);
                h = 0;
              } else {
                p++;
              }
              n = n >> 1;
            }
          } else {
            n = 1;
            for (t = 0; t < l; t++) {
              h = (h << 1) | n;
              if (p == 15) {
                p = 0;
                c += v(h);
                h = 0;
              } else {
                p++;
              }
              n = 0;
            }
            n = u.charCodeAt(0);
            for (t = 0; t < 16; t++) {
              h = (h << 1) | (n & 1);
              if (p == 15) {
                p = 0;
                c += v(h);
                h = 0;
              } else {
                p++;
              }
              n = n >> 1;
            }
          }
          a--;
          if (a == 0) {
            a = Math.pow(2, l);
            l++;
          }
          delete i[u];
        } else {
          n = r[u];
          for (t = 0; t < l; t++) {
            h = (h << 1) | (n & 1);
            if (p == 15) {
              p = 0;
              c += v(h);
              h = 0;
            } else {
              p++;
            }
            n = n >> 1;
          }
        }
        a--;
        if (a == 0) {
          a = Math.pow(2, l);
          l++;
        }
        r[o] = f++;
        u = String(s);
      }
    }
    if (u !== "") {
      if (Object.prototype.hasOwnProperty.call(i, u)) {
        if (u.charCodeAt(0) < 256) {
          for (t = 0; t < l; t++) {
            h = h << 1;
            if (p == 15) {
              p = 0;
              c += v(h);
              h = 0;
            } else {
              p++;
            }
          }
          n = u.charCodeAt(0);
          for (t = 0; t < 8; t++) {
            h = (h << 1) | (n & 1);
            if (p == 15) {
              p = 0;
              c += v(h);
              h = 0;
            } else {
              p++;
            }
            n = n >> 1;
          }
        } else {
          n = 1;
          for (t = 0; t < l; t++) {
            h = (h << 1) | n;
            if (p == 15) {
              p = 0;
              c += v(h);
              h = 0;
            } else {
              p++;
            }
            n = 0;
          }
          n = u.charCodeAt(0);
          for (t = 0; t < 16; t++) {
            h = (h << 1) | (n & 1);
            if (p == 15) {
              p = 0;
              c += v(h);
              h = 0;
            } else {
              p++;
            }
            n = n >> 1;
          }
        }
        a--;
        if (a == 0) {
          a = Math.pow(2, l);
          l++;
        }
        delete i[u];
      } else {
        n = r[u];
        for (t = 0; t < l; t++) {
          h = (h << 1) | (n & 1);
          if (p == 15) {
            p = 0;
            c += v(h);
            h = 0;
          } else {
            p++;
          }
          n = n >> 1;
        }
      }
      a--;
      if (a == 0) {
        a = Math.pow(2, l);
        l++;
      }
    }
    n = 2;
    for (t = 0; t < l; t++) {
      h = (h << 1) | (n & 1);
      if (p == 15) {
        p = 0;
        c += v(h);
        h = 0;
      } else {
        p++;
      }
      n = n >> 1;
    }
    while (true) {
      h = h << 1;
      if (p == 15) {
        c += v(h);
        break;
      } else p++;
    }
    return c;
  },
  decompress: function (e) {
    if (e == null) return "";
    if (e == "") return null;
    var t = [],
      n,
      r = 4,
      i = 4,
      s = 3,
      o = "",
      u = "",
      a,
      f,
      l,
      c,
      h,
      p,
      d,
      v = LZString._f,
      m = { string: e, val: e.charCodeAt(0), position: 32768, index: 1 };
    for (a = 0; a < 3; a += 1) {
      t[a] = a;
    }
    l = 0;
    h = Math.pow(2, 2);
    p = 1;
    while (p != h) {
      c = m.val & m.position;
      m.position >>= 1;
      if (m.position == 0) {
        m.position = 32768;
        m.val = m.string.charCodeAt(m.index++);
      }
      l |= (c > 0 ? 1 : 0) * p;
      p <<= 1;
    }
    switch ((n = l)) {
      case 0:
        l = 0;
        h = Math.pow(2, 8);
        p = 1;
        while (p != h) {
          c = m.val & m.position;
          m.position >>= 1;
          if (m.position == 0) {
            m.position = 32768;
            m.val = m.string.charCodeAt(m.index++);
          }
          l |= (c > 0 ? 1 : 0) * p;
          p <<= 1;
        }
        d = v(l);
        break;
      case 1:
        l = 0;
        h = Math.pow(2, 16);
        p = 1;
        while (p != h) {
          c = m.val & m.position;
          m.position >>= 1;
          if (m.position == 0) {
            m.position = 32768;
            m.val = m.string.charCodeAt(m.index++);
          }
          l |= (c > 0 ? 1 : 0) * p;
          p <<= 1;
        }
        d = v(l);
        break;
      case 2:
        return "";
    }
    t[3] = d;
    f = u = d;
    while (true) {
      if (m.index > m.string.length) {
        return "";
      }
      l = 0;
      h = Math.pow(2, s);
      p = 1;
      while (p != h) {
        c = m.val & m.position;
        m.position >>= 1;
        if (m.position == 0) {
          m.position = 32768;
          m.val = m.string.charCodeAt(m.index++);
        }
        l |= (c > 0 ? 1 : 0) * p;
        p <<= 1;
      }
      switch ((d = l)) {
        case 0:
          l = 0;
          h = Math.pow(2, 8);
          p = 1;
          while (p != h) {
            c = m.val & m.position;
            m.position >>= 1;
            if (m.position == 0) {
              m.position = 32768;
              m.val = m.string.charCodeAt(m.index++);
            }
            l |= (c > 0 ? 1 : 0) * p;
            p <<= 1;
          }
          t[i++] = v(l);
          d = i - 1;
          r--;
          break;
        case 1:
          l = 0;
          h = Math.pow(2, 16);
          p = 1;
          while (p != h) {
            c = m.val & m.position;
            m.position >>= 1;
            if (m.position == 0) {
              m.position = 32768;
              m.val = m.string.charCodeAt(m.index++);
            }
            l |= (c > 0 ? 1 : 0) * p;
            p <<= 1;
          }
          t[i++] = v(l);
          d = i - 1;
          r--;
          break;
        case 2:
          return u;
      }
      if (r == 0) {
        r = Math.pow(2, s);
        s++;
      }
      if (t[d]) {
        o = t[d];
      } else {
        if (d === i) {
          o = f + f.charAt(0);
        } else {
          return null;
        }
      }
      u += o;
      t[i++] = f + o.charAt(0);
      r--;
      f = o;
      if (r == 0) {
        r = Math.pow(2, s);
        s++;
      }
    }
  },
};
if (typeof module !== "undefined" && module != null) {
  module.exports = LZString;
}


code:
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var CanvasTileRenderer = (function () {
      function CanvasTileRenderer(renderer) {
        this.tileAnim = [0, 0];
        this.dontUseTransform = false;
        this.renderer = renderer;
        this.tileAnim = [0, 0];
      }
      return CanvasTileRenderer;
    })();
    tilemap.CanvasTileRenderer = CanvasTileRenderer;
    PIXI.CanvasRenderer.registerPlugin("tilemap", CanvasTileRenderer);
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var __extends =
  (this && this.__extends) ||
  (function () {
    var extendStatics =
      Object.setPrototypeOf ||
      ({ __proto__: [] } instanceof Array &&
        function (d, b) {
          d.__proto__ = b;
        }) ||
      function (d, b) {
        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
      };
    return function (d, b) {
      extendStatics(d, b);
      function __() {
        this.constructor = d;
      }
      d.prototype =
        b === null
          ? Object.create(b)
          : ((__.prototype = b.prototype), new __());
    };
  })();
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var CompositeRectTileLayer = (function (_super) {
      __extends(CompositeRectTileLayer, _super);
      function CompositeRectTileLayer(zIndex, bitmaps, useSquare, texPerChild) {
        var _this = _super.call(this) || this;
        _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);
        _this.modificationMarker = 0;
        _this._globalMat = null;
        _this._tempScale = null;
        _this.initialize.apply(_this, arguments);
        return _this;
      }
      CompositeRectTileLayer.prototype.updateTransform = function () {
        _super.prototype.displayObjectUpdateTransform.call(this);
      };
      CompositeRectTileLayer.prototype.initialize = function (
        zIndex,
        bitmaps,
        useSquare,
        texPerChild
      ) {
        this.z = this.zIndex = zIndex;
        this.useSquare = useSquare;
        this.texPerChild = texPerChild || 16;
        if (bitmaps) {
          this.setBitmaps(bitmaps);
        }
      };
      CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) {
        var texPerChild = this.texPerChild;
        var len1 = this.children.length;
        var len2 = Math.ceil(bitmaps.length / texPerChild);
        var i;
        for (i = 0; i < len1; i++) {
          this.children[i].textures = bitmaps.slice(
            i * texPerChild,
            (i + 1) * texPerChild
          );
        }
        for (i = len1; i < len2; i++) {
          this.addChild(
            new tilemap.RectTileLayer(
              this.zIndex,
              bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)
            )
          );
        }
      };
      CompositeRectTileLayer.prototype.clear = function () {
        for (var i = 0; i < this.children.length; i++) this.children[i].clear();
        this.modificationMarker = 0;
      };
      CompositeRectTileLayer.prototype.addRect = function (
        num,
        u,
        v,
        x,
        y,
        tileWidth,
        tileHeight
      ) {
        if (this.children[num] && this.children[num].textures)
          this.children[num].addRect(0, u, v, x, y, tileWidth, tileHeight);
      };
      CompositeRectTileLayer.prototype.addFrame = function (
        texture_,
        x,
        y,
        animX,
        animY
      ) {
        var texture;
        var layer = null,
          ind = 0;
        var children = this.children;
        if (typeof texture_ === "number") {
          var childIndex = (texture_ / this.texPerChild) >> 0;
          layer = children[childIndex];
          if (!layer) {
            layer = children[0];
            if (!layer) {
              return false;
            }
            ind = 0;
          } else {
            ind = texture_ % this.texPerChild;
          }
          texture = layer.textures[ind];
        } else if (typeof texture_ === "string") {
          texture = PIXI.Texture.fromImage(texture_);
        } else {
          texture = texture_;
          for (var i = 0; i < children.length; i++) {
            var child = children[i];
            var tex = child.textures;
            for (var j = 0; j < tex.length; j++) {
              if (tex[j].baseTexture == texture.baseTexture) {
                layer = child;
                ind = j;
                break;
              }
            }
            if (layer) {
              break;
            }
          }
          if (!layer) {
            for (i = 0; i < children.length; i++) {
              var child = children[i];
              if (child.textures.length < this.texPerChild) {
                layer = child;
                ind = child.textures.length;
                child.textures.push(texture);
                break;
              }
            }
            if (!layer) {
              children.push(
                (layer = new tilemap.RectTileLayer(this.zIndex, texture))
              );
              ind = 0;
            }
          }
        }
        layer.addRect(
          ind,
          texture.frame.x,
          texture.frame.y,
          x,
          y,
          texture.frame.width,
          texture.frame.height,
          animX,
          animY
        );
        return true;
      };
      CompositeRectTileLayer.prototype.renderCanvas = function (renderer) {
        if (!renderer.plugins.tilemap.dontUseTransform) {
          var wt = this.worldTransform;
          renderer.context.setTransform(
            wt.a,
            wt.b,
            wt.c,
            wt.d,
            wt.tx * renderer.resolution,
            wt.ty * renderer.resolution
          );
        }
        var layers = this.children;
        for (var i = 0; i < layers.length; i++)
          layers[i].renderCanvas(renderer);
      };
      CompositeRectTileLayer.prototype.renderWebGL = function (renderer) {
        var gl = renderer.gl;
        var shader = renderer.plugins.tilemap.getShader(this.useSquare);
        renderer.setObjectRenderer(renderer.plugins.tilemap);
        renderer.bindShader(shader);
        this._globalMat = this._globalMat || new PIXI.Matrix();
        renderer._activeRenderTarget.projectionMatrix
          .copy(this._globalMat)
          .append(this.worldTransform);
        shader.uniforms.projectionMatrix = this._globalMat.toArray(true);
        shader.uniforms.shadowColor = this.shadowColor;
        if (this.useSquare) {
          var tempScale = (this._tempScale = this._tempScale || [0, 0]);
          tempScale[0] = this._globalMat.a >= 0 ? 1 : -1;
          tempScale[1] = this._globalMat.d < 0 ? 1 : -1;
          var ps = (shader.uniforms.pointScale = tempScale);
          shader.uniforms.projectionScale =
            Math.abs(this.worldTransform.a) * renderer.resolution;
        }
        var af = (shader.uniforms.animationFrame =
          renderer.plugins.tilemap.tileAnim);
        var layers = this.children;
        for (var i = 0; i < layers.length; i++)
          layers[i].renderWebGL(renderer, this.useSquare);
      };
      CompositeRectTileLayer.prototype.isModified = function (anim) {
        var layers = this.children;
        if (this.modificationMarker != layers.length) {
          return true;
        }
        for (var i = 0; i < layers.length; i++) {
          var layer = layers[i];
          if (
            layer.modificationMarker != layer.pointsBuf.length ||
            (anim && layer.hasAnim)
          ) {
            return true;
          }
        }
        return false;
      };
      CompositeRectTileLayer.prototype.clearModify = function () {
        var layers = this.children;
        this.modificationMarker = layers.length;
        for (var i = 0; i < layers.length; i++) {
          var layer = layers[i];
          layer.modificationMarker = layer.pointsBuf.length;
        }
      };
      return CompositeRectTileLayer;
    })(PIXI.Container);
    tilemap.CompositeRectTileLayer = CompositeRectTileLayer;
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var GraphicsLayer = (function (_super) {
      __extends(GraphicsLayer, _super);
      function GraphicsLayer(zIndex) {
        var _this = _super.call(this) || this;
        _this.z = _this.zIndex = zIndex;
        return _this;
      }
      GraphicsLayer.prototype.renderCanvas = function (renderer) {
        var wt = null;
        if (renderer.plugins.tilemap.dontUseTransform) {
          wt = this.transform.worldTransform;
          this.transform.worldTransform = PIXI.Matrix.IDENTITY;
        }
        renderer.plugins.graphics.render(this);
        if (renderer.plugins.tilemap.dontUseTransform) {
          this.transform.worldTransform = wt;
        }
        renderer.context.globalAlpha = 1.0;
      };
      GraphicsLayer.prototype.renderWebGL = function (renderer) {
        if (!this._webGL[renderer.CONTEXT_UID]) this.dirty = true;
        _super.prototype.renderWebGL.call(this, renderer);
      };
      GraphicsLayer.prototype.isModified = function (anim) {
        return false;
      };
      GraphicsLayer.prototype.clearModify = function () {};
      return GraphicsLayer;
    })(PIXI.Graphics);
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var RectTileLayer = (function (_super) {
      __extends(RectTileLayer, _super);
      function RectTileLayer(zIndex, texture) {
        var _this = _super.call(this) || this;
        _this.z = 0;
        _this.zIndex = 0;
        _this.pointsBuf = [];
        _this._tempSize = new Float32Array([0, 0]);
        _this._tempTexSize = 1;
        _this.modificationMarker = 0;
        _this.hasAnim = false;
        _this.vbId = 0;
        _this.vbBuffer = null;
        _this.vbArray = null;
        _this.vbInts = null;
        _this.initialize(zIndex, texture);
        return _this;
      }
      RectTileLayer.prototype.initialize = function (zIndex, textures) {
        if (!textures) {
          textures = [];
        } else if (!(textures instanceof Array) && textures.baseTexture) {
          textures = [textures];
        }
        this.textures = textures;
        this.z = this.zIndex = zIndex;
        this.visible = false;
      };
      RectTileLayer.prototype.clear = function () {
        this.pointsBuf.length = 0;
        this.modificationMarker = 0;
        this.hasAnim = false;
      };
      RectTileLayer.prototype.renderCanvas = function (renderer) {
        if (this.textures.length === 0) return;
        var points = this.pointsBuf;
        renderer.context.fillStyle = "#000000";
        for (var i = 0, n = points.length; i < n; i += 9) {
          var x1 = points[i],
            y1 = points[i + 1];
          var x2 = points[i + 2],
            y2 = points[i + 3];
          var w = points[i + 4];
          var h = points[i + 5];
          x1 += points[i + 6] * renderer.plugins.tilemap.tileAnim[0];
          y1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[1];
          var textureId = points[i + 8];
          if (textureId >= 0) {
            renderer.context.drawImage(
              this.textures[textureId].baseTexture.source,
              x1,
              y1,
              w,
              h,
              x2,
              y2,
              w,
              h
            );
          } else {
            renderer.context.globalAlpha = 0.5;
            renderer.context.fillRect(x2, y2, w, h);
            renderer.context.globalAlpha = 1;
          }
        }
      };
      RectTileLayer.prototype.addRect = function (
        textureId,
        u,
        v,
        x,
        y,
        tileWidth,
        tileHeight,
        animX,
        animY
      ) {
        if (animX === void 0) {
          animX = 0;
        }
        if (animY === void 0) {
          animY = 0;
        }
        var pb = this.pointsBuf;
        this.hasAnim = this.hasAnim || animX > 0 || animY > 0;
        if (tileWidth == tileHeight) {
          pb.push(u);
          pb.push(v);
          pb.push(x);
          pb.push(y);
          pb.push(tileWidth);
          pb.push(tileHeight);
          pb.push(animX | 0);
          pb.push(animY | 0);
          pb.push(textureId);
        } else {
          var i;
          if (tileWidth % tileHeight === 0) {
            for (i = 0; i < tileWidth / tileHeight; i++) {
              pb.push(u + i * tileHeight);
              pb.push(v);
              pb.push(x + i * tileHeight);
              pb.push(y);
              pb.push(tileHeight);
              pb.push(tileHeight);
              pb.push(animX | 0);
              pb.push(animY | 0);
              pb.push(textureId);
            }
          } else if (tileHeight % tileWidth === 0) {
            for (i = 0; i < tileHeight / tileWidth; i++) {
              pb.push(u);
              pb.push(v + i * tileWidth);
              pb.push(x);
              pb.push(y + i * tileWidth);
              pb.push(tileWidth);
              pb.push(tileWidth);
              pb.push(animX | 0);
              pb.push(animY | 0);
              pb.push(textureId);
            }
          } else {
            pb.push(u);
            pb.push(v);
            pb.push(x);
            pb.push(y);
            pb.push(tileWidth);
            pb.push(tileHeight);
            pb.push(animX | 0);
            pb.push(animY | 0);
            pb.push(textureId);
          }
        }
      };
      RectTileLayer.prototype.renderWebGL = function (renderer, useSquare) {
        if (useSquare === void 0) {
          useSquare = false;
        }
        var points = this.pointsBuf;
        if (points.length === 0) return;
        var rectsCount = points.length / 9;
        var tile = renderer.plugins.tilemap;
        var gl = renderer.gl;
        if (!useSquare) {
          tile.checkIndexBuffer(rectsCount);
        }
        var shader = tile.getShader(useSquare);
        var textures = this.textures;
        if (textures.length === 0) return;
        var len = textures.length;
        if (this._tempTexSize < shader.maxTextures) {
          this._tempTexSize = shader.maxTextures;
          this._tempSize = new Float32Array(2 * shader.maxTextures);
        }
        for (var i = 0; i < len; i++) {
          if (!textures[i] || !textures[i].valid) return;
          var texture = textures[i].baseTexture;
        }
        tile.bindTextures(renderer, shader, textures);
        var vb = tile.getVb(this.vbId);
        if (!vb) {
          vb = tile.createVb(useSquare);
          this.vbId = vb.id;
          this.vbBuffer = null;
          this.modificationMarker = 0;
        }
        var vao = vb.vao;
        renderer.bindVao(vao);
        var vertexBuf = vb.vb;
        vertexBuf.bind();
        var vertices = rectsCount * shader.vertPerQuad;
        if (vertices === 0) return;
        if (this.modificationMarker != vertices) {
          this.modificationMarker = vertices;
          var vs = shader.stride * vertices;
          if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {
            var bk = shader.stride;
            while (bk < vs) {
              bk *= 2;
            }
            this.vbBuffer = new ArrayBuffer(bk);
            this.vbArray = new Float32Array(this.vbBuffer);
            this.vbInts = new Uint32Array(this.vbBuffer);
            vertexBuf.upload(this.vbBuffer, 0, true);
          }
          var arr = this.vbArray,
            ints = this.vbInts;
          var sz = 0;
          var textureId, shiftU, shiftV;
          if (useSquare) {
            for (i = 0; i < points.length; i += 9) {
              textureId = points[i + 8] >> 2;
              shiftU = 1024 * (points[i + 8] & 1);
              shiftV = 1024 * ((points[i + 8] >> 1) & 1);
              arr[sz++] = points[i + 2];
              arr[sz++] = points[i + 3];
              arr[sz++] = points[i + 0] + shiftU;
              arr[sz++] = points[i + 1] + shiftV;
              arr[sz++] = points[i + 4];
              arr[sz++] = points[i + 6];
              arr[sz++] = points[i + 7];
              arr[sz++] = textureId;
            }
          } else {
            var tint = -1;
            for (i = 0; i < points.length; i += 9) {
              var eps = 0.5;
              textureId = points[i + 8] >> 2;
              shiftU = 1024 * (points[i + 8] & 1);
              shiftV = 1024 * ((points[i + 8] >> 1) & 1);
              var x = points[i + 2],
                y = points[i + 3];
              var w = points[i + 4],
                h = points[i + 5];
              var u = points[i] + shiftU,
                v = points[i + 1] + shiftV;
              var animX = points[i + 6],
                animY = points[i + 7];
              arr[sz++] = x;
              arr[sz++] = y;
              arr[sz++] = u;
              arr[sz++] = v;
              arr[sz++] = u + eps;
              arr[sz++] = v + eps;
              arr[sz++] = u + w - eps;
              arr[sz++] = v + h - eps;
              arr[sz++] = animX;
              arr[sz++] = animY;
              arr[sz++] = textureId;
              arr[sz++] = x + w;
              arr[sz++] = y;
              arr[sz++] = u + w;
              arr[sz++] = v;
              arr[sz++] = u + eps;
              arr[sz++] = v + eps;
              arr[sz++] = u + w - eps;
              arr[sz++] = v + h - eps;
              arr[sz++] = animX;
              arr[sz++] = animY;
              arr[sz++] = textureId;
              arr[sz++] = x + w;
              arr[sz++] = y + h;
              arr[sz++] = u + w;
              arr[sz++] = v + h;
              arr[sz++] = u + eps;
              arr[sz++] = v + eps;
              arr[sz++] = u + w - eps;
              arr[sz++] = v + h - eps;
              arr[sz++] = animX;
              arr[sz++] = animY;
              arr[sz++] = textureId;
              arr[sz++] = x;
              arr[sz++] = y + h;
              arr[sz++] = u;
              arr[sz++] = v + h;
              arr[sz++] = u + eps;
              arr[sz++] = v + eps;
              arr[sz++] = u + w - eps;
              arr[sz++] = v + h - eps;
              arr[sz++] = animX;
              arr[sz++] = animY;
              arr[sz++] = textureId;
            }
          }
          vertexBuf.upload(arr, 0, true);
        }
        if (useSquare) gl.drawArrays(gl.POINTS, 0, vertices);
        else
          gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0);
      };
      return RectTileLayer;
    })(PIXI.Container);
    tilemap.RectTileLayer = RectTileLayer;
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var rectShaderFrag =
      "varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n   vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n   float textureId = floor(vTextureId + 0.5);\n\n   vec4 color;\n   %forloop%\n   gl_FragColor = color;\n}";
    var rectShaderVert =
      "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n   vec2 anim = aAnim * animationFrame;\n   vTextureCoord = aTextureCoord + anim;\n   vFrame = aFrame + vec4(anim, anim);\n   vTextureId = aTextureId;\n}\n";
    var TilemapShader = (function (_super) {
      __extends(TilemapShader, _super);
      function TilemapShader(gl, maxTextures, shaderVert, shaderFrag) {
        var _this = _super.call(this, gl, shaderVert, shaderFrag) || this;
        _this.maxTextures = 0;
        _this.maxTextures = maxTextures;
        tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
        return _this;
      }
      return TilemapShader;
    })(PIXI.Shader);
    tilemap.TilemapShader = TilemapShader;
    var RectTileShader = (function (_super) {
      __extends(RectTileShader, _super);
      function RectTileShader(gl, maxTextures) {
        var _this =
          _super.call(
            this,
            gl,
            maxTextures,
            rectShaderVert,
            tilemap.shaderGenerator.generateFragmentSrc(
              maxTextures,
              rectShaderFrag
            )
          ) || this;
        _this.vertSize = 11;
        _this.vertPerQuad = 4;
        _this.stride = _this.vertSize * 4;
        tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
        return _this;
      }
      RectTileShader.prototype.createVao = function (renderer, vb) {
        var gl = renderer.gl;
        return renderer
          .createVao()
          .addIndex(this.indexBuffer)
          .addAttribute(
            vb,
            this.attributes.aVertexPosition,
            gl.FLOAT,
            false,
            this.stride,
            0
          )
          .addAttribute(
            vb,
            this.attributes.aTextureCoord,
            gl.FLOAT,
            false,
            this.stride,
            2 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aFrame,
            gl.FLOAT,
            false,
            this.stride,
            4 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aAnim,
            gl.FLOAT,
            false,
            this.stride,
            8 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aTextureId,
            gl.FLOAT,
            false,
            this.stride,
            10 * 4
          );
      };
      return RectTileShader;
    })(TilemapShader);
    tilemap.RectTileShader = RectTileShader;
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var shaderGenerator;
    (function (shaderGenerator) {
      function fillSamplers(shader, maxTextures) {
        var sampleValues = [];
        for (var i = 0; i < maxTextures; i++) {
          sampleValues[i] = i;
        }
        shader.bind();
        shader.uniforms.uSamplers = sampleValues;
        var samplerSize = [];
        for (i = 0; i < maxTextures; i++) {
          samplerSize.push(1.0 / 2048);
          samplerSize.push(1.0 / 2048);
        }
        shader.uniforms.uSamplerSize = samplerSize;
      }
      shaderGenerator.fillSamplers = fillSamplers;
      function generateFragmentSrc(maxTextures, fragmentSrc) {
        return fragmentSrc
          .replace(/%count%/gi, maxTextures + "")
          .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));
      }
      shaderGenerator.generateFragmentSrc = generateFragmentSrc;
      function generateSampleSrc(maxTextures) {
        var src = "";
        src += "\n";
        src += "\n";
        src += "if(vTextureId <= -1.0) {";
        src += "\n\tcolor = shadowColor;";
        src += "\n}";
        for (var i = 0; i < maxTextures; i++) {
          src += "\nelse ";
          if (i < maxTextures - 1) {
            src += "if(textureId == " + i + ".0)";
          }
          src += "\n{";
          src +=
            "\n\tcolor = texture2D(uSamplers[" +
            i +
            "], textureCoord * uSamplerSize[" +
            i +
            "]);";
          src += "\n}";
        }
        src += "\n";
        src += "\n";
        return src;
      }
      shaderGenerator.generateSampleSrc = generateSampleSrc;
    })(
      (shaderGenerator =
        tilemap.shaderGenerator || (tilemap.shaderGenerator = {}))
    );
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var squareShaderVert =
      "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n   gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n   gl_PointSize = aSize * projectionScale;\n   vTextureCoord = aTextureCoord + aAnim * animationFrame;\n   vTextureId = aTextureId;\n   vSize = aSize;\n}\n";
    var squareShaderFrag =
      "\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n   float margin = 0.5 / vSize;\n   vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n   vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n   vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n   float textureId = vTextureId;\n   vec4 color;\n   %forloop%\n   gl_FragColor = color;\n}\n\n";
    var SquareTileShader = (function (_super) {
      __extends(SquareTileShader, _super);
      function SquareTileShader(gl, maxTextures) {
        var _this =
          _super.call(
            this,
            gl,
            maxTextures,
            squareShaderVert,
            tilemap.shaderGenerator.generateFragmentSrc(
              maxTextures,
              squareShaderFrag
            )
          ) || this;
        _this.vertSize = 8;
        _this.vertPerQuad = 1;
        _this.stride = _this.vertSize * 4;
        _this.maxTextures = maxTextures;
        tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
        return _this;
      }
      SquareTileShader.prototype.createVao = function (renderer, vb) {
        var gl = renderer.gl;
        return renderer
          .createVao()
          .addIndex(this.indexBuffer)
          .addAttribute(
            vb,
            this.attributes.aVertexPosition,
            gl.FLOAT,
            false,
            this.stride,
            0
          )
          .addAttribute(
            vb,
            this.attributes.aTextureCoord,
            gl.FLOAT,
            false,
            this.stride,
            2 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aSize,
            gl.FLOAT,
            false,
            this.stride,
            4 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aAnim,
            gl.FLOAT,
            false,
            this.stride,
            5 * 4
          )
          .addAttribute(
            vb,
            this.attributes.aTextureId,
            gl.FLOAT,
            false,
            this.stride,
            7 * 4
          );
      };
      return SquareTileShader;
    })(tilemap.TilemapShader);
    tilemap.SquareTileShader = SquareTileShader;
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap) {
    var glCore = PIXI.glCore;
    function _hackSubImage(tex, sprite, clearBuffer, clearWidth, clearHeight) {
      var gl = tex.gl;
      var baseTex = sprite.texture.baseTexture;
      if (clearBuffer && clearWidth > 0 && clearHeight > 0) {
        gl.texSubImage2D(
          gl.TEXTURE_2D,
          0,
          sprite.position.x,
          sprite.position.y,
          clearWidth,
          clearHeight,
          tex.format,
          tex.type,
          clearBuffer
        );
      }
      gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
      gl.texSubImage2D(
        gl.TEXTURE_2D,
        0,
        sprite.position.x,
        sprite.position.y,
        tex.format,
        tex.type,
        baseTex.source
      );
    }
    var TileRenderer = (function (_super) {
      __extends(TileRenderer, _super);
      function TileRenderer(renderer) {
        var _this = _super.call(this, renderer) || this;
        _this.vbs = {};
        _this.indices = new Uint16Array(0);
        _this.lastTimeCheck = 0;
        _this.tileAnim = [0, 0];
        _this.maxTextures = 4;
        _this.texLoc = [];
        return _this;
      }
      TileRenderer.prototype.onContextChange = function () {
        var gl = this.renderer.gl;
        var maxTextures = this.maxTextures;
        this.rectShader = new tilemap.RectTileShader(gl, maxTextures);
        this.squareShader = new tilemap.SquareTileShader(gl, maxTextures);
        this.checkIndexBuffer(2000);
        this.rectShader.indexBuffer = this.indexBuffer;
        this.squareShader.indexBuffer = this.indexBuffer;
        this.vbs = {};
        this.glTextures = [];
        this.boundSprites = [];
        this.initBounds();
      };
      TileRenderer.prototype.initBounds = function () {
        var gl = this.renderer.gl;
        var tempCanvas = document.createElement("canvas");
        tempCanvas.width = 2048;
        tempCanvas.height = 2048;
        for (var i = 0; i < this.maxTextures; i++) {
          var rt = PIXI.RenderTexture.create(2048, 2048);
          rt.baseTexture.premultipliedAlpha = true;
          rt.baseTexture.scaleMode = TileRenderer.SCALE_MODE;
          rt.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP;
          this.renderer.textureManager.updateTexture(rt);
          this.glTextures.push(rt);
          var bs = [];
          for (var j = 0; j < 4; j++) {
            var spr = new PIXI.Sprite();
            spr.position.x = 1024 * (j & 1);
            spr.position.y = 1024 * (j >> 1);
            bs.push(spr);
          }
          this.boundSprites.push(bs);
        }
      };
      TileRenderer.prototype.bindTextures = function (
        renderer,
        shader,
        textures
      ) {
        var bounds = this.boundSprites;
        var glts = this.glTextures;
        var len = textures.length;
        var maxTextures = this.maxTextures;
        if (len > 4 * maxTextures) {
          return;
        }
        var doClear = TileRenderer.DO_CLEAR;
        if (doClear && !this._clearBuffer) {
          this._clearBuffer = new Uint8Array(1024 * 1024 * 4);
        }
        var i;
        for (i = 0; i < len; i++) {
          var texture = textures[i];
          if (!texture || !textures[i].valid) continue;
          var bs = bounds[i >> 2][i & 3];
          if (!bs.texture || bs.texture.baseTexture !== texture.baseTexture) {
            bs.texture = texture;
            var glt = glts[i >> 2];
            renderer.bindTexture(glt, 0, true);
            if (doClear) {
              _hackSubImage(
                glt.baseTexture._glTextures[renderer.CONTEXT_UID],
                bs,
                this._clearBuffer,
                1024,
                1024
              );
            } else {
              _hackSubImage(
                glt.baseTexture._glTextures[renderer.CONTEXT_UID],
                bs
              );
            }
          }
        }
        this.texLoc.length = 0;
        for (i = 0; i < maxTextures; i++) {
          this.texLoc.push(renderer.bindTexture(glts[i], i, true));
        }
        shader.uniforms.uSamplers = this.texLoc;
      };
      TileRenderer.prototype.checkLeaks = function () {
        var now = Date.now();
        var old = now - 10000;
        if (this.lastTimeCheck < old || this.lastTimeCheck > now) {
          this.lastTimeCheck = now;
          var vbs = this.vbs;
          for (var key in vbs) {
            if (vbs[key].lastTimeAccess < old) {
              this.removeVb(key);
            }
          }
        }
      };
      TileRenderer.prototype.start = function () {
        this.renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
      };
      TileRenderer.prototype.getVb = function (id) {
        this.checkLeaks();
        var vb = this.vbs[id];
        if (vb) {
          vb.lastAccessTime = Date.now();
          return vb;
        }
        return null;
      };
      TileRenderer.prototype.createVb = function (useSquare) {
        var id = ++TileRenderer.vbAutoincrement;
        var shader = this.getShader(useSquare);
        var gl = this.renderer.gl;
        var vb = PIXI.glCore.GLBuffer.createVertexBuffer(
          gl,
          null,
          gl.STREAM_DRAW
        );
        var stuff = {
          id: id,
          vb: vb,
          vao: shader.createVao(this.renderer, vb),
          lastTimeAccess: Date.now(),
          useSquare: useSquare,
          shader: shader,
        };
        this.vbs[id] = stuff;
        return stuff;
      };
      TileRenderer.prototype.removeVb = function (id) {
        if (this.vbs[id]) {
          this.vbs[id].vb.destroy();
          this.vbs[id].vao.destroy();
          delete this.vbs[id];
        }
      };
      TileRenderer.prototype.checkIndexBuffer = function (size) {
        var totalIndices = size * 6;
        var indices = this.indices;
        if (totalIndices <= indices.length) {
          return;
        }
        var len = indices.length || totalIndices;
        while (len < totalIndices) {
          len <<= 1;
        }
        indices = new Uint16Array(len);
        this.indices = indices;
        for (var i = 0, j = 0; i + 5 < indices.length; i += 6, j += 4) {
          indices[i + 0] = j + 0;
          indices[i + 1] = j + 1;
          indices[i + 2] = j + 2;
          indices[i + 3] = j + 0;
          indices[i + 4] = j + 2;
          indices[i + 5] = j + 3;
        }
        if (this.indexBuffer) {
          this.indexBuffer.upload(indices);
        } else {
          var gl = this.renderer.gl;
          this.indexBuffer = glCore.GLBuffer.createIndexBuffer(
            gl,
            this.indices,
            gl.STATIC_DRAW
          );
        }
      };
      TileRenderer.prototype.getShader = function (useSquare) {
        return useSquare ? this.squareShader : this.rectShader;
      };
      TileRenderer.prototype.destroy = function () {
        _super.prototype.destroy.call(this);
        this.rectShader.destroy();
        this.squareShader.destroy();
        this.rectShader = null;
        this.squareShader = null;
      };
      return TileRenderer;
    })(PIXI.ObjectRenderer);
    TileRenderer.vbAutoincrement = 0;
    TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.LINEAR;
    TileRenderer.DO_CLEAR = false;
    tilemap.TileRenderer = TileRenderer;
    PIXI.WebGLRenderer.registerPlugin("tilemap", TileRenderer);
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
var PIXI;
(function (PIXI) {
  var tilemap;
  (function (tilemap_1) {
    var ZLayer = (function (_super) {
      __extends(ZLayer, _super);
      function ZLayer(tilemap, zIndex) {
        var _this = _super.call(this) || this;
        _this._lastAnimationFrame = -1;
        _this.tilemap = tilemap;
        _this.z = zIndex;
        return _this;
      }
      ZLayer.prototype.clear = function () {
        var layers = this.children;
        for (var i = 0; i < layers.length; i++) layers[i].clear();
        this._previousLayers = 0;
      };
      ZLayer.prototype.cacheIfDirty = function () {
        var tilemap = this.tilemap;
        var layers = this.children;
        var modified = this._previousLayers != layers.length;
        this._previousLayers = layers.length;
        var buf = this.canvasBuffer;
        var tempRender = this._tempRender;
        if (!buf) {
          buf = this.canvasBuffer = document.createElement("canvas");
          tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, {
            view: buf,
          });
          tempRender.context = tempRender.rootContext;
          tempRender.plugins.tilemap.dontUseTransform = true;
        }
        if (
          buf.width != tilemap._layerWidth ||
          buf.height != tilemap._layerHeight
        ) {
          buf.width = tilemap._layerWidth;
          buf.height = tilemap._layerHeight;
          modified = true;
        }
        var i;
        if (!modified) {
          for (i = 0; i < layers.length; i++) {
            if (
              layers[i].isModified(
                this._lastAnimationFrame != tilemap.animationFrame
              )
            ) {
              modified = true;
              break;
            }
          }
        }
        this._lastAnimationFrame = tilemap.animationFrame;
        if (modified) {
          if (tilemap._hackRenderer) {
            tilemap._hackRenderer(tempRender);
          }
          tempRender.context.clearRect(0, 0, buf.width, buf.height);
          for (i = 0; i < layers.length; i++) {
            layers[i].clearModify();
            layers[i].renderCanvas(tempRender);
          }
        }
        this.layerTransform = this.worldTransform;
        for (i = 0; i < layers.length; i++) {
          this.layerTransform = layers[i].worldTransform;
          break;
        }
      };
      ZLayer.prototype.renderCanvas = function (renderer) {
        this.cacheIfDirty();
        var wt = this.layerTransform;
        renderer.context.setTransform(
          wt.a,
          wt.b,
          wt.c,
          wt.d,
          wt.tx * renderer.resolution,
          wt.ty * renderer.resolution
        );
        var tilemap = this.tilemap;
        renderer.context.drawImage(this.canvasBuffer, 0, 0);
      };
      return ZLayer;
    })(PIXI.Container);
    tilemap_1.ZLayer = ZLayer;
  })((tilemap = PIXI.tilemap || (PIXI.tilemap = {})));
})(PIXI || (PIXI = {}));
//# sourceMappingURL=pixi-tilemap.js.map

repo_name: Idkwtcm/violated

license: unknown


code:
//=============================================================================
// AdjustPictureGraphical.js
// ----------------------------------------------------------------------------
// Copyright (c) 2015 Triacontane
// This plugin is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.2.1 2017/09/13 DWindow.jsなどピクチャコンテナにピクチャ以外を入れる一部のプラグインとの競合を解消
// 1.2.0 2017/08/13 パラメータの型指定機能に対応
// 1.1.1 2016/01/24 ピクチャが回転しているときも位置を把握できるよう修正
// 1.1.0 2015/12/26 グリッドの表示機能とグリッドにスナップ機能を追加
//                  Ctrl+Cで座標をコピーできる機能を追加
//                  任意のマップを読み込んでテストする機能を追加
// 1.0.3 2015/12/20 ピクチャのボタン化プラグインとの競合を解消
// 1.0.2 2015/11/23 競合防止のため、タッチ関連の処理をSprite_Pictureに定義
// 1.0.1 2015/11/21 ピクチャ番号を出力するよう機能修正
//                  コンソールにログを出す機能を追加
// 1.0.0 2015/11/20 初版
// ----------------------------------------------------------------------------
// [Blog]   : http://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================

/*:
 * @plugindesc Plugin that adjust picture to graphical
 * @author triacontane
 *
 * @param GridSize
 * @desc View grid line
 * @default 48
 * @type number
 *
 * @param TestMapId
 * @desc Event test map id
 * @default -1
 * @type number
 * @min -1
 *
 * @help Plugin that adjust picture to graphical.
 * Drag and drop on test screen.
 * this is support plugin. No impact for game.
 * Start for Event Test(Ctrl+R)
 *
 * Caution!
 * When you set status 'on' this plugin at Plugin Manager,
 * you have to save project(Ctrl+S) before test
 *
 * This plugin is released under the MIT License.
 */
/*:ja
 * @plugindesc ピクチャのグラフィカルな位置調整プラグイン。
 * パラメータを変更したら「プロジェクトの保存」（Ctrl+S）
 * @author トリアコンタン
 *
 * @param グリッドサイズ
 * @desc ピクチャ調整中に指定サイズでグリッドを表示します。0を指定すると非表示になります。
 * @default 48
 * @type number
 *
 * @param テストマップID
 * @desc 任意のマップをイベントテストの舞台に設定できます。
 * @default -1
 * @type number
 * @min -1
 *
 * @help イベントコマンドのテスト時に、ピクチャの表示位置を
 * ドラッグ＆ドロップで微調整できます。
 * 左上のタイトルバーに選択したピクチャの座標が表示されるので
 * テスト画面を表示させつつ、ピクチャの座標を調整してください。
 * なお、イベントコマンドのテスト以外では機能しません。
 * イベントコマンドのテストは、イベントエディタからイベントコマンドを
 * 選択して右クリック→テスト（Ctrl+R）で実行できます。
 *
 * 注意！
 * プラグインマネージャーから当プラグインを有効にしたら、
 * テストを行う前に「プロジェクトの保存」（Ctrl+S）を行ってください。
 *
 * このプラグインにはプラグインコマンドはありません。
 *
 * 利用規約：
 *  作者に無断で改変、再配布が可能で、利用形態（商用、18禁利用等）
 *  についても制限はありません。
 *  このプラグインはもうあなたのものです。
 */
(function () {
  "use strict";
  // イベントテスト時以外は一切の機能を無効
  if (!DataManager.isEventTest()) return;

  var pluginName = "AdjustPictureGraphical";

  //=============================================================================
  // ローカル関数
  //  プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
  //=============================================================================
  var getParamNumber = function (paramNames, min, max) {
    var value = getParamOther(paramNames);
    if (arguments.length < 2) min = -Infinity;
    if (arguments.length < 3) max = Infinity;
    return (parseInt(value, 10) || 0).clamp(min, max);
  };

  var getParamOther = function (paramNames) {
    if (!Array.isArray(paramNames)) paramNames = [paramNames];
    for (var i = 0; i < paramNames.length; i++) {
      var name = PluginManager.parameters(pluginName)[paramNames[i]];
      if (name) return name;
    }
    return null;
  };

  //=============================================================================
  // Input
  //  [c]を追加定義します。
  //=============================================================================
  Input.keyMapper[67] = "copy";

  //=============================================================================
  // DataManager
  //  テスト用マップの読み込みを追加定義します。
  //=============================================================================
  var _DataManager_setupEventTest = DataManager.setupEventTest;
  DataManager.setupEventTest = function () {
    _DataManager_setupEventTest.call(this);
    var mapId = getParamNumber(["TestMapId", "テストマップID"], -1, 9999);
    if (mapId > 0) $gamePlayer.reserveTransfer(mapId, 8, 6);
  };

  //=============================================================================
  // Game_Picture
  //  ピクチャを掴んだ場合に移動を中断します。
  //=============================================================================
  Game_Picture.prototype.resetMove = function (x, y) {
    this._x = x;
    this._y = y;
    this._duration = 0;
  };

  //=============================================================================
  // Game_Screen
  //  最後に選択したピクチャの座標を保存します。
  //=============================================================================
  var _Game_Screen_initialize = Game_Screen.prototype.initialize;
  Game_Screen.prototype.initialize = function () {
    _Game_Screen_initialize.call(this);
    this._lastPictureX = null;
    this._lastPictureY = null;
    this._copyCount = 0;
    this._infoPicture = "";
    this._infoHelp =
      "Shift:ウィンドウ表示切替 Ctrl+マウス:グリッドにスナップ Ctrl+C:座標コピー ";
    this._infoCopy = "";
    this._documentTitle = "";
  };

  var _Game_Screen_updatePictures = Game_Screen.prototype.updatePictures;
  Game_Screen.prototype.updatePictures = function () {
    _Game_Screen_updatePictures.call(this);
    if (
      Utils.isNwjs() &&
      Input.isPressed("control") &&
      Input.isTriggered("copy")
    ) {
      if (this._lastPictureX == null || this._lastPictureY == null) return;
      var clipboard = require("nw.gui").Clipboard.get();
      var copyValue = "";
      if (this._copyCount % 2 === 0) {
        copyValue = this._lastPictureX.toString();
        this._infoCopy = " X座標[" + copyValue + "]をコピーしました。";
      } else {
        copyValue = this._lastPictureY.toString();
        this._infoCopy = " Y座標[" + copyValue + "]をコピーしました。";
      }
      clipboard.set(copyValue, "text");
      this._copyCount++;
    }
    var docTitle = this._infoHelp + this._infoPicture + this._infoCopy;
    if (docTitle !== this._documentTitle) {
      document.title = docTitle;
      this._documentTitle = docTitle;
    }
  };

  //=============================================================================
  // Scene_Map
  //  テストイベント時の特別な処理
  //=============================================================================
  var _Scene_Map_update = Scene_Map.prototype.update;
  Scene_Map.prototype.update = function () {
    if (!$gameMap.isEventRunning()) this.updateEventTest();
    _Scene_Map_update.call(this);
  };

  Scene_Map.prototype.updateEventTest = function () {
    this._spriteset.checkDragPictures();
    if (Input.isTriggered("shift")) {
      if (!this._messageWindow.isOpen()) {
        this._messageWindow.open();
      } else {
        this._messageWindow.close();
      }
    }
  };

  Scene_Map.prototype.isMapTouchOk = function () {
    return false;
  };

  //=============================================================================
  // Spriteset_Base
  //  配下のピクチャから掴んでいるものを探します。
  //=============================================================================
  Spriteset_Base.prototype.checkDragPictures = function () {
    this._pictureContainer.children.reverse().some(function (picture) {
      return picture.checkDrag && picture.checkDrag();
    }, this);
    this._pictureContainer.children.reverse();
  };

  var _Spriteset_Base_createLowerLayer =
    Spriteset_Base.prototype.createLowerLayer;
  Spriteset_Base.prototype.createLowerLayer = function () {
    _Spriteset_Base_createLowerLayer.call(this);
    this.createGridSprite();
  };

  Spriteset_Base.prototype.createGridSprite = function () {
    var size = getParamNumber(
      ["GridSize", "グリッドサイズ"],
      0,
      Math.max(this.width, this.height)
    );
    if (size === 0) return;
    this._gridSprite = new Sprite();
    this._gridSprite.setFrame(0, 0, this.width, this.height);
    var bitmap = new Bitmap(this.width, this.height);
    for (var x = 0; x < this.width; x += size) {
      bitmap.fillRect(x, 0, 1, this.height, "rgba(255,255,255,1.0)");
    }
    for (var y = 0; y < this.height; y += size) {
      bitmap.fillRect(0, y, this.width, 1, "rgba(255,255,255,1.0)");
    }
    this._gridSprite.bitmap = bitmap;
    this.addChild(this._gridSprite);
  };

  //=============================================================================
  // Sprite_Picture
  //  テストイベント時にピクチャを掴みます。
  //=============================================================================
  var _Sprite_Picture_initialize = Sprite_Picture.prototype.initialize;
  Sprite_Picture.prototype.initialize = function (pictureId) {
    _Sprite_Picture_initialize.call(this, pictureId);
    this._holding = false;
    this._dx = 0;
    this._dy = 0;
  };

  Sprite_Picture.prototype.checkDrag = function () {
    var picture = this.picture();
    if (picture != null) {
      if (this.updateDragMove()) {
        var result =
          "PictureNum:[" +
          this._pictureId +
          "] X:[" +
          this.x +
          "] Y:[" +
          this.y +
          "]";
        $gameScreen._lastPictureX = this.x;
        $gameScreen._lastPictureY = this.y;
        $gameScreen._infoPicture = result;
        $gameScreen._infoCopy = "";
        if (!this._holding) console.log(result);
        picture.resetMove(this.x, this.y);
        return true;
      }
    }
    return false;
  };

  Sprite_Picture.prototype.updateDragMove = function () {
    if (this.isTriggered() || (this._holding && TouchInput.isPressed())) {
      if (!this._holding) this.hold();
      var x = TouchInput.x - this._dx;
      var y = TouchInput.y - this._dy;
      if (Input.isPressed("control")) {
        var size = getParamNumber(
          ["GridSize", "グリッドサイズ"],
          0,
          Math.max(this.width, this.height)
        );
        if (size !== 0) {
          x % size > size / 2 ? (x += size - (x % size)) : (x -= x % size);
          y % size > size / 2 ? (y += size - (y % size)) : (y -= y % size);
        }
      }
      this.move(x, y);
      return true;
    } else if (this._holding) {
      this.release();
      return true;
    }
    return false;
  };

  Sprite_Picture.prototype.hold = function () {
    this._holding = true;
    this._dx = TouchInput.x - this.x;
    this._dy = TouchInput.y - this.y;
    this.setBlendColor([255, 255, 255, 192]);
  };

  Sprite_Picture.prototype.release = function () {
    this._holding = false;
    this.setBlendColor([0, 0, 0, 0]);
  };

  //=============================================================================
  // Sprite_Picture
  //  タッチ操作を可能にする共通部分
  //=============================================================================
  Sprite_Picture.prototype.screenWidth = function () {
    return (this.width || 0) * this.scale.x;
  };

  Sprite_Picture.prototype.screenHeight = function () {
    return (this.height || 0) * this.scale.y;
  };

  Sprite_Picture.prototype.screenX = function () {
    return (this.x || 0) - this.anchor.x * this.screenWidth();
  };

  Sprite_Picture.prototype.screenY = function () {
    return (this.y || 0) - this.anchor.y * this.screenHeight();
  };

  Sprite_Picture.prototype.minX = function () {
    var width = this.screenWidth();
    return Math.min(this.screenX(), this.screenX() + width);
  };

  Sprite_Picture.prototype.minY = function () {
    var height = this.screenHeight();
    return Math.min(this.screenY(), this.screenY() + height);
  };

  Sprite_Picture.prototype.maxX = function () {
    var width = this.screenWidth();
    return Math.max(this.screenX(), this.screenX() + width);
  };

  Sprite_Picture.prototype.maxY = function () {
    var height = this.screenHeight();
    return Math.max(this.screenY(), this.screenY() + height);
  };

  Sprite_Picture.prototype.isTouchPosInRect = function () {
    var dx = TouchInput.x - this.x;
    var dy = TouchInput.y - this.y;
    var sin = Math.sin(-this.rotation);
    var cos = Math.cos(-this.rotation);
    var rx = this.x + Math.floor(dx * cos + dy * -sin);
    var ry = this.y + Math.floor(dx * sin + dy * cos);
    return (
      rx >= this.minX() &&
      rx <= this.maxX() &&
      ry >= this.minY() &&
      ry <= this.maxY()
    );
  };

  Sprite_Picture.prototype.isTouchable = function () {
    return (
      this.bitmap != null &&
      this.visible &&
      this.scale.x !== 0 &&
      this.scale.y !== 0
    );
  };

  Sprite_Picture.prototype.isTriggered = function () {
    return this.isTouchEvent(TouchInput.isTriggered);
  };

  Sprite_Picture.prototype.isTouchEvent = function (triggerFunc) {
    return (
      this.isTouchable() &&
      triggerFunc.call(TouchInput) &&
      this.isTouchPosInRect()
    );
  };
})();


code:
//=============================================================================
// AltMenuScreen.js
//=============================================================================

/*:
 * @plugindesc Alternative menu screen layout.
 * @author Yoji Ojima
 *
 * @help This plugin does not provide plugin commands.
 */

/*:ja
 * @plugindesc メニュー画面のレイアウトを変更します。
 * @author Yoji Ojima
 *
 * @help このプラグインには、プラグインコマンドはありません。
 */

(function () {
  var _Scene_Menu_create = Scene_Menu.prototype.create;
  Scene_Menu.prototype.create = function () {
    _Scene_Menu_create.call(this);
    this._statusWindow.x = 0;
    this._statusWindow.y = this._commandWindow.height;
    this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
  };

  Window_MenuCommand.prototype.windowWidth = function () {
    return Graphics.boxWidth;
  };

  Window_MenuCommand.prototype.maxCols = function () {
    return 4;
  };

  Window_MenuCommand.prototype.numVisibleRows = function () {
    return 2;
  };

  Window_MenuStatus.prototype.windowWidth = function () {
    return Graphics.boxWidth;
  };

  Window_MenuStatus.prototype.windowHeight = function () {
    var h1 = this.fittingHeight(1);
    var h2 = this.fittingHeight(2);
    return Graphics.boxHeight - h1 - h2;
  };

  Window_MenuStatus.prototype.maxCols = function () {
    return 4;
  };

  Window_MenuStatus.prototype.numVisibleRows = function () {
    return 1;
  };

  Window_MenuStatus.prototype.drawItemImage = function (index) {
    var actor = $gameParty.members()[index];
    var rect = this.itemRectForText(index);
    var w = Math.min(rect.width, 144);
    var h = Math.min(rect.height, 144);
    var lineHeight = this.lineHeight();
    this.changePaintOpacity(actor.isBattleMember());
    this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
    this.changePaintOpacity(true);
  };

  Window_MenuStatus.prototype.drawItemStatus = function (index) {
    var actor = $gameParty.members()[index];
    var rect = this.itemRectForText(index);
    var x = rect.x;
    var y = rect.y;
    var width = rect.width;
    var bottom = y + rect.height;
    var lineHeight = this.lineHeight();
    this.drawActorName(actor, x, y + lineHeight * 0, width);
    this.drawActorLevel(actor, x, y + lineHeight * 1, width);
    this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
    this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
    this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
    this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
  };

  var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
  Window_MenuActor.prototype.initialize = function () {
    _Window_MenuActor_initialize.call(this);
    this.y = this.fittingHeight(2);
  };
})();


code:
//=============================================================================
// AltSaveScreen.js
//=============================================================================

/*:
 * @plugindesc Alternative save/load screen layout.
 * @author Yoji Ojima
 *
 * @help This plugin does not provide plugin commands.
 */

/*:ja
 * @plugindesc セーブ／ロード画面のレイアウトを変更します。
 * @author Yoji Ojima
 *
 * @help このプラグインには、プラグインコマンドはありません。
 */

(function () {
  var _Scene_File_create = Scene_File.prototype.create;
  Scene_File.prototype.create = function () {
    _Scene_File_create.call(this);
    this._listWindow.height = this._listWindow.fittingHeight(8);
    var x = 0;
    var y = this._listWindow.y + this._listWindow.height;
    var width = Graphics.boxWidth;
    var height = Graphics.boxHeight - y;
    this._statusWindow = new Window_SavefileStatus(x, y, width, height);
    this._statusWindow.setMode(this.mode());
    this._listWindow.statusWindow = this._statusWindow;
    this._listWindow.callUpdateHelp();
    this.addWindow(this._statusWindow);
  };

  var _Scene_File_start = Scene_File.prototype.start;
  Scene_File.prototype.start = function () {
    _Scene_File_start.call(this);
    this._listWindow.ensureCursorVisible();
    this._listWindow.callUpdateHelp();
  };

  Window_SavefileList.prototype.windowWidth = function () {
    return Graphics.boxWidth;
  };

  Window_SavefileList.prototype.maxCols = function () {
    return 4;
  };

  Window_SavefileList.prototype.numVisibleRows = function () {
    return 5;
  };

  Window_SavefileList.prototype.spacing = function () {
    return 8;
  };

  Window_SavefileList.prototype.itemHeight = function () {
    return this.lineHeight() * 2;
  };

  var _Window_SavefileList_callUpdateHelp =
    Window_SavefileList.prototype.callUpdateHelp;
  Window_SavefileList.prototype.callUpdateHelp = function () {
    _Window_SavefileList_callUpdateHelp.call(this);
    if (this.active && this.statusWindow) {
      this.statusWindow.setId(this.index() + 1);
    }
  };

  function Window_SavefileStatus() {
    this.initialize.apply(this, arguments);
  }

  Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
  Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;

  Window_SavefileStatus.prototype.initialize = function (x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this._id = 1;
  };

  Window_SavefileStatus.prototype.setMode = function (mode) {
    this._mode = mode;
  };

  Window_SavefileStatus.prototype.setId = function (id) {
    this._id = id;
    this.refresh();
  };

  Window_SavefileStatus.prototype.refresh = function () {
    this.contents.clear();
    var id = this._id;
    var valid = DataManager.isThisGameFile(id);
    var info = DataManager.loadSavefileInfo(id);
    var rect = this.contents.rect;
    this.resetTextColor();
    if (this._mode === "load") {
      this.changePaintOpacity(valid);
    }
    this.drawFileId(id, rect.x, rect.y);
    if (info) {
      this.changePaintOpacity(valid);
      this.drawContents(info, rect, valid);
      this.changePaintOpacity(true);
    }
  };

  Window_SavefileStatus.prototype.drawFileId = function (id, x, y) {
    this.drawText(TextManager.file + " " + id, x, y, 180);
  };

  Window_SavefileStatus.prototype.drawContents = function (info, rect, valid) {
    var bottom = rect.y + rect.height;
    var playtimeY = bottom - this.lineHeight();
    this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
    if (valid) {
      this.drawPartyfaces(info, rect.x, bottom - 144);
    }
    this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right");
  };

  Window_SavefileStatus.prototype.drawPartyfaces = function (info, x, y) {
    if (info && info.faces) {
      for (var i = 0; i < info.faces.length; i++) {
        var data = info.faces[i];
        this.drawFace(data[0], data[1], x + i * 150, y);
      }
    }
  };
})();


code:
//=============================================================================
// BB_WindowSelector3.js
//=============================================================================

/*:
 * @plugindesc ウインドウスキンと切り替えるプラグイン。
 * @author ビービー
 *
 * @param Variable ID
 * @desc 指定したIDの変数が2の時にWindow2が3のときにWindow3が表示されます。
 * それ以外のときはデフォルトのWindowが表示されます。default：0
 * @default 0
 *
 * @param Window1 Opacity
 * @desc 指定したIDの変数の数値によってウインドウの透明度を調節します。default：192
 * @default 192
 *
 * @param Window2 Opacity
 * @desc 指定したIDの変数の数値によってウインドウの透明度を調節します。default：192
 * @default 192
 *
 * @param Window3 Opacity
 * @desc 指定したIDの変数の数値によってウインドウの透明度を調節します。default：192
 * @default 192
 *
 * @param Window1 OutlineColor
 * @desc Windowの文字枠の色を変更します。R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。default：rgba(0, 0, 0, 0.5)
 * @default rgba(0, 0, 0, 0.5)
 *
 * @param Window1 OutlineWidth
 * @desc Windowの文字枠の幅を変更します。default：4
 * @default 4
 *
 * @param Window2 OutlineColor
 * @desc Window2の文字枠の色を変更します。R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。default：rgba(0, 0, 0, 0.5)
 * @default rgba(0, 0, 0, 0.5)
 *
 * @param Window2 OutlineWidth
 * @desc Windowの文字枠の幅を変更します。default：4
 * @default 4
 *
 * @param Window3 OutlineColor
 * @desc Window3の文字枠の色を変更します。R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。default：rgba(0, 0, 0, 0.5)
 * @default rgba(0, 0, 0, 0.5)
 *
 * @param Window3 OutlineWidth
 * @desc Windowの文字枠の幅を変更します。default：4
 * @default 4
 *
 * @param Window1 DimmerColor
 * @desc Window1を暗くするに設定した時の背景色。
 * default：rgba(0, 0, 0, 0.6)
 * @default rgba(0, 0, 0, 0.6)
 *
 * @param Window1 DimGradationColor
 * @desc Window1を暗くするに設定した時の背景色グラデーション。
 * default：rgba(0, 0, 0, 0)
 * @default rgba(0, 0, 0, 0)
 *
 * @param Window2 DimmerColor
 * @desc Window2を暗くするに設定した時の背景色。
 * default：rgba(0, 0, 0, 0.6)
 * @default rgba(0, 0, 0, 0.6)
 *
 * @param Window2 DimGradationColor
 * @desc Window2を暗くするに設定した時の背景色グラデーション。
 * default：rgba(0, 0, 0, 0)
 * @default rgba(0, 0, 0, 0)
 *
 * @param Window3 DimmerColor
 * @desc Window3を暗くするに設定した時の背景色。
 * default：rgba(0, 0, 0, 0.6)
 * @default rgba(0, 0, 0, 0.6)
 *
 * @param Window3 DimGradationColor
 * @desc Window3を暗くするに設定した時の背景色グラデーション。
 * default：rgba(0, 0, 0, 0)
 * @default rgba(0, 0, 0, 0)
 *
 * @help Variable ID：パラメータで指定したIDの変数が2の時にWindow2が表示され、
 * 3のときにはWindow3が表示されます。それ以外のときはWindowを表示します。
 * --------------------------------------------------------------------------
 * Window1～3 Opacity：それぞれのウインドウの透明度を設定できます。
 * 透明度範囲＝0～255。デフォルト＝192。
 * --------------------------------------------------------------------------
 * ウインドウはそれぞれ文字枠色、文字枠幅を調節できます。
 * 変更されるのはメッセージウインドウのみです。
 *
 * OutlineColor：文字枠の色を変更します。
 * デフォルト：rgba(0, 0, 0, 0.5)
 * R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。
 * RGB(赤緑青)は0～255(0=明るい,255=暗い)の間で指定、A(強さ)は0～1(0=透明,1=不透明)の間で指定。
 *
 * OutlineWidth：Windowの文字枠の幅を変更します。
 * デフォルト：4
 * --------------------------------------------------------------------------
 * ウインドウを暗くするに設定した場合の背景色を指定できます。
 *
 * DimmerColor：背景中央部分の色指定。
 * デフォルト：rgba(0, 0, 0, 0.6)
 * R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。
 * RGB(赤緑青)は0～255(0=明るい,255=暗い)の間で指定、A(強さ)は0～1(0=透明,1=不透明)の間で指定。
 *
 * DimGradationColor：背景上下グラデーション部分の色指定。
 * デフォルト：rgba(0, 0, 0, 0)
 * R(赤),G(緑),B(青),A(強さ)の順番でカンマ(,)区切りで指定。
 * RGB(赤緑青)は0～255(0=明るい,255=暗い)の間で指定、A(強さ)は0～1(0=透明,1=不透明)の間で指定。
 * --------------------------------------------------------------------------
 * 利用規約：
 * 作者に無断で改変、再配布が可能で、利用形態（商用、18禁利用等）
 * についても制限はありません。
 *
 * BLOG:http://bb-entertainment-blog.blogspot.jp/
 *
 */

(function () {
  var parameters = PluginManager.parameters("BB_WindowSelector3");
  var BBWSvar = Number(parameters["Variable ID"] || "0");
  var BBWS1o = Number(parameters["Window1 Opacity"] || "192");
  var BBWS2o = Number(parameters["Window2 Opacity"] || "192");
  var BBWS3o = Number(parameters["Window3 Opacity"] || "192");
  var BBWS1oc = String(
    parameters["Window1 OutlineColor"] || "rgba(0, 0, 0, 0.5)"
  );
  var BBWS1ow = Number(parameters["Window1 OutlineWidth"] || "4");
  var BBWS2oc = String(
    parameters["Window2 OutlineColor"] || "rgba(0, 0, 0, 0.5)"
  );
  var BBWS2ow = Number(parameters["Window2 OutlineWidth"] || "4");
  var BBWS3oc = String(
    parameters["Window3 OutlineColor"] || "rgba(0, 0, 0, 0.5)"
  );
  var BBWS3ow = Number(parameters["Window3 OutlineWidth"] || "4");
  var BBWS1dm = String(
    parameters["Window1 DimmerColor"] || "rgba(0, 0, 0, 0.6)"
  );
  var BBWS2dm = String(
    parameters["Window1 DimGradationColor"] || "rgba(0, 0, 0, 0)"
  );
  var BBWS3dm = String(
    parameters["Window2 DimmerColor"] || "rgba(0, 0, 0, 0.6)"
  );
  var BBWS4dm = String(
    parameters["Window2 DimGradationColor"] || "rgba(0, 0, 0, 0)"
  );
  var BBWS5dm = String(
    parameters["Window3 DimmerColor"] || "rgba(0, 0, 0, 0.6)"
  );
  var BBWS6dm = String(
    parameters["Window3 DimGradationColor"] || "rgba(0, 0, 0, 0)"
  );

  // 画像の読み込み
  var _Scene_Boot_prototype_loadSystemWindowImage =
    Scene_Boot.prototype.loadSystemWindowImage;
  Scene_Boot.prototype.loadSystemWindowImage = function () {
    ImageManager.loadSystem("Window");
    ImageManager.loadSystem("Window2");
    ImageManager.loadSystem("Window3");
  };

  // ウインドウ画像の切り替え
  var _Window_Base_prototype_update = Window_Base.prototype.update;
  Window_Base.prototype.update = function () {
    Window.prototype.update.call(this);
    if ($gameVariables.value(BBWSvar) == 3) {
      this.windowskin = ImageManager.loadSystem("Window3");
      this.backOpacity = BBWS3o;
      this.contents.outlineColor = BBWS3oc;
      this.contents.outlineWidth = BBWS3ow;
    } else if ($gameVariables.value(BBWSvar) == 2) {
      this.windowskin = ImageManager.loadSystem("Window2");
      this.backOpacity = BBWS2o;
      this.contents.outlineColor = BBWS2oc;
      this.contents.outlineWidth = BBWS2ow;
    } else {
      this.windowskin = ImageManager.loadSystem("Window");
      this.backOpacity = BBWS1o;
      this.contents.outlineColor = BBWS1oc;
      this.contents.outlineWidth = BBWS1ow;
    }
    this.updateTone();
    this.updateOpen();
    this.updateClose();
    this.updateBackgroundDimmer();
  };

  var _Window_Base_prototype_updateBackgroundDimmer =
    Window_Base.prototype.updateBackgroundDimmer;
  Window_Base.prototype.updateBackgroundDimmer = function () {
    if (this._dimmerSprite) {
      this._dimmerSprite.opacity = this.openness;
      this.refreshDimmerBitmap();
    }
  };

  var _Window_Base_prototype_refreshDimmerBitmap =
    Window_Base.prototype.refreshDimmerBitmap;
  Window_Base.prototype.refreshDimmerBitmap = function () {
    if (this._dimmerSprite) {
      var bitmap = this._dimmerSprite.bitmap;
      var w = this.width;
      var h = this.height;
      var m = this.padding;
      if ($gameVariables.value(BBWSvar) == 3) {
        var c1 = this.dimColor5();
        var c2 = this.dimColor6();
      } else if ($gameVariables.value(BBWSvar) == 2) {
        var c1 = this.dimColor3();
        var c2 = this.dimColor4();
      } else {
        var c1 = this.dimColor1();
        var c2 = this.dimColor2();
      }
      bitmap.resize(w, h);
      bitmap.gradientFillRect(0, 0, w, m, c2, c1, true);
      bitmap.fillRect(0, m, w, h - m * 2, c1);
      bitmap.gradientFillRect(0, h - m, w, m, c1, c2, true);
      this._dimmerSprite.setFrame(0, 0, w, h);
    }
  };

  var _Window_Base_prototype_dimColor1 = Window_Base.prototype.dimColor1;
  Window_Base.prototype.dimColor1 = function () {
    return BBWS1dm;
  };

  var _Window_Base_prototype_dimColor21 = Window_Base.prototype.dimColor2;
  Window_Base.prototype.dimColor2 = function () {
    return BBWS2dm;
  };

  var _Window_Base_prototype_dimColor3 = Window_Base.prototype.dimColor3;
  Window_Base.prototype.dimColor3 = function () {
    return BBWS3dm;
  };

  var _Window_Base_prototype_dimColor4 = Window_Base.prototype.dimColor4;
  Window_Base.prototype.dimColor4 = function () {
    return BBWS4dm;
  };

  var _Window_Base_prototype_dimColor5 = Window_Base.prototype.dimColor5;
  Window_Base.prototype.dimColor5 = function () {
    return BBWS5dm;
  };

  var _Window_Base_prototype_dimColor6 = Window_Base.prototype.dimColor6;
  Window_Base.prototype.dimColor6 = function () {
    return BBWS6dm;
  };
})();


code:
//=============================================================================
// rpg_managers.jsから抜き出し
//=============================================================================

/*:
 * @plugindesc 背景ぼかさないよ
 * @author ゆわか
 *
 * @help プラグインコマンドはありません。
 *
 * 戦闘背景を指定せずに戦闘をした時に戦闘背景として表示されたり
 * メニューを呼び出したときに表示されるマップ画像をぼかさないプラグインです。
 *
 * 使用報告不要・クレジット不要・改変可・商用利用可
 * もし何か問題が起きても、当方は一切責任を負いません。ご了承ください。
 */

SceneManager.snapForBackground = function () {
  this._backgroundBitmap = this.snap();
  //    this._backgroundBitmap.blur();
};