var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError( "Class extends value " + String(b) + " is not a constructor or null" ); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __()); }; })(); var Sprite_Picture_prototype_drawEro = Sprite_Picture.prototype.drawEro; Sprite_Picture.prototype.drawEro = function (file) { $gameAvJacketMaker.clear(); Sprite_Picture_prototype_drawEro.call(this, file); }; var _Sprite_Picture_prototype_selectEro2Texture = Sprite_Picture.prototype.selectEro2Texture; Sprite_Picture.prototype.selectEro2Texture = function (s, file, fileId, index) { var texture = _Sprite_Picture_prototype_selectEro2Texture.call( this, s, file, fileId, index ); if (texture) { var id = texture.textureCacheIds[0]; $gameAvJacketMaker.addEro(id); } return texture; }; var TITLE_FONT_SIZE = 18; var SUBTITLE_FONT_SIZE = 12; var JacketScale; (function (JacketScale) { JacketScale[(JacketScale["scale1"] = 1)] = "scale1"; JacketScale[(JacketScale["scale2"] = 2.5)] = "scale2"; JacketScale[(JacketScale["scale3"] = 3.35)] = "scale3"; })(JacketScale || (JacketScale = {})); var Sprite_AvScreenShot = /** @class */ (function (_super) { __extends(Sprite_AvScreenShot, _super); function Sprite_AvScreenShot(ss, originCenter) { if (originCenter === void 0) { originCenter = true; } var _this = _super.call(this) || this; _this._ss = ss; _this._originCenter = originCenter; if (!ss) { console.error("ss is null"); } _this.makeJacket(); return _this; } Sprite_AvScreenShot.prototype.makeJacket = function () { this._sprite = new PIXI.Sprite(); if (this._originCenter) { this._sprite.x = -148 / 2; this._sprite.y = -this.spriteHight() / 2; } this.addChild(this._sprite); var list = this._ss.eroImageList(); for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { var file = list_1[_i]; var f = "av_" + file; var t = PIXI.utils.TextureCache[f]; if (!t) { console.error(f + "のAV Jacketファイルが見つかりません"); continue; } var s = new PIXI.Sprite(t); this._sprite.addChild(s); if (this._ss.manColor() > 0) { if (t.textureCacheIds.length > 0) { if (t.textureCacheIds[0].includes("man")) { var s2 = new PIXI.Sprite(t); this._sprite.addChild(s2); setManColorFilter(this._ss.manColor(), s2); } } } } }; Sprite_AvScreenShot.prototype.destroy = function (options) { this.removeChild(this._sprite); _super.prototype.destroy.call(this, options); }; Sprite_AvScreenShot.prototype.spriteHight = function () { return 92; }; Sprite_AvScreenShot.prototype.setScreenShot = function (ss) { this._ss = ss; if (this._sprite) { this.removeChild(this._sprite); } this.makeJacket(); }; return Sprite_AvScreenShot; })(Sprite); var Sprite_AvActor = /** @class */ (function (_super) { __extends(Sprite_AvActor, _super); function Sprite_AvActor(avJacket) { var _this = _super.call(this) || this; _this._avJacket = avJacket; _this._avActor = avJacket.avActor(); return _this; } Sprite_AvActor.prototype.refresh = function () { this.removeChildren(); if (this._avJacket.manZIndex() == ManZIndex.back) { this.refreshMan(); this.refreshActor(); } else { this.refreshActor(); this.refreshMan(); } }; Sprite_AvActor.prototype.refreshActor = function () { var a = $gameActors.actor(this._avActor.actorId()); var actor = JsonEx.makeDeepCopy(a); this._avActor._cos.restoreCostume(actor); actor.setNaked(false); actor.setBote(this._avActor._cos.boteId()); var faceId = this._avActor._cos.faceId(); this.drawActor(actor, faceId, this._avJacket.actorOffsetX(), 0); }; Sprite_AvActor.prototype.refreshMan = function () { if (!this._avJacket.isManTachieEnabled()) { return; } var actorId = this._avJacket.manId(); if (actorId < 0) { return; } var a = $gameActors.actor(actorId); var actor = JsonEx.makeDeepCopy(a); var faceId = 1; if (this._avJacket.manCos()) { this._avJacket.manCos().restoreCostume(actor); faceId = this._avJacket.manCos().faceId(); } this.drawActor(actor, faceId, this._avJacket.manX(), this._avJacket.manY()); }; Sprite_AvActor.prototype.drawActor = function ( actor, faceId, offsetX, offsetY ) { if (!actor) { return; } var jacketScale = this.jacketScale(); offsetY += this._avJacket.actorOffsetY(actor.actorId()); var actorPos = Nore.Tachie.offset[actor.actorId()]; var x = this.actorX(actor.actorId()) * jacketScale + offsetX * jacketScale - actorPos.x; var y = this.actorY(actor.actorId()) * jacketScale + offsetY * jacketScale - actorPos.y; var scale = this._avJacket.scale() * jacketScale; if (scale > 1 && scale < 1.01) { scale = 1; } this.drawTachieActor( actor, this, Math.round(x), Math.round(y), null, faceId, scale, false, false, 1, 100 ); }; Sprite_AvActor.prototype.jacketScale = function () { return 1; }; Sprite_AvActor.prototype.actorX = function (actorId) { switch (actorId) { case 4: return -14; case 5: return -15; case 8: return -15; case 9: return -2; case 10: return 6; case 11: return -3; case 13: return -12; case 16: return -33; case 17: return -20; case 18: return -25; case 19: return -20; case 20: return -14; case 21: return -24; } return 0; }; Sprite_AvActor.prototype.actorY = function (actorId) { var base = -40; switch (actorId) { case 3: return base - 23; case 4: return base + 10; case 5: return base - 32; case 8: return base - 0; case 9: return base + 10; case 10: return base + 10; case 11: return base - 0; case 13: return base - 4; case 16: return base - 10; case 17: return base - 10; case 21: return base - 20; } return base; }; Sprite_AvActor.prototype.update = function () { _super.prototype.update.call(this); if (this._avActor && this._avActor.isDirty()) { this.refresh(); } }; return Sprite_AvActor; })(Sprite); var Sprite_JacketText = /** @class */ (function (_super) { __extends(Sprite_JacketText, _super); function Sprite_JacketText(avJacket, spriteWidth, jacketScale, fontSize) { var _this = _super.call(this) || this; _this._textColor = new TextColor(1); _this._avJacket = avJacket; _this._spriteWidth = spriteWidth; _this._jacketScale = jacketScale; _this._fontSize = fontSize; _this._avText = _this._avJacket.avText(); _this.bitmap = new BitmapNoOutline(_this.spriteWidth(), 220 * jacketScale); return _this; } Sprite_JacketText.prototype.textIndex = function () { switch (this._fontSize) { case FontSize.title: return 1; case FontSize.smallTitle: return 1; case FontSize.sub: return 2; case FontSize.smallSub: return 2; } }; Sprite_JacketText.prototype.spriteWidth = function () { return this._spriteWidth; }; Sprite_JacketText.prototype.spriteHeight = function () { return 100; }; Sprite_JacketText.prototype.setText = function (text) { this._text = text; }; Sprite_JacketText.prototype.refresh = function () { this.bitmap.clear(); this.drawText(); this.updateFilter(); }; Sprite_JacketText.prototype.drawText = function () { if (!this._text) { return; } this.bitmap.fontBold = true; //this._avText.isBold(); this.bitmap.textColor = this._textColor.textColorMz(); this.bitmap.outlineWidth = 0; this.bitmap.fontFace = this._avText.fontFace(this.textIndex()); this.bitmap.fontSize = this._fontSize; if (this._avJacket.isVertical()) { this.drawVertialTitle(this._text, 0); } else { this.bitmap.drawText( this._text, 0, 5 * this._jacketScale, this.spriteWidth() - 10, 40, "center" ); } }; Sprite_JacketText.prototype.updateFilter = function () { var thickness = this._avJacket.avText().outlineThickness1(); if (this._fontSize == FontSize.sub || this._fontSize == FontSize.smallSub) { thickness = this._avJacket.avText().outlineThickness2(); } this.filters = this._textColor.makeFilters(this._fontSize, thickness); }; Sprite_JacketText.prototype.glowFilterDistance = function () { switch (this._jacketScale) { case JacketScale.scale1: return 4; case JacketScale.scale2: return 8; case JacketScale.scale3: return 10; default: console.error("不正なスケールです:" + this._jacketScale); } }; Sprite_JacketText.prototype.outlineFilterWidth = function () { if (this._spriteWidth > 200) { return 3; } else { return 2; } }; Sprite_JacketText.prototype.pixiColor = function () { var r = parseInt(this._outlineColor.substring(1, 3), 16) * 256 * 256; var g = parseInt(this._outlineColor.substring(3, 5), 16) * 256; var b = parseInt(this._outlineColor.substring(5, 7), 16); return r + g + b; }; Sprite_JacketText.prototype.plainColor = function () { var rate = 1.1; var r = parseInt(this._color.substring(1, 3), 16); r += Math.floor((256 - r) / rate); var g = parseInt(this._color.substring(3, 5), 16); g += Math.floor((256 - g) / rate); var b = parseInt(this._color.substring(5, 7), 16); b += Math.floor((256 - b) / rate); //p(this._color) var rString = r.toString(16); if (rString.length == 0) { rString = "0" + rString; } var gString = g.toString(16); if (gString.length == 0) { gString = "0" + gString; } var bString = b.toString(16); if (bString.length == 0) { bString = "0" + bString; } return "#" + rString + gString + bString; }; Sprite_JacketText.prototype.setFontSize = function (n) { if (this._fontSize == n) { return; } this._fontSize = n; }; Sprite_JacketText.prototype.setTextColor = function (c) { if (this._textColor.id() == c.id()) { return; } this._textColor = c; }; Sprite_JacketText.prototype.isShorter = function (text) { if (this._fontSize == FontSize.sub) { return false; } if (this._fontSize == FontSize.smallSub) { return false; } return text.length >= 13; }; Sprite_JacketText.prototype.isShorter12 = function (text) { if (this._fontSize == FontSize.sub) { return false; } if (this._fontSize == FontSize.smallSub) { return false; } return text.length >= 12; }; Sprite_JacketText.prototype.drawVertialTitle = function (text, x) { var y = this.textStartY(); if (this.isShorter(text)) { y -= 12; } else if (this.isShorter12(text)) { if (this._fontSize == FontSize.title) { y -= 12; } else { y -= 4; } } for (var i = 0; i < text.length; i++) { var c = text.charAt(i); this.drawCharacter(c, y); y += this._fontSize + 1; y += this.packY(text); } }; Sprite_JacketText.prototype.packY = function (text) { if (this.isShorter(text)) { if (this._fontSize == FontSize.title) { return -7; } else { return -2; } } else if (this.isShorter12(text)) { return -2; } return 0; }; Sprite_JacketText.prototype.drawCharacter = function (c, y) { if (this.isRotationChar(c)) { this.drawRotationChar(c, y); } else if (this.isPunctuationMark(c)) { this.drawPunctuationMark(c, y); } else if (this.isMiniCharacter(c)) { this.drawMiniCharacter(c, y); } else { if (this._jacketScale == JacketScale.scale3) { this.bitmap.drawText(c, 0, y, 60, 30, "center"); } else { this.bitmap.drawText(c, 0, y, 50, 30, "center"); } } }; Sprite_JacketText.prototype.isRotationChar = function (c) { switch (c) { case "ー": case "ー": case "~": case "-": case "…": case "【": case "】": case "『": case "』": case "「": case "」": case "(": case ")": case "(": case ")": case "<": case ">": case "{": case "}": case "{": case "}": case "=": case "=": return true; } return false; }; Sprite_JacketText.prototype.drawRotationChar = function (c, y) { if (this._spriteWidth > 200) { if (this._fontSize == FontSize.sub) { this.bitmap.drawTextRotate(c, -4, y - 8, 50, 30, "center"); } else { this.bitmap.drawTextRotate(c, -9, y - 14, 50, 30, "center"); } } else { this.bitmap.drawTextRotate(c, 2, y + 1, 50, 30, "center"); } }; Sprite_JacketText.prototype.isPunctuationMark = function (c) { switch (c) { case "、": case "。": return true; } return false; }; Sprite_JacketText.prototype.drawPunctuationMark = function (c, y) { if (this._spriteWidth > 200) { if (this._fontSize == FontSize.title) { this.bitmap.drawText(c, 0 + 31, y - 22, 50, 30, "center"); } else { this.bitmap.drawText(c, 0 + 26, y - 15, 50, 30, "center"); } } else { this.bitmap.drawText(c, 0 + 8, y - 6, 50, 30, "center"); } }; Sprite_JacketText.prototype.isMiniCharacter = function (c) { switch (c) { case "ぁ": case "ぃ": case "ぅ": case "ぇ": case "ぉ": case "ゃ": case "ょ": case "ゅ": case "っ": case "ァ": case "ィ": case "ゥ": case "ェ": case "ォ": case "ッ": case "ャ": case "ュ": case "ョ": return true; } }; Sprite_JacketText.prototype.drawMiniCharacter = function (c, y) { var offsetX = Math.floor(this._fontSize / 8); var offsetY = Math.floor(this._fontSize / 8); if (this._fontSize == FontSize.title) { offsetX += 6; offsetY += 4; } if (this._fontSize == FontSize.sub) { offsetX += 3; offsetY += 3; } this.bitmap.drawText(c, 0 + offsetX, y - offsetY, 50, 30, "center"); }; Sprite_JacketText.prototype.textStartY = function () { return 10 * this._jacketScale; }; return Sprite_JacketText; })(Sprite); var TextColor = /** @class */ (function () { function TextColor(weaponId) { this._weaponId = weaponId; } TextColor.prototype.textColor = function () { return parseInt(this.weapon().meta["color"], 16); }; TextColor.prototype.textColorMz = function () { return "#" + this.weapon().meta["color"]; }; TextColor.prototype.weapon = function () { return $dataWeapons[this._weaponId]; }; TextColor.prototype.id = function () { return this._weaponId; }; TextColor.prototype.makeFilters = function (fontSize, thickness) { var filters = []; filters.push(this.makeOutlineFiler(1, fontSize, thickness)); filters.push(this.makeOutlineFiler(2, fontSize, thickness)); filters.push(this.makeGlowFiler(1, fontSize, thickness)); filters.push(this.makeDropShadowFiler(fontSize)); var result = []; for (var _i = 0, filters_1 = filters; _i < filters_1.length; _i++) { var f = filters_1[_i]; if (f) { result.push(f); } } return result; }; TextColor.prototype.makeOutlineFiler = function (index, fontSize, thickness) { var weapon = this.weapon(); if (!weapon.meta["outline%1_color".format(index)]) { return null; } var color = parseInt(weapon.meta["outline%1_color".format(index)], 16); var width = parseInt(weapon.meta["outline%1_width".format(index)]); var filter = new PIXI.filters.OutlineFilter( width * this.outlineScale(fontSize, thickness), color, 0.5 ); return filter; }; TextColor.prototype.makeGlowFiler = function (index, fontSize, thickness) { var weapon = this.weapon(); if (!weapon.meta["glow%1_color".format(index)]) { return null; } var color = parseInt(weapon.meta["glow%1_color".format(index)], 16); var strength = parseInt(weapon.meta["glow%1_strength".format(index)]); var distance = parseInt(weapon.meta["glow%1_distance".format(index)]); distance *= this.glowFilterDistanceRate(fontSize, thickness); var filter = new PIXI.filters.GlowFilter({ distance: distance, outerStrength: strength, color: color, quality: 0.7, }); return filter; }; TextColor.prototype.makeDropShadowFiler = function (fontSize) { var weapon = this.weapon(); if (!weapon.meta["dropShadowColor"]) { return null; } var color = parseInt(weapon.meta["dropShadowColor"], 16); var distance = parseInt(weapon.meta["dropShadowDistance"]); distance *= this.glowFilterDistanceRate(fontSize); if (fontSize == FontSize.smallTitle || fontSize == FontSize.smallSub) { var filter_1 = new PIXI.filters.DropShadowFilter({ color: color, distance: 1, blur: 0, alpha: 1, }); filter_1.offset.x = 1; filter_1.offset.y = 1; return filter_1; } var filter = new PIXI.filters.DropShadowFilter({ color: color, distance: Math.round(distance), blur: 0, alpha: 1, }); return filter; }; TextColor.prototype.outlineScale = function (fontSize, thickness) { var rate = 1; if (thickness == Thickness.thin) { rate = 0.5; } else if (thickness == Thickness.slim) { rate = 0.75; } else if (thickness == Thickness.bold) { rate = 1.25; } switch (fontSize) { case FontSize.title: return 0.5 * rate; case FontSize.sub: return 0.4 * rate; case FontSize.smallTitle: return 0.5 * 0.4; case FontSize.smallSub: return 0.4 * 0.4; default: console.error("不正なフォントサイズです"); } }; TextColor.prototype.glowFilterDistanceRate = function (fontSize, thickness) { var rate = 1; if (thickness == Thickness.thin) { rate = 0.5; } else if (thickness == Thickness.slim) { rate = 0.75; } else if (thickness == Thickness.bold) { rate = 1.25; } switch (fontSize) { case FontSize.title: return 1 * rate; case FontSize.sub: return 0.8 * rate; case FontSize.smallTitle: return 0.3 * rate; case FontSize.smallSub: return 0.24 * rate; default: console.error("不正なスケールです:" + fontSize); } }; return TextColor; })(); var FontSize; (function (FontSize) { FontSize[(FontSize["title"] = 56)] = "title"; FontSize[(FontSize["sub"] = 40)] = "sub"; FontSize[(FontSize["smallTitle"] = 17)] = "smallTitle"; FontSize[(FontSize["smallSub"] = 12)] = "smallSub"; })(FontSize || (FontSize = {})); var Sprite_AvText = /** @class */ (function (_super) { __extends(Sprite_AvText, _super); function Sprite_AvText(avJacket, jacketScale) { if (jacketScale === void 0) { jacketScale = JacketScale.scale1; } var _this = _super.call(this) || this; _this._bottom = false; _this._avJacket = avJacket; _this._jacketScale = jacketScale; _this._avText = avJacket.avText(); _this.bitmap = new BitmapNoOutline( _this.spriteWidth(), _this.spriteHeight() ); _this._text1 = new Sprite_JacketText( _this._avJacket, _this.spriteWidth(), jacketScale, _this.fontSizeTitle() ); _this.addChild(_this._text1); _this._text2 = new Sprite_JacketText( _this._avJacket, _this.spriteWidth(), jacketScale, _this.fontSizeSubTitle() ); _this.addChild(_this._text2); _this.refresh(); return _this; } Sprite_AvText.prototype.spriteWidth = function () { return Math.floor(147 * this._jacketScale); }; Sprite_AvText.prototype.spriteHeight = function () { return Math.floor(200 * this._jacketScale); }; Sprite_AvText.prototype.whiteLineHeight = function () { return Math.ceil(36 * this._jacketScale); }; Sprite_AvText.prototype.fontSizeTitle = function () { if (this._jacketScale == JacketScale.scale3) { return FontSize.title; } else { return FontSize.smallTitle; } //return Math.ceil(TITLE_FONT_SIZE * this._jacketScale); }; Sprite_AvText.prototype.fontSizeSubTitle = function () { if (this._jacketScale == JacketScale.scale3) { return FontSize.sub; } else { return FontSize.smallSub; } //return Math.ceil(SUBTITLE_FONT_SIZE * this._jacketScale); }; Sprite_AvText.prototype.update = function () { _super.prototype.update.call(this); if (this._avText.isDirty()) { this.refresh(); } }; Sprite_AvText.prototype.refresh = function () { if (this._bg) { this.removeChild(this._bg); this._bg = null; } var color1 = this._avText.textColor1(); var color2 = this._avText.textColor2(); this.bitmap.clear(); this._text1.setFontSize(this.fontSizeTitle()); this._text2.setFontSize(this.fontSizeSubTitle()); this._text1.setTextColor(color1); this._text2.setTextColor(color2); this._text1.setText(this._avText.text1()); this._text2.setText(this._avText.text2()); if (this._avJacket.isVertical()) { this.drawTypeVertical3(); } else if (this._avJacket.isTopBottom()) { this.drawTopBottom(); } else { this.drawType3(); } }; Sprite_AvText.prototype.drawTypeVertical3 = function () { this._text1.refresh(); this._text2.refresh(); this._text1.x = 110; this._text1.y = -10; this._text2.x = -14; this._text2.y = -10; }; Sprite_AvText.prototype.drawTopBottom = function () { this._text1.refresh(); this._text2.refresh(); this._text1.x = 2; this._text1.y = 4; this._text2.x = 2; this._text2.y = 150; }; Sprite_AvText.prototype.drawType3 = function () { this.fillBg(); this.addChild(this._text1); this.addChild(this._text2); this._text1.refresh(); this._text2.refresh(); this.updatePositionType3(); }; Sprite_AvText.prototype.lineY = function () { if (this._bottom) { return this.spriteHeight() - this.whiteLineHeight(); } else { return this.centerY(); } }; Sprite_AvText.prototype.updatePositionType3 = function () { var y = this.lineY(); this._text1.x = 2; this._text1.y = y - 13; this._text2.x = 2; this._text2.y = y + 16 - 12; }; Sprite_AvText.prototype.fillBg = function () { var w = this.spriteWidth(); var h = this.whiteLineHeight(); var y; if (this._bottom) { y = this.spriteHeight() - this.whiteLineHeight(); } else { y = this.centerY(); } var dark = new PIXI.Graphics(); dark.beginFill(this.pixiBgColor(), 0.8); dark.drawRect(0, 0, w, h); dark.endFill(); this.addChildAt(dark, 0); dark.y = y; this._bg = dark; }; Sprite_AvText.prototype.centerY = function () { return Math.round(82 * this._jacketScale); }; Sprite_AvText.prototype.pixiBgColor = function () { var layout = $gameAvLayoutManager.colorScheme(1); var color = layout.bgColor(); var r = parseInt(color.substring(1, 3), 16) * 256 * 256; var g = parseInt(color.substring(3, 5), 16) * 256; var b = parseInt(color.substring(5, 7), 16); return r + g + b; }; Sprite_AvText.prototype.setBottom = function (b) { if (this._bottom == b) { return; } this._bottom = b; this.refresh(); }; return Sprite_AvText; })(Sprite); var Sprite_BaseAvJacket = /** @class */ (function (_super) { __extends(Sprite_BaseAvJacket, _super); function Sprite_BaseAvJacket() { return (_super !== null && _super.apply(this, arguments)) || this; } Sprite_BaseAvJacket.prototype.drawFrame = function (rect) { this.drawFrameTop(rect); this.drawFrameBottom(rect); this.drawFrameLeft(rect); this.drawFrameRight(rect); }; Sprite_BaseAvJacket.prototype.drawFrameLeft = function (rect) { var white = new PIXI.Graphics(); white.beginFill(0xffffff, 1); white.drawRect(0, 0, this.outerFrameWidth(), rect.height); white.endFill(); this.addChild(white); }; Sprite_BaseAvJacket.prototype.drawFrameRight = function (rect) { var white = new PIXI.Graphics(); white.beginFill(0xffffff, 1); white.drawRect(0, 0, this.outerFrameWidth(), rect.height); white.x = rect.width - this.outerFrameWidth(); white.endFill(); this.addChild(white); }; Sprite_BaseAvJacket.prototype.drawFrameTop = function (rect) { var white = new PIXI.Graphics(); white.beginFill(0xffffff, 1); white.drawRect(0, 0, rect.width, this.outerFrameWidth()); white.endFill(); this.addChild(white); }; Sprite_BaseAvJacket.prototype.drawFrameBottom = function (rect) { var white = new PIXI.Graphics(); white.beginFill(0xffffff, 1); white.drawRect(0, 0, rect.width, this.outerFrameWidth()); white.y = rect.height - this.outerFrameWidth(); white.endFill(); this.addChild(white); }; Sprite_BaseAvJacket.prototype.frameColor = function () { return 0xffffff; }; Sprite_BaseAvJacket.prototype.createBackSprite = function () { var backItemId = this._avJacket.backItemId(); if (this._avJacket.layout() == 21) { backItemId = 201; // 黒背景 } if (this._avJacket.layout() == 22) { backItemId = 202; // 白背景 } var armor = $dataArmors[backItemId]; if (armor.meta["back"]) { var backId = parseInt(armor.meta["back"]); var t = PIXI.utils.TextureCache["back_" + backId.padZero(3) + ".png"]; var s = new PIXI.Sprite(t); s.scale.x = s.scale.y = this.jacketScale() / JacketScale.scale3; return s; } else if (armor.meta["backColor"]) { var color = armor.meta["backColor"]; var dark = new PIXI.Graphics(); dark.beginFill(parseInt(color), 1); dark.drawRect(0, 0, this.spriteWidth(), this.spriteHeight()); dark.endFill(); var s = new PIXI.Sprite(); s.addChild(dark); return s; } else { console.error("背景画像が不正です:" + backItemId); } }; Sprite_BaseAvJacket.prototype.update = function () { _super.prototype.update.call(this); this.updatePosition(); if (this._avJacket.isDirty()) { this.refresh(); } }; Sprite_BaseAvJacket.prototype.updatePosition = function () { if (this.isAvJacketThumbnail()) { this.updateThumbnailAvJacketPosition(); } else { this.updateAvJacketPosition(); } this.updateAvTextPosition(); }; Sprite_BaseAvJacket.prototype.updateAvTextPosition = function () { if (this._avJacket.isBottom()) { this._avText.setBottom(true); } else { this._avText.setBottom(false); } }; Sprite_BaseAvJacket.prototype.updateAvJacketPosition = function () { var margin = this.margin(); this._screenShot.scale.x = 1; this._screenShot.scale.y = 1; this._screenShot.anchor.x = 0.5; this._screenShot.anchor.y = 0.5; this._screenShot.rotation = 0; this._screenShot.x = this.spriteWidth() / 2; if (this._screenShot.filters && this._screenShot.filters.length > 0) { this._screenShot.filters = []; } if (this._avJacket.isCenter()) { this._screenShot.y = ((200 - this._screenShot.spriteHight()) / 2) * this.jacketScale() + margin; } else { this._screenShot.y = (200 - this._screenShot.spriteHight()) * this.jacketScale() + margin; } this._screenShot.y += this.spriteHeight() / 4; }; Sprite_BaseAvJacket.prototype.updateThumbnailAvJacketPosition = function () { var thumbnail = this._avJacket.thumbnail(); this._screenShot.anchor.x = 0.5; this._screenShot.anchor.y = 0.5; this._screenShot.scale.x = thumbnail.scale(); this._screenShot.scale.y = thumbnail.scale(); this._screenShot.x = (thumbnail.x() / JacketScale.scale3) * this.jacketScale(); this._screenShot.y = (thumbnail.y() / JacketScale.scale3) * this.jacketScale(); this._screenShot.rotation = (thumbnail.angle() * Math.PI) / 180; this._screenShot.visible = true; if (!this._screenShot.filters || this._screenShot.filters.length == 0) { this._screenShot.filters = [this.outlineFilter()]; } }; Sprite_BaseAvJacket.prototype.isAvJacketThumbnail = function () { if (!this._avJacket.isNoScreenShot()) { return false; } return this._avJacket.isThumbnail(); }; Sprite_BaseAvJacket.prototype.refresh = function () { this.refreshBack(); this._avActor.refresh(); this._avText.refresh(); this._avParts.refresh(); this.createBackSprite(); this._screenShot.setScreenShot(this._avJacket.screenShot()); this.refreshBack(); this.updatePosition(); if (this._avJacket.isNoScreenShot()) { if (this._avJacket.isThumbnail()) { this._screenShot.visible = true; } else { this._screenShot.visible = false; } } else { this._screenShot.visible = true; } if (this._avJacket.isCenter()) { this._avActor.visible = false; } else { this._avActor.visible = true; } }; Sprite_BaseAvJacket.prototype.refreshBack = function () { if (this._backSprite) { this._backLayer.removeChild(this._backSprite); } var margin = this.margin(); this._backSprite = this.createBackSprite(); this._backSprite.x = margin; this._backSprite.y = margin; this._backLayer.addChild(this._backSprite); }; Sprite_BaseAvJacket.prototype.destroy = function (options) { this._backLayer.removeChild(this._backSprite); _super.prototype.destroy.call(this, options); }; Sprite_BaseAvJacket.prototype.outlineColor = function () { return 0x000000; }; return Sprite_BaseAvJacket; })(Sprite); var Sprite_AvJacket = /** @class */ (function (_super) { __extends(Sprite_AvJacket, _super); function Sprite_AvJacket(avJacket) { var _this = _super.call(this) || this; var margin = _this.margin(); _this._avJacket = avJacket; _this._screenShot = new Sprite_AvScreenShot(avJacket.screenShot()); _this._screenShot.x = margin; _this._avActor = new Sprite_AvActor(avJacket); _this._avActor.x = margin; _this._avActor.y = margin; _this._avText = new Sprite_AvText(avJacket); _this._avText.x = margin; _this._avText.y = margin; _this._avParts = new Sprite_AvParts(avJacket, JacketScale.scale1); _this._avParts.x = margin; _this._avParts.y = margin; var g = new PIXI.Graphics(); g.beginFill(_this.frameColor(), 1); g.drawRect( 0, 0, _this.spriteWidth() + margin * 2, _this.spriteHeight() + margin * 2 ); g.endFill(); _this.addChild(g); _this._selectedLayer = new PIXI.Sprite(); _this._backLayer = new PIXI.Sprite(); _this.addChild(_this._backLayer); _this.addChild(_this._avActor); _this.addChild(_this._screenShot); _this.addChild(_this._avParts); _this.addChild(_this._avText); var rect = new Rectangle(0, 0, 150, 204); var myMask = new PIXI.Graphics(); myMask.beginFill(0xffffff); myMask.drawRect( rect.x + _this.getGlobalPosition().x, rect.y + _this.getGlobalPosition().y, rect.width, rect.height ); myMask.endFill(); _this.mask = myMask; _this.addChild(_this.mask); _this.drawFrame(rect); _this.addChild(_this._selectedLayer); _this._frame.width = rect.width; _this._frame.height = rect.height; _this.updatePosition(); return _this; } Sprite_AvJacket.prototype.update = function () { _super.prototype.update.call(this); this.updateTouch(); }; Sprite_AvJacket.prototype.outerFrameWidth = function () { return 2; }; Sprite_AvJacket.prototype.margin = function () { return 2; }; Sprite_AvJacket.prototype.jacketScale = function () { return JacketScale.scale1; }; Sprite_AvJacket.prototype.outlineFilter = function () { var filter = new PIXI.filters.OutlineFilter(1, this.outlineColor(), 0.5); filter.alpha = 0.7; return filter; }; Sprite_AvJacket.prototype.spriteWidth = function () { return 147; }; Sprite_AvJacket.prototype.spriteHeight = function () { return 200; }; Sprite_AvJacket.prototype.setHandler = function (f) { this._clickHandler = f; }; Sprite_AvJacket.prototype.updateTouch = function () { if (!this._clickHandler) { return; } var touchPos = new Point(TouchInput.x, TouchInput.y); var localPos = this.worldTransform.applyInverse(touchPos); if (this._frame.contains(localPos.x, localPos.y)) { if (TouchInput.isTriggered()) { this._clickHandler(); } else { this.select(); } } else { this.deselect(); } }; Sprite_AvJacket.prototype.deselect = function () { if (!this._selected) { return; } this._selected = false; this._selectedLayer.removeChildren(); }; Sprite_AvJacket.prototype.select = function () { if (this._selected) { return; } this._selected = true; var baseTexture = Nore.getSystemBaseTexture("Window"); var w = 48; var h = 48; var m = 5; var r = new Rectangle(96, 96, w, h); var texture = new PIXI.Texture(baseTexture, r); var s = new PIXI.Sprite(texture); s.x = -1; s.y = -1; s.scale.x = (this.spriteWidth() + m) / w; s.scale.y = (this.spriteHeight() + m) / h; this._selectedLayer.addChild(s); }; return Sprite_AvJacket; })(Sprite_BaseAvJacket); var Sprite_AvParts = /** @class */ (function (_super) { __extends(Sprite_AvParts, _super); function Sprite_AvParts(avJacket, jackeScale) { var _this = _super.call(this) || this; _this._avJacket = avJacket; _this._jackeScale = jackeScale; return _this; } Sprite_AvParts.prototype.refresh = function () { this.removeChildren(); var partsList = this._avJacket.partsList(); for (var _i = 0, partsList_1 = partsList; _i < partsList_1.length; _i++) { var partsId = partsList_1[_i]; this.addParts(partsId); } }; Sprite_AvParts.prototype.addParts = function (partsId) { var t = this.getTexture(partsId); var s = new PIXI.Sprite(t); if (partsId < 10) { if (!this._avJacket.isDividedLayout()) { return; } } else if (partsId >= 11 && partsId <= 19) { if (!this._avJacket.isActorLayout()) { return; } if (this._avJacket.isBigActorLayout()) { s.x -= Math.round(this.bigActorIconOffset()); } } s.scale.x = s.scale.y = this._jackeScale / JacketScale.scale3; s.x += this._avJacket.manLayoutActorOffsetX() * this._jackeScale; s.y += this._avJacket.actorOffsetY(this._avJacket.actorId()) * this._jackeScale; this.addChild(s); }; Sprite_AvParts.prototype.getTexture = function (partsId) { return PIXI.utils.TextureCache["parts_" + partsId.padZero(3) + ".png"]; }; Sprite_AvParts.prototype.bigActorIconOffset = function () { return 10; }; Sprite_AvParts.prototype.destroy = function (options) { this.removeChildren(); _super.prototype.destroy.call(this, options); }; return Sprite_AvParts; })(Sprite);